00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef GEOS_OP_INTERSECTION_RECTANGLEINTERSECTIONBUILDER_H
00016 #define GEOS_OP_INTERSECTION_RECTANGLEINTERSECTIONBUILDER_H
00017
00018 #include <geos/export.h>
00019
00020 #ifdef _MSC_VER
00021 #pragma warning(push)
00022 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00023 #endif
00024
00025 #include <memory>
00026 #include <list>
00027 #include <vector>
00028
00029
00030
00031 namespace geos {
00032 namespace geom {
00033 class Coordinate;
00034 class Geometry;
00035 class GeometryFactory;
00036 class Polygon;
00037 class LineString;
00038 class Point;
00039 }
00040 namespace operation {
00041 namespace intersection {
00042 class Rectangle;
00043 }
00044 }
00045 }
00046
00047 namespace geos {
00048 namespace operation {
00049 namespace intersection {
00050
00063 class GEOS_DLL RectangleIntersectionBuilder
00064 {
00065
00066 friend class RectangleIntersection;
00067
00068 public:
00069
00070 ~RectangleIntersectionBuilder();
00071
00072 private:
00073
00077 std::auto_ptr<geom::Geometry> build();
00078
00085 void reconnectPolygons(const Rectangle & rect);
00086
00107 void reconnect();
00108
00109 void reverseLines();
00110
00114 void release(RectangleIntersectionBuilder & parts);
00115
00116
00117 void add(geom::Polygon * g);
00118 void add(geom::LineString * g);
00119 void add(geom::Point * g);
00120
00121
00122 bool empty() const;
00123 void clear();
00124
00125
00126 std::list<geom::Polygon *> polygons;
00127 std::list<geom::LineString *> lines;
00128 std::list<geom::Point *> points;
00129
00142 void close_boundary(
00143 const Rectangle & rect,
00144 std::vector<geom::Coordinate> * ring,
00145 double x1, double y1,
00146 double x2, double y2);
00147
00148 void close_ring(const Rectangle & rect, std::vector<geom::Coordinate> * ring);
00149
00150 RectangleIntersectionBuilder(const geom::GeometryFactory& f)
00151 : _gf(f) {}
00152
00153 const geom::GeometryFactory &_gf;
00154
00155 };
00156
00157 }
00158 }
00159 }
00160
00161 #endif // GEOS_OP_INTERSECTION_RECTANGLEINTERSECTIONBUILDER_H