GEOS: BufferBuilder.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# BufferBuilder.h

    00001 /**********************************************************************
    00002  * $Id: BufferBuilder.h 2779 2009-12-03 19:45:53Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
    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 rev. 1.30 (JTS-1.10)
    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 // Forward declarations
    00033 namespace geos {
    00034         namespace geom {
    00035                 class PrecisionModel;
    00036                 class Geometry;
    00037                 class GeometryFactory;
    00038         }
    00039         namespace algorithm {
    00040                 class CGAlgorithms;
    00041                 class LineIntersector;
    00042         }
    00043         namespace noding {
    00044                 class Noder;
    00045                 class SegmentString;
    00046                 class IntersectionAdder;
    00047         }
    00048         namespace geomgraph {
    00049                 class Edge;
    00050                 class Label;
    00051                 class PlanarGraph;
    00052         }
    00053         namespace operation {
    00054                 namespace buffer {
    00055                         class BufferSubgraph;
    00056                 }
    00057                 namespace overlay {
    00058                         class PolygonBuilder;
    00059                 }
    00060         }
    00061 }
    00062
    00063 namespace geos {
    00064 namespace operation { // geos.operation
    00065 namespace buffer { // geos.operation.buffer
    00066
    00084 class GEOS_DLL BufferBuilder {
    00085
    00086 public:
    00096         BufferBuilder(const BufferParameters& nBufParams)
    00097                 :
    00098                 bufParams(nBufParams),
    00099                 workingPrecisionModel(NULL),
    00100                 li(NULL),
    00101                 intersectionAdder(NULL),
    00102                 workingNoder(NULL),
    00103                 geomFact(NULL),
    00104                 edgeList()
    00105         {}
    00106
    00107         ~BufferBuilder();
    00108
    00109
    00120         void setWorkingPrecisionModel(const geom::PrecisionModel *pm) {
    00121                 workingPrecisionModel=pm;
    00122         }
    00123
    00131         void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
    00132
    00133         geom::Geometry* buffer(const geom::Geometry *g, double distance);
    00134                 // throw (GEOSException);
    00135
    00137         geom::Geometry* bufferLineSingleSided( const geom::Geometry* g,
    00138                                         double distance, bool leftSide ) ;
    00139                 // throw (GEOSException);
    00140
    00141 private:
    00145         static int depthDelta(geomgraph::Label *label);
    00146
    00147         const BufferParameters& bufParams;
    00148
    00149         const geom::PrecisionModel* workingPrecisionModel;
    00150
    00151         algorithm::LineIntersector* li;
    00152
    00153         noding::IntersectionAdder* intersectionAdder;
    00154
    00155         noding::Noder* workingNoder;
    00156
    00157         const geom::GeometryFactory* geomFact;
    00158
    00159         geomgraph::EdgeList edgeList;
    00160
    00161         std::vector<geomgraph::Label *> newLabels;
    00162
    00163         void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
    00164                         const geom::PrecisionModel *precisionModel);
    00165                         // throw(GEOSException);
    00166
    00176         void insertUniqueEdge(geomgraph::Edge *e);
    00177
    00178         void createSubgraphs(geomgraph::PlanarGraph *graph,
    00179                         std::vector<BufferSubgraph*>& list);
    00180
    00191         void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
    00192                         overlay::PolygonBuilder& polyBuilder);
    00193
    00197         //
    00202         noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
    00203
    00204
    00212         geom::Geometry* createEmptyResultGeometry() const;
    00213
    00214     // Declare type as noncopyable
    00215     BufferBuilder(const BufferBuilder& other);
    00216     BufferBuilder& operator=(const BufferBuilder& rhs);
    00217 };
    00218
    00219 } // namespace geos::operation::buffer
    00220 } // namespace geos::operation
    00221 } // namespace geos
    00222
    00223 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
    00224
    00225 /**********************************************************************
    00226  * $Log$
    00227  * Revision 1.2  2006/03/14 16:08:21  strk
    00228  * changed buildSubgraphs signature to use refs rather then pointers, made it const-correct. Reduced heap allocations in createSubgraphs()
    00229  *
    00230  * Revision 1.1  2006/03/14 00:19:40  strk
    00231  * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
    00232  *
    00233  **********************************************************************/
    00234