GEOS
3.2.3
|
00001 /********************************************************************** 00002 * $Id: Point.h 2556 2009-06-06 22:22:28Z strk $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00008 * Copyright (C) 2005 2006 Refractions Research Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 ********************************************************************** 00016 * 00017 * Last port: geom/Point.java rev. 1.37 (JTS-1.10) 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_GEOS_POINT_H 00022 #define GEOS_GEOS_POINT_H 00023 00024 #include <geos/export.h> 00025 #include <geos/platform.h> 00026 #include <geos/geom/Geometry.h> 00027 #include <geos/geom/CoordinateSequence.h> // for proper use of auto_ptr<> 00028 #include <geos/geom/Envelope.h> // for proper use of auto_ptr<> 00029 #include <geos/geom/Dimension.h> // for Dimension::DimensionType 00030 00031 #include <geos/inline.h> 00032 00033 #include <string> 00034 #include <vector> 00035 #include <memory> // for auto_ptr 00036 00037 // Forward declarations 00038 namespace geos { 00039 namespace geom { // geos::geom 00040 class Coordinate; 00041 class CoordinateArraySequence; 00042 class CoordinateFilter; 00043 class CoordinateSequenceFilter; 00044 class GeometryComponentFilter; 00045 class GeometryFilter; 00046 } 00047 } 00048 00049 namespace geos { 00050 namespace geom { // geos::geom 00051 00056 class GEOS_DLL Point : public Geometry 00057 00058 // NOTE: in JTS Point implements Puntual 00059 { 00060 00061 public: 00062 00063 friend class GeometryFactory; 00064 00066 typedef std::vector<const Point *> ConstVect; 00067 00068 virtual ~Point(); 00069 00076 Geometry *clone() const { return new Point(*this); } 00077 00078 CoordinateSequence* getCoordinates(void) const; 00079 00080 const CoordinateSequence* getCoordinatesRO() const; 00081 00082 size_t getNumPoints() const; 00083 bool isEmpty() const; 00084 bool isSimple() const; 00085 //bool isValid() const; 00086 00088 Dimension::DimensionType getDimension() const; 00089 00091 int getBoundaryDimension() const; 00092 00101 Geometry* getBoundary() const; 00102 00103 double getX() const; 00104 double getY() const; 00105 const Coordinate* getCoordinate() const; 00106 std::string getGeometryType() const; 00107 virtual GeometryTypeId getGeometryTypeId() const; 00108 void apply_ro(CoordinateFilter *filter) const; 00109 void apply_rw(const CoordinateFilter *filter); 00110 void apply_ro(GeometryFilter *filter) const; 00111 void apply_rw(GeometryFilter *filter); 00112 void apply_rw(GeometryComponentFilter *filter); 00113 void apply_ro(GeometryComponentFilter *filter) const; 00114 void apply_rw(CoordinateSequenceFilter& filter); 00115 void apply_ro(CoordinateSequenceFilter& filter) const; 00116 00117 bool equalsExact(const Geometry *other, double tolerance=0) const; 00118 00119 void normalize(void) 00120 { 00121 // a Point is always in normalized form 00122 } 00123 00124 Geometry* reverse() const 00125 { 00126 return clone(); 00127 } 00128 00129 protected: 00130 00143 Point(CoordinateSequence *newCoords, const GeometryFactory *newFactory); 00144 00145 Point(const Point &p); 00146 00147 Envelope::AutoPtr computeEnvelopeInternal() const; 00148 00149 int compareToSameClass(const Geometry *p) const; 00150 00151 private: 00152 00156 std::auto_ptr<CoordinateSequence> coordinates; 00157 }; 00158 00159 } // namespace geos::geom 00160 } // namespace geos 00161 00162 //#ifdef GEOS_INLINE 00163 //# include "geos/geom/Point.inl" 00164 //#endif 00165 00166 #endif // ndef GEOS_GEOS_POINT_H 00167