Skip to content

Commit aafbc4e

Browse files
committedSep 14, 2014
Use _r GEOS API in geometry import test
1 parent e4ab3f2 commit aafbc4e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed
 

‎tests/src/core/testqgsgeometryimport.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ void TestQgsGeometryImport::pointGeos()
114114
QFETCH( double, x );
115115
QFETCH( double, y );
116116

117-
GEOSCoordSequence *coord = GEOSCoordSeq_create( 1, 2 );
118-
GEOSCoordSeq_setX( coord, 0, x );
119-
GEOSCoordSeq_setY( coord, 0, y );
120-
GEOSGeometry* geosPt = GEOSGeom_createPoint( coord );
117+
GEOSContextHandle_t geosctxt = QgsGeometry::getGEOSHandler();
118+
119+
GEOSCoordSequence *coord = GEOSCoordSeq_create_r( geosctxt, 1, 2 );
120+
GEOSCoordSeq_setX_r( geosctxt, coord, 0, x );
121+
GEOSCoordSeq_setY_r( geosctxt, coord, 0, y );
122+
GEOSGeometry* geosPt = GEOSGeom_createPoint_r( geosctxt, coord );
121123

122124
QgsGeometry geom;
123125
geom.fromGeos( geosPt );
@@ -197,15 +199,17 @@ void TestQgsGeometryImport::linestringGeos()
197199
{
198200
QFETCH( QVariantList, line );
199201

202+
GEOSContextHandle_t geosctxt = QgsGeometry::getGEOSHandler();
203+
200204
//create geos coord sequence first
201-
GEOSCoordSequence *coord = GEOSCoordSeq_create( line.count(), 2 );
205+
GEOSCoordSequence *coord = GEOSCoordSeq_create_r( geosctxt, line.count(), 2 );
202206
for ( int i = 0; i < line.count(); i++ )
203207
{
204208
QPointF pt = line.at( i ).toPointF();
205-
GEOSCoordSeq_setX( coord, i, pt.x() );
206-
GEOSCoordSeq_setY( coord, i, pt.y() );
209+
GEOSCoordSeq_setX_r( geosctxt, coord, i, pt.x() );
210+
GEOSCoordSeq_setY_r( geosctxt, coord, i, pt.y() );
207211
}
208-
GEOSGeometry* geosLine = GEOSGeom_createLineString( coord );
212+
GEOSGeometry* geosLine = GEOSGeom_createLineString_r( geosctxt, coord );
209213
QgsGeometry geom;
210214
geom.fromGeos( geosLine );
211215
QVERIFY( geom.wkbType() == QGis::WKBLineString );

0 commit comments

Comments
 (0)
Please sign in to comment.