GEOS  3.3.3
Point.h
1 /**********************************************************************
2  * $Id: Point.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) 2011 Sandro Santilli <strk@keybit.net>
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  * Copyright (C) 2005 2006 Refractions Research Inc.
10  *
11  * This is free software; you can redistribute and/or modify it under
12  * the terms of the GNU Lesser General Public Licence as published
13  * by the Free Software Foundation.
14  * See the COPYING file for more information.
15  *
16  **********************************************************************
17  *
18  * Last port: geom/Point.java r320 (JTS-1.12)
19  *
20  **********************************************************************/
21 
22 #ifndef GEOS_GEOS_POINT_H
23 #define GEOS_GEOS_POINT_H
24 
25 #include <geos/export.h>
26 #include <geos/platform.h>
27 #include <geos/geom/Geometry.h> // for inheritance
28 #include <geos/geom/Puntal.h> // for inheritance
29 #include <geos/geom/CoordinateSequence.h> // for proper use of auto_ptr<>
30 #include <geos/geom/Envelope.h> // for proper use of auto_ptr<>
31 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
32 
33 #include <geos/inline.h>
34 
35 #include <string>
36 #include <vector>
37 #include <memory> // for auto_ptr
38 
39 #ifdef _MSC_VER
40 #pragma warning(push)
41 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
42 #endif
43 
44 // Forward declarations
45 namespace geos {
46  namespace geom { // geos::geom
47  class Coordinate;
48  class CoordinateArraySequence;
49  class CoordinateFilter;
50  class CoordinateSequenceFilter;
51  class GeometryComponentFilter;
52  class GeometryFilter;
53  }
54 }
55 
56 namespace geos {
57 namespace geom { // geos::geom
58 
68 class GEOS_DLL Point : public virtual Geometry, public Puntal
69 {
70 
71 public:
72 
73  friend class GeometryFactory;
74 
76  typedef std::vector<const Point *> ConstVect;
77 
78  virtual ~Point();
79 
86  Geometry *clone() const { return new Point(*this); }
87 
88  CoordinateSequence* getCoordinates(void) const;
89 
90  const CoordinateSequence* getCoordinatesRO() const;
91 
92  size_t getNumPoints() const;
93  bool isEmpty() const;
94  bool isSimple() const;
95 
97  Dimension::DimensionType getDimension() const;
98 
100  virtual int getCoordinateDimension() const;
101 
103  int getBoundaryDimension() const;
104 
113  Geometry* getBoundary() const;
114 
115  double getX() const;
116  double getY() const;
117  const Coordinate* getCoordinate() const;
118  std::string getGeometryType() const;
119  virtual GeometryTypeId getGeometryTypeId() const;
120  void apply_ro(CoordinateFilter *filter) const;
121  void apply_rw(const CoordinateFilter *filter);
122  void apply_ro(GeometryFilter *filter) const;
123  void apply_rw(GeometryFilter *filter);
124  void apply_rw(GeometryComponentFilter *filter);
125  void apply_ro(GeometryComponentFilter *filter) const;
126  void apply_rw(CoordinateSequenceFilter& filter);
127  void apply_ro(CoordinateSequenceFilter& filter) const;
128 
129  bool equalsExact(const Geometry *other, double tolerance=0) const;
130 
131  void normalize(void)
132  {
133  // a Point is always in normalized form
134  }
135 
136  Geometry* reverse() const
137  {
138  return clone();
139  }
140 
141 protected:
142 
155  Point(CoordinateSequence *newCoords, const GeometryFactory *newFactory);
156 
157  Point(const Point &p);
158 
159  Envelope::AutoPtr computeEnvelopeInternal() const;
160 
161  int compareToSameClass(const Geometry *p) const;
162 
163 private:
164 
168  std::auto_ptr<CoordinateSequence> coordinates;
169 };
170 
171 } // namespace geos::geom
172 } // namespace geos
173 
174 //#ifdef GEOS_INLINE
175 //# include "geos/geom/Point.inl"
176 //#endif
177 
178 #ifdef _MSC_VER
179 #pragma warning(pop)
180 #endif
181 
182 #endif // ndef GEOS_GEOS_POINT_H
183