GEOS 3.6.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 auto_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 auto_ptr
34
35// Forward declarations
36namespace geos {
37 namespace geom { // geos::geom
38 class Coordinate;
41 }
42}
43
44namespace geos {
45namespace geom { // geos::geom
46
56class GEOS_DLL GeometryCollection : public virtual Geometry {
57
58public:
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 virtual Geometry *clone() const {
76 return new GeometryCollection(*this);
77 }
78
79 virtual ~GeometryCollection();
80
95
96 virtual bool isEmpty() const;
97
106
108 virtual int getCoordinateDimension() const;
109
110 virtual Geometry* getBoundary() const;
111
117 virtual int getBoundaryDimension() const;
118
119 virtual std::size_t getNumPoints() const;
120
121 virtual std::string getGeometryType() const;
122
124
125 virtual bool equalsExact(const Geometry *other,
126 double tolerance=0) const;
127
128 virtual void apply_ro(CoordinateFilter *filter) const;
129
130 virtual void apply_rw(const CoordinateFilter *filter);
131
132 virtual void apply_ro(GeometryFilter *filter) const;
133
134 virtual void apply_rw(GeometryFilter *filter);
135
136 virtual void apply_ro(GeometryComponentFilter *filter) const;
137
138 virtual void apply_rw(GeometryComponentFilter *filter);
139
140 virtual void apply_rw(CoordinateSequenceFilter& filter);
141
142 virtual void apply_ro(CoordinateSequenceFilter& filter) const;
143
144 virtual void normalize();
145
146 virtual const Coordinate* getCoordinate() const;
147
149 virtual double getArea() const;
150
152 virtual double getLength() const;
153
155 virtual std::size_t getNumGeometries() const;
156
158 virtual const Geometry* getGeometryN(std::size_t n) const;
159
160protected:
161
162 GeometryCollection(const GeometryCollection &gc);
163
188 GeometryCollection(std::vector<Geometry *> *newGeoms, const GeometryFactory *newFactory);
189
190
191 std::vector<Geometry *>* geometries;
192
193 Envelope::AutoPtr computeEnvelopeInternal() const;
194
195 int compareToSameClass(const Geometry *gc) const;
196
197};
198
199} // namespace geos::geom
200} // namespace geos
201
202#ifdef GEOS_INLINE
203# include "geos/geom/GeometryCollection.inl"
204#endif
205
206#endif // ndef GEOS_GEOS_GEOMETRYCOLLECTION_H
The default implementation of CoordinateSequence.
Definition CoordinateArraySequence.h:37
Definition CoordinateFilter.h:43
Definition CoordinateSequenceFilter.h:58
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
DimensionType
Definition Dimension.h:31
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:56
virtual int getBoundaryDimension() const
Returns the maximum boundary dimension of geometries in this collection.
virtual Geometry * clone() const
Definition GeometryCollection.h:75
virtual int getCoordinateDimension() const
Returns coordinate dimension.
virtual Dimension::DimensionType getDimension() const
Returns the maximum dimension of geometries in this collection (0=point, 1=line, 2=surface).
GeometryCollection(std::vector< Geometry * > *newGeoms, const GeometryFactory *newFactory)
Construct a GeometryCollection with the given GeometryFactory. Will keep a reference to the factory,...
virtual std::size_t getNumPoints() const
Returns the count of this Geometrys vertices.
virtual std::string getGeometryType() const
Return a string representation of this Geometry type.
virtual const Coordinate * getCoordinate() const
Returns a vertex of this Geometry, or NULL if this is the empty geometry.
virtual void apply_ro(CoordinateSequenceFilter &filter) const
virtual double getArea() const
Returns the total area of this collection.
virtual const Geometry * getGeometryN(std::size_t n) const
Returns a pointer to the nth Geometry int this collection.
virtual double getLength() const
Returns the total length of this collection.
virtual std::size_t getNumGeometries() const
Returns the number of geometries in this collection.
virtual void normalize()
Converts this Geometry to normal form (or canonical form).
virtual bool isEmpty() const
Returns whether or not the set of points in this Geometry is empty.
virtual bool equalsExact(const Geometry *other, double tolerance=0) const
Returns true if the two Geometrys are exactly equal, up to a specified tolerance.
virtual void apply_rw(CoordinateSequenceFilter &filter)
virtual GeometryTypeId getGeometryTypeId() const
Return an integer representation of this Geometry type.
virtual CoordinateSequence * getCoordinates() const
Collects all coordinates of all subgeometries into a CoordinateSequence.
virtual Geometry * getBoundary() const
Returns the boundary, or an empty geometry of appropriate dimension if this Geometry is empty.
Definition GeometryComponentFilter.h:43
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition GeometryFilter.h:48
Geometry(const Geometry &geom)
Polygon overrides to check for actual rectangle.
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
GeometryTypeId
Geometry types.
Definition Geometry.h:65
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25