[geos-commits] r2569 - in trunk/source:
headers/geos/operation/predicate operation/predicate
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Jun 8 13:12:04 EDT 2009
Author: strk
Date: 2009-06-08 13:12:04 -0400 (Mon, 08 Jun 2009)
New Revision: 2569
Modified:
trunk/source/headers/geos/operation/predicate/RectangleContains.h
trunk/source/operation/predicate/RectangleContains.cpp
Log:
Sync RectangleContains to JTS-1.10
Modified: trunk/source/headers/geos/operation/predicate/RectangleContains.h
===================================================================
--- trunk/source/headers/geos/operation/predicate/RectangleContains.h 2009-06-08 17:02:33 UTC (rev 2568)
+++ trunk/source/headers/geos/operation/predicate/RectangleContains.h 2009-06-08 17:12:04 UTC (rev 2569)
@@ -13,7 +13,7 @@
*
**********************************************************************
*
- * Last port: operation/predicate/RectangleContains.java rev 1.1 (JTS-1.7)
+ * Last port: operation/predicate/RectangleContains.java rev 1.5 (JTS-1.10)
*
**********************************************************************/
@@ -57,9 +57,35 @@
const geom::Envelope& rectEnv;
bool isContainedInBoundary(const geom::Geometry& geom);
+
bool isPointContainedInBoundary(const geom::Point& geom);
- bool isPointContainedInBoundary(const geom::Coordinate &coord);
+
+ /** \brief
+ * Tests if a point is contained in the boundary of the target
+ * rectangle.
+ *
+ * @param pt the point to test
+ * @return true if the point is contained in the boundary
+ */
+ bool isPointContainedInBoundary(const geom::Coordinate &pt);
+
+ /** \brief
+ * Tests if a linestring is completely contained in the boundary
+ * of the target rectangle.
+ *
+ * @param line the linestring to test
+ * @return true if the linestring is contained in the boundary
+ */
bool isLineStringContainedInBoundary(const geom::LineString &line);
+
+ /** \brief
+ * Tests if a line segment is contained in the boundary of the
+ * target rectangle.
+ *
+ * @param p0 an endpoint of the segment
+ * @param p1 an endpoint of the segment
+ * @return true if the line segment is contained in the boundary
+ */
bool isLineSegmentContainedInBoundary(const geom::Coordinate& p0,
const geom::Coordinate& p1);
Modified: trunk/source/operation/predicate/RectangleContains.cpp
===================================================================
--- trunk/source/operation/predicate/RectangleContains.cpp 2009-06-08 17:02:33 UTC (rev 2568)
+++ trunk/source/operation/predicate/RectangleContains.cpp 2009-06-08 17:12:04 UTC (rev 2569)
@@ -13,7 +13,7 @@
*
**********************************************************************
*
- * Last port: operation/predicate/RectangleContains.java rev 1.1 (JTS-1.7)
+ * Last port: operation/predicate/RectangleContains.java rev 1.5 (JTS-1.10)
*
**********************************************************************/
@@ -77,13 +77,16 @@
bool
RectangleContains::isPointContainedInBoundary(const Coordinate& pt)
{
- // we already know that the point is contained in the
- // rectangle envelope
- return
- pt.x == rectEnv.getMinX() || pt.x == rectEnv.getMaxX() ||
- pt.y == rectEnv.getMinY() || pt.y == rectEnv.getMaxY();
-
- return true;
+ /**
+ * contains = false iff the point is properly contained
+ * in the rectangle.
+ *
+ * This code assumes that the point lies in the rectangle envelope
+ */
+ return pt.x == rectEnv.getMinX()
+ || pt.x == rectEnv.getMaxX()
+ || pt.y == rectEnv.getMinY()
+ || pt.y == rectEnv.getMaxY();
}
/*private*/
More information about the geos-commits
mailing list