GEOS 3.12.0
OffsetCurveSection.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (c) 2021 Martin Davis
7 * Copyright (C) 2021 Paul Ramsey <pramsey@cleverelephant.ca>
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#pragma once
17
18#include <geos/export.h>
19#include <memory>
20#include <vector>
21
22// Forward declarations
23namespace geos {
24namespace geom {
25class Coordinate;
27class Geometry;
28class GeometryFactory;
29class LineString;
30}
31}
32
38
39namespace geos { // geos.
40namespace operation { // geos.operation
41namespace buffer { // geos.operation.buffer
42
54class GEOS_DLL OffsetCurveSection {
55
56private:
57
58 std::unique_ptr<CoordinateSequence> sectionPts;
59 double location;
60 double locLast;
61
62 bool isEndInSameSegment(double nextLoc) const;
63
64
65public:
66
67 OffsetCurveSection(std::unique_ptr<CoordinateSequence> && secPts, double pLoc, double pLocLast)
68 : sectionPts(std::move(secPts))
69 , location(pLoc)
70 , locLast(pLocLast)
71 {};
72
73 const CoordinateSequence* getCoordinates() const;
74 std::unique_ptr<CoordinateSequence> releaseCoordinates();
75
76 double getLocation() const { return location; };
77
87 static std::unique_ptr<Geometry> toLine(
88 std::vector<std::unique_ptr<OffsetCurveSection>>& sections,
89 const GeometryFactory* geomFactory);
90
91 static std::unique_ptr<Geometry> toGeometry(
92 std::vector<std::unique_ptr<OffsetCurveSection>>& sections,
93 const GeometryFactory* geomFactory);
94
95 static std::unique_ptr<OffsetCurveSection> create(
96 const CoordinateSequence* srcPts,
97 std::size_t start, std::size_t end,
98 double loc, double locLast);
99
100 static bool OffsetCurveSectionComparator(
101 const std::unique_ptr<OffsetCurveSection>& a,
102 const std::unique_ptr<OffsetCurveSection>& b);
103
104};
105
106
107} // namespace geos.operation.buffer
108} // namespace geos.operation
109} // namespace geos
110
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:216
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:65
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:186
Definition LineString.h:65
Definition OffsetCurveSection.h:54
static std::unique_ptr< Geometry > toLine(std::vector< std::unique_ptr< OffsetCurveSection > > &sections, const GeometryFactory *geomFactory)
Basic namespace for all GEOS functionalities.
Definition geos.h:39