GEOS  3.13.1
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 <geos/geom/CoordinateSequence.h> // to materialize CoordinateSequence
20 #include <memory>
21 #include <vector>
22 
23 // Forward declarations
24 namespace geos {
25 namespace geom {
26 class Coordinate;
27 class CoordinateSequence;
28 class Geometry;
29 class GeometryFactory;
30 class LineString;
31 }
32 }
33 
39 
40 namespace geos { // geos.
41 namespace operation { // geos.operation
42 namespace buffer { // geos.operation.buffer
43 
55 class GEOS_DLL OffsetCurveSection {
56 
57 private:
58 
59  std::unique_ptr<CoordinateSequence> sectionPts;
60  double location;
61  double locLast;
62 
63  bool isEndInSameSegment(double nextLoc) const;
64 
65 
66 public:
67 
68  OffsetCurveSection(std::unique_ptr<CoordinateSequence> && secPts, double pLoc, double pLocLast)
69  : sectionPts(std::move(secPts))
70  , location(pLoc)
71  , locLast(pLocLast)
72  {};
73 
74  const CoordinateSequence* getCoordinates() const;
75  std::unique_ptr<CoordinateSequence> releaseCoordinates();
76 
77  double getLocation() const { return location; };
78 
88  static std::unique_ptr<Geometry> toLine(
89  std::vector<std::unique_ptr<OffsetCurveSection>>& sections,
90  const GeometryFactory* geomFactory);
91 
92  static std::unique_ptr<Geometry> toGeometry(
93  std::vector<std::unique_ptr<OffsetCurveSection>>& sections,
94  const GeometryFactory* geomFactory);
95 
96  static std::unique_ptr<OffsetCurveSection> create(
97  const CoordinateSequence* srcPts,
98  std::size_t start, std::size_t end,
99  double loc, double locLast);
100 
101  static bool OffsetCurveSectionComparator(
102  const std::unique_ptr<OffsetCurveSection>& a,
103  const std::unique_ptr<OffsetCurveSection>& b);
104 
105 };
106 
107 
108 } // namespace geos.operation.buffer
109 } // namespace geos.operation
110 } // namespace geos
111 
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:217
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:197
Definition: LineString.h:66
Definition: OffsetCurveSection.h:55
static std::unique_ptr< Geometry > toLine(std::vector< std::unique_ptr< OffsetCurveSection >> &sections, const GeometryFactory *geomFactory)
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25