GEOS  3.6.1
Point.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
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/Point.java r320 (JTS-1.12)
18  *
19  **********************************************************************/
20 
21 #ifndef GEOS_GEOS_POINT_H
22 #define GEOS_GEOS_POINT_H
23 
24 #include <geos/export.h>
25 #include <geos/platform.h>
26 #include <geos/geom/Geometry.h> // for inheritance
27 #include <geos/geom/Puntal.h> // for inheritance
28 #include <geos/geom/CoordinateSequence.h> // for proper use of auto_ptr<>
29 #include <geos/geom/Envelope.h> // for proper use of auto_ptr<>
30 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
31 
32 #include <geos/inline.h>
33 
34 #include <string>
35 #include <vector>
36 #include <memory> // for auto_ptr
37 
38 #ifdef _MSC_VER
39 #pragma warning(push)
40 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
41 #endif
42 
43 // Forward declarations
44 namespace geos {
45  namespace geom { // geos::geom
46  class Coordinate;
47  class CoordinateArraySequence;
48  class CoordinateFilter;
49  class CoordinateSequenceFilter;
50  class GeometryComponentFilter;
51  class GeometryFilter;
52  }
53 }
54 
55 namespace geos {
56 namespace geom { // geos::geom
57 
67 class GEOS_DLL Point : public virtual Geometry, public Puntal
68 {
69 
70 public:
71 
72  friend class GeometryFactory;
73 
75  typedef std::vector<const Point *> ConstVect;
76 
77  virtual ~Point();
78 
85  Geometry *clone() const { return new Point(*this); }
86 
87  CoordinateSequence* getCoordinates(void) const;
88 
89  const CoordinateSequence* getCoordinatesRO() const;
90 
91  size_t getNumPoints() const;
92  bool isEmpty() const;
93  bool isSimple() const;
94 
96  Dimension::DimensionType getDimension() const;
97 
99  virtual int getCoordinateDimension() const;
100 
102  int getBoundaryDimension() const;
103 
112  Geometry* getBoundary() const;
113 
114  double getX() const;
115  double getY() const;
116  const Coordinate* getCoordinate() const;
117  std::string getGeometryType() const;
118  virtual GeometryTypeId getGeometryTypeId() const;
119  void apply_ro(CoordinateFilter *filter) const;
120  void apply_rw(const CoordinateFilter *filter);
121  void apply_ro(GeometryFilter *filter) const;
122  void apply_rw(GeometryFilter *filter);
123  void apply_rw(GeometryComponentFilter *filter);
124  void apply_ro(GeometryComponentFilter *filter) const;
125  void apply_rw(CoordinateSequenceFilter& filter);
126  void apply_ro(CoordinateSequenceFilter& filter) const;
127 
128  bool equalsExact(const Geometry *other, double tolerance=0) const;
129 
130  void normalize(void)
131  {
132  // a Point is always in normalized form
133  }
134 
135  Geometry* reverse() const
136  {
137  return clone();
138  }
139 
140 protected:
141 
154  Point(CoordinateSequence *newCoords, const GeometryFactory *newFactory);
155 
156  Point(const Point &p);
157 
158  Envelope::AutoPtr computeEnvelopeInternal() const;
159 
160  int compareToSameClass(const Geometry *p) const;
161 
162 private:
163 
167  std::auto_ptr<CoordinateSequence> coordinates;
168 };
169 
170 } // namespace geos::geom
171 } // namespace geos
172 
173 //#ifdef GEOS_INLINE
174 //# include "geos/geom/Point.inl"
175 //#endif
176 
177 #ifdef _MSC_VER
178 #pragma warning(pop)
179 #endif
180 
181 #endif // ndef GEOS_GEOS_POINT_H
182 
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition: GeometryFilter.h:48
void normalize(void)
Converts this Geometry to normal form (or canonical form).
Definition: Point.h:130
Definition: Puntal.h:32
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
Definition: CoordinateFilter.h:43
std::vector< const Point * > ConstVect
A vector of const Point pointers.
Definition: Point.h:75
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Geometry * clone() const
Definition: Point.h:85
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
Definition: Point.h:67
DimensionType
Definition: Dimension.h:31
Definition: GeometryComponentFilter.h:43