Skip to content

Commit

Permalink
Allow use of circular string digitizing in reshape tool
Browse files Browse the repository at this point in the history
While the reshape operation itself requires geometry segmentization,
this allows for easy reshaping of features to a curved path.

(it's intended mostly as a test of the previous commit)
  • Loading branch information
nyalldawson committed Mar 4, 2021
1 parent aed7645 commit d0f00ba
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/app/qgsmaptoolreshape.cpp
Expand Up @@ -81,6 +81,17 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
}

bool QgsMapToolReshape::supportsTechnique( QgsMapToolCapture::CaptureTechnique technique ) const
{
switch ( technique )
{
case QgsMapToolCapture::StraightSegments:
case QgsMapToolCapture::CircularString:
return true;
}
return false;
}

bool QgsMapToolReshape::isBindingLine( QgsVectorLayer *vlayer, const QgsRectangle &bbox ) const
{
if ( vlayer->geometryType() != QgsWkbTypes::LineGeometry )
Expand Down Expand Up @@ -121,9 +132,18 @@ void QgsMapToolReshape::reshape( QgsVectorLayer *vlayer )
bbox.combineExtentWith( pointsZM().at( i ).x(), pointsZM().at( i ).y() );
}


const bool hasCurvedSegments = captureCurve()->hasCurvedSegments();
QgsPointSequence pts;
captureCurve()->points( pts );
if ( !hasCurvedSegments )
{
captureCurve()->points( pts );
}
else
{
std::unique_ptr< QgsLineString > segmented( captureCurve()->curveToLine() );
segmented->points( pts );
}

QgsLineString reshapeLineString( pts );

//query all the features that intersect bounding box of capture line
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmaptoolreshape.h
Expand Up @@ -27,6 +27,7 @@ class APP_EXPORT QgsMapToolReshape: public QgsMapToolCapture
public:
QgsMapToolReshape( QgsMapCanvas *canvas );
void cadCanvasReleaseEvent( QgsMapMouseEvent *e ) override;
bool supportsTechnique( CaptureTechnique technique ) const override;

private:
void reshape( QgsVectorLayer *vlayer );
Expand Down

0 comments on commit d0f00ba

Please sign in to comment.