GEOS  3.14.0dev
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 
34 namespace geos { // geos.
35 namespace operation { // geos.operation
36 namespace buffer { // geos.operation.buffer
37 
49 class GEOS_DLL OffsetCurveSection {
55 
56 private:
57 
58  std::unique_ptr<CoordinateSequence> sectionPts;
59  double location;
60  double locLast;
61 
62  bool isEndInSameSegment(double nextLoc) const;
63 
64 
65 public:
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: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:49
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