GEOS  3.3.3
GeometryCollection.h
1 /**********************************************************************
2  * $Id: GeometryCollection.h 3185 2011-02-07 15:39:27Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  * Copyright (C) 2005 2006 Refractions Research Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: geom/GeometryCollection.java rev. 1.41
18  *
19  **********************************************************************/
20 
21 #ifndef GEOS_GEOS_GEOMETRYCOLLECTION_H
22 #define GEOS_GEOS_GEOMETRYCOLLECTION_H
23 
24 #include <geos/export.h>
25 #include <geos/geom/Geometry.h> // for inheritance
26 //#include <geos/platform.h>
27 #include <geos/geom/Envelope.h> // for proper use of auto_ptr<>
28 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
29 
30 #include <geos/inline.h>
31 
32 #include <string>
33 #include <vector>
34 #include <memory> // for auto_ptr
35 
36 // Forward declarations
37 namespace geos {
38  namespace geom { // geos::geom
39  class Coordinate;
40  class CoordinateArraySequence;
41  class CoordinateSequenceFilter;
42  }
43 }
44 
45 namespace geos {
46 namespace geom { // geos::geom
47 
57 class GEOS_DLL GeometryCollection : public virtual Geometry {
58 
59 public:
60  friend class GeometryFactory;
61 
62  typedef std::vector<Geometry *>::const_iterator const_iterator;
63 
64  typedef std::vector<Geometry *>::iterator iterator;
65 
66  const_iterator begin() const;
67 
68  const_iterator end() const;
69 
76  virtual Geometry *clone() const {
77  return new GeometryCollection(*this);
78  }
79 
80  virtual ~GeometryCollection();
81 
95  virtual CoordinateSequence* getCoordinates() const;
96 
97  virtual bool isEmpty() const;
98 
106  virtual Dimension::DimensionType getDimension() const;
107 
109  virtual int getCoordinateDimension() const;
110 
111  virtual Geometry* getBoundary() const;
112 
118  virtual int getBoundaryDimension() const;
119 
120  virtual std::size_t getNumPoints() const;
121 
122  virtual std::string getGeometryType() const;
123 
124  virtual GeometryTypeId getGeometryTypeId() const;
125 
126  virtual bool equalsExact(const Geometry *other,
127  double tolerance=0) const;
128 
129  virtual void apply_ro(CoordinateFilter *filter) const;
130 
131  virtual void apply_rw(const CoordinateFilter *filter);
132 
133  virtual void apply_ro(GeometryFilter *filter) const;
134 
135  virtual void apply_rw(GeometryFilter *filter);
136 
137  virtual void apply_ro(GeometryComponentFilter *filter) const;
138 
139  virtual void apply_rw(GeometryComponentFilter *filter);
140 
141  virtual void apply_rw(CoordinateSequenceFilter& filter);
142 
143  virtual void apply_ro(CoordinateSequenceFilter& filter) const;
144 
145  virtual void normalize();
146 
147  virtual const Coordinate* getCoordinate() const;
148 
150  virtual double getArea() const;
151 
153  virtual double getLength() const;
154 
156  virtual std::size_t getNumGeometries() const;
157 
159  virtual const Geometry* getGeometryN(std::size_t n) const;
160 
161 protected:
162 
164 
189  GeometryCollection(std::vector<Geometry *> *newGeoms, const GeometryFactory *newFactory);
190 
191 
192  std::vector<Geometry *>* geometries;
193 
194  virtual Envelope::AutoPtr computeEnvelopeInternal() const;
195 
196  virtual int compareToSameClass(const Geometry *gc) const;
197 
198 };
199 
200 } // namespace geos::geom
201 } // namespace geos
202 
203 #ifdef GEOS_INLINE
204 # include "geos/geom/GeometryCollection.inl"
205 #endif
206 
207 #endif // ndef GEOS_GEOS_GEOMETRYCOLLECTION_H
208 
209 /**********************************************************************
210  * $Log$
211  * Revision 1.8 2006/06/12 10:10:39 strk
212  * Fixed getGeometryN() to take size_t rather then int, changed unsigned int parameters to size_t.
213  *
214  * Revision 1.7 2006/05/04 15:49:39 strk
215  * updated all Geometry::getDimension() methods to return Dimension::DimensionType (closes bug#93)
216  *
217  * Revision 1.6 2006/04/28 10:55:39 strk
218  * Geometry constructors made protected, to ensure all constructions use GeometryFactory,
219  * which has been made friend of all Geometry derivates. getNumPoints() changed to return
220  * size_t.
221  *
222  * Revision 1.5 2006/04/10 18:15:09 strk
223  * Changed Geometry::envelope member to be of type auto_ptr<Envelope>.
224  * Changed computeEnvelopeInternal() signater to return auto_ptr<Envelope>
225  *
226  * Revision 1.4 2006/04/07 09:54:30 strk
227  * Geometry::getNumGeometries() changed to return 'unsigned int'
228  * rather then 'int'
229  *
230  * Revision 1.3 2006/03/24 09:52:41 strk
231  * USE_INLINE => GEOS_INLINE
232  *
233  * Revision 1.2 2006/03/23 12:12:01 strk
234  * Fixes to allow build with -DGEOS_INLINE
235  *
236  * Revision 1.1 2006/03/09 16:46:49 strk
237  * geos::geom namespace definition, first pass at headers split
238  *
239  **********************************************************************/