Skip to content

Commit

Permalink
Fix tools which doesn't works when map is rotated
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Sep 28, 2017
1 parent 3f317b6 commit 8e4234c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/app/qgsmaptoolellipseextent.cpp
Expand Up @@ -60,15 +60,29 @@ void QgsMapToolEllipseExtent::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
void QgsMapToolEllipseExtent::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint( e->mapPoint() );

if ( mTempRubberBand )
{

if ( qgsDoubleNear( mCanvas->rotation(), 0.0 ) )
switch ( mPoints.size() )
{
mEllipse = QgsEllipse().fromExtent( mPoints.at( 0 ), mapPoint );
mTempRubberBand->setGeometry( mEllipse.toPolygon() );
case 1:
{

if ( qgsDoubleNear( mCanvas->rotation(), 0.0 ) )
{
mEllipse = QgsEllipse().fromExtent( mPoints.at( 0 ), mapPoint );
mTempRubberBand->setGeometry( mEllipse.toPolygon() );
}
else
{
emit messageEmitted( tr( "Cannot use this tool when the map canvas is rotated" ), QgsMessageBar::WARNING );
mPoints.clear();
break;
}
}
break;
default:
break;
}
else
emit messageEmitted( tr( "Cannot use this tool when the map canvas is rotated" ), QgsMessageBar::WARNING );
}
}
4 changes: 4 additions & 0 deletions src/app/qgsmaptoolrectanglecenter.cpp
Expand Up @@ -80,7 +80,11 @@ void QgsMapToolRectangleCenter::cadCanvasMoveEvent( QgsMapMouseEvent *e )
mTempRubberBand->setGeometry( QgsMapToolAddRectangle::rectangleToPolygon() );
}
else
{
emit messageEmitted( tr( "Cannot use this tool when the map canvas is rotated" ), QgsMessageBar::WARNING );
mPoints.clear();
break;
}
}
break;
default:
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgsmaptoolrectangleextent.cpp
Expand Up @@ -76,7 +76,11 @@ void QgsMapToolRectangleExtent::cadCanvasMoveEvent( QgsMapMouseEvent *e )
mTempRubberBand->setGeometry( QgsMapToolAddRectangle::rectangleToPolygon( ) );
}
else
{
emit messageEmitted( tr( "Cannot use this tool when the map canvas is rotated" ), QgsMessageBar::WARNING );
mPoints.clear();
break;
}
}
break;
default:
Expand Down

0 comments on commit 8e4234c

Please sign in to comment.