@@ -1612,14 +1612,12 @@ void TestQgsGeometry::lineStringV2()
1612
1612
QCOMPARE ( l26.numPoints (), 2 );
1613
1613
QCOMPARE ( l26.pointN ( 0 ), QgsPointV2 ( QgsWKBTypes::PointZM, 1 , 2 , 2 , 3 ) );
1614
1614
QCOMPARE ( l26.pointN ( 1 ), QgsPointV2 ( QgsWKBTypes::PointZM, 21 , 22 , 6 , 7 ) );
1615
- QVERIFY ( l26.deleteVertex ( QgsVertexId ( 0 , 0 , 0 ) ) );
1616
- QCOMPARE ( l26.numPoints (), 1 );
1617
- QCOMPARE ( l26.pointN ( 0 ), QgsPointV2 ( QgsWKBTypes::PointZM, 21 , 22 , 6 , 7 ) );
1615
+ // removing the second to last vertex removes both remaining vertices
1618
1616
QVERIFY ( l26.deleteVertex ( QgsVertexId ( 0 , 0 , 0 ) ) );
1619
1617
QCOMPARE ( l26.numPoints (), 0 );
1618
+ QVERIFY ( !l26.deleteVertex ( QgsVertexId ( 0 , 0 , 0 ) ) );
1620
1619
QVERIFY ( l26.isEmpty () );
1621
1620
1622
-
1623
1621
// reversed
1624
1622
QgsLineStringV2 l27;
1625
1623
QScopedPointer< QgsLineStringV2 > reversed ( l27.reversed () );
@@ -2090,6 +2088,12 @@ void TestQgsGeometry::lineStringV2()
2090
2088
QVERIFY ( qgsDoubleNear ( l38.vertexAngle ( QgsVertexId ( 0 , 0 , 0 ) ), 2.35619 , 0.00001 ) );
2091
2089
QVERIFY ( qgsDoubleNear ( l38.vertexAngle ( QgsVertexId ( 0 , 0 , 6 ) ), 2.35619 , 0.00001 ) );
2092
2090
2091
+ // removing the second to last vertex should remove the whole line
2092
+ QgsLineStringV2 l39;
2093
+ l39.setPoints ( QList<QgsPointV2>() << QgsPointV2 ( 0 , 0 ) << QgsPointV2 ( 1 , 1 ) );
2094
+ QVERIFY ( l39.numPoints () == 2 );
2095
+ l39.deleteVertex ( QgsVertexId ( 0 , 0 , 1 ) );
2096
+ QVERIFY ( l39.numPoints () == 0 );
2093
2097
}
2094
2098
2095
2099
void TestQgsGeometry::polygonV2 ()
@@ -2787,6 +2791,14 @@ void TestQgsGeometry::polygonV2()
2787
2791
expectedGML3prec3 += QString ( " <interior xmlns=\" gml\" ><LinearRing xmlns=\" gml\" ><coordinates xmlns=\" gml\" >0.667,0.667 0.667,1.333 1.333,1.333 1.333,0.667 0.667,0.667</coordinates></LinearRing></interior></Polygon>" );
2788
2792
QCOMPARE ( elemToString ( exportPolygonFloat.asGML3 ( doc, 3 ) ), expectedGML3prec3 );
2789
2793
2794
+ // removing the fourth to last vertex removes the whole ring
2795
+ QgsPolygonV2 p20;
2796
+ QgsLineStringV2* p20ExteriorRing = new QgsLineStringV2 ();
2797
+ p20ExteriorRing->setPoints ( QList<QgsPointV2>() << QgsPointV2 ( 0 , 0 ) << QgsPointV2 ( 1 , 0 ) << QgsPointV2 ( 1 , 1 ) << QgsPointV2 ( 0 , 0 ) );
2798
+ p20.setExteriorRing ( p20ExteriorRing );
2799
+ QVERIFY ( p20.exteriorRing () );
2800
+ p20.deleteVertex ( QgsVertexId ( 0 , 0 , 2 ) );
2801
+ QVERIFY ( !p20.exteriorRing () );
2790
2802
}
2791
2803
2792
2804
void TestQgsGeometry::fromQgsPoint ()
0 commit comments