GEOS  3.7.2
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/platform.h>
26 #include <geos/geom/Envelope.h> // for proper use of unique_ptr<>
27 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
28 
29 #include <geos/inline.h>
30 
31 #include <string>
32 #include <vector>
33 #include <memory> // for unique_ptr
34 
35 // Forward declarations
36 namespace geos {
37  namespace geom { // geos::geom
38  class Coordinate;
39  class CoordinateArraySequence;
40  class CoordinateSequenceFilter;
41  }
42 }
43 
44 namespace geos {
45 namespace geom { // geos::geom
46 
56 class GEOS_DLL GeometryCollection : public virtual Geometry {
57 
58 public:
59  friend class GeometryFactory;
60 
61  typedef std::vector<Geometry *>::const_iterator const_iterator;
62 
63  typedef std::vector<Geometry *>::iterator iterator;
64 
65  const_iterator begin() const;
66 
67  const_iterator end() const;
68 
75  Geometry *clone() const override {
76  return new GeometryCollection(*this);
77  }
78 
79  ~GeometryCollection() override;
80 
95 
96  bool isEmpty() const override;
97 
106 
108  int getCoordinateDimension() const override;
109 
110  Geometry* getBoundary() const override;
111 
117  int getBoundaryDimension() const override;
118 
119  std::size_t getNumPoints() const override;
120 
121  std::string getGeometryType() const override;
122 
124 
125  bool equalsExact(const Geometry *other,
126  double tolerance=0) const override;
127 
128  void apply_ro(CoordinateFilter *filter) const override;
129 
130  void apply_rw(const CoordinateFilter *filter) override;
131 
132  void apply_ro(GeometryFilter *filter) const override;
133 
134  void apply_rw(GeometryFilter *filter) override;
135 
136  void apply_ro(GeometryComponentFilter *filter) const override;
137 
138  void apply_rw(GeometryComponentFilter *filter) override;
139 
140  void apply_rw(CoordinateSequenceFilter& filter) override;
141 
142  void apply_ro(CoordinateSequenceFilter& filter) const override;
143 
144  void normalize() override;
145 
146  const Coordinate* getCoordinate() const override;
147 
149  double getArea() const override;
150 
152  double getLength() const override;
153 
155  std::size_t getNumGeometries() const override;
156 
158  const Geometry* getGeometryN(std::size_t n) const override;
159 
167  Geometry* reverse() const override;
168 
169 protected:
170 
172 
197  GeometryCollection(std::vector<Geometry *> *newGeoms, const GeometryFactory *newFactory);
198 
199 
200  std::vector<Geometry *>* geometries;
201 
202  Envelope::Ptr computeEnvelopeInternal() const override;
203 
204  int compareToSameClass(const Geometry *gc) const override;
205 
206 };
207 
208 } // namespace geos::geom
209 } // namespace geos
210 
211 #ifdef GEOS_INLINE
212 # include "geos/geom/GeometryCollection.inl"
213 #endif
214 
215 #endif // ndef GEOS_GEOS_GEOMETRYCOLLECTION_H
geos::geom::GeometryCollection::getNumPoints
std::size_t getNumPoints() const override
Returns the count of this Geometrys vertices.
geos::geom::GeometryCollection::getGeometryN
const Geometry * getGeometryN(std::size_t n) const override
Returns a pointer to the nth Geometry int this collection.
geos::geom::GeometryCollection::apply_ro
void apply_ro(CoordinateSequenceFilter &filter) const override
geos::geom::GeometryCollection::apply_rw
void apply_rw(CoordinateSequenceFilter &filter) override
geos::geom::GeometryCollection::getNumGeometries
std::size_t getNumGeometries() const override
Returns the number of geometries in this collection.
geos::geom::GeometryCollection::getBoundary
Geometry * getBoundary() const override
Returns the boundary, or an empty geometry of appropriate dimension if this Geometry is empty.
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::geom::GeometryComponentFilter
Definition: GeometryComponentFilter.h:43
geos::geom::GeometryCollection::getLength
double getLength() const override
Returns the total length of this collection.
geos::geom::GeometryCollection::getCoordinateDimension
int getCoordinateDimension() const override
Returns coordinate dimension.
geos::geom::GeometryCollection::getDimension
Dimension::DimensionType getDimension() const override
Returns the maximum dimension of geometries in this collection (0=point, 1=line, 2=surface)
geos::geom::GeometryCollection::getBoundaryDimension
int getBoundaryDimension() const override
Returns the maximum boundary dimension of geometries in this collection.
geos::geom::Dimension::DimensionType
DimensionType
Definition: Dimension.h:31
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:177
geos::geom::GeometryCollection::clone
Geometry * clone() const override
Definition: GeometryCollection.h:75
geos::geom::GeometryCollection
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:56
geos::geom::GeometryCollection::equalsExact
bool equalsExact(const Geometry *other, double tolerance=0) const override
Returns true iff the two Geometrys are of the same type and their vertices corresponding by index are...
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
geos::geom::CoordinateSequenceFilter
Definition: CoordinateSequenceFilter.h:58
geos::geom::GeometryCollection::isEmpty
bool isEmpty() const override
Returns whether or not the set of points in this Geometry is empty.
geos::geom::GeometryCollection::normalize
void normalize() override
Converts this Geometry to normal form (or canonical form).
geos::geom::GeometryCollection::getGeometryTypeId
GeometryTypeId getGeometryTypeId() const override
Return an integer representation of this Geometry type.
geos::geom::GeometryCollection::getCoordinates
CoordinateSequence * getCoordinates() const override
Collects all coordinates of all subgeometries into a CoordinateSequence.
geos::geom::GeometryCollection::GeometryCollection
GeometryCollection(std::vector< Geometry * > *newGeoms, const GeometryFactory *newFactory)
Construct a GeometryCollection with the given GeometryFactory. Will keep a reference to the factory,...
geos::geom::GeometryTypeId
GeometryTypeId
Geometry types.
Definition: Geometry.h:75
geos::geom::GeometryCollection::getCoordinate
const Coordinate * getCoordinate() const override
Returns a vertex of this Geometry, or NULL if this is the empty geometry.
geos::geom::CoordinateFilter
Definition: CoordinateFilter.h:43
geos::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
geos::geom::GeometryFilter
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition: GeometryFilter.h:48
geos::geom::GeometryCollection::reverse
Geometry * reverse() const override
geos::geom::GeometryCollection::getArea
double getArea() const override
Returns the total area of this collection.
geos::geom::GeometryCollection::getGeometryType
std::string getGeometryType() const override
Return a string representation of this Geometry type.