22 #ifndef GEOS_GEOM_GEOMETRY_H
23 #define GEOS_GEOM_GEOMETRY_H
25 #include <geos/export.h>
26 #include <geos/platform.h>
27 #include <geos/inline.h>
28 #include <geos/geom/Envelope.h>
29 #include <geos/geom/Dimension.h>
30 #include <geos/geom/GeometryComponentFilter.h>
39 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
40 #pragma warning(disable: 4355) // warning C4355: 'this' : used in base member initializer list
47 class CoordinateFilter;
48 class CoordinateSequence;
49 class CoordinateSequenceFilter;
50 class GeometryComponentFilter;
51 class GeometryFactory;
53 class IntersectionMatrix;
237 virtual int getSRID()
const {
return SRID; }
243 virtual void setSRID(
int newSRID) { SRID=newSRID; }
249 const PrecisionModel* getPrecisionModel()
const;
255 virtual const Coordinate* getCoordinate()
const=0;
262 virtual CoordinateSequence* getCoordinates()
const=0;
265 virtual std::size_t getNumPoints()
const=0;
268 virtual bool isSimple()
const;
271 virtual std::string getGeometryType()
const=0;
293 virtual bool isValid()
const;
296 virtual bool isEmpty()
const=0;
305 virtual int getCoordinateDimension()
const=0;
323 virtual Geometry* getBoundary()
const=0;
326 virtual int getBoundaryDimension()
const=0;
329 virtual Geometry* getEnvelope()
const;
335 virtual const Envelope* getEnvelopeInternal()
const;
353 virtual bool disjoint(
const Geometry *other)
const;
359 virtual bool touches(
const Geometry *other)
const;
362 virtual bool intersects(
const Geometry *g)
const;
386 virtual bool crosses(
const Geometry *g)
const;
392 virtual bool within(
const Geometry *g)
const;
395 virtual bool contains(
const Geometry *g)
const;
402 virtual bool overlaps(
const Geometry *g)
const;
418 virtual bool relate(
const Geometry *g,
419 const std::string& intersectionPattern)
const;
421 bool relate(
const Geometry& g,
const std::string& intersectionPattern)
const
423 return relate(&g, intersectionPattern);
427 virtual IntersectionMatrix* relate(
const Geometry *g)
const;
428 IntersectionMatrix* relate(
const Geometry &g)
const {
437 virtual bool equals(
const Geometry *g)
const;
477 bool covers(
const Geometry* g)
const;
515 virtual std::string toString()
const;
517 virtual std::string toText()
const;
523 virtual Geometry* buffer(
double distance)
const;
532 virtual Geometry* buffer(
double distance,
int quadrantSegments)
const;
570 virtual Geometry* buffer(
double distance,
int quadrantSegments,
571 int endCapStyle)
const;
576 virtual Geometry* convexHull()
const;
618 AutoPtr Union()
const;
648 virtual bool equalsExact(
const Geometry *other,
double tolerance=0)
688 for(std::size_t i=0, n=getNumGeometries(); i<n; ++i)
689 f.filter(getGeometryN(i));
693 virtual void normalize()=0;
695 virtual int compareTo(
const Geometry *geom)
const;
701 virtual double distance(
const Geometry *g)
const;
704 virtual double getArea()
const;
707 virtual double getLength()
const;
720 virtual bool isWithinDistance(
const Geometry *geom,
721 double cDistance)
const;
732 virtual Point* getCentroid()
const;
738 virtual bool getCentroid(
Coordinate& ret)
const;
750 virtual Point* getInteriorPoint()
const;
757 virtual void geometryChanged();
764 void geometryChangedAction();
772 static bool hasNonEmptyElements(
const std::vector<Geometry *>* geometries);
778 static bool hasNullElements(
const std::vector<Geometry *>* lrs);
789 virtual bool isEquivalentClass(
const Geometry *other)
const;
791 static void checkNotGeometryCollection(
const Geometry *g);
798 virtual Envelope::AutoPtr computeEnvelopeInternal()
const=0;
800 virtual int compareToSameClass(
const Geometry *geom)
const=0;
802 int compare(std::vector<Coordinate> a, std::vector<Coordinate> b)
const;
804 int compare(std::vector<Geometry *> a, std::vector<Geometry *> b)
const;
807 double tolerance)
const;
834 int getClassSortIndex()
const;
845 static GeometryChangedFilter geometryChangedFilter;
851 const GeometryFactory *factory;
853 static const GeometryFactory* INTERNAL_GEOMETRY_FACTORY;
862 GEOS_DLL std::ostream&
operator<< (std::ostream& os,
const Geometry& geom);
864 struct GEOS_DLL GeometryGreaterThen {
865 bool operator()(
const Geometry *first,
const Geometry *second);
883 typedef std::auto_ptr<Geometry> GeomPtr;
895 #endif // ndef GEOS_GEOM_GEOMETRY_H
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition: GeometryFilter.h:49
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:54
a linestring
Definition: Geometry.h:70
a collection of heterogeneus geometries
Definition: Geometry.h:82
a collection of linestrings
Definition: Geometry.h:78
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:61
virtual const Geometry * getGeometryN(std::size_t) const
Definition: Geometry.h:282
void * getUserData()
Gets the user data object for this geometry, if any.
Definition: Geometry.h:220
GEOS_DLL std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
virtual bool isRectangle() const
Polygon overrides to check for actual rectangle.
Definition: Geometry.h:299
Definition: CoordinateSequenceFilter.h:59
virtual std::size_t getNumGeometries() const
Definition: Geometry.h:278
std::string geosversion()
Return current GEOS version.
GeometryTypeId
Geometry types.
Definition: Geometry.h:66
bool covers(const Geometry *g) const
Returns true if this geometry covers the specified geometry.
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:168
Definition: CoordinateFilter.h:44
a collection of points
Definition: Geometry.h:76
std::auto_ptr< Envelope > envelope
The bounding box of this Geometry.
Definition: Geometry.h:769
std::string jtsport()
Return the version of JTS this GEOS release has been ported from.
void setUserData(void *newUserData)
A simple scheme for applications to add their own custom data to a Geometry. An example use might be ...
Definition: Geometry.h:212
std::auto_ptr< Geometry > AutoPtr
An auto_ptr of Geometry.
Definition: Geometry.h:181
const GeometryFactory * getFactory() const
Gets the factory which contains the context in which this geometry was created.
Definition: Geometry.h:197
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
void geometryChangedAction()
Notifies this Geometry that its Coordinates have been changed by an external party.
std::vector< Geometry * > NonConstVect
A vector of non-const Geometry pointers.
Definition: Geometry.h:178
a polygon
Definition: Geometry.h:74
a linear ring (linestring with 1st point == last point)
Definition: Geometry.h:72
a point
Definition: Geometry.h:68
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:60
a collection of polygons
Definition: Geometry.h:80
void applyComponentFilter(T &f) const
Apply a fiter to each component of this geometry. The filter is expected to provide a ...
Definition: Geometry.h:686
std::vector< const Geometry * > ConstVect
A vector of const Geometry pointers.
Definition: Geometry.h:175
DimensionType
Definition: Dimension.h:32
bool coveredBy(const Geometry *g) const
Tests whether this geometry is covered by the specified geometry.
Definition: Geometry.h:509
Definition: GeometryComponentFilter.h:44