GEOS  3.14.0dev
Surface.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/Geometry.h>
18 
19 namespace geos {
20 namespace geom {
21 
22 class Curve;
23 
27 class GEOS_DLL Surface : public Geometry {
28 
29 private:
30 
31 protected:
32  using Geometry::Geometry;
33 
34 public:
35 
36  void apply_ro(CoordinateFilter* filter) const override;
37 
38  void apply_ro(CoordinateSequenceFilter& filter) const override;
39 
40  void apply_ro(GeometryComponentFilter* filter) const override;
41 
42  void apply_ro(GeometryFilter* filter) const override;
43 
44  void apply_rw(CoordinateSequenceFilter& filter) override;
45 
46  void apply_rw(GeometryComponentFilter* filter) override;
47 
48  void apply_rw(GeometryFilter* filter) override;
49 
50  void apply_rw(const CoordinateFilter* filter) override;
51 
52  std::unique_ptr<Geometry> convexHull() const override;
53 
54  bool
55  equalsExact(const Geometry* other, double tolerance = 0.0) const override;
56 
57  bool
58  equalsIdentical(const Geometry* other) const override;
59 
60  int
61  getBoundaryDimension() const override
62  {
63  return 1;
64  }
65 
66  const CoordinateXY* getCoordinate() const override;
67 
68  uint8_t getCoordinateDimension() const override;
69 
71  getDimension() const override
72  {
73  return Dimension::A; // area
74  }
75 
76  const Envelope* getEnvelopeInternal() const override;
77 
79  virtual const Curve* getExteriorRing() const = 0;
80 
82  virtual const Curve* getInteriorRingN(std::size_t n) const = 0;
83 
85  double getLength() const override;
86 
88  virtual size_t getNumInteriorRing() const = 0;
89 
90  size_t getNumPoints() const override;
91 
92  bool hasM() const override;
93 
94  bool hasZ() const override;
95 
96  bool isEmpty() const override;
97 
98 protected:
99 
100  int
101  compareToSameClass(const Geometry* g) const override;
102 
103  // Helper method allowing PolygonImpl to use GeometryFactory without circular imports
104  static std::unique_ptr<Geometry> createEmptyRing(const GeometryFactory&);
105 
106  virtual Curve* getExteriorRing() = 0;
107 
108  virtual Curve* getInteriorRingN(std::size_t i) = 0;
109 
110  void geometryChangedAction() override {}
111 
112 };
113 
114 }
115 }
Geometry classes support the concept of applying a coordinate filter to every coordinate in the Geome...
Definition: CoordinateFilter.h:43
Interface for classes which provide operations that can be applied to the coordinates in a Coordinate...
Definition: CoordinateSequenceFilter.h:56
DimensionType
Definition: Dimension.h:29
@ A
Dimension value of a surface (2).
Definition: Dimension.h:46
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:59
Definition: GeometryComponentFilter.h:41
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:70
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition: GeometryFilter.h:45
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:197
Definition: Surface.h:27
const CoordinateXY * getCoordinate() const override
Returns a vertex of this Geometry, or NULL if this is the empty geometry.
bool isEmpty() const override
Returns whether or not the set of points in this Geometry is empty.
virtual const Curve * getInteriorRingN(std::size_t n) const =0
Get nth interior ring (hole)
uint8_t getCoordinateDimension() const override
Returns the coordinate dimension of this Geometry (2=XY, 3=XYZ or XYM, 4=XYZM).
bool equalsIdentical(const Geometry *other) const override
Returns true if the two geometries are of the same type and their vertices corresponding by index are...
bool equalsExact(const Geometry *other, double tolerance=0.0) const override
Returns true iff the two Geometrys are of the same type and their vertices corresponding by index are...
void geometryChangedAction() override
Notifies this Geometry that its Coordinates have been changed by an external party.
Definition: Surface.h:110
Dimension::DimensionType getDimension() const override
Returns the dimension of this Geometry (0=point, 1=line, 2=surface)
Definition: Surface.h:71
void apply_rw(CoordinateSequenceFilter &filter) override
virtual size_t getNumInteriorRing() const =0
Returns number of interior rings (holes)
int getBoundaryDimension() const override
Returns the dimension of this Geometrys inherent boundary.
Definition: Surface.h:61
std::unique_ptr< Geometry > convexHull() const override
Returns the smallest convex Polygon that contains all the points in the Geometry.
size_t getNumPoints() const override
Returns the count of this Geometrys vertices.
virtual const Curve * getExteriorRing() const =0
Returns the exterior ring (shell)
const Envelope * getEnvelopeInternal() const override
Returns the minimum and maximum x and y values in this Geometry, or a null Envelope if this Geometry ...
void apply_ro(CoordinateSequenceFilter &filter) const override
double getLength() const override
Returns the perimeter of this Surface.
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25