GEOS 3.6.2
OffsetCurveBuilder.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net>
7 * Copyright (C) 2006-2007 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: operation/buffer/OffsetCurveBuilder.java r378 (JTS-1.12)
17 *
18 **********************************************************************/
19
20#ifndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H
21#define GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H
22
23#include <geos/export.h>
24
25#include <geos/operation/buffer/BufferParameters.h> // for composition
26#include <geos/operation/buffer/OffsetSegmentGenerator.h>
27
28#include <vector>
29#include <memory> // for auto_ptr
30
31#ifdef _MSC_VER
32#pragma warning(push)
33#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
34#endif
35
36// Forward declarations
37namespace geos {
38 namespace geom {
40 class PrecisionModel;
41 }
42}
43
44namespace geos {
45namespace operation { // geos.operation
46namespace buffer { // geos.operation.buffer
47
62class GEOS_DLL OffsetCurveBuilder {
63public:
64
65 /*
66 * @param nBufParams buffer parameters, this object will
67 * keep a reference to the passed parameters
68 * so caller must make sure the object is
69 * kept alive for the whole lifetime of
70 * the buffer builder.
71 */
72 OffsetCurveBuilder(const geom::PrecisionModel *newPrecisionModel,
73 const BufferParameters& nBufParams)
74 :
75 distance(0.0),
76 precisionModel(newPrecisionModel),
77 bufParams(nBufParams)
78 {}
79
86 {
87 return bufParams;
88 }
89
100 double distance,
101 std::vector<geom::CoordinateSequence*>& lineList);
102
120 double distance, std::vector<geom::CoordinateSequence*>& lineList,
121 bool leftSide, bool rightSide ) ;
122
130 void getRingCurve(const geom::CoordinateSequence *inputPts, int side,
131 double distance,
132 std::vector<geom::CoordinateSequence*>& lineList);
133
134
135private:
136
137 double distance;
138
139 const geom::PrecisionModel* precisionModel;
140
141 const BufferParameters& bufParams;
142
150 static const double SIMPLIFY_FACTOR; // 100.0;
151
159 double simplifyTolerance(double bufDistance);
160
161 void computeLineBufferCurve(const geom::CoordinateSequence& inputPts,
162 OffsetSegmentGenerator& segGen);
163
164 void computeSingleSidedBufferCurve(const geom::CoordinateSequence& inputPts,
165 bool isRightSide,
166 OffsetSegmentGenerator& segGen);
167
168 void computeRingBufferCurve(const geom::CoordinateSequence& inputPts,
169 int side, OffsetSegmentGenerator& segGen);
170
171 std::auto_ptr<OffsetSegmentGenerator> getSegGen(double dist);
172
173 void computePointCurve(const geom::Coordinate& pt,
174 OffsetSegmentGenerator& segGen);
175
176
177 // Declare type as noncopyable
178 OffsetCurveBuilder(const OffsetCurveBuilder& other);
179 OffsetCurveBuilder& operator=(const OffsetCurveBuilder& rhs);
180};
181
182} // namespace geos::operation::buffer
183} // namespace geos::operation
184} // namespace geos
185
186#ifdef _MSC_VER
187#pragma warning(pop)
188#endif
189
190#endif // ndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H
191
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
Contains the parameters which describe how a buffer should be constructed.
Definition BufferParameters.h:58
const BufferParameters & getBufferParameters() const
Definition OffsetCurveBuilder.h:85
void getLineCurve(const geom::CoordinateSequence *inputPts, double distance, std::vector< geom::CoordinateSequence * > &lineList)
void getRingCurve(const geom::CoordinateSequence *inputPts, int side, double distance, std::vector< geom::CoordinateSequence * > &lineList)
void getSingleSidedLineCurve(const geom::CoordinateSequence *inputPts, double distance, std::vector< geom::CoordinateSequence * > &lineList, bool leftSide, bool rightSide)
Definition OffsetSegmentGenerator.h:61
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Provides classes for computing buffers of geometries.
Definition opBuffer.h:23
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25