Point.h

00001 /**********************************************************************
00002  * $Id: Point.h 1820 2006-09-06 16:54:23Z mloskot $
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 #ifndef GEOS_GEOS_POINT_H
00018 #define GEOS_GEOS_POINT_H
00019 
00020 #include <geos/platform.h>
00021 #include <geos/geom/Geometry.h>
00022 #include <geos/geom/CoordinateSequence.h> // for proper use of auto_ptr<>
00023 #include <geos/geom/Envelope.h> // for proper use of auto_ptr<>
00024 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
00025 
00026 #include <geos/inline.h>
00027 
00028 #include <string>
00029 #include <vector>
00030 #include <memory> // for auto_ptr
00031 
00032 // Forward declarations
00033 namespace geos {
00034         namespace geom { // geos::geom
00035                 class Coordinate;
00036                 class CoordinateArraySequence;
00037                 class CoordinateFilter;
00038                 class GeometryComponentFilter;
00039                 class GeometryFilter;
00040         }
00041 }
00042 
00043 namespace geos {
00044 namespace geom { // geos::geom
00045 
00050 class Point : public Geometry {
00051 
00052 public:
00053 
00054         friend class GeometryFactory;
00055 
00057         typedef std::vector<const Point *> ConstVect;
00058 
00059         virtual ~Point();
00060 
00061         Geometry *clone() const { return new Point(*this); }
00062 
00063         CoordinateSequence* getCoordinates(void) const;
00064 
00065         const CoordinateSequence* getCoordinatesRO() const;
00066 
00067         size_t getNumPoints() const;
00068         bool isEmpty() const;
00069         bool isSimple() const;
00070         //bool isValid() const;
00071 
00073         Dimension::DimensionType getDimension() const;
00074 
00076         int getBoundaryDimension() const;
00077 
00079         Geometry* getBoundary() const;
00080 
00081         double getX() const;
00082         double getY() const;
00083         const Coordinate* getCoordinate() const;
00084         std::string getGeometryType() const;
00085         virtual GeometryTypeId getGeometryTypeId() const;
00086         void apply_ro(CoordinateFilter *filter) const;
00087         void apply_rw(const CoordinateFilter *filter);
00088         void apply_ro(GeometryFilter *filter) const;
00089         void apply_rw(GeometryFilter *filter);
00090         void apply_rw(GeometryComponentFilter *filter);
00091         void apply_ro(GeometryComponentFilter *filter) const;
00092 
00093         bool equalsExact(const Geometry *other, double tolerance=0) const;
00094         void normalize(void) { };
00095 
00096 protected:
00097 
00110         Point(CoordinateSequence *newCoords, const GeometryFactory *newFactory);
00111 
00112         Point(const Point &p); 
00113 
00114         Envelope::AutoPtr computeEnvelopeInternal() const;
00115 
00116         int compareToSameClass(const Geometry *p) const;
00117 
00118 private:
00119 
00123         std::auto_ptr<CoordinateSequence> coordinates;
00124 };
00125 
00126 } // namespace geos::geom
00127 } // namespace geos
00128 
00129 //#ifdef GEOS_INLINE
00130 //# include "geos/geom/Point.inl"
00131 //#endif
00132 
00133 #endif // ndef GEOS_GEOS_POINT_H
00134 
00135 /**********************************************************************
00136  * $Log$
00137  * Revision 1.6  2006/05/04 15:49:39  strk
00138  * updated all Geometry::getDimension() methods to return Dimension::DimensionType (closes bug#93)
00139  *
00140  * Revision 1.5  2006/04/28 10:55:39  strk
00141  * Geometry constructors made protected, to ensure all constructions use GeometryFactory,
00142  * which has been made friend of all Geometry derivates. getNumPoints() changed to return
00143  * size_t.
00144  *
00145  * Revision 1.4  2006/04/10 18:15:09  strk
00146  * Changed Geometry::envelope member to be of type auto_ptr<Envelope>.
00147  * Changed computeEnvelopeInternal() signater to return auto_ptr<Envelope>
00148  *
00149  * Revision 1.3  2006/04/10 17:35:44  strk
00150  * Changed LineString::points and Point::coordinates to be wrapped
00151  * in an auto_ptr<>. This should close bugs #86 and #89
00152  *
00153  * Revision 1.2  2006/03/24 09:52:41  strk
00154  * USE_INLINE => GEOS_INLINE
00155  *
00156  * Revision 1.1  2006/03/09 16:46:49  strk
00157  * geos::geom namespace definition, first pass at headers split
00158  *
00159  **********************************************************************/

Generated on Fri Mar 27 04:52:56 2009 for GEOS by  doxygen 1.5.4