GEOS 3.6.2
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
44namespace geos {
45 namespace geom { // geos::geom
46 class Coordinate;
48 class CoordinateFilter;
51 class GeometryFilter;
52 }
53}
54
55namespace geos {
56namespace geom { // geos::geom
57
67class GEOS_DLL Point : public virtual Geometry, public Puntal
68{
69
70public:
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
88
89 const CoordinateSequence* getCoordinatesRO() const;
90
91 size_t getNumPoints() const;
92 bool isEmpty() const;
93 bool isSimple() const;
94
97
99 virtual int getCoordinateDimension() const;
100
103
113
114 double getX() const;
115 double getY() const;
116 const Coordinate* getCoordinate() const;
117 std::string getGeometryType() 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;
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
140protected:
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
162private:
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
The default implementation of CoordinateSequence.
Definition CoordinateArraySequence.h:37
Definition CoordinateFilter.h:43
Definition CoordinateSequenceFilter.h:58
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
DimensionType
Definition Dimension.h:31
Definition GeometryComponentFilter.h:43
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition GeometryFilter.h:48
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Geometry(const Geometry &geom)
Polygon overrides to check for actual rectangle.
const Coordinate * getCoordinate() const
Returns a vertex of this Geometry, or NULL if this is the empty geometry.
bool isEmpty() const
Returns whether or not the set of points in this Geometry is empty.
Point(CoordinateSequence *newCoords, const GeometryFactory *newFactory)
Creates a Point taking ownership of the given CoordinateSequence (must have 1 element).
virtual GeometryTypeId getGeometryTypeId() const
Return an integer representation of this Geometry type.
std::string getGeometryType() const
Return a string representation of this Geometry type.
void apply_rw(CoordinateSequenceFilter &filter)
std::vector< const Point * > ConstVect
A vector of const Point pointers.
Definition Point.h:75
int getBoundaryDimension() const
Returns Dimension::False (Point has no boundary).
virtual int getCoordinateDimension() const
Returns coordinate dimension.
bool equalsExact(const Geometry *other, double tolerance=0) const
Returns true if the two Geometrys are exactly equal, up to a specified tolerance.
Geometry * getBoundary() const
Dimension::DimensionType getDimension() const
Returns point dimension (0).
size_t getNumPoints() const
Returns the count of this Geometrys vertices.
void apply_ro(CoordinateSequenceFilter &filter) const
bool isSimple() const
Returns false if the Geometry not simple.
CoordinateSequence * getCoordinates(void) const
Returns this Geometry vertices. Caller takes ownership of the returned object.
Geometry * clone() const
Definition Point.h:85
void normalize(void)
Converts this Geometry to normal form (or canonical form).
Definition Point.h:130
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
GeometryTypeId
Geometry types.
Definition Geometry.h:65
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25