Skip to content
Permalink
Browse files

Fix tools which doesn't works when map is rotated

  • Loading branch information
lbartoletti committed Sep 28, 2017
1 parent 3f317b6 commit 8e4234ca75474525b49b619fc61132d5be2b8181
@@ -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 );
}
}
@@ -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:
@@ -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:

0 comments on commit 8e4234c

Please sign in to comment.
You can’t perform that action at this time.