mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
fix QgsGeometry::moveVertex on polygon (fixes #9442)
This commit is contained in:
parent
db277ce74c
commit
70c594984f
@ -1323,7 +1323,6 @@ bool QgsGeometry::moveVertex( double x, double y, int atVertex )
|
||||
|
||||
for ( int linenr = 0, pointIndex = 0; linenr < nLines; ++linenr )
|
||||
{
|
||||
wkbPtr += 1 + sizeof( int );
|
||||
if ( moveVertex( wkbPtr, x, y, atVertex, hasZValue, pointIndex, true ) )
|
||||
{
|
||||
mDirtyGeos = true;
|
||||
@ -1676,9 +1675,7 @@ bool QgsGeometry::insertVertex( double x, double y, int beforeVertex )
|
||||
dstPtr << nRings;
|
||||
|
||||
for ( int ringnr = 0, pointIndex = 0; ringnr < nRings; ++ringnr )
|
||||
{
|
||||
inserted |= insertVertex( srcPtr, dstPtr, beforeVertex, x, y, hasZValue, pointIndex, true );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -2665,7 +2662,6 @@ int QgsGeometry::translate( double dx, double dy )
|
||||
{
|
||||
int nRings;
|
||||
wkbPtr >> nRings;
|
||||
|
||||
for ( int index = 0; index < nRings; ++index )
|
||||
{
|
||||
int nPoints;
|
||||
|
@ -821,6 +821,31 @@ class TestQgsGeometry(TestCase):
|
||||
wkt = polyline.exportToWkt()
|
||||
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )
|
||||
|
||||
# 5-+-4
|
||||
# | |
|
||||
# 6 2-3
|
||||
# | |
|
||||
# 0-1
|
||||
polygon = QgsGeometry.fromWkt( "POLYGON((0 0,1 0,1 1,2 1,2 2,0 2,0 0))" )
|
||||
|
||||
assert not polygon.moveVertex( 3, 4, -10 ), "move vertex unexpectedly succeeded"
|
||||
assert not polygon.moveVertex( 3, 4, 7 ), "move vertex unexpectedly succeeded"
|
||||
|
||||
assert polygon.moveVertex( 1, 2, 0 ), "move vertex failed"
|
||||
expwkt = "POLYGON((1 2,1 0,1 1,2 1,2 2,0 2,1 2))"
|
||||
wkt = polygon.exportToWkt()
|
||||
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )
|
||||
|
||||
assert polygon.moveVertex( 3, 4, 3 ), "move vertex failed"
|
||||
expwkt = "POLYGON((1 2,1 0,1 1,3 4,2 2,0 2,1 2))"
|
||||
wkt = polygon.exportToWkt()
|
||||
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )
|
||||
|
||||
assert polygon.moveVertex( 2, 3, 6 ), "move vertex failed"
|
||||
expwkt = "POLYGON((2 3,1 0,1 1,3 4,2 2,0 2,2 3))"
|
||||
wkt = polygon.exportToWkt()
|
||||
assert compareWkt( expwkt, wkt ), "Expected:\n%s\nGot:\n%s\n" % (expwkt, wkt )
|
||||
|
||||
# 5-+-4 0-+-9
|
||||
# | | | |
|
||||
# 6 2-3 1-2!+
|
||||
|
Loading…
x
Reference in New Issue
Block a user