GEOS  3.4.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
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  virtual Geometry *clone() const {
76  return new GeometryCollection(*this);
77  }
78 
79  virtual ~GeometryCollection();
80 
94  virtual CoordinateSequence* getCoordinates() const;
95 
96  virtual bool isEmpty() const;
97 
105  virtual Dimension::DimensionType getDimension() const;
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 
123  virtual GeometryTypeId getGeometryTypeId() const;
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 
160 protected:
161 
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
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition: GeometryFilter.h:48
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: CoordinateSequenceFilter.h:58
GeometryTypeId
Geometry types.
Definition: Geometry.h:65
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
virtual Geometry * clone() const
Definition: GeometryCollection.h:75
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:56
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
DimensionType
Definition: Dimension.h:31
Definition: GeometryComponentFilter.h:43