GEOS  3.3.7
Point.h
00001 /**********************************************************************
00002  * $Id: Point.h 3185 2011-02-07 15:39:27Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00009  * Copyright (C) 2005 2006 Refractions Research Inc.
00010  *
00011  * This is free software; you can redistribute and/or modify it under
00012  * the terms of the GNU Lesser General Public Licence as published
00013  * by the Free Software Foundation. 
00014  * See the COPYING file for more information.
00015  *
00016  **********************************************************************
00017  *
00018  * Last port: geom/Point.java r320 (JTS-1.12)
00019  *
00020  **********************************************************************/
00021 
00022 #ifndef GEOS_GEOS_POINT_H
00023 #define GEOS_GEOS_POINT_H
00024 
00025 #include <geos/export.h>
00026 #include <geos/platform.h>
00027 #include <geos/geom/Geometry.h> // for inheritance
00028 #include <geos/geom/Puntal.h> // for inheritance
00029 #include <geos/geom/CoordinateSequence.h> // for proper use of auto_ptr<>
00030 #include <geos/geom/Envelope.h> // for proper use of auto_ptr<>
00031 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
00032 
00033 #include <geos/inline.h>
00034 
00035 #include <string>
00036 #include <vector>
00037 #include <memory> // for auto_ptr
00038 
00039 #ifdef _MSC_VER
00040 #pragma warning(push)
00041 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00042 #endif
00043 
00044 // Forward declarations
00045 namespace geos {
00046         namespace geom { // geos::geom
00047                 class Coordinate;
00048                 class CoordinateArraySequence;
00049                 class CoordinateFilter;
00050                 class CoordinateSequenceFilter;
00051                 class GeometryComponentFilter;
00052                 class GeometryFilter;
00053         }
00054 }
00055 
00056 namespace geos {
00057 namespace geom { // geos::geom
00058 
00068 class GEOS_DLL Point : public virtual Geometry, public Puntal 
00069 {
00070 
00071 public:
00072 
00073         friend class GeometryFactory;
00074 
00076         typedef std::vector<const Point *> ConstVect;
00077 
00078         virtual ~Point();
00079 
00086         Geometry *clone() const { return new Point(*this); }
00087 
00088         CoordinateSequence* getCoordinates(void) const;
00089 
00090         const CoordinateSequence* getCoordinatesRO() const;
00091 
00092         size_t getNumPoints() const;
00093         bool isEmpty() const;
00094         bool isSimple() const;
00095 
00097         Dimension::DimensionType getDimension() const;
00098 
00100         virtual int getCoordinateDimension() const;
00101 
00103         int getBoundaryDimension() const;
00104 
00113         Geometry* getBoundary() const;
00114 
00115         double getX() const;
00116         double getY() const;
00117         const Coordinate* getCoordinate() const;
00118         std::string getGeometryType() const;
00119         virtual GeometryTypeId getGeometryTypeId() const;
00120         void apply_ro(CoordinateFilter *filter) const;
00121         void apply_rw(const CoordinateFilter *filter);
00122         void apply_ro(GeometryFilter *filter) const;
00123         void apply_rw(GeometryFilter *filter);
00124         void apply_rw(GeometryComponentFilter *filter);
00125         void apply_ro(GeometryComponentFilter *filter) const;
00126         void apply_rw(CoordinateSequenceFilter& filter);
00127         void apply_ro(CoordinateSequenceFilter& filter) const;
00128 
00129         bool equalsExact(const Geometry *other, double tolerance=0) const;
00130 
00131         void normalize(void)
00132         {
00133                 // a Point is always in normalized form
00134         }
00135 
00136         Geometry* reverse() const
00137         {
00138                 return clone();
00139         }
00140 
00141 protected:
00142 
00155         Point(CoordinateSequence *newCoords, const GeometryFactory *newFactory);
00156 
00157         Point(const Point &p); 
00158 
00159         Envelope::AutoPtr computeEnvelopeInternal() const;
00160 
00161         int compareToSameClass(const Geometry *p) const;
00162 
00163 private:
00164 
00168         std::auto_ptr<CoordinateSequence> coordinates;
00169 };
00170 
00171 } // namespace geos::geom
00172 } // namespace geos
00173 
00174 //#ifdef GEOS_INLINE
00175 //# include "geos/geom/Point.inl"
00176 //#endif
00177 
00178 #ifdef _MSC_VER
00179 #pragma warning(pop)
00180 #endif
00181 
00182 #endif // ndef GEOS_GEOS_POINT_H
00183