BufferBuilder.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net>
00007  * Copyright (C) 2008-2010 Safe Software Inc.
00008  * Copyright (C) 2006-2007 Refractions Research Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
00014  *
00015  **********************************************************************
00016  *
00017  * Last port: operation/buffer/BufferBuilder.java r378 (JTS-1.12)
00018  *
00019  **********************************************************************/
00020 
00021 #ifndef GEOS_OP_BUFFER_BUFFERBUILDER_H
00022 #define GEOS_OP_BUFFER_BUFFERBUILDER_H
00023 
00024 #include <geos/export.h>
00025 
00026 #include <vector>
00027 
00028 #include <geos/operation/buffer/BufferOp.h> // for inlines (BufferOp enums)
00029 #include <geos/operation/buffer/OffsetCurveBuilder.h> // for inline (OffsetCurveBuilder enums)
00030 #include <geos/geomgraph/EdgeList.h> // for composition
00031 
00032 #ifdef _MSC_VER
00033 #pragma warning(push)
00034 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00035 #endif
00036 
00037 // Forward declarations
00038 namespace geos {
00039         namespace geom {
00040                 class PrecisionModel;
00041                 class Geometry;
00042                 class GeometryFactory;
00043         }
00044         namespace algorithm {
00045                 class CGAlgorithms;
00046                 class LineIntersector;
00047         }
00048         namespace noding {
00049                 class Noder;
00050                 class SegmentString;
00051                 class IntersectionAdder;
00052         }
00053         namespace geomgraph {
00054                 class Edge;
00055                 class Label;
00056                 class PlanarGraph;
00057         }
00058         namespace operation {
00059                 namespace buffer {
00060                         class BufferSubgraph;
00061                 }
00062                 namespace overlay {
00063                         class PolygonBuilder;
00064                 }
00065         }
00066 }
00067 
00068 namespace geos {
00069 namespace operation { // geos.operation
00070 namespace buffer { // geos.operation.buffer
00071 
00089 class GEOS_DLL BufferBuilder {
00090 
00091 public:
00101         BufferBuilder(const BufferParameters& nBufParams)
00102                 :
00103                 bufParams(nBufParams),
00104                 workingPrecisionModel(NULL),
00105                 li(NULL),
00106                 intersectionAdder(NULL),
00107                 workingNoder(NULL),
00108                 geomFact(NULL),
00109                 edgeList()
00110         {}
00111 
00112         ~BufferBuilder();
00113 
00114 
00125         void setWorkingPrecisionModel(const geom::PrecisionModel *pm) {
00126                 workingPrecisionModel=pm;
00127         }
00128 
00136         void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
00137 
00138         geom::Geometry* buffer(const geom::Geometry *g, double distance);
00139                 // throw (GEOSException);
00140 
00159         geom::Geometry* bufferLineSingleSided( const geom::Geometry* g,
00160                                         double distance, bool leftSide ) ;
00161                 // throw (GEOSException);
00162 
00163 private:
00164 
00168         static int depthDelta(const geomgraph::Label& label);
00169 
00170         const BufferParameters& bufParams; 
00171 
00172         const geom::PrecisionModel* workingPrecisionModel;
00173 
00174         algorithm::LineIntersector* li;
00175 
00176         noding::IntersectionAdder* intersectionAdder;
00177 
00178         noding::Noder* workingNoder;
00179 
00180         const geom::GeometryFactory* geomFact;
00181 
00182         geomgraph::EdgeList edgeList;
00183 
00184         std::vector<geomgraph::Label *> newLabels;
00185 
00186         void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
00187                         const geom::PrecisionModel *precisionModel);
00188                         // throw(GEOSException);
00189 
00199         void insertUniqueEdge(geomgraph::Edge *e);
00200 
00201         void createSubgraphs(geomgraph::PlanarGraph *graph,
00202                         std::vector<BufferSubgraph*>& list);
00203 
00214         void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
00215                         overlay::PolygonBuilder& polyBuilder);
00216 
00220         //
00225         noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
00226 
00227 
00235         geom::Geometry* createEmptyResultGeometry() const;
00236     
00237     // Declare type as noncopyable
00238     BufferBuilder(const BufferBuilder& other);
00239     BufferBuilder& operator=(const BufferBuilder& rhs);
00240 };
00241 
00242 } // namespace geos::operation::buffer
00243 } // namespace geos::operation
00244 } // namespace geos
00245 
00246 #ifdef _MSC_VER
00247 #pragma warning(pop)
00248 #endif
00249 
00250 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H

Generated on 23 Sep 2013 for GEOS by  doxygen 1.4.7