Created
July 29, 2012 12:34
-
-
Save NathanW2/3198411 to your computer and use it in GitHub Desktop.
interpolate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit cd56dd7408797189cb5c909618ad4e0d22610f35 | |
Author: Nathan Woodrow <[email protected]> | |
Date: Sun Jul 29 22:32:17 2012 +1000 | |
Add interoplate to QgsGeometry | |
diff --git a/python/core/qgsgeometry.sip b/python/core/qgsgeometry.sip | |
index ae805d8..cbd08c2 100644 | |
--- a/python/core/qgsgeometry.sip | |
+++ b/python/core/qgsgeometry.sip | |
@@ -297,6 +297,8 @@ not disjoint with existing polygons of the feature*/ | |
/** Returns the smallest convex polygon that contains all the points in the geometry. */ | |
QgsGeometry* convexHull() /Factory/; | |
+ | |
+ QgsGeometry* interpolate( double distance ); | |
/** Returns a geometry representing the points shared by this geometry and other. */ | |
QgsGeometry* intersection(QgsGeometry* geometry) /Factory/; | |
diff --git a/src/core/qgsgeometry.cpp b/src/core/qgsgeometry.cpp | |
index ad1b041..2437c48 100644 | |
--- a/src/core/qgsgeometry.cpp | |
+++ b/src/core/qgsgeometry.cpp | |
@@ -6409,6 +6409,24 @@ QgsGeometry* QgsGeometry::convexHull() | |
CATCH_GEOS( 0 ) | |
} | |
+QgsGeometry* QgsGeometry::interpolate( double distance ) | |
+{ | |
+ if ( !mGeos ) | |
+ { | |
+ exportWkbToGeos(); | |
+ } | |
+ if ( !mGeos ) | |
+ { | |
+ return 0; | |
+ } | |
+ | |
+ try | |
+ { | |
+ return fromGeosGeom( GEOSInterpolate( mGeos, distance ) ); | |
+ } | |
+ CATCH_GEOS( 0 ) | |
+} | |
+ | |
QgsGeometry* QgsGeometry::intersection( QgsGeometry* geometry ) | |
{ | |
if ( !geometry ) | |
diff --git a/src/core/qgsgeometry.h b/src/core/qgsgeometry.h | |
index 78ac89a..acdf66a 100644 | |
--- a/src/core/qgsgeometry.h | |
+++ b/src/core/qgsgeometry.h | |
@@ -343,6 +343,8 @@ class CORE_EXPORT QgsGeometry | |
/** Returns the smallest convex polygon that contains all the points in the geometry. */ | |
QgsGeometry* convexHull(); | |
+ QgsGeometry* interpolate( double distance ); | |
+ | |
/** Returns a geometry representing the points shared by this geometry and other. */ | |
QgsGeometry* intersection( QgsGeometry* geometry ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment