Skip to content

Commit

Permalink
Use _r GEOS API in geometry import test
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Sep 14, 2014
1 parent e4ab3f2 commit aafbc4e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/src/core/testqgsgeometryimport.cpp
Expand Up @@ -114,10 +114,12 @@ void TestQgsGeometryImport::pointGeos()
QFETCH( double, x );
QFETCH( double, y );

GEOSCoordSequence *coord = GEOSCoordSeq_create( 1, 2 );
GEOSCoordSeq_setX( coord, 0, x );
GEOSCoordSeq_setY( coord, 0, y );
GEOSGeometry* geosPt = GEOSGeom_createPoint( coord );
GEOSContextHandle_t geosctxt = QgsGeometry::getGEOSHandler();

GEOSCoordSequence *coord = GEOSCoordSeq_create_r( geosctxt, 1, 2 );
GEOSCoordSeq_setX_r( geosctxt, coord, 0, x );
GEOSCoordSeq_setY_r( geosctxt, coord, 0, y );
GEOSGeometry* geosPt = GEOSGeom_createPoint_r( geosctxt, coord );

QgsGeometry geom;
geom.fromGeos( geosPt );
Expand Down Expand Up @@ -197,15 +199,17 @@ void TestQgsGeometryImport::linestringGeos()
{
QFETCH( QVariantList, line );

GEOSContextHandle_t geosctxt = QgsGeometry::getGEOSHandler();

//create geos coord sequence first
GEOSCoordSequence *coord = GEOSCoordSeq_create( line.count(), 2 );
GEOSCoordSequence *coord = GEOSCoordSeq_create_r( geosctxt, line.count(), 2 );
for ( int i = 0; i < line.count(); i++ )
{
QPointF pt = line.at( i ).toPointF();
GEOSCoordSeq_setX( coord, i, pt.x() );
GEOSCoordSeq_setY( coord, i, pt.y() );
GEOSCoordSeq_setX_r( geosctxt, coord, i, pt.x() );
GEOSCoordSeq_setY_r( geosctxt, coord, i, pt.y() );
}
GEOSGeometry* geosLine = GEOSGeom_createLineString( coord );
GEOSGeometry* geosLine = GEOSGeom_createLineString_r( geosctxt, coord );
QgsGeometry geom;
geom.fromGeos( geosLine );
QVERIFY( geom.wkbType() == QGis::WKBLineString );
Expand Down

0 comments on commit aafbc4e

Please sign in to comment.