Skip to content
Permalink
Browse files
Merge pull request #43491 from olivierdalang/2021-06_fix-convert-to-c…
…urve-alg

Fix convertToCurve not converting CURVEPOLYGON
  • Loading branch information
m-kuhn committed Jun 2, 2021
2 parents f54914d + 9558ecf commit bc2a3fb64b12b124f4a366f2675ca5ca144c621a
Showing with 5 additions and 9 deletions.
  1. +0 −7 src/core/geometry/qgsinternalgeometryengine.cpp
  2. +5 −2 tests/src/python/test_qgsgeometry.py
@@ -1553,13 +1553,6 @@ QgsGeometry QgsInternalGeometryEngine::convertToCurves( double distanceTolerance
return QgsGeometry( mGeometry->clone() ); // point geometry, nothing to do
}

if ( QgsWkbTypes::isCurvedType( mGeometry->wkbType() ) )
{
// already curved. In future we may want to allow this, and convert additional candidate segments
// in an already curved geometry to curves
return QgsGeometry( mGeometry->clone() );
}

if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) )
{
int numGeom = gc->numGeometries();
@@ -5707,8 +5707,11 @@ def testConvertToCurves(self):
["LINESTRING(-13151357.927248 3913656.64539871,-13151419.0845266 3913664.12016378,-13151441.323537 3913666.61175286,-13151456.8908442 3913666.61175286,-13151476.9059536 3913666.61175286,-13151496.921063 3913666.61175287,-13151521.3839744 3913666.61175287,-13151591.4368571 3913665.36595828)",
"CompoundCurve ((-13151357.92724799923598766 3913656.64539870992302895, -13151419.08452660031616688 3913664.12016378017142415, -13151441.32353699952363968 3913666.61175285978242755, -13151456.8908441998064518 3913666.61175285978242755, -13151476.90595359914004803 3913666.61175285978242755, -13151496.92106300033628941 3913666.61175287002697587, -13151521.38397439941763878 3913666.61175287002697587, -13151591.43685710057616234 3913665.36595827993005514))", 0.000001, 0.0000001],
["Point( 1 2 )", "Point( 1 2 )", 0.00001, 0.00001],
["MultiPoint( 1 2, 3 4 )", "MultiPoint( (1 2 ), (3 4 ))", 0.00001, 0.00001]

["MultiPoint( 1 2, 3 4 )", "MultiPoint( (1 2 ), (3 4 ))", 0.00001, 0.00001],
# A polygon converts to curve
["POLYGON((3 3,2.4142135623731 1.58578643762691,1 1,-0.414213562373092 1.5857864376269,-1 2.99999999999999,-0.414213562373101 4.41421356237309,0.999999999999991 5,2.41421356237309 4.4142135623731,3 3))", "CURVEPOLYGON(COMPOUNDCURVE(CircularString(3 3, -1 2.99999999999998979, 3 3)))", 0.00000001, 0.00000001],
# The same polygon, even if already CURVEPOLYGON, still converts to curve
["CURVEPOLYGON((3 3,2.4142135623731 1.58578643762691,1 1,-0.414213562373092 1.5857864376269,-1 2.99999999999999,-0.414213562373101 4.41421356237309,0.999999999999991 5,2.41421356237309 4.4142135623731,3 3))", "CURVEPOLYGON(COMPOUNDCURVE(CircularString(3 3, -1 2.99999999999998979, 3 3)))", 0.00000001, 0.00000001],
]
for t in tests:
g1 = QgsGeometry.fromWkt(t[0])

0 comments on commit bc2a3fb

Please sign in to comment.