geometry_contains.diff

Jeremy Palmer, 2010-03-16 04:50 PM

Download (2.25 KB)

View differences:

python/core/qgsgeometry.sip (working copy)
238 238

  
239 239
    /** Test for containment of a point (uses GEOS) */
240 240
    bool contains(QgsPoint* p);
241
    
242
    /** Test for containment with a geometry (uses GEOS)
243
    *  @note added in 1.5 */
244
    bool contains( QgsGeometry* geometry );
241 245

  
242 246
    /** Returns a buffer region around this geometry having the given width and with a specified number
243 247
        of segments used to approximate curves */
src/core/qgsgeometry.cpp (working copy)
3751 3751
  return returnval;
3752 3752
}
3753 3753

  
3754
bool QgsGeometry::contains( QgsGeometry* geometry )
3755
{
3756
  try // geos might throw exception on error
3757
  {
3758
    // ensure that both geometries have geos geometry
3759
    exportWkbToGeos();
3760
    geometry->exportWkbToGeos();
3754 3761

  
3762
    if ( !mGeos || !geometry->mGeos )
3763
    {
3764
      QgsDebugMsg( "GEOS geometry not available!" );
3765
      return false;
3766
    }
3767
    return GEOSContains( mGeos, geometry->mGeos );
3768
  }
3769
  CATCH_GEOS( false )
3770
}
3771

  
3755 3772
QString QgsGeometry::exportToWkt()
3756 3773
{
3757 3774
  QgsDebugMsg( "entered." );
src/core/qgsgeometry.h (working copy)
276 276

  
277 277
    /** Test for intersection with a rectangle (uses GEOS) */
278 278
    bool intersects( const QgsRectangle& r );
279
    /** Test for intersection with a geoemetry (uses GEOS) */
279
    /** Test for intersection with a geometry (uses GEOS) */
280 280
    bool intersects( QgsGeometry* geometry );
281 281

  
282 282
    /** Test for containment of a point (uses GEOS) */
283 283
    bool contains( QgsPoint* p );
284 284

  
285
    /** Test for containment with a geometry (uses GEOS)
286
     *  @note added in 1.5 */
287
    bool contains( QgsGeometry* geometry );
288

  
285 289
    /** Returns a buffer region around this geometry having the given width and with a specified number
286 290
        of segments used to approximate curves */
287 291
    QgsGeometry* buffer( double distance, int segments );