GEOS  3.11.1
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 class CoordinateArraySequence;
33 }
34 }
35 
36 namespace geos {
37 namespace geom { // geos::geom
38 
55 class GEOS_DLL LinearRing : public LineString {
56 
57 public:
58 
63  static const unsigned int MINIMUM_VALID_SIZE = 3;
64 
65  LinearRing(const LinearRing& lr);
66 
80  const GeometryFactory* newFactory);
81 
83  LinearRing(CoordinateSequence::Ptr && points,
84  const GeometryFactory& newFactory);
85 
86  LinearRing(std::vector<Coordinate> && pts,
87  const GeometryFactory& newFactory);
88 
89  std::unique_ptr<LinearRing> clone() const
90  {
91  return std::unique_ptr<LinearRing>(cloneImpl());
92  }
93 
94  ~LinearRing() override = default;
95 
102  int getBoundaryDimension() const override;
103 
104  bool isClosed() const override;
105 
106  std::string getGeometryType() const override;
107 
108  GeometryTypeId getGeometryTypeId() const override;
109 
110  void setPoints(const CoordinateSequence* cl);
111 
112  std::unique_ptr<LinearRing> reverse() const { return std::unique_ptr<LinearRing>(reverseImpl()); }
113 
114 protected:
115 
116  int
117  getSortIndex() const override
118  {
119  return SORTINDEX_LINEARRING;
120  };
121 
122  LinearRing* cloneImpl() const override { return new LinearRing(*this); }
123 
124  LinearRing* reverseImpl() const override;
125 
126 private:
127 
128  void validateConstruction();
129 };
130 
131 
132 } // namespace geos::geom
133 } // namespace geos
134 
GeometryTypeId
Geometry types.
Definition: Geometry.h:73
Definition: LineString.h:66
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple...
Definition: LinearRing.h:55
LinearRing * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition: LinearRing.h:122
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44