GEOS: BufferBuilder.h Source File

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

# BufferBuilder.h

    00001 /**********************************************************************
    00002  * $Id: BufferBuilder.h 1969 2007-02-06 01:57:23Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006-2007 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************/
    00015
    00016 #ifndef GEOS_OP_BUFFER_BUFFERBUILDER_H
    00017 #define GEOS_OP_BUFFER_BUFFERBUILDER_H
    00018
    00019 #include <vector>
    00020
    00021 #include <geos/operation/buffer/BufferOp.h> // for inlines (BufferOp enums)
    00022 #include <geos/operation/buffer/OffsetCurveBuilder.h> // for inline (OffsetCurveBuilder enums)
    00023 #include <geos/geomgraph/EdgeList.h> // for composition
    00024
    00025 // Forward declarations
    00026 namespace geos {
    00027         namespace geom {
    00028                 class PrecisionModel;
    00029                 class Geometry;
    00030                 class GeometryFactory;
    00031         }
    00032         namespace algorithm {
    00033                 class CGAlgorithms;
    00034                 class LineIntersector;
    00035         }
    00036         namespace noding {
    00037                 class Noder;
    00038                 class SegmentString;
    00039                 class IntersectionAdder;
    00040         }
    00041         namespace geomgraph {
    00042                 class Edge;
    00043                 class Label;
    00044                 class PlanarGraph;
    00045         }
    00046         namespace operation {
    00047                 namespace buffer {
    00048                         class BufferSubgraph;
    00049                 }
    00050                 namespace overlay {
    00051                         class PolygonBuilder;
    00052                 }
    00053         }
    00054 }
    00055
    00056 namespace geos {
    00057 namespace operation { // geos.operation
    00058 namespace buffer { // geos.operation.buffer
    00059
    00079 class BufferBuilder {
    00080
    00081 private:
    00085         static int depthDelta(geomgraph::Label *label);
    00086
    00087         int quadrantSegments;
    00088
    00089         int endCapStyle;
    00090
    00091         const geom::PrecisionModel* workingPrecisionModel;
    00092
    00093         algorithm::LineIntersector* li;
    00094
    00095         noding::IntersectionAdder* intersectionAdder;
    00096
    00097         noding::Noder* workingNoder;
    00098
    00099         const geom::GeometryFactory* geomFact;
    00100
    00101         geomgraph::EdgeList edgeList;
    00102
    00103         std::vector<geomgraph::Label *> newLabels;
    00104
    00105         void computeNodedEdges(std::vector<noding::SegmentString*>& bufferSegStrList,
    00106                         const geom::PrecisionModel *precisionModel);
    00107                         // throw(GEOSException);
    00108
    00118         void insertEdge(geomgraph::Edge *e);
    00119
    00120         void createSubgraphs(geomgraph::PlanarGraph *graph,
    00121                         std::vector<BufferSubgraph*>& list);
    00122
    00133         void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
    00134                         overlay::PolygonBuilder& polyBuilder);
    00135
    00139         //
    00144         noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
    00145
    00146
    00154         geom::Geometry* createEmptyResultGeometry() const;
    00155
    00156 public:
    00160         BufferBuilder()
    00161                 :
    00162                 quadrantSegments(OffsetCurveBuilder::DEFAULT_QUADRANT_SEGMENTS),
    00163                 endCapStyle(BufferOp::CAP_ROUND),
    00164                 workingPrecisionModel(NULL),
    00165                 li(NULL),
    00166                 intersectionAdder(NULL),
    00167                 workingNoder(NULL),
    00168                 geomFact(NULL),
    00169                 edgeList()
    00170         {}
    00171
    00172         ~BufferBuilder();
    00173
    00180         void setQuadrantSegments(int nQuadrantSegments) {
    00181                 quadrantSegments=nQuadrantSegments;
    00182         }
    00183
    00184
    00195         void setWorkingPrecisionModel(const geom::PrecisionModel *pm) {
    00196                 workingPrecisionModel=pm;
    00197         }
    00198
    00206         void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
    00207
    00208         void setEndCapStyle(int nEndCapStyle) {
    00209                 endCapStyle=nEndCapStyle;
    00210         }
    00211
    00212         geom::Geometry* buffer(const geom::Geometry *g, double distance);
    00213                 // throw (GEOSException);
    00214
    00215 };
    00216
    00217 } // namespace geos::operation::buffer
    00218 } // namespace geos::operation
    00219 } // namespace geos
    00220
    00221 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
    00222
    00223 /**********************************************************************
    00224  * $Log$
    00225  * Revision 1.2  2006/03/14 16:08:21  strk
    00226  * changed buildSubgraphs signature to use refs rather then pointers, made it const-correct. Reduced heap allocations in createSubgraphs()
    00227  *
    00228  * Revision 1.1  2006/03/14 00:19:40  strk
    00229  * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
    00230  *
    00231  **********************************************************************/
    00232