Skip to content

Commit e8bbc2d

Browse files
committed
Add interoplate to QgsGeometry
1 parent 80c251d commit e8bbc2d

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

python/core/qgsgeometry.sip

+2
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ not disjoint with existing polygons of the feature*/
297297

298298
/** Returns the smallest convex polygon that contains all the points in the geometry. */
299299
QgsGeometry* convexHull() /Factory/;
300+
301+
QgsGeometry* interoplate( double distance ) /Factory/;
300302

301303
/** Returns a geometry representing the points shared by this geometry and other. */
302304
QgsGeometry* intersection(QgsGeometry* geometry) /Factory/;

src/core/qgsgeometry.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -6409,6 +6409,24 @@ QgsGeometry* QgsGeometry::convexHull()
64096409
CATCH_GEOS( 0 )
64106410
}
64116411

6412+
QgsGeometry* QgsGeometry::interpolate( double distance )
6413+
{
6414+
if ( !mGeos )
6415+
{
6416+
exportWkbToGeos();
6417+
}
6418+
if ( !mGeos )
6419+
{
6420+
return 0;
6421+
}
6422+
6423+
try
6424+
{
6425+
return fromGeosGeom( GEOSInterpolate( mGeos, distance ) );
6426+
}
6427+
CATCH_GEOS( 0 )
6428+
}
6429+
64126430
QgsGeometry* QgsGeometry::intersection( QgsGeometry* geometry )
64136431
{
64146432
if ( !geometry )

src/core/qgsgeometry.h

+2
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ class CORE_EXPORT QgsGeometry
343343
/** Returns the smallest convex polygon that contains all the points in the geometry. */
344344
QgsGeometry* convexHull();
345345

346+
QgsGeometry* interpolate( double distance );
347+
346348
/** Returns a geometry representing the points shared by this geometry and other. */
347349
QgsGeometry* intersection( QgsGeometry* geometry );
348350

0 commit comments

Comments
 (0)