GEOS  3.13.1
CompoundCurve.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2024 ISciences, LLC
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************/
14 
15 #pragma once
16 
17 #include <geos/geom/SimpleCurve.h>
18 #include <geos/util.h>
19 #include <vector>
20 
21 namespace geos {
22 namespace geom {
23 
24 class GEOS_DLL CompoundCurve : public Curve {
25  friend class GeometryFactory;
26 
27 public:
28  using Curve::apply_ro;
29  using Curve::apply_rw;
30 
31  void apply_ro(CoordinateFilter* filter) const override;
32 
33  void apply_ro(CoordinateSequenceFilter& filter) const override;
34 
35  void apply_rw(CoordinateSequenceFilter& filter) override;
36 
37  void apply_rw(const CoordinateFilter* filter) override;
38 
39  int compareToSameClass(const Geometry* geom) const override;
40 
41  std::unique_ptr<CompoundCurve> clone() const;
42 
43  bool equalsExact(const Geometry* other, double tolerance = 0)
44  const override;
45 
46  bool equalsIdentical(const Geometry* other) const override;
47 
48  std::unique_ptr<Geometry> getBoundary() const override;
49 
50  const CoordinateXY* getCoordinate() const override;
51 
52  uint8_t getCoordinateDimension() const override;
53 
54  std::unique_ptr<CoordinateSequence> getCoordinates() const override;
55 
57  const SimpleCurve* getCurveN(std::size_t) const override;
58 
59  const Envelope* getEnvelopeInternal() const override
60  {
61  return &envelope;
62  }
63 
64  std::string getGeometryType() const override;
65 
66  GeometryTypeId getGeometryTypeId() const override;
67 
68  double getLength() const override;
69 
71  std::size_t getNumCurves() const override;
72 
73  std::size_t getNumPoints() const override;
74 
75  bool hasCurvedComponents() const override;
76 
77  bool hasM() const override;
78 
79  bool hasZ() const override;
80 
81  bool isClosed() const override;
82 
83  bool isEmpty() const override;
84 
85  void normalize() override;
86 
87  std::unique_ptr<CompoundCurve> reverse() const;
88 
89 protected:
92  CompoundCurve(std::vector<std::unique_ptr<SimpleCurve>>&&,
93  const GeometryFactory&);
94 
95  CompoundCurve(const CompoundCurve&);
96 
97  CompoundCurve& operator=(const CompoundCurve&);
98 
99  CompoundCurve* cloneImpl() const override;
100 
101  Envelope computeEnvelopeInternal() const;
102 
103  void geometryChangedAction() override
104  {
105  envelope = computeEnvelopeInternal();
106  }
107 
108  int getSortIndex() const override
109  {
110  return SORTINDEX_COMPOUNDCURVE;
111  }
112 
113  CompoundCurve* reverseImpl() const override;
114 
115 private:
116  std::vector<std::unique_ptr<SimpleCurve>> curves;
117  Envelope envelope;
118 };
119 
120 }
121 }
GeometryTypeId
Geometry types.
Definition: Geometry.h:74
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25