@@ -1558,35 +1558,34 @@ void TestQgsGeometry::circularString()
1558
1558
1559
1559
// 2d line
1560
1560
l24.setPoints ( QgsPointSequence () << QgsPoint ( 1 , 2 )
1561
- << QgsPoint ( 11 , 12 ) << QgsPoint ( 21 , 22 ) );
1562
- QVERIFY ( l24.insertVertex ( QgsVertexId ( 0 , 0 , 1 ), QgsPoint ( 6 .0 , 7.0 ) ) );
1561
+ << QgsPoint ( 11 , 12 ) << QgsPoint ( 1 , 22 ) );
1562
+ QVERIFY ( l24.insertVertex ( QgsVertexId ( 0 , 0 , 1 ), QgsPoint ( 4 .0 , 7.0 ) ) );
1563
1563
QCOMPARE ( l24.numPoints (), 5 );
1564
1564
QVERIFY ( !l24.is3D () );
1565
1565
QVERIFY ( !l24.isMeasure () );
1566
1566
QCOMPARE ( l24.wkbType (), QgsWkbTypes::CircularString );
1567
1567
QCOMPARE ( l24.pointN ( 0 ), QgsPoint ( 1.0 , 2.0 ) );
1568
- QCOMPARE ( l24.pointN ( 1 ), QgsPoint ( 6.0 , 7.0 ) );
1569
- // note - the next point is just testing current behavior - I do NOT know if this is the correct value!
1570
- QGSCOMPARENEAR ( l24.pointN ( 2 ).x (), -0.66 , 0.01 );
1571
- QGSCOMPARENEAR ( l24.pointN ( 2 ).y (), -0.745 , 0.01 );
1568
+ QCOMPARE ( l24.pointN ( 1 ), QgsPoint ( 4.0 , 7.0 ) );
1569
+ QGSCOMPARENEAR ( l24.pointN ( 2 ).x (), 7.192236 , 0.01 );
1570
+ QGSCOMPARENEAR ( l24.pointN ( 2 ).y (), 9.930870 , 0.01 );
1572
1571
QCOMPARE ( l24.pointN ( 3 ), QgsPoint ( 11.0 , 12.0 ) );
1573
- QCOMPARE ( l24.pointN ( 4 ), QgsPoint ( 21 .0 , 22.0 ) );
1572
+ QCOMPARE ( l24.pointN ( 4 ), QgsPoint ( 1 .0 , 22.0 ) );
1574
1573
1575
1574
QVERIFY ( l24.insertVertex ( QgsVertexId ( 0 , 0 , 1 ), QgsPoint ( 8.0 , 9.0 ) ) );
1576
- QVERIFY ( l24.insertVertex ( QgsVertexId ( 0 , 0 , 2 ), QgsPoint ( 18.0 , 19 .0 ) ) );
1575
+ QVERIFY ( l24.insertVertex ( QgsVertexId ( 0 , 0 , 2 ), QgsPoint ( 18.0 , 16 .0 ) ) );
1577
1576
QCOMPARE ( l24.numPoints (), 9 );
1578
1577
QCOMPARE ( l24.pointN ( 0 ), QgsPoint ( 1.0 , 2.0 ) );
1579
- QGSCOMPARENEAR ( l24.pointN ( 1 ).x (), - 0.63 , 0.01 );
1580
- QGSCOMPARENEAR ( l24.pointN ( 1 ).y (), - 0.774 , 0.01 );
1578
+ QGSCOMPARENEAR ( l24.pointN ( 1 ).x (), 4.363083 , 0.01 );
1579
+ QGSCOMPARENEAR ( l24.pointN ( 1 ).y (), 5.636917 , 0.01 );
1581
1580
QCOMPARE ( l24.pointN ( 2 ), QgsPoint ( 8.0 , 9.0 ) );
1582
- QCOMPARE ( l24.pointN ( 3 ), QgsPoint ( 18.0 , 19 .0 ) );
1583
- QGSCOMPARENEAR ( l24.pointN ( 4 ).x (), - 0.658 , 0.01 );
1584
- QGSCOMPARENEAR ( l24.pointN ( 4 ).y (), - 0.753 , 0.01 );
1585
- QCOMPARE ( l24.pointN ( 5 ), QgsPoint ( 6 .0 , 7.0 ) );
1586
- QGSCOMPARENEAR ( l24.pointN ( 6 ).x (), - 0.666 , 0.01 );
1587
- QGSCOMPARENEAR ( l24.pointN ( 6 ).y (), - 0.745 , 0.01 );
1581
+ QCOMPARE ( l24.pointN ( 3 ), QgsPoint ( 18.0 , 16 .0 ) );
1582
+ QGSCOMPARENEAR ( l24.pointN ( 4 ).x (), 5.876894 , 0.01 );
1583
+ QGSCOMPARENEAR ( l24.pointN ( 4 ).y (), 8.246211 , 0.01 );
1584
+ QCOMPARE ( l24.pointN ( 5 ), QgsPoint ( 4 .0 , 7.0 ) );
1585
+ QGSCOMPARENEAR ( l24.pointN ( 6 ).x (), 7.192236 , 0.01 );
1586
+ QGSCOMPARENEAR ( l24.pointN ( 6 ).y (), 9.930870 , 0.01 );
1588
1587
QCOMPARE ( l24.pointN ( 7 ), QgsPoint ( 11.0 , 12.0 ) );
1589
- QCOMPARE ( l24.pointN ( 8 ), QgsPoint ( 21 .0 , 22.0 ) );
1588
+ QCOMPARE ( l24.pointN ( 8 ), QgsPoint ( 1 .0 , 22.0 ) );
1590
1589
1591
1590
// insert vertex at end
1592
1591
QVERIFY ( !l24.insertVertex ( QgsVertexId ( 0 , 0 , 9 ), QgsPoint ( 31.0 , 32.0 ) ) );
@@ -1615,11 +1614,11 @@ void TestQgsGeometry::circularString()
1615
1614
1616
1615
// insert 4d vertex in 2d line
1617
1616
l24.setPoints ( QgsPointSequence () << QgsPoint ( 1 , 2 )
1618
- << QgsPoint ( 11 , 12 ) << QgsPoint ( 21 , 22 ) );
1619
- QVERIFY ( l24.insertVertex ( QgsVertexId ( 0 , 0 , 1 ), QgsPoint ( QgsWkbTypes::PointZM, 101 , 102 , 103 , 104 ) ) );
1617
+ << QgsPoint ( 11 , 12 ) << QgsPoint ( 1 , 22 ) );
1618
+ QVERIFY ( l24.insertVertex ( QgsVertexId ( 0 , 0 , 1 ), QgsPoint ( QgsWkbTypes::PointZM, 2 , 4 , 103 , 104 ) ) );
1620
1619
QCOMPARE ( l24.numPoints (), 5 );
1621
1620
QCOMPARE ( l24.wkbType (), QgsWkbTypes::CircularString );
1622
- QCOMPARE ( l24.pointN ( 1 ), QgsPoint ( QgsWkbTypes::Point, 101 , 102 ) );
1621
+ QCOMPARE ( l24.pointN ( 1 ), QgsPoint ( QgsWkbTypes::Point, 2 , 4 ) );
1623
1622
1624
1623
// move vertex
1625
1624
@@ -6353,27 +6352,27 @@ void TestQgsGeometry::curvePolygon()
6353
6352
QgsRectangle bBox = boundingBoxPoly.boundingBox (); // no crash!
6354
6353
6355
6354
ext = new QgsCircularString ();
6356
- ext->setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 , 1 ) << QgsPoint ( 1 , 0 , 2 ) << QgsPoint ( 2 , 0 , 3 )
6357
- << QgsPoint ( 1 , 0.5 , 4 ) << QgsPoint ( 0 , 0 , 1 ) );
6355
+ ext->setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 , 1 ) << QgsPoint ( 1 , 10 , 2 ) << QgsPoint ( 0 , 18 , 3 )
6356
+ << QgsPoint ( - 1 , 4 , 4 ) << QgsPoint ( 0 , 0 , 1 ) );
6358
6357
boundingBoxPoly.setExteriorRing ( ext );
6359
6358
bBox = boundingBoxPoly.boundingBox ();
6360
- QGSCOMPARENEAR ( bBox.xMinimum (), 0 , 0.001 );
6361
- QGSCOMPARENEAR ( bBox.xMaximum (), 2 , 0.001 );
6362
- QGSCOMPARENEAR ( bBox.yMinimum (), 0 , 0.001 );
6363
- QGSCOMPARENEAR ( bBox.yMaximum (), 0.5 , 0.001 );
6359
+ QGSCOMPARENEAR ( bBox.xMinimum (), - 1.435273 , 0.001 );
6360
+ QGSCOMPARENEAR ( bBox.xMaximum (), 1.012344 , 0.001 );
6361
+ QGSCOMPARENEAR ( bBox.yMinimum (), 0.000000 , 0.001 );
6362
+ QGSCOMPARENEAR ( bBox.yMaximum (), 18 , 0.001 );
6364
6363
6365
6364
// surfaceToPolygon
6366
6365
QgsCurvePolygon p12a;
6367
6366
std::unique_ptr< QgsPolygonV2 > surface ( p12a.surfaceToPolygon () );
6368
6367
QVERIFY ( surface->isEmpty () );
6369
6368
6370
6369
ext = new QgsCircularString ();
6371
- ext->setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 ) << QgsPoint ( 1 , 0 ) << QgsPoint ( 2 , 0 )
6372
- << QgsPoint ( 1 , 0. 5 ) << QgsPoint ( 0 , 0 ) );
6370
+ ext->setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 ) << QgsPoint ( 1 , 3 ) << QgsPoint ( 2 , 4 )
6371
+ << QgsPoint ( - 1 , 5 ) << QgsPoint ( 0 , 6 ) );
6373
6372
p12a.setExteriorRing ( ext );
6374
6373
surface.reset ( p12a.surfaceToPolygon () );
6375
6374
QCOMPARE ( surface->wkbType (), QgsWkbTypes::Polygon );
6376
- QCOMPARE ( surface->exteriorRing ()->nCoordinates (), 110 );
6375
+ QCOMPARE ( surface->exteriorRing ()->nCoordinates (), 290 );
6377
6376
QVERIFY ( surface->exteriorRing ()->isClosed () );
6378
6377
// too many vertices to actually check the result, let's just make sure the bounding boxes are similar
6379
6378
QgsRectangle r1 = ext->boundingBox ();
@@ -6389,7 +6388,7 @@ void TestQgsGeometry::curvePolygon()
6389
6388
p12a.addInteriorRing ( ring );
6390
6389
surface.reset ( p12a.surfaceToPolygon () );
6391
6390
QCOMPARE ( surface->wkbType (), QgsWkbTypes::Polygon );
6392
- QCOMPARE ( surface->exteriorRing ()->nCoordinates (), 110 );
6391
+ QCOMPARE ( surface->exteriorRing ()->nCoordinates (), 290 );
6393
6392
QVERIFY ( surface->exteriorRing ()->isClosed () );
6394
6393
QCOMPARE ( surface->numInteriorRings (), 1 );
6395
6394
// too many vertices to actually check the result, let's just make sure the bounding boxes are similar
@@ -6406,28 +6405,28 @@ void TestQgsGeometry::curvePolygon()
6406
6405
QVERIFY ( surface->isEmpty () );
6407
6406
6408
6407
ext = new QgsCircularString ();
6409
- ext->setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 ) << QgsPoint ( 1 , 0 ) << QgsPoint ( 2 , 0 )
6410
- << QgsPoint ( 1 , 0.5 ) << QgsPoint ( 0 , 0 ) );
6408
+ ext->setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 ) << QgsPoint ( 1 , 10 ) << QgsPoint ( 0 , 18 )
6409
+ << QgsPoint ( - 1 , 4 ) << QgsPoint ( 0 , 0 ) );
6411
6410
p12a.setExteriorRing ( ext );
6412
6411
surface.reset ( p12a.toPolygon () );
6413
6412
QCOMPARE ( surface->wkbType (), QgsWkbTypes::Polygon );
6414
- QCOMPARE ( surface->exteriorRing ()->nCoordinates (), 110 );
6413
+ QCOMPARE ( surface->exteriorRing ()->nCoordinates (), 64 );
6415
6414
QVERIFY ( surface->exteriorRing ()->isClosed () );
6416
6415
// too many vertices to actually check the result, let's just make sure the bounding boxes are similar
6417
6416
r1 = ext->boundingBox ();
6418
6417
r2 = surface->exteriorRing ()->boundingBox ();
6419
- QGSCOMPARENEAR ( r1.xMinimum (), r2.xMinimum (), 0.0001 );
6420
- QGSCOMPARENEAR ( r1.xMaximum (), r2.xMaximum (), 0.0001 );
6421
- QGSCOMPARENEAR ( r1.yMinimum (), r2.yMinimum (), 0.0001 );
6422
- QGSCOMPARENEAR ( r1.yMaximum (), r2.yMaximum (), 0.0001 );
6418
+ QGSCOMPARENEAR ( r1.xMinimum (), r2.xMinimum (), 0.01 );
6419
+ QGSCOMPARENEAR ( r1.xMaximum (), r2.xMaximum (), 0.01 );
6420
+ QGSCOMPARENEAR ( r1.yMinimum (), r2.yMinimum (), 0.01 );
6421
+ QGSCOMPARENEAR ( r1.yMaximum (), r2.yMaximum (), 0.01 );
6423
6422
ring = new QgsCircularString ();
6424
6423
ring->setPoints ( QgsPointSequence () << QgsPoint ( QgsWkbTypes::PointZM, 1 , 1 , 1 , 2 )
6425
6424
<< QgsPoint ( QgsWkbTypes::PointZM, 1 , 9 , 2 , 3 ) << QgsPoint ( QgsWkbTypes::PointZM, 9 , 9 , 3 , 6 )
6426
6425
<< QgsPoint ( QgsWkbTypes::PointZM, 9 , 1 , 4 , 4 ) << QgsPoint ( QgsWkbTypes::PointZM, 1 , 1 , 1 , 7 ) );
6427
6426
p12a.addInteriorRing ( ring );
6428
6427
surface.reset ( p12a.toPolygon () );
6429
6428
QCOMPARE ( surface->wkbType (), QgsWkbTypes::Polygon );
6430
- QCOMPARE ( surface->exteriorRing ()->nCoordinates (), 110 );
6429
+ QCOMPARE ( surface->exteriorRing ()->nCoordinates (), 64 );
6431
6430
QVERIFY ( surface->exteriorRing ()->isClosed () );
6432
6431
QCOMPARE ( surface->numInteriorRings (), 1 );
6433
6432
// too many vertices to actually check the result, let's just make sure the bounding boxes are similar
@@ -6721,15 +6720,15 @@ void TestQgsGeometry::curvePolygon()
6721
6720
6722
6721
// add interior rings
6723
6722
QgsCircularString removeRingsRing1;
6724
- removeRingsRing1.setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 , 1 ) << QgsPoint ( 0.1 , 0 , 2 ) << QgsPoint ( 0.2 , 0 , 3 )
6725
- << QgsPoint ( 0.1 , 0.05 , 4 ) << QgsPoint ( 0 , 0 , 1 ) );
6723
+ removeRingsRing1.setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 , 1 ) << QgsPoint ( 0.1 , 1 , 2 ) << QgsPoint ( 0 , 2 , 3 )
6724
+ << QgsPoint ( - 0.1 , 1.2 , 4 ) << QgsPoint ( 0 , 0 , 1 ) );
6726
6725
QgsCircularString removeRingsRing2;
6727
- removeRingsRing2.setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 , 1 ) << QgsPoint ( 1 , 0 , 2 ) << QgsPoint ( 2 , 0 , 3 )
6728
- << QgsPoint ( 1 , 0.5 , 4 ) << QgsPoint ( 0 , 0 , 1 ) );
6726
+ removeRingsRing2.setPoints ( QgsPointSequence () << QgsPoint ( 0 , 0 , 1 ) << QgsPoint ( 0.01 , 0.1 , 2 ) << QgsPoint ( 0 , 0.2 , 3 )
6727
+ << QgsPoint ( - 0.01 , 0.12 , 4 ) << QgsPoint ( 0 , 0 , 1 ) );
6729
6728
removeRings1.setInteriorRings ( QList< QgsCurve * >() << removeRingsRing1.clone () << removeRingsRing2.clone () );
6730
6729
6731
6730
// remove ring with size filter
6732
- removeRings1.removeInteriorRings ( 0.1 );
6731
+ removeRings1.removeInteriorRings ( 0.05 );
6733
6732
QCOMPARE ( removeRings1.numInteriorRings (), 1 );
6734
6733
6735
6734
// remove ring with no size filter
0 commit comments