Skip to content
Permalink
Browse files

fix for #11504 RotateFeature tool prerotation

  • Loading branch information
rduivenvoorde authored and jef-n committed Oct 26, 2014
1 parent a00039c commit 6f1c37139905b6ccdd45d09907c8d2ea575d7a10
Showing with 8 additions and 2 deletions.
  1. +7 −2 src/app/qgsmaptoolrotatefeature.cpp
  2. +1 −0 src/app/qgsmaptoolrotatefeature.h
@@ -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();
@@ -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 )
@@ -340,6 +344,7 @@ void QgsMapToolRotateFeature::deactivate()
delete mAnchorPoint;
mRubberBand = 0;
mAnchorPoint = 0;
mRotationOffset = 0;

QgsMapTool::deactivate();
}
@@ -63,6 +63,7 @@ class APP_EXPORT QgsMapToolRotateFeature: public QgsMapToolEdit
/**Id of moved feature*/
QgsFeatureIds mRotatedFeatures;
double mRotation;
double mRotationOffset;

QPoint mStPoint;
QgsVertexMarker* mAnchorPoint;

0 comments on commit 6f1c371

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