[geos-commits] r2054 - trunk/source/headers/geos/geom

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Dec 21 15:03:37 EST 2007


Author: benjubb
Date: 2007-12-21 15:03:37 -0500 (Fri, 21 Dec 2007)
New Revision: 2054

Modified:
   trunk/source/headers/geos/geom/Envelope.inl
Log:
Added a covers() predicate, from JTS 1.9, to support prepared geometry

Modified: trunk/source/headers/geos/geom/Envelope.inl
===================================================================
--- trunk/source/headers/geos/geom/Envelope.inl	2007-12-21 20:00:22 UTC (rev 2053)
+++ trunk/source/headers/geos/geom/Envelope.inl	2007-12-21 20:03:37 UTC (rev 2054)
@@ -80,6 +80,46 @@
 	return (x <= maxx && x >= minx && y <= maxy && y >= miny);
 }
 
+
+/*public*/
+INLINE bool 
+Envelope::covers(double x, double y) const
+{
+	if (isNull()) return false;
+	return x >= minx &&
+		x <= maxx &&
+		y >= miny &&
+		y <= maxy;
+}
+
+/*public*/
+INLINE bool 
+Envelope::covers( const Coordinate *p) const
+{
+	return covers(p->x, p->y);
+}
+
+/*public*/
+INLINE bool 
+Envelope::covers( const Envelope *other) const
+{
+	if (isNull() || other->isNull()) return false;
+
+	return 
+		other->getMinX() >= minx &&
+		other->getMaxX() <= maxx &&
+		other->getMinY() >= miny &&
+		other->getMaxY() <= maxy;
+}
+
+/*public*/
+INLINE bool 
+Envelope::covers( const Envelope &other) const 
+{ 
+	return covers( &other); 
+}
+
+
 } // namespace geos::geom
 } // namespace geos
 



More information about the geos-commits mailing list