GEOS  3.8.0dev
GeometryCollection.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/GeometryCollection.java rev. 1.41
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_GEOS_GEOMETRYCOLLECTION_H
21 #define GEOS_GEOS_GEOMETRYCOLLECTION_H
22 
23 #include <geos/export.h>
24 #include <geos/geom/Geometry.h> // for inheritance
25 #include <geos/geom/Envelope.h> // for proper use of unique_ptr<>
26 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
27 
28 #include <geos/inline.h>
29 
30 #include <string>
31 #include <vector>
32 #include <memory> // for unique_ptr
33 
34 // Forward declarations
35 namespace geos {
36 namespace geom { // geos::geom
37 class Coordinate;
38 class CoordinateArraySequence;
39 class CoordinateSequenceFilter;
40 }
41 }
42 
43 namespace geos {
44 namespace geom { // geos::geom
45 
55 class GEOS_DLL GeometryCollection : public virtual Geometry {
56 
57 public:
58  friend class GeometryFactory;
59 
60  typedef std::vector<Geometry*>::const_iterator const_iterator;
61 
62  typedef std::vector<Geometry*>::iterator iterator;
63 
64  const_iterator begin() const;
65 
66  const_iterator end() const;
67 
74  Geometry*
75  clone() const override
76  {
77  return new GeometryCollection(*this);
78  }
79 
80  ~GeometryCollection() override;
81 
82  void setSRID(int) override;
83 
97  CoordinateSequence* getCoordinates() const override;
98 
99  bool isEmpty() const override;
100 
108  Dimension::DimensionType getDimension() const override;
109 
111  int getCoordinateDimension() const override;
112 
113  Geometry* getBoundary() const override;
114 
120  int getBoundaryDimension() const override;
121 
122  std::size_t getNumPoints() const override;
123 
124  std::string getGeometryType() const override;
125 
126  GeometryTypeId getGeometryTypeId() const override;
127 
128  bool equalsExact(const Geometry* other,
129  double tolerance = 0) const override;
130 
131  void apply_ro(CoordinateFilter* filter) const override;
132 
133  void apply_rw(const CoordinateFilter* filter) override;
134 
135  void apply_ro(GeometryFilter* filter) const override;
136 
137  void apply_rw(GeometryFilter* filter) override;
138 
139  void apply_ro(GeometryComponentFilter* filter) const override;
140 
141  void apply_rw(GeometryComponentFilter* filter) override;
142 
143  void apply_rw(CoordinateSequenceFilter& filter) override;
144 
145  void apply_ro(CoordinateSequenceFilter& filter) const override;
146 
147  void normalize() override;
148 
149  const Coordinate* getCoordinate() const override;
150 
152  double getArea() const override;
153 
155  double getLength() const override;
156 
158  std::size_t getNumGeometries() const override;
159 
161  const Geometry* getGeometryN(std::size_t n) const override;
162 
170  Geometry* reverse() const override;
171 
172 protected:
173 
175 
200  GeometryCollection(std::vector<Geometry*>* newGeoms, const GeometryFactory* newFactory);
201 
202  int
203  getSortIndex() const override
204  {
205  return SORTINDEX_GEOMETRYCOLLECTION;
206  };
207 
208  std::vector<Geometry*>* geometries;
209 
210  Envelope::Ptr computeEnvelopeInternal() const override;
211 
212  int compareToSameClass(const Geometry* gc) const override;
213 
214 };
215 
216 } // namespace geos::geom
217 } // namespace geos
218 
219 #ifdef GEOS_INLINE
220 # include "geos/geom/GeometryCollection.inl"
221 #endif
222 
223 #endif // ndef GEOS_GEOS_GEOMETRYCOLLECTION_H
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition: GeometryFilter.h:47
Geometry * clone() const override
Definition: GeometryCollection.h:75
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: CoordinateSequenceFilter.h:58
GeometryTypeId
Geometry types.
Definition: Geometry.h:74
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:187
Definition: CoordinateFilter.h:43
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:55
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
DimensionType
Definition: Dimension.h:31
Definition: GeometryComponentFilter.h:43