GEOS 3.9.1
OffsetCurveBuilder.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009-2011 Sandro Santilli <strk@kbt.io>
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 unique_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 {
38namespace geom {
39class CoordinateSequence;
40class 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
85 const BufferParameters&
87 {
88 return bufParams;
89 }
90
103 bool isLineOffsetEmpty(double distance);
104
118 double distance,
119 std::vector<geom::CoordinateSequence*>& lineList);
120
140 double distance, std::vector<geom::CoordinateSequence*>& lineList,
141 bool leftSide, bool rightSide) ;
142
153 void getRingCurve(const geom::CoordinateSequence* inputPts, int side,
154 double distance,
155 std::vector<geom::CoordinateSequence*>& lineList);
156
157private:
158
159 double distance;
160
161 const geom::PrecisionModel* precisionModel;
162
163 const BufferParameters& bufParams;
164
172 static const double SIMPLIFY_FACTOR; // 100.0;
173
181 double simplifyTolerance(double bufDistance);
182
183 void computeLineBufferCurve(const geom::CoordinateSequence& inputPts,
184 OffsetSegmentGenerator& segGen);
185
186 void computeSingleSidedBufferCurve(const geom::CoordinateSequence& inputPts,
187 bool isRightSide,
188 OffsetSegmentGenerator& segGen);
189
190 void computeRingBufferCurve(const geom::CoordinateSequence& inputPts,
191 int side, OffsetSegmentGenerator& segGen);
192
193 std::unique_ptr<OffsetSegmentGenerator> getSegGen(double dist);
194
195 void computePointCurve(const geom::Coordinate& pt,
196 OffsetSegmentGenerator& segGen);
197
198
199 // Declare type as noncopyable
200 OffsetCurveBuilder(const OffsetCurveBuilder& other) = delete;
201 OffsetCurveBuilder& operator=(const OffsetCurveBuilder& rhs) = delete;
202};
203
204} // namespace geos::operation::buffer
205} // namespace geos::operation
206} // namespace geos
207
208#ifdef _MSC_VER
209#pragma warning(pop)
210#endif
211
212#endif // ndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H
213
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
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:57
Computes the raw offset curve for a single Geometry component (ring, line or point).
Definition: OffsetCurveBuilder.h:62
const BufferParameters & getBufferParameters() const
Gets the buffer parameters being used to generate the curve.
Definition: OffsetCurveBuilder.h:86
void getLineCurve(const geom::CoordinateSequence *inputPts, double distance, std::vector< geom::CoordinateSequence * > &lineList)
This method handles single points as well as lines.
void getRingCurve(const geom::CoordinateSequence *inputPts, int side, double distance, std::vector< geom::CoordinateSequence * > &lineList)
This method handles the degenerate cases of single points and lines, as well as rings.
void getSingleSidedLineCurve(const geom::CoordinateSequence *inputPts, double distance, std::vector< geom::CoordinateSequence * > &lineList, bool leftSide, bool rightSide)
This method handles single points as well as lines.
Definition: OffsetSegmentGenerator.h:61
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26