- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# RectangleContains.h

    00001 /**********************************************************************
    00002  * $Id: RectangleContains.h 2781 2009-12-03 19:48:04Z 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  * Last port: operation/predicate/RectangleContains.java rev 1.5 (JTS-1.10)
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
    00021 #define GEOS_OP_PREDICATE_RECTANGLECONTAINS_H
    00022
    00023 #include <geos/export.h>
    00024
    00025 #include <geos/geom/Polygon.h> // for inlines
    00026
    00027 // Forward declarations
    00028 namespace geos {
    00029         namespace geom {
    00030                 class Envelope;
    00031                 class Geometry;
    00032                 class Point;
    00033                 class Coordinate;
    00034                 class LineString;
    00035                 //class Polygon;
    00036         }
    00037 }
    00038
    00039 namespace geos {
    00040 namespace operation { // geos::operation
    00041 namespace predicate { // geos::operation::predicate
    00042
    00052 class GEOS_DLL RectangleContains {
    00053
    00054 private:
    00055
    00056         const geom::Polygon& rectangle;
    00057         const geom::Envelope& rectEnv;
    00058
    00059         bool isContainedInBoundary(const geom::Geometry& geom);
    00060
    00061         bool isPointContainedInBoundary(const geom::Point& geom);
    00062
    00070         bool isPointContainedInBoundary(const geom::Coordinate &pt);
    00071
    00079         bool isLineStringContainedInBoundary(const geom::LineString &line);
    00080
    00089         bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
    00090                         const geom::Coordinate& p1);
    00091
    00092 public:
    00093
    00094         static bool contains(const geom::Polygon& rect, const geom::Geometry& b)
    00095         {
    00096                 RectangleContains rc(rect);
    00097                 return rc.contains(b);
    00098         }
    00099
    00105         RectangleContains(const geom::Polygon& rect)
    00106                 :
    00107                 rectangle(rect),
    00108                 rectEnv(*(rect.getEnvelopeInternal()))
    00109                 {}
    00110
    00111         bool contains(const geom::Geometry& geom);
    00112
    00113     // Declare type as noncopyable
    00114     RectangleContains(const RectangleContains& other);
    00115     RectangleContains& operator=(const RectangleContains& rhs);
    00116 };
    00117
    00118
    00119
    00120 } // namespace geos::operation::predicate
    00121 } // namespace geos::operation
    00122 } // namespace geos
    00123
    00124 #endif // ifndef GEOS_OP_PREDICATE_RECTANGLECONTAINS_H