21 #ifndef GEOS_GEOM_GEOMETRY_H
22 #define GEOS_GEOM_GEOMETRY_H
24 #include <geos/export.h>
25 #include <geos/platform.h>
26 #include <geos/inline.h>
27 #include <geos/geom/Envelope.h>
28 #include <geos/geom/Dimension.h>
29 #include <geos/geom/GeometryComponentFilter.h>
38 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
39 #pragma warning(disable: 4355) // warning C4355: 'this' : used in base member initializer list
46 class CoordinateFilter;
47 class CoordinateSequence;
48 class CoordinateSequenceFilter;
49 class GeometryComponentFilter;
50 class GeometryFactory;
52 class IntersectionMatrix;
236 virtual int getSRID()
const {
return SRID; }
242 virtual void setSRID(
int newSRID) { SRID=newSRID; }
248 const PrecisionModel* getPrecisionModel()
const;
254 virtual const Coordinate* getCoordinate()
const=0;
261 virtual CoordinateSequence* getCoordinates()
const=0;
264 virtual std::size_t getNumPoints()
const=0;
267 virtual bool isSimple()
const;
270 virtual std::string getGeometryType()
const=0;
292 virtual bool isValid()
const;
295 virtual bool isEmpty()
const=0;
304 virtual int getCoordinateDimension()
const=0;
322 virtual Geometry* getBoundary()
const=0;
325 virtual int getBoundaryDimension()
const=0;
328 virtual Geometry* getEnvelope()
const;
334 virtual const Envelope* getEnvelopeInternal()
const;
352 virtual bool disjoint(
const Geometry *other)
const;
358 virtual bool touches(
const Geometry *other)
const;
361 virtual bool intersects(
const Geometry *g)
const;
385 virtual bool crosses(
const Geometry *g)
const;
391 virtual bool within(
const Geometry *g)
const;
394 virtual bool contains(
const Geometry *g)
const;
401 virtual bool overlaps(
const Geometry *g)
const;
417 virtual bool relate(
const Geometry *g,
418 const std::string& intersectionPattern)
const;
420 bool relate(
const Geometry& g,
const std::string& intersectionPattern)
const
422 return relate(&g, intersectionPattern);
426 virtual IntersectionMatrix* relate(
const Geometry *g)
const;
427 IntersectionMatrix* relate(
const Geometry &g)
const {
436 virtual bool equals(
const Geometry *g)
const;
476 bool covers(
const Geometry* g)
const;
514 virtual std::string toString()
const;
516 virtual std::string toText()
const;
522 virtual Geometry* buffer(
double distance)
const;
531 virtual Geometry* buffer(
double distance,
int quadrantSegments)
const;
569 virtual Geometry* buffer(
double distance,
int quadrantSegments,
570 int endCapStyle)
const;
575 virtual Geometry* convexHull()
const;
617 AutoPtr Union()
const;
647 virtual bool equalsExact(
const Geometry *other,
double tolerance=0)
687 for(std::size_t i=0, n=getNumGeometries(); i<n; ++i)
688 f.filter(getGeometryN(i));
692 virtual void normalize()=0;
694 virtual int compareTo(
const Geometry *geom)
const;
700 virtual double distance(
const Geometry *g)
const;
703 virtual double getArea()
const;
706 virtual double getLength()
const;
719 virtual bool isWithinDistance(
const Geometry *geom,
720 double cDistance)
const;
731 virtual Point* getCentroid()
const;
737 virtual bool getCentroid(
Coordinate& ret)
const;
749 virtual Point* getInteriorPoint()
const;
756 virtual void geometryChanged();
763 void geometryChangedAction();
771 static bool hasNonEmptyElements(
const std::vector<Geometry *>* geometries);
777 static bool hasNullElements(
const std::vector<Geometry *>* lrs);
788 virtual bool isEquivalentClass(
const Geometry *other)
const;
790 static void checkNotGeometryCollection(
const Geometry *g);
797 virtual Envelope::AutoPtr computeEnvelopeInternal()
const=0;
799 virtual int compareToSameClass(
const Geometry *geom)
const=0;
801 int compare(std::vector<Coordinate> a, std::vector<Coordinate> b)
const;
803 int compare(std::vector<Geometry *> a, std::vector<Geometry *> b)
const;
806 double tolerance)
const;
833 int getClassSortIndex()
const;
844 static GeometryChangedFilter geometryChangedFilter;
850 const GeometryFactory *factory;
859 GEOS_DLL std::ostream&
operator<< (std::ostream& os,
const Geometry& geom);
861 struct GEOS_DLL GeometryGreaterThen {
862 bool operator()(
const Geometry *first,
const Geometry *second);
880 typedef std::auto_ptr<Geometry> GeomPtr;
892 #endif // ndef GEOS_GEOM_GEOMETRY_H
Geometry classes support the concept of applying a Geometry filter to the Geometry.
Definition: GeometryFilter.h:48
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:53
a linestring
Definition: Geometry.h:69
a collection of heterogeneus geometries
Definition: Geometry.h:81
a collection of linestrings
Definition: Geometry.h:77
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
virtual const Geometry * getGeometryN(std::size_t) const
Definition: Geometry.h:281
void * getUserData()
Gets the user data object for this geometry, if any.
Definition: Geometry.h:219
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:298
Definition: CoordinateSequenceFilter.h:58
virtual std::size_t getNumGeometries() const
Definition: Geometry.h:277
std::string geosversion()
Return current GEOS version.
GeometryTypeId
Geometry types.
Definition: Geometry.h:65
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:167
Definition: CoordinateFilter.h:43
a collection of points
Definition: Geometry.h:75
std::auto_ptr< Envelope > envelope
The bounding box of this Geometry.
Definition: Geometry.h:768
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:211
std::auto_ptr< Geometry > AutoPtr
An auto_ptr of Geometry.
Definition: Geometry.h:180
const GeometryFactory * getFactory() const
Gets the factory which contains the context in which this geometry was created.
Definition: Geometry.h:196
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
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:177
a polygon
Definition: Geometry.h:73
a linear ring (linestring with 1st point == last point)
Definition: Geometry.h:71
a point
Definition: Geometry.h:67
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
a collection of polygons
Definition: Geometry.h:79
void applyComponentFilter(T &f) const
Apply a fiter to each component of this geometry. The filter is expected to provide a ...
Definition: Geometry.h:685
std::vector< const Geometry * > ConstVect
A vector of const Geometry pointers.
Definition: Geometry.h:174
DimensionType
Definition: Dimension.h:31
bool coveredBy(const Geometry *g) const
Tests whether this geometry is covered by the specified geometry.
Definition: Geometry.h:508
Definition: GeometryComponentFilter.h:43