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_RECTANGLE_INTERSECTION_H 00016 #define GEOS_OP_RECTANGLE_INTERSECTION_H 00017 00018 #include <geos/export.h> 00019 00020 #include <memory> 00021 00022 #ifdef _MSC_VER 00023 #pragma warning(push) 00024 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00025 #endif 00026 00027 // Forward declarations 00028 namespace geos { 00029 namespace geom { 00030 class Point; 00031 class MultiPoint; 00032 class Polygon; 00033 class MultiPolygon; 00034 class LineString; 00035 class MultiLineString; 00036 class Geometry; 00037 class GeometryCollection; 00038 class GeometryFactory; 00039 class CoordinateSequenceFactory; 00040 } 00041 namespace operation { 00042 namespace intersection { 00043 class Rectangle; 00044 class RectangleIntersectionBuilder; 00045 } 00046 } 00047 } 00048 00049 namespace geos { 00050 namespace operation { // geos::operation 00051 namespace intersection { // geos::operation::intersection 00052 00074 class GEOS_DLL RectangleIntersection 00075 { 00076 public: 00077 00086 static std::auto_ptr<geom::Geometry> clip(const geom::Geometry & geom, 00087 const Rectangle & rect); 00088 00101 static std::auto_ptr<geom::Geometry> clipBoundary(const geom::Geometry & geom, 00102 const Rectangle & rect); 00103 00104 private: 00105 00106 RectangleIntersection(const geom::Geometry& geom, const Rectangle& rect); 00107 00108 std::auto_ptr<geom::Geometry> clipBoundary(); 00109 00110 std::auto_ptr<geom::Geometry> clip(); 00111 00112 const geom::Geometry &_geom; 00113 const Rectangle &_rect; 00114 const geom::GeometryFactory *_gf; 00115 const geom::CoordinateSequenceFactory *_csf; 00116 00117 void clip_geom(const geom::Geometry * g, 00118 RectangleIntersectionBuilder & parts, 00119 const Rectangle & rect, 00120 bool keep_polygons); 00121 00122 void clip_point(const geom::Point * g, 00123 RectangleIntersectionBuilder & parts, 00124 const Rectangle & rect); 00125 00126 void clip_multipoint(const geom::MultiPoint * g, 00127 RectangleIntersectionBuilder & parts, 00128 const Rectangle & rect); 00129 00130 void clip_linestring(const geom::LineString * g, 00131 RectangleIntersectionBuilder & parts, 00132 const Rectangle & rect); 00133 00134 void clip_multilinestring(const geom::MultiLineString * g, 00135 RectangleIntersectionBuilder & parts, 00136 const Rectangle & rect); 00137 00138 void clip_polygon(const geom::Polygon * g, 00139 RectangleIntersectionBuilder & parts, 00140 const Rectangle & rect, 00141 bool keep_polygons); 00142 00143 void clip_multipolygon(const geom::MultiPolygon * g, 00144 RectangleIntersectionBuilder & parts, 00145 const Rectangle & rect, 00146 bool keep_polygons); 00147 00148 void clip_geometrycollection( 00149 const geom::GeometryCollection * g, 00150 RectangleIntersectionBuilder & parts, 00151 const Rectangle & rect, 00152 bool keep_polygons); 00153 00154 void clip_polygon_to_linestrings(const geom::Polygon * g, 00155 RectangleIntersectionBuilder & parts, 00156 const Rectangle & rect); 00157 00158 void clip_polygon_to_polygons(const geom::Polygon * g, 00159 RectangleIntersectionBuilder & parts, 00160 const Rectangle & rect); 00161 00162 00169 bool clip_linestring_parts(const geom::LineString * gi, 00170 RectangleIntersectionBuilder & parts, 00171 const Rectangle & rect); 00172 00173 }; // class RectangleIntersection 00174 00175 } // namespace geos::operation::intersection 00176 } // namespace geos::operation 00177 } // namespace geos 00178 00179 #endif // GEOS_OP_RECTANGLE_INTERSECTION_H