GEOS  3.13.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 <memory>
20 #include <vector>
21 
22 // Forward declarations
23 namespace geos {
24 namespace geom {
25 class Coordinate;
26 class CoordinateSequence;
27 class Geometry;
28 class GeometryFactory;
29 class LineString;
30 }
31 }
32 
38 
39 namespace geos { // geos.
40 namespace operation { // geos.operation
41 namespace buffer { // geos.operation.buffer
42 
54 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: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: Angle.h:25