📄 geometry.h
字号:
* As an added benefit, <code>covers</code> is more amenable to * optimization, and hence should be more performant. * * @param g * the <code>Geometry</code> with which to compare this * <code>Geometry</code> * * @return <code>true</code> if this <code>Geometry</code> * covers <code>g</code> * * @see Geometry::contains * @see Geometry::coveredBy */ bool covers(const Geometry* g) const; /** \brief * Returns <code>true</code> if this geometry is covered by the * specified geometry. * * - Every point of this geometry is a point of the other geometry. * - The DE-9IM Intersection Matrix for the two geometries is * <code>T*F**F***</code> * or <code>*TF**F***</code> * or <code>**FT*F***</code> * or <code>**F*TF***</code> * - <code>g.covers(this)</code> * (<code>coveredBy</code> is the inverse of <code>covers</code>) * * Note the difference between <code>coveredBy</code> and * <code>within</code> * - <code>coveredBy</code> is a more inclusive relation. * * @param g * the <code>Geometry</code> with which to compare this * <code>Geometry</code> * @return <code>true</code> if this <code>Geometry</code> is * covered by <code>g</code> * * @see Geometry::within * @see Geometry::covers */ bool coveredBy(const Geometry* g) const { return g->covers(this); } /// Returns the Well-known Text representation of this Geometry. virtual std::string toString() const; virtual std::string toText() const; /// Returns a buffer region around this Geometry having the given width. // /// @throws util::TopologyException if a robustness error occurs /// virtual Geometry* buffer(double distance) const; /// \brief /// Returns a buffer region around this Geometry having the /// given width and with a specified number of segments used /// to approximate curves. // /// @throws util::TopologyException if a robustness error occurs /// virtual Geometry* buffer(double distance,int quadrantSegments) const; /** \brief * Computes a buffer area around this geometry having the given * width and with a specified accuracy of approximation for circular * arcs, and using a specified end cap style. * * Buffer area boundaries can contain circular arcs. * To represent these arcs using linear geometry they must be * approximated with line segments. * * The <code>quadrantSegments</code> argument allows controlling the * accuracy of the approximation by specifying the number of line * segments used to represent a quadrant of a circle * * The end cap style specifies the buffer geometry that will be * created at the ends of linestrings. The styles provided are: * * - BufferOp::CAP_ROUND - (default) a semi-circle * - BufferOp::CAP_BUTT - a straight line perpendicular to the * end segment * - BufferOp::CAP_SQUARE - a half-square * * * @param distance the width of the buffer * (may be positive, negative or 0) * * @param quadrantSegments the number of line segments used * to represent a quadrant of a circle * * @param endCapStyle the end cap style to use * * @return an area geometry representing the buffer region * * @throws util::TopologyException if a robustness error occurs * * @see BufferOp */ virtual Geometry* buffer(double distance, int quadrantSegments, int endCapStyle) const; /// \brief /// Returns the smallest convex Polygon that contains /// all the points in the Geometry. virtual Geometry* convexHull() const; /** \brief * Returns a Geometry representing the points shared by * this Geometry and other. * * @throws util::TopologyException if a robustness error occurs * @throws util::IllegalArgumentException if either arg is a collection * */ virtual Geometry* intersection(const Geometry *other) const; /** \brief * Returns a Geometry representing all the points in this Geometry * and other. * * @throws util::TopologyException if a robustness error occurs * @throws util::IllegalArgumentException if either arg is a collection * */ virtual Geometry* Union(const Geometry *other) const; // throw(IllegalArgumentException *, TopologyException *); /** * \brief * Returns a Geometry representing the points making up this * Geometry that do not make up other. * * @throws util::TopologyException if a robustness error occurs * @throws util::IllegalArgumentException if either arg is a collection * */ virtual Geometry* difference(const Geometry *other) const; /** \brief * Returns a set combining the points in this Geometry not in other, * and the points in other not in this Geometry. * * @throws util::TopologyException if a robustness error occurs * @throws util::IllegalArgumentException if either arg is a collection * */ virtual Geometry* symDifference(const Geometry *other) const; /** \brief * Returns true if the two Geometrys are exactly equal, * up to a specified tolerance. */ virtual bool equalsExact(const Geometry *other, double tolerance=0) const=0; //Abstract virtual void apply_rw(const CoordinateFilter *filter)=0; //Abstract virtual void apply_ro(CoordinateFilter *filter) const=0; //Abstract virtual void apply_rw(GeometryFilter *filter); virtual void apply_ro(GeometryFilter *filter) const; virtual void apply_rw(GeometryComponentFilter *filter); virtual void apply_ro(GeometryComponentFilter *filter) const; /** \brief * Apply a fiter to each component of this geometry. * The filter is expected to provide a .filter(const Geometry*) * method. * * I intend similar templated methods to replace * all the virtual apply_rw and apply_ro functions... * --strk(2005-02-06); */ template <class T> void applyComponentFilter(T& f) const { for(size_t i=0, n=getNumGeometries(); i<n; ++i) f.filter(getGeometryN(i)); } /// Converts this Geometry to normal form (or canonical form). virtual void normalize()=0; //Abstract virtual int compareTo(const Geometry *geom) const; /** \brief * Returns the minimum distance between this Geometry * and the Geometry g */ virtual double distance(const Geometry *g) const; /// Returns the area of this Geometry. virtual double getArea() const; /// Returns the length of this Geometry. virtual double getLength() const; /** \brief * Tests whether the distance from this Geometry to another * is less than or equal to a specified value. */ virtual bool isWithinDistance(const Geometry *geom,double cDistance); /** \brief * Computes the centroid of this <code>Geometry</code>. * * The centroid is equal to the centroid of the set of component * Geometrys of highest dimension (since the lower-dimension geometries * contribute zero "weight" to the centroid) * * @return a {@link Point} which is the centroid of this Geometry */ virtual Point* getCentroid() const; /// Computes the centroid of this Geometry as a Coordinate // /// Returns false if centroid cannot be computed (EMPTY geometry) /// virtual bool getCentroid(Coordinate& ret) const; /** \brief * Computes an interior point of this <code>Geometry</code>. * * An interior point is guaranteed to lie in the interior of the Geometry, * if it possible to calculate such a point exactly. Otherwise, * the point may lie on the boundary of the geometry. * * @return a Point which is in the interior of this Geometry, or * null if the geometry doesn't have an interior (empty) */ virtual Point* getInteriorPoint() const; /* * \brief * Notifies this Geometry that its Coordinates have been changed * by an external party (using a CoordinateFilter, for example). */ virtual void geometryChanged(); /** * \brief * Notifies this Geometry that its Coordinates have been changed * by an external party. */ void geometryChangedAction();protected: mutable std::auto_ptr<Envelope> envelope; /// Returns true if the array contains any non-empty Geometrys. static bool hasNonEmptyElements(const std::vector<Geometry *>* geometries); /// Returns true if the CoordinateSequence contains any null elements. static bool hasNullElements(const CoordinateSequence* list); /// Returns true if the vector contains any null elements. static bool hasNullElements(const std::vector<Geometry *>* lrs);// static void reversePointOrder(CoordinateSequence* coordinates);// static Coordinate& minCoordinate(CoordinateSequence* coordinates);// static void scroll(CoordinateSequence* coordinates,Coordinate* firstCoordinate);// static int indexOf(Coordinate* coordinate,CoordinateSequence* coordinates);// /** \brief * Returns whether the two Geometrys are equal, from the point * of view of the equalsExact method. */ virtual bool isEquivalentClass(const Geometry *other) const; static void checkNotGeometryCollection(const Geometry *g); // throw(IllegalArgumentException *); //virtual void checkEqualSRID(Geometry *other); //virtual void checkEqualPrecisionModel(Geometry *other); virtual Envelope::AutoPtr computeEnvelopeInternal() const=0; //Abstract virtual int compareToSameClass(const Geometry *geom) const=0; //Abstract int compare(std::vector<Coordinate> a, std::vector<Coordinate> b) const; int compare(std::vector<Geometry *> a, std::vector<Geometry *> b) const; bool equal(const Coordinate& a, const Coordinate& b, double tolerance) const; int SRID; /// @deprecated //Geometry* toInternalGeometry(const Geometry *g) const; /// @deprecated //Geometry* fromInternalGeometry(const Geometry *g) const; /// Polygon overrides to check for actual rectangle virtual bool isRectangle() const { return false; } Geometry(const Geometry &geom); /** \brief * Construct a geometry with the given GeometryFactory. * Will keep a reference to the factory, so don't * delete it until al Geometry objects referring to * it are deleted. */ Geometry(const GeometryFactory *factory);private: int getClassSortIndex() const; static GeometryComponentFilter geometryChangedFilter; const GeometryFactory *factory; static const GeometryFactory* INTERNAL_GEOMETRY_FACTORY; void* userData;};/// \brief/// Write the Well-known Binary representation of this Geometry/// as an HEX string to the given output stream///std::ostream& operator<< (std::ostream& os, const Geometry& geom);struct GeometryGreaterThen { bool operator()(const Geometry *first, const Geometry *second);};/// Return current GEOS versionstd::string geosversion();/** * \brief * Return the version of JTS this GEOS * release has been ported from. */std::string jtsport();} // namespace geos::geom} // namespace geos#ifdef GEOS_INLINE# include <geos/geom/Geometry.inl>#endif#endif // ndef GEOS_GEOM_GEOMETRY_H/********************************************************************** * $Log$ * Revision 1.14 2006/07/08 00:33:55 strk * * configure.in: incremented CAPI minor version, to avoid falling behind any future version from the 2.2. branch. * * source/geom/Geometry.cpp, source/geom/GeometryFactory.cpp, * source/geomgraph/EdgeRing.cpp, * source/headers/geos/geom/Geometry.h, * source/headers/geos/geom/GeometryFactory.h, * source/headers/geos/geom/GeometryFactory.inl, * source/headers/geos/geomgraph/EdgeRing.h: * updated doxygen comments (sync with JTS head). * * source/headers/geos/platform.h.in: include <inttypes.h> * rather then <stdint.h> * * Revision 1.13 2006/06/12 10:10:39 strk * Fixed getGeometryN() to take size_t rather then int, changed unsigned int parameters to size_t. * * Revision 1.12 2006/05/18 08:56:50 strk * * source/geom/Geometry.cpp, * source/headers/geos/geom/Geometry.h: added * covers() and isCoveredBy() predicates. * * tests/unit/Makefile.am, * tests/unit/geom/Geometry/coversTest.cpp: * added test for covers() predicates. * * Revision 1.11 2006/05/04 15:49:39 strk * updated all Geometry::getDimension() methods to return Dimension::DimensionType (closes bug#93) * * Revision 1.10 2006/04/28 10:55:39 strk * Geometry constructors made protected, to ensure all constructions use GeometryFactory, * which has been made friend of all Geometry derivates. getNumPoints() changed to return * size_t. * * Revision 1.9 2006/04/11 09:31:47 strk * Added Geometry::AutoPtr typedef * * Revision 1.8 2006/04/10 18:15:09 strk * Changed Geometry::envelope member to be of type auto_ptr<Envelope>. * Changed computeEnvelopeInternal() signater to return auto_ptr<Envelope> * * Revision 1.7 2006/04/07 09:54:30 strk * Geometry::getNumGeometries() changed to return 'unsigned int' * rather then 'int' * * Revision 1.6 2006/03/31 16:53:53 strk * Added comment about possible NULL return from getCoordinate() * * Revision 1.5 2006/03/24 09:52:41 strk * USE_INLINE => GEOS_INLINE * * Revision 1.4 2006/03/23 15:10:29 strk * Dropped by-pointer TopologyException constructor, various small cleanups * * Revision 1.3 2006/03/23 12:12:01 strk * Fixes to allow build with -DGEOS_INLINE * * Revision 1.2 2006/03/20 12:03:25 strk * Added operator<< for Geometry, writing HEXWKB * * Revision 1.1 2006/03/09 16:46:49 strk * geos::geom namespace definition, first pass at headers split * **********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -