Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix for #11504 RotateFeature tool prerotation
  • Loading branch information
rduivenvoorde authored and jef-n committed Oct 26, 2014
1 parent a00039c commit 6f1c371
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/qgsmaptoolrotatefeature.cpp
Expand Up @@ -59,9 +59,10 @@ void QgsMapToolRotateFeature::canvasMoveEvent( QMouseEvent * e )
}
if ( mRubberBand )
{
double XDistance = mStPoint.x() - e->pos().x();
double YDistance = mStPoint.y() - e->pos().y();
double XDistance = e->pos().x() - mStPoint.x();
double YDistance = e->pos().y() - mStPoint.y();
mRotation = atan2( YDistance, XDistance ) * ( 180 / PI );
mRotation = mRotation-mRotationOffset;

mStPoint = toCanvasCoordinates( mStartPointMapCoords );
double offsetX = mStPoint.x() - mRubberBand->x();
Expand Down Expand Up @@ -175,6 +176,9 @@ void QgsMapToolRotateFeature::canvasPressEvent( QMouseEvent * e )
mRubberBand->setWidth( 2 );
mRubberBand->show();

double XDistance = mInitialPos.x() - mAnchorPoint->x();
double YDistance = mInitialPos.y() - mAnchorPoint->y() ;
mRotationOffset = atan2( YDistance, XDistance ) * ( 180 / PI );
}

void QgsMapToolRotateFeature::canvasReleaseEvent( QMouseEvent * e )
Expand Down Expand Up @@ -340,6 +344,7 @@ void QgsMapToolRotateFeature::deactivate()
delete mAnchorPoint;
mRubberBand = 0;
mAnchorPoint = 0;
mRotationOffset = 0;

QgsMapTool::deactivate();
}
1 change: 1 addition & 0 deletions src/app/qgsmaptoolrotatefeature.h
Expand Up @@ -63,6 +63,7 @@ class APP_EXPORT QgsMapToolRotateFeature: public QgsMapToolEdit
/**Id of moved feature*/
QgsFeatureIds mRotatedFeatures;
double mRotation;
double mRotationOffset;

QPoint mStPoint;
QgsVertexMarker* mAnchorPoint;
Expand Down

0 comments on commit 6f1c371

Please sign in to comment.