mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Added missing QgsGeometry::contains predicate.
Contributed by Jeremy Palmer (#2560). git-svn-id: http://svn.osgeo.org/qgis/trunk@13065 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
74141c9288
commit
24b1c0b14e
@ -238,6 +238,10 @@ not disjoint with existing polygons of the feature*/
|
||||
|
||||
/** Test for containment of a point (uses GEOS) */
|
||||
bool contains(QgsPoint* p);
|
||||
|
||||
/** Test for containment with a geometry (uses GEOS)
|
||||
* @note added in 1.5 */
|
||||
bool contains( QgsGeometry* geometry );
|
||||
|
||||
/** Returns a buffer region around this geometry having the given width and with a specified number
|
||||
of segments used to approximate curves */
|
||||
|
@ -3751,6 +3751,23 @@ bool QgsGeometry::contains( QgsPoint* p )
|
||||
return returnval;
|
||||
}
|
||||
|
||||
bool QgsGeometry::contains( QgsGeometry* geometry )
|
||||
{
|
||||
try // geos might throw exception on error
|
||||
{
|
||||
// ensure that both geometries have geos geometry
|
||||
exportWkbToGeos();
|
||||
geometry->exportWkbToGeos();
|
||||
|
||||
if ( !mGeos || !geometry->mGeos )
|
||||
{
|
||||
QgsDebugMsg( "GEOS geometry not available!" );
|
||||
return false;
|
||||
}
|
||||
return GEOSContains( mGeos, geometry->mGeos );
|
||||
}
|
||||
CATCH_GEOS( false )
|
||||
}
|
||||
|
||||
QString QgsGeometry::exportToWkt()
|
||||
{
|
||||
|
@ -276,12 +276,16 @@ class CORE_EXPORT QgsGeometry
|
||||
|
||||
/** Test for intersection with a rectangle (uses GEOS) */
|
||||
bool intersects( const QgsRectangle& r );
|
||||
/** Test for intersection with a geoemetry (uses GEOS) */
|
||||
/** Test for intersection with a geometry (uses GEOS) */
|
||||
bool intersects( QgsGeometry* geometry );
|
||||
|
||||
/** Test for containment of a point (uses GEOS) */
|
||||
bool contains( QgsPoint* p );
|
||||
|
||||
/** Test for containment with a geometry (uses GEOS)
|
||||
* @note added in 1.5 */
|
||||
bool contains( QgsGeometry* geometry );
|
||||
|
||||
/** Returns a buffer region around this geometry having the given width and with a specified number
|
||||
of segments used to approximate curves */
|
||||
QgsGeometry* buffer( double distance, int segments );
|
||||
|
Loading…
x
Reference in New Issue
Block a user