GEOS 3.3.4

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

- File List

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