@@ -132,8 +132,10 @@ static GEOSInit geosinit;
132
132
#define GEOSGetInteriorRingN (g,i ) GEOSGetInteriorRingN( (GEOSGeometry *)g, i )
133
133
#define GEOSDisjoint (g0,g1 ) GEOSDisjoint( (GEOSGeometry *)g0, (GEOSGeometry*)g1 )
134
134
#define GEOSIntersection (g0,g1 ) GEOSIntersection( (GEOSGeometry*) g0, (GEOSGeometry*)g1 )
135
- #define GEOSBuffer (g, d, s ) GEOSBuffer( (GEOSGeometry*) g, d, s)
136
- #define GEOSArea (g, a ) GEOSArea( (GEOSGeometry*) g, a)
135
+ #define GEOSBuffer (g, d, s ) GEOSBuffer( (GEOSGeometry*) g, d, s )
136
+ #define GEOSArea (g, a ) GEOSArea( (GEOSGeometry*) g, a )
137
+ #define GEOSSimplify (g, t ) GEOSSimplify( (GEOSGeometry*) g, t )
138
+ #define GEOSGetCentroid (g ) GEOSGetCentroid( (GEOSGeometry*) g )
137
139
138
140
#define GEOSCoordSeq_getSize (cs,n ) GEOSCoordSeq_getSize( (GEOSCoordSequence *) cs, n )
139
141
#define GEOSCoordSeq_getX (cs,i,x ) GEOSCoordSeq_getX( (GEOSCoordSequence *)cs, i, x )
@@ -5328,6 +5330,40 @@ QgsGeometry* QgsGeometry::buffer( double distance, int segments )
5328
5330
CATCH_GEOS ( 0 )
5329
5331
}
5330
5332
5333
+ QgsGeometry* QgsGeometry::simplify ( double tolerance )
5334
+ {
5335
+ if ( mGeos == NULL )
5336
+ {
5337
+ exportWkbToGeos ();
5338
+ }
5339
+ if ( !mGeos )
5340
+ {
5341
+ return 0 ;
5342
+ }
5343
+ try
5344
+ {
5345
+ return fromGeosGeom ( GEOSSimplify ( mGeos , tolerance ) );
5346
+ }
5347
+ CATCH_GEOS ( 0 )
5348
+ }
5349
+
5350
+ QgsGeometry* QgsGeometry::centroid ()
5351
+ {
5352
+ if ( mGeos == NULL )
5353
+ {
5354
+ exportWkbToGeos ();
5355
+ }
5356
+ if ( !mGeos )
5357
+ {
5358
+ return 0 ;
5359
+ }
5360
+ try
5361
+ {
5362
+ return fromGeosGeom ( GEOSGetCentroid ( mGeos ) );
5363
+ }
5364
+ CATCH_GEOS ( 0 )
5365
+ }
5366
+
5331
5367
QgsGeometry* QgsGeometry::convexHull ()
5332
5368
{
5333
5369
if ( mGeos == NULL )
@@ -5450,7 +5486,6 @@ QgsGeometry* QgsGeometry::symDifference( QgsGeometry* geometry )
5450
5486
CATCH_GEOS ( 0 )
5451
5487
}
5452
5488
5453
-
5454
5489
QList<QgsGeometry*> QgsGeometry::asGeometryCollection ()
5455
5490
{
5456
5491
if ( mGeos == NULL )
0 commit comments