File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,13 @@ const QgsAbstractGeometryV2* QgsGeometry::geometry() const
146
146
void QgsGeometry::setGeometry ( QgsAbstractGeometryV2* geometry )
147
147
{
148
148
detach ( false );
149
+ if ( d->geometry )
150
+ {
151
+ delete d->geometry ;
152
+ d->geometry = 0 ;
153
+ }
154
+ removeWkbGeos ();
155
+
149
156
d->geometry = geometry;
150
157
}
151
158
Original file line number Diff line number Diff line change @@ -1007,10 +1007,14 @@ class TestQgsExpression: public QObject
1007
1007
QgsPolygon polygon;
1008
1008
polygon << polygon_ring;
1009
1009
1010
- QTest::newRow ( " geomFromWKT Point" ) << " geom_from_wkt('" + QgsGeometry::fromPoint ( point )->exportToWkt () + " ')" << ( void * ) QgsGeometry::fromPoint ( point ) << false ;
1011
- QTest::newRow ( " geomFromWKT Line" ) << " geomFromWKT('" + QgsGeometry::fromPolyline ( line )->exportToWkt () + " ')" << ( void * ) QgsGeometry::fromPolyline ( line ) << false ;
1012
- QTest::newRow ( " geomFromWKT Polyline" ) << " geomFromWKT('" + QgsGeometry::fromPolyline ( polyline )->exportToWkt () + " ')" << ( void * ) QgsGeometry::fromPolyline ( polyline ) << false ;
1013
- QTest::newRow ( " geomFromWKT Polygon" ) << " geomFromWKT('" + QgsGeometry::fromPolygon ( polygon )->exportToWkt () + " ')" << ( void * ) QgsGeometry::fromPolygon ( polygon ) << false ;
1010
+ QScopedPointer<QgsGeometry> sourcePoint ( QgsGeometry::fromPoint ( point ) );
1011
+ QTest::newRow ( " geomFromWKT Point" ) << " geom_from_wkt('" + sourcePoint->exportToWkt () + " ')" << ( void * ) QgsGeometry::fromPoint ( point ) << false ;
1012
+ QScopedPointer<QgsGeometry> sourceLine ( QgsGeometry::fromPolyline ( line ) );
1013
+ QTest::newRow ( " geomFromWKT Line" ) << " geomFromWKT('" + sourceLine->exportToWkt () + " ')" << ( void * ) QgsGeometry::fromPolyline ( line ) << false ;
1014
+ QScopedPointer<QgsGeometry> sourcePolyline ( QgsGeometry::fromPolyline ( polyline ) );
1015
+ QTest::newRow ( " geomFromWKT Polyline" ) << " geomFromWKT('" + sourcePolyline->exportToWkt () + " ')" << ( void * ) QgsGeometry::fromPolyline ( polyline ) << false ;
1016
+ QScopedPointer<QgsGeometry> sourcePolygon ( QgsGeometry::fromPolygon ( polygon ) );
1017
+ QTest::newRow ( " geomFromWKT Polygon" ) << " geomFromWKT('" + sourcePolygon->exportToWkt () + " ')" << ( void * ) QgsGeometry::fromPolygon ( polygon ) << false ;
1014
1018
1015
1019
// GML Point
1016
1020
QTest::newRow ( " GML Point (coordinates)" ) << " geomFromGML('<gml:Point><gml:coordinates>123,456</gml:coordinates></gml:Point>')" << ( void * ) QgsGeometry::fromPoint ( point ) << false ;
Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ void TestQgsGeometry::cleanup()
211
211
delete mpPolygonGeometryA;
212
212
delete mpPolygonGeometryB;
213
213
delete mpPolygonGeometryC;
214
+ delete mpPolylineGeometryD;
214
215
delete mpPainter;
215
216
}
216
217
@@ -456,6 +457,8 @@ void TestQgsGeometry::initTestCase()
456
457
457
458
void TestQgsGeometry::cleanupTestCase ()
458
459
{
460
+
461
+
459
462
//
460
463
// Runs once after all tests are run
461
464
//
You can’t perform that action at this time.
0 commit comments