GEOS
3.3.9
|
00001 /********************************************************************** 00002 * $Id: BufferBuilder.h 3301 2011-04-27 09:42:31Z strk $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net> 00008 * Copyright (C) 2008-2010 Safe Software Inc. 00009 * Copyright (C) 2006-2007 Refractions Research Inc. 00010 * 00011 * This is free software; you can redistribute and/or modify it under 00012 * the terms of the GNU Lesser General Public Licence as published 00013 * by the Free Software Foundation. 00014 * See the COPYING file for more information. 00015 * 00016 ********************************************************************** 00017 * 00018 * Last port: operation/buffer/BufferBuilder.java r378 (JTS-1.12) 00019 * 00020 **********************************************************************/ 00021 00022 #ifndef GEOS_OP_BUFFER_BUFFERBUILDER_H 00023 #define GEOS_OP_BUFFER_BUFFERBUILDER_H 00024 00025 #include <geos/export.h> 00026 00027 #include <vector> 00028 00029 #include <geos/operation/buffer/BufferOp.h> // for inlines (BufferOp enums) 00030 #include <geos/operation/buffer/OffsetCurveBuilder.h> // for inline (OffsetCurveBuilder enums) 00031 #include <geos/geomgraph/EdgeList.h> // for composition 00032 00033 #ifdef _MSC_VER 00034 #pragma warning(push) 00035 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00036 #endif 00037 00038 // Forward declarations 00039 namespace geos { 00040 namespace geom { 00041 class PrecisionModel; 00042 class Geometry; 00043 class GeometryFactory; 00044 } 00045 namespace algorithm { 00046 class CGAlgorithms; 00047 class LineIntersector; 00048 } 00049 namespace noding { 00050 class Noder; 00051 class SegmentString; 00052 class IntersectionAdder; 00053 } 00054 namespace geomgraph { 00055 class Edge; 00056 class Label; 00057 class PlanarGraph; 00058 } 00059 namespace operation { 00060 namespace buffer { 00061 class BufferSubgraph; 00062 } 00063 namespace overlay { 00064 class PolygonBuilder; 00065 } 00066 } 00067 } 00068 00069 namespace geos { 00070 namespace operation { // geos.operation 00071 namespace buffer { // geos.operation.buffer 00072 00090 class GEOS_DLL BufferBuilder { 00091 00092 public: 00102 BufferBuilder(const BufferParameters& nBufParams) 00103 : 00104 bufParams(nBufParams), 00105 workingPrecisionModel(NULL), 00106 li(NULL), 00107 intersectionAdder(NULL), 00108 workingNoder(NULL), 00109 geomFact(NULL), 00110 edgeList() 00111 {} 00112 00113 ~BufferBuilder(); 00114 00115 00126 void setWorkingPrecisionModel(const geom::PrecisionModel *pm) { 00127 workingPrecisionModel=pm; 00128 } 00129 00137 void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; } 00138 00139 geom::Geometry* buffer(const geom::Geometry *g, double distance); 00140 // throw (GEOSException); 00141 00143 geom::Geometry* bufferLineSingleSided( const geom::Geometry* g, 00144 double distance, bool leftSide ) ; 00145 // throw (GEOSException); 00146 00147 private: 00151 static int depthDelta(geomgraph::Label *label); 00152 00153 const BufferParameters& bufParams; 00154 00155 const geom::PrecisionModel* workingPrecisionModel; 00156 00157 algorithm::LineIntersector* li; 00158 00159 noding::IntersectionAdder* intersectionAdder; 00160 00161 noding::Noder* workingNoder; 00162 00163 const geom::GeometryFactory* geomFact; 00164 00165 geomgraph::EdgeList edgeList; 00166 00167 std::vector<geomgraph::Label *> newLabels; 00168 00169 void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr, 00170 const geom::PrecisionModel *precisionModel); 00171 // throw(GEOSException); 00172 00182 void insertUniqueEdge(geomgraph::Edge *e); 00183 00184 void createSubgraphs(geomgraph::PlanarGraph *graph, 00185 std::vector<BufferSubgraph*>& list); 00186 00197 void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList, 00198 overlay::PolygonBuilder& polyBuilder); 00199 00203 // 00208 noding::Noder* getNoder(const geom::PrecisionModel* precisionModel); 00209 00210 00218 geom::Geometry* createEmptyResultGeometry() const; 00219 00220 // Declare type as noncopyable 00221 BufferBuilder(const BufferBuilder& other); 00222 BufferBuilder& operator=(const BufferBuilder& rhs); 00223 }; 00224 00225 } // namespace geos::operation::buffer 00226 } // namespace geos::operation 00227 } // namespace geos 00228 00229 #ifdef _MSC_VER 00230 #pragma warning(pop) 00231 #endif 00232 00233 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H 00234 00235 /********************************************************************** 00236 * $Log$ 00237 * Revision 1.2 2006/03/14 16:08:21 strk 00238 * changed buildSubgraphs signature to use refs rather then pointers, made it const-correct. Reduced heap allocations in createSubgraphs() 00239 * 00240 * Revision 1.1 2006/03/14 00:19:40 strk 00241 * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/ 00242 * 00243 **********************************************************************/ 00244