# RectangleIntersects.h

    00001 /**********************************************************************
    00002  * $Id: RectangleIntersects.h 1820 2006-09-06 16:54:23Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************/
    00015
    00016 #ifndef GEOS_OP_PREDICATE_RECTANGLEINTERSECTS_H
    00017 #define GEOS_OP_PREDICATE_RECTANGLEINTERSECTS_H
    00018
    00019 #include <geos/geom/Polygon.h> // for inlines
    00020
    00021 // Forward declarations
    00022 namespace geos {
    00023         namespace geom {
    00024                 class Envelope;
    00025                 //class Polygon;
    00026         }
    00027 }
    00028
    00029 namespace geos {
    00030 namespace operation { // geos::operation
    00031 namespace predicate { // geos::operation::predicate
    00032
    00043 class RectangleIntersects {
    00044
    00045 private:
    00046
    00047         const geom::Polygon &rectangle;
    00048
    00049         const geom::Envelope &rectEnv;
    00050
    00051 public:
    00052
    00060         static const size_t MAXIMUM_SCAN_SEGMENT_COUNT;
    00061
    00067         RectangleIntersects(const geom::Polygon &newRect)
    00068                 :
    00069                 rectangle(newRect),
    00070                 rectEnv(*(newRect.getEnvelopeInternal()))
    00071         {}
    00072
    00073         bool intersects(const geom::Geometry& geom);
    00074
    00075         static bool intersects(const geom::Polygon &rectangle,
    00076                         const geom::Geometry &b)
    00077         {
    00078                 RectangleIntersects rp(rectangle);
    00079                 return rp.intersects(b);
    00080         }
    00081
    00082 };
    00083
    00084
    00085 } // namespace geos::operation::predicate
    00086 } // namespace geos::operation
    00087 } // namespace geos
    00088
    00089 #endif // ifndef GEOS_OP_PREDICATE_RECTANGLEINTERSECTS_H