@@ -56,11 +56,13 @@ class TestQgsGeometryImport: public QObject
56
56
57
57
private:
58
58
bool compareLineStrings ( const QgsPolylineXY &polyline, QVariantList &line );
59
+
60
+ GEOSContextHandle_t geos = nullptr ;
59
61
};
60
62
61
63
void TestQgsGeometryImport::initTestCase ()
62
64
{
63
- initGEOS ( 0 , 0 );
65
+ geos = initGEOS_r ( 0 , 0 );
64
66
}
65
67
66
68
void TestQgsGeometryImport::pointWkt_data ()
@@ -128,10 +130,10 @@ void TestQgsGeometryImport::pointGeos()
128
130
QFETCH ( double , x );
129
131
QFETCH ( double , y );
130
132
131
- GEOSCoordSequence *coord = GEOSCoordSeq_create ( 1 , 2 );
132
- GEOSCoordSeq_setX ( coord, 0 , x );
133
- GEOSCoordSeq_setY ( coord, 0 , y );
134
- GEOSGeometry *geosPt = GEOSGeom_createPoint ( coord );
133
+ GEOSCoordSequence *coord = GEOSCoordSeq_create_r ( geos, 1 , 2 );
134
+ GEOSCoordSeq_setX_r ( geos, coord, 0 , x );
135
+ GEOSCoordSeq_setY_r ( geos, coord, 0 , y );
136
+ GEOSGeometry *geosPt = GEOSGeom_createPoint_r ( geos, coord );
135
137
136
138
QgsGeometry geom = QgsGeos::geometryFromGeos ( geosPt );
137
139
QVERIFY ( geom.wkbType () == QgsWkbTypes::Point );
@@ -210,14 +212,14 @@ void TestQgsGeometryImport::linestringGeos()
210
212
QFETCH ( QVariantList, line );
211
213
212
214
// create geos coord sequence first
213
- GEOSCoordSequence *coord = GEOSCoordSeq_create ( line.count (), 2 );
215
+ GEOSCoordSequence *coord = GEOSCoordSeq_create_r ( geos, line.count (), 2 );
214
216
for ( int i = 0 ; i < line.count (); i++ )
215
217
{
216
218
QPointF pt = line.at ( i ).toPointF ();
217
- GEOSCoordSeq_setX ( coord, i, pt.x () );
218
- GEOSCoordSeq_setY ( coord, i, pt.y () );
219
+ GEOSCoordSeq_setX_r ( geos, coord, i, pt.x () );
220
+ GEOSCoordSeq_setY_r ( geos, coord, i, pt.y () );
219
221
}
220
- GEOSGeometry *geosLine = GEOSGeom_createLineString ( coord );
222
+ GEOSGeometry *geosLine = GEOSGeom_createLineString_r ( geos, coord );
221
223
QgsGeometry geom = QgsGeos::geometryFromGeos ( geosLine );
222
224
QVERIFY ( geom.wkbType () == QgsWkbTypes::LineString );
223
225
0 commit comments