GEOS  3.14.0dev
LinearRing.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2001-2002 Vivid Solutions Inc.
7  * Copyright (C) 2005 2006 Refractions Research Inc.
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  * Last port: geom/LinearRing.java r320 (JTS-1.12)
17  *
18  **********************************************************************/
19 
20 #pragma once
21 
22 #include <geos/export.h>
23 #include <string>
24 #include <vector>
25 #include <geos/geom/LineString.h>
26 
27 
28 // Forward declarations
29 namespace geos {
30 namespace geom { // geos::geom
31 class Coordinate;
32 }
33 }
34 
35 namespace geos {
36 namespace geom { // geos::geom
37 
54 class GEOS_DLL LinearRing : public LineString {
55 
56 public:
57 
62  static const unsigned int MINIMUM_VALID_SIZE = 3;
63 
64  LinearRing(const LinearRing& lr);
65 
78  LinearRing(CoordinateSequence::Ptr && points,
79  const GeometryFactory& newFactory);
80 
81  std::unique_ptr<LinearRing> clone() const
82  {
83  return std::unique_ptr<LinearRing>(cloneImpl());
84  }
85 
86  ~LinearRing() override = default;
87 
94  int getBoundaryDimension() const override;
95 
96  bool isClosed() const override;
97 
98  std::string getGeometryType() const override;
99 
101 
102  void setPoints(const CoordinateSequence* cl);
103 
104  std::unique_ptr<LinearRing> reverse() const { return std::unique_ptr<LinearRing>(reverseImpl()); }
105 
106  void orient(bool isCW);
107 
108 protected:
109 
110  int
111  getSortIndex() const override
112  {
113  return SORTINDEX_LINEARRING;
114  };
115 
116  LinearRing* cloneImpl() const override { return new LinearRing(*this); }
117 
118  LinearRing* reverseImpl() const override;
119 
120 private:
121 
122  void validateConstruction();
123 };
124 
125 
126 } // namespace geos::geom
127 } // namespace geos
128 
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:56
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:70
Definition: LineString.h:66
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition: LinearRing.h:54
int getBoundaryDimension() const override
Returns Dimension.FALSE, since by definition LinearRings do not have a boundary.
LinearRing * reverseImpl() const override
Make a geometry with coordinates in reverse order.
LinearRing(CoordinateSequence::Ptr &&points, const GeometryFactory &newFactory)
Constructs a LinearRing with the given points.
std::string getGeometryType() const override
Return a string representation of this Geometry type.
LinearRing * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition: LinearRing.h:116
GeometryTypeId getGeometryTypeId() const override
Return an integer representation of this Geometry type.
GeometryTypeId
Geometry types.
Definition: Geometry.h:74
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25