Skip to content

Commit cfec125

Browse files
committedOct 16, 2017
[bugfix] Fixes #17118 Reshape tool with z support
1 parent 364847f commit cfec125

File tree

5 files changed

+37
-6
lines changed

5 files changed

+37
-6
lines changed
 

‎src/app/qgsmaptoolreshape.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
9797
QgsGeometry* geom = f.geometry();
9898
if ( geom )
9999
{
100-
reshapeReturn = geom->reshapeGeometry( points() );
100+
reshapeReturn = geom->reshapeGeometry( pointsV2() );
101101
if ( reshapeReturn == 0 )
102102
{
103103
//avoid intersections on polygon layers

‎src/core/geometry/qgsgeometry.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -800,28 +800,34 @@ int QgsGeometry::splitGeometry( const QList<QgsPoint>& splitLine, QList<QgsGeome
800800

801801
/** Replaces a part of this geometry with another line*/
802802
int QgsGeometry::reshapeGeometry( const QList<QgsPoint>& reshapeWithLine )
803+
{
804+
QgsPointSequenceV2 reshapeLine;
805+
convertPointList( reshapeWithLine, reshapeLine );
806+
return reshapeGeometry( reshapeLine );
807+
}
808+
809+
int QgsGeometry::reshapeGeometry( const QList<QgsPointV2>& reshapeLine )
803810
{
804811
if ( !d->geometry )
805812
{
806813
return 0;
807814
}
808815

809-
QgsPointSequenceV2 reshapeLine;
810-
convertPointList( reshapeWithLine, reshapeLine );
811816
QgsLineStringV2 reshapeLineString;
812817
reshapeLineString.setPoints( reshapeLine );
813-
814818
QgsGeos geos( d->geometry );
815819
int errorCode = 0;
816820
QgsAbstractGeometryV2* geom = geos.reshapeGeometry( reshapeLineString, &errorCode );
821+
817822
if ( errorCode == 0 && geom )
818823
{
819-
detach( false );
824+
detach( true );
820825
delete d->geometry;
821-
d->geometry = geom;
822826
removeWkbGeos();
827+
d->geometry = geom;
823828
return 0;
824829
}
830+
825831
return errorCode;
826832
}
827833

‎src/core/geometry/qgsgeometry.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,15 @@ class CORE_EXPORT QgsGeometry
438438
*/
439439
int reshapeGeometry( const QList<QgsPoint>& reshapeWithLine );
440440

441+
/**
442+
* Replaces a part of this geometry with another line with Z support
443+
*
444+
* @return 0 in case of success
445+
*
446+
* @note added in 2.18
447+
*/
448+
int reshapeGeometry( const QList<QgsPointV2>& reshapeLine );
449+
441450
/** Changes this geometry such that it does not intersect the other geometry
442451
* @param other geometry that should not be intersect
443452
* @return 0 in case of success

‎src/gui/qgsmaptoolcapture.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,13 @@ QList<QgsPoint> QgsMapToolCapture::points()
722722
return points;
723723
}
724724

725+
QgsPointSequenceV2 QgsMapToolCapture::pointsV2()
726+
{
727+
QgsPointSequenceV2 pts;
728+
mCaptureCurve.points( pts );
729+
return pts;
730+
}
731+
725732
void QgsMapToolCapture::setPoints( const QList<QgsPoint>& pointList )
726733
{
727734
QgsPointSequenceV2 pts;

‎src/gui/qgsmaptoolcapture.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
194194
*/
195195
QList<QgsPoint> points();
196196

197+
/**
198+
* List of digitized points with z support
199+
*
200+
* @return List of points
201+
*
202+
* @node added in 2.18
203+
*/
204+
QgsPointSequenceV2 pointsV2();
205+
197206
/**
198207
* Set the points on which to work
199208
*

0 commit comments

Comments
 (0)
Please sign in to comment.