GEOS  3.6.2
Point.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
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 r320 (JTS-1.12)
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> // for inheritance
00027 #include <geos/geom/Puntal.h> // for inheritance
00028 #include <geos/geom/CoordinateSequence.h> // for proper use of auto_ptr<>
00029 #include <geos/geom/Envelope.h> // for proper use of auto_ptr<>
00030 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
00031 
00032 #include <geos/inline.h>
00033 
00034 #include <string>
00035 #include <vector>
00036 #include <memory> // for auto_ptr
00037 
00038 #ifdef _MSC_VER
00039 #pragma warning(push)
00040 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00041 #endif
00042 
00043 // Forward declarations
00044 namespace geos {
00045         namespace geom { // geos::geom
00046                 class Coordinate;
00047                 class CoordinateArraySequence;
00048                 class CoordinateFilter;
00049                 class CoordinateSequenceFilter;
00050                 class GeometryComponentFilter;
00051                 class GeometryFilter;
00052         }
00053 }
00054 
00055 namespace geos {
00056 namespace geom { // geos::geom
00057 
00067 class GEOS_DLL Point : public virtual Geometry, public Puntal 
00068 {
00069 
00070 public:
00071 
00072         friend class GeometryFactory;
00073 
00075         typedef std::vector<const Point *> ConstVect;
00076 
00077         virtual ~Point();
00078 
00085         Geometry *clone() const { return new Point(*this); }
00086 
00087         CoordinateSequence* getCoordinates(void) const;
00088 
00089         const CoordinateSequence* getCoordinatesRO() const;
00090 
00091         size_t getNumPoints() const;
00092         bool isEmpty() const;
00093         bool isSimple() const;
00094 
00096         Dimension::DimensionType getDimension() const;
00097 
00099         virtual int getCoordinateDimension() const;
00100 
00102         int getBoundaryDimension() const;
00103 
00112         Geometry* getBoundary() const;
00113 
00114         double getX() const;
00115         double getY() const;
00116         const Coordinate* getCoordinate() const;
00117         std::string getGeometryType() const;
00118         virtual GeometryTypeId getGeometryTypeId() const;
00119         void apply_ro(CoordinateFilter *filter) const;
00120         void apply_rw(const CoordinateFilter *filter);
00121         void apply_ro(GeometryFilter *filter) const;
00122         void apply_rw(GeometryFilter *filter);
00123         void apply_rw(GeometryComponentFilter *filter);
00124         void apply_ro(GeometryComponentFilter *filter) const;
00125         void apply_rw(CoordinateSequenceFilter& filter);
00126         void apply_ro(CoordinateSequenceFilter& filter) const;
00127 
00128         bool equalsExact(const Geometry *other, double tolerance=0) const;
00129 
00130         void normalize(void)
00131         {
00132                 // a Point is always in normalized form
00133         }
00134 
00135         Geometry* reverse() const
00136         {
00137                 return clone();
00138         }
00139 
00140 protected:
00141 
00154         Point(CoordinateSequence *newCoords, const GeometryFactory *newFactory);
00155 
00156         Point(const Point &p); 
00157 
00158         Envelope::AutoPtr computeEnvelopeInternal() const;
00159 
00160         int compareToSameClass(const Geometry *p) const;
00161 
00162 private:
00163 
00167         std::auto_ptr<CoordinateSequence> coordinates;
00168 };
00169 
00170 } // namespace geos::geom
00171 } // namespace geos
00172 
00173 //#ifdef GEOS_INLINE
00174 //# include "geos/geom/Point.inl"
00175 //#endif
00176 
00177 #ifdef _MSC_VER
00178 #pragma warning(pop)
00179 #endif
00180 
00181 #endif // ndef GEOS_GEOS_POINT_H
00182