mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-05 00:09:32 -04:00
Merge pull request #55371 from lbartoletti/fix_curve_wkt_maptool
QgsMapToolCapture: fix a regression
This commit is contained in:
commit
269e1d74f4
@ -1391,6 +1391,27 @@ void QgsMapToolCapture::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//does compoundcurve contain circular strings?
|
||||
//does provider support circular strings?
|
||||
if ( QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer() ) )
|
||||
{
|
||||
const bool hasCurvedSegments = captureCurve()->hasCurvedSegments();
|
||||
const bool providerSupportsCurvedSegments = vlayer->dataProvider()->capabilities() & QgsVectorDataProvider::CircularGeometries;
|
||||
|
||||
if ( hasCurvedSegments && providerSupportsCurvedSegments )
|
||||
{
|
||||
curveToAdd = captureCurve()->clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
curveToAdd = captureCurve()->curveToLine();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
curveToAdd = captureCurve()->clone();
|
||||
}
|
||||
QgsCurvePolygon *poly = new QgsCurvePolygon();
|
||||
poly->setExteriorRing( curveToAdd );
|
||||
g = QgsGeometry( poly );
|
||||
|
@ -161,9 +161,7 @@ void TestQgsMapToolAddRing::testAddRing()
|
||||
) );
|
||||
mCaptureTool->cadCanvasReleaseEvent( event.get() );
|
||||
|
||||
// TODO: fix https://github.com/qgis/QGIS/issues/55361
|
||||
// const QString wkt = "MultiPolygon (((0 0, 5 0, 5 5, 0 5, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1)))";
|
||||
const QString wkt = "MultiPolygon (((0 0, 5 0, 5 5, 0 5, 0 0),CompoundCurve ((1 1, 1 2, 2 2, 2 1, 1 1))))";
|
||||
const QString wkt = "MultiPolygon (((0 0, 5 0, 5 5, 0 5, 0 0),(1 1, 1 2, 2 2, 2 1, 1 1)))";
|
||||
QCOMPARE( mLayerMultiPolygon->getFeature( 1 ).geometry().asWkt(), wkt );
|
||||
}
|
||||
|
||||
@ -212,9 +210,7 @@ void TestQgsMapToolAddRing::testAddRingClockWise()
|
||||
) );
|
||||
mCaptureTool->cadCanvasReleaseEvent( event.get() );
|
||||
|
||||
// TODO: fix https://github.com/qgis/QGIS/issues/55361
|
||||
// const QString wkt = "MultiPolygon (((0 0, 5 0, 5 5, 0 5, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1), (3 3, 3 4, 4 4, 4 3, 3 3)))";
|
||||
const QString wkt = "MultiPolygon (((0 0, 5 0, 5 5, 0 5, 0 0),CompoundCurve ((1 1, 1 2, 2 2, 2 1, 1 1)),CompoundCurve ((3 3, 3 4, 4 4, 4 3, 3 3))))";
|
||||
const QString wkt = "MultiPolygon (((0 0, 5 0, 5 5, 0 5, 0 0),(1 1, 1 2, 2 2, 2 1, 1 1),(3 3, 3 4, 4 4, 4 3, 3 3)))";
|
||||
QCOMPARE( mLayerMultiPolygon->getFeature( 1 ).geometry().asWkt(), wkt );
|
||||
}
|
||||
QGSTEST_MAIN( TestQgsMapToolAddRing )
|
||||
|
Loading…
x
Reference in New Issue
Block a user