GEOS  3.8.0dev
Point.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
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/geom/Geometry.h> // for inheritance
26 #include <geos/geom/Puntal.h> // for inheritance
27 #include <geos/geom/CoordinateSequence.h> // for proper use of unique_ptr<>
28 #include <geos/geom/Envelope.h> // for proper use of unique_ptr<>
29 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
30 
31 #include <geos/inline.h>
32 
33 #include <string>
34 #include <vector>
35 #include <memory> // for unique_ptr
36 
37 #ifdef _MSC_VER
38 #pragma warning(push)
39 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
40 #endif
41 
42 // Forward declarations
43 namespace geos {
44 namespace geom { // geos::geom
45 class Coordinate;
46 class CoordinateArraySequence;
47 class CoordinateFilter;
48 class CoordinateSequenceFilter;
49 class GeometryComponentFilter;
50 class GeometryFilter;
51 }
52 }
53 
54 namespace geos {
55 namespace geom { // geos::geom
56 
66 class GEOS_DLL Point : public virtual Geometry, public Puntal {
67 
68 public:
69 
70  friend class GeometryFactory;
71 
73  typedef std::vector<const Point*> ConstVect;
74 
75  ~Point() override;
76 
83  Geometry*
84  clone() const override
85  {
86  return new Point(*this);
87  }
88 
89  CoordinateSequence* getCoordinates(void) const override;
90 
91  const CoordinateSequence* getCoordinatesRO() const;
92 
93  size_t getNumPoints() const override;
94  bool isEmpty() const override;
95  bool isSimple() const override;
96 
98  Dimension::DimensionType getDimension() const override;
99 
101  int getCoordinateDimension() const override;
102 
104  int getBoundaryDimension() const override;
105 
114  Geometry* getBoundary() const override;
115 
116  double getX() const;
117  double getY() const;
118  double getZ() const;
119  const Coordinate* getCoordinate() const override;
120  std::string getGeometryType() const override;
121  GeometryTypeId getGeometryTypeId() const override;
122  void apply_ro(CoordinateFilter* filter) const override;
123  void apply_rw(const CoordinateFilter* filter) override;
124  void apply_ro(GeometryFilter* filter) const override;
125  void apply_rw(GeometryFilter* filter) override;
126  void apply_rw(GeometryComponentFilter* filter) override;
127  void apply_ro(GeometryComponentFilter* filter) const override;
128  void apply_rw(CoordinateSequenceFilter& filter) override;
129  void apply_ro(CoordinateSequenceFilter& filter) const override;
130 
131  bool equalsExact(const Geometry* other, double tolerance = 0) const override;
132 
133  void
134  normalize(void) override
135  {
136  // a Point is always in normalized form
137  }
138 
139  Geometry*
140  reverse() const override
141  {
142  return clone();
143  }
144 
145 protected:
146 
159  Point(CoordinateSequence* newCoords, const GeometryFactory* newFactory);
160 
161  Point(const Point& p);
162 
163  Envelope::Ptr computeEnvelopeInternal() const override;
164 
165  int compareToSameClass(const Geometry* p) const override;
166 
167  int
168  getSortIndex() const override
169  {
170  return SORTINDEX_POINT;
171  };
172 
173 private:
174 
178  std::unique_ptr<CoordinateSequence> coordinates;
179 };
180 
181 } // namespace geos::geom
182 } // namespace geos
183 
184 //#ifdef GEOS_INLINE
185 //# include "geos/geom/Point.inl"
186 //#endif
187 
188 #ifdef _MSC_VER
189 #pragma warning(pop)
190 #endif
191 
192 #endif // ndef GEOS_GEOS_POINT_H
193 
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition: GeometryFilter.h:47
std::vector< const Point * > ConstVect
A vector of const Point pointers.
Definition: Point.h:73
Definition: Puntal.h:37
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: CoordinateSequenceFilter.h:58
GeometryTypeId
Geometry types.
Definition: Geometry.h:74
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:187
Definition: CoordinateFilter.h:43
Geometry * clone() const override
Definition: Point.h:84
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
void normalize(void) override
Converts this Geometry to normal form (or canonical form).
Definition: Point.h:134
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Geometry * reverse() const override
Definition: Point.h:140
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Definition: Point.h:66
DimensionType
Definition: Dimension.h:31
Definition: GeometryComponentFilter.h:43