Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

BufferBuilder.h

00001 /**********************************************************************
00002  * $Id: BufferBuilder.h 2559 2009-06-08 10:07:05Z strk $
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 private:
00090         static int depthDelta(geomgraph::Label *label);
00091 
00092         const BufferParameters& bufParams; 
00093 
00094         const geom::PrecisionModel* workingPrecisionModel;
00095 
00096         algorithm::LineIntersector* li;
00097 
00098         noding::IntersectionAdder* intersectionAdder;
00099 
00100         noding::Noder* workingNoder;
00101 
00102         const geom::GeometryFactory* geomFact;
00103 
00104         geomgraph::EdgeList edgeList;
00105 
00106         std::vector<geomgraph::Label *> newLabels;
00107 
00108         void computeNodedEdges(std::vector<noding::SegmentString*>& bufSegStr,
00109                         const geom::PrecisionModel *precisionModel);
00110                         // throw(GEOSException);
00111 
00121         void insertUniqueEdge(geomgraph::Edge *e);
00122 
00123         void createSubgraphs(geomgraph::PlanarGraph *graph,
00124                         std::vector<BufferSubgraph*>& list);
00125 
00136         void buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
00137                         overlay::PolygonBuilder& polyBuilder);
00138 
00142         //
00147         noding::Noder* getNoder(const geom::PrecisionModel* precisionModel);
00148 
00149 
00157         geom::Geometry* createEmptyResultGeometry() const;
00158 
00159 public:
00169         BufferBuilder(const BufferParameters& nBufParams)
00170                 :
00171                 bufParams(nBufParams),
00172                 workingPrecisionModel(NULL),
00173                 li(NULL),
00174                 intersectionAdder(NULL),
00175                 workingNoder(NULL),
00176                 geomFact(NULL),
00177                 edgeList()
00178         {}
00179 
00180         ~BufferBuilder();
00181 
00182 
00193         void setWorkingPrecisionModel(const geom::PrecisionModel *pm) {
00194                 workingPrecisionModel=pm;
00195         }
00196 
00204         void setNoder(noding::Noder* newNoder) { workingNoder = newNoder; }
00205 
00206         geom::Geometry* buffer(const geom::Geometry *g, double distance);
00207                 // throw (GEOSException);
00208 
00210         geom::Geometry* bufferLineSingleSided( const geom::Geometry* g,
00211                                         double distance, bool leftSide ) ;
00212                 // throw (GEOSException);
00213 
00214 };
00215 
00216 } // namespace geos::operation::buffer
00217 } // namespace geos::operation
00218 } // namespace geos
00219 
00220 #endif // ndef GEOS_OP_BUFFER_BUFFERBUILDER_H
00221 
00222 /**********************************************************************
00223  * $Log$
00224  * Revision 1.2  2006/03/14 16:08:21  strk
00225  * changed buildSubgraphs signature to use refs rather then pointers, made it const-correct. Reduced heap allocations in createSubgraphs()
00226  *
00227  * Revision 1.1  2006/03/14 00:19:40  strk
00228  * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
00229  *
00230  **********************************************************************/
00231 

Generated on Thu Jun 11 06:17:00 2009 for GEOS by  doxygen 1.4.4