GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2014 Mika Heiskanen <mika.heiskanen@fmi.fi> 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Public Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 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 // Forward declarations 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 { // geos::operation 00049 namespace intersection { // geos::operation::intersection 00050 00063 class GEOS_DLL RectangleIntersectionBuilder 00064 { 00065 // Regular users are not supposed to use this utility class. 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 // Adding Geometry components 00117 void add(geom::Polygon * g); 00118 void add(geom::LineString * g); 00119 void add(geom::Point * g); 00120 00121 // Trivial methods 00122 bool empty() const; 00123 void clear(); 00124 00125 // Added components 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 }; // class RectangleIntersectionBuilder 00156 00157 } // namespace geos::operation::intersection 00158 } // namespace geos::operation 00159 } // namespace geos 00160 00161 #endif // GEOS_OP_INTERSECTION_RECTANGLEINTERSECTIONBUILDER_H