Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added Rotate Map Tool
  • Loading branch information
vinayan authored and mhugent committed Jan 12, 2013
1 parent a3f5cea commit 68e7b01
Show file tree
Hide file tree
Showing 6 changed files with 373 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -69,6 +69,7 @@ SET(QGIS_APP_SRCS
qgsmaptoolmovevertex.cpp
qgsmaptooloffsetcurve.cpp
qgsmaptoolreshape.cpp
qgsmaptoolrotatefeature.cpp
qgsmaptoolrotatelabel.cpp
qgsmaptoolrotatepointsymbols.cpp
qgsmaptoolselect.cpp
Expand Down Expand Up @@ -226,6 +227,7 @@ SET (QGIS_APP_MOC_HDRS
qgsmaptoolmovevertex.h
qgsmaptooloffsetcurve.h
qgsmaptoolreshape.h
qgsmaptoolrotatefeature.h
qgsmaptoolrotatelabel.h
qgsmaptoolrotatepointsymbols.h
qgsmaptoolselectfreehand.h
Expand Down
18 changes: 18 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -226,6 +226,7 @@
#include "qgsmaptoolidentify.h"
#include "qgsmaptoolmeasureangle.h"
#include "qgsmaptoolmovefeature.h"
#include "qgsmaptoolrotatefeature.h"
#include "qgsmaptoolmovevertex.h"
#include "qgsmaptooloffsetcurve.h"
#include "qgsmaptoolpan.h"
Expand Down Expand Up @@ -747,6 +748,7 @@ QgisApp::~QgisApp()
delete mMapTools.mPinLabels;
delete mMapTools.mShowHideLabels;
delete mMapTools.mMoveLabel;
delete mMapTools.mRotateFeature;
delete mMapTools.mRotateLabel;
delete mMapTools.mChangeLabelProperties;
delete mMapTools.mOffsetCurve;
Expand Down Expand Up @@ -883,6 +885,8 @@ void QgisApp::createActions()
connect( mActionPasteStyle, SIGNAL( triggered() ), this, SLOT( pasteStyle() ) );
connect( mActionAddFeature, SIGNAL( triggered() ), this, SLOT( addFeature() ) );
connect( mActionMoveFeature, SIGNAL( triggered() ), this, SLOT( moveFeature() ) );
connect( mActionRotateFeature, SIGNAL( triggered() ), this, SLOT( rotateFeature() ) );

connect( mActionReshapeFeatures, SIGNAL( triggered() ), this, SLOT( reshapeFeatures() ) );
connect( mActionSplitFeatures, SIGNAL( triggered() ), this, SLOT( splitFeatures() ) );
connect( mActionDeleteSelected, SIGNAL( triggered() ), this, SLOT( deleteSelected() ) );
Expand Down Expand Up @@ -1142,6 +1146,7 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction( mActionMeasureAngle );
mMapToolGroup->addAction( mActionAddFeature );
mMapToolGroup->addAction( mActionMoveFeature );
mMapToolGroup->addAction( mActionRotateFeature );
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
mMapToolGroup->addAction( mActionOffsetCurve );
Expand Down Expand Up @@ -1696,6 +1701,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionPasteFeatures->setIcon( QgsApplication::getThemeIcon( "/mActionEditPaste.png" ) );
mActionAddFeature->setIcon( QgsApplication::getThemeIcon( "/mActionCapturePoint.png" ) );
mActionMoveFeature->setIcon( QgsApplication::getThemeIcon( "/mActionMoveFeature.png" ) );
//mActionRotateFeature->setIcon( QgsApplication::getThemeIcon( "/mActionRotateFeature.png" ) );
mActionReshapeFeatures->setIcon( QgsApplication::getThemeIcon( "/mActionReshape.png" ) );
mActionSplitFeatures->setIcon( QgsApplication::getThemeIcon( "/mActionSplitFeatures.svg" ) );
mActionDeleteSelected->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.png" ) );
Expand Down Expand Up @@ -1885,6 +1891,8 @@ void QgisApp::createCanvasTools()
mMapTools.mAddFeature->setAction( mActionAddFeature );
mMapTools.mMoveFeature = new QgsMapToolMoveFeature( mMapCanvas );
mMapTools.mMoveFeature->setAction( mActionMoveFeature );
mMapTools.mRotateFeature = new QgsMapToolRotateFeature( mMapCanvas);
mMapTools.mRotateFeature->setAction(mActionRotateFeature);
//need at least geos 3.3 for OffsetCurve tool
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
Expand Down Expand Up @@ -1928,6 +1936,7 @@ void QgisApp::createCanvasTools()
mMapTools.mShowHideLabels->setAction( mActionShowHideLabels );
mMapTools.mMoveLabel = new QgsMapToolMoveLabel( mMapCanvas );
mMapTools.mMoveLabel->setAction( mActionMoveLabel );

mMapTools.mRotateLabel = new QgsMapToolRotateLabel( mMapCanvas );
mMapTools.mRotateLabel->setAction( mActionRotateLabel );
mMapTools.mChangeLabelProperties = new QgsMapToolChangeLabelProperties( mMapCanvas );
Expand Down Expand Up @@ -4592,6 +4601,11 @@ void QgisApp::moveLabel()
mMapCanvas->setMapTool( mMapTools.mMoveLabel );
}

void QgisApp::rotateFeature()
{
mMapCanvas->setMapTool( mMapTools.mRotateFeature );
}

void QgisApp::rotateLabel()
{
mMapCanvas->setMapTool( mMapTools.mRotateLabel );
Expand Down Expand Up @@ -7396,6 +7410,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionFeatureAction->setEnabled( false );
mActionAddFeature->setEnabled( false );
mActionMoveFeature->setEnabled( false );
mActionRotateFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionNodeTool->setEnabled( false );
mActionDeleteSelected->setEnabled( false );
Expand Down Expand Up @@ -7538,13 +7553,15 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddPart->setEnabled( true );
mActionDeletePart->setEnabled( true );
mActionMoveFeature->setEnabled( true );
mActionRotateFeature->setEnabled( true );
mActionNodeTool->setEnabled( true );
}
else
{
mActionAddPart->setEnabled( false );
mActionDeletePart->setEnabled( false );
mActionMoveFeature->setEnabled( false );
mActionRotateFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionNodeTool->setEnabled( false );
}
Expand Down Expand Up @@ -7669,6 +7686,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddPart->setEnabled( false );
mActionNodeTool->setEnabled( false );
mActionMoveFeature->setEnabled( false );
mActionRotateFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionCopyFeatures->setEnabled( false );
mActionCutFeatures->setEnabled( false );
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -240,6 +240,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionDeleteSelected() { return mActionDeleteSelected; }
QAction *actionAddFeature() { return mActionAddFeature; }
QAction *actionMoveFeature() { return mActionMoveFeature; }
QAction *actionRotateFeature() { return mActionRotateFeature;}
QAction *actionSplitFeatures() { return mActionSplitFeatures; }
QAction *actionAddRing() { return mActionAddRing; }
QAction *actionAddPart() { return mActionAddPart; }
Expand Down Expand Up @@ -964,6 +965,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void showHideLabels();
//! Activates the move label tool
void moveLabel();
//! Activates rotate feature tool
void rotateFeature();
//! Activates rotate label tool
void rotateLabel();
//! Activates label property tool
Expand Down Expand Up @@ -1173,6 +1176,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QgsMapTool* mPinLabels;
QgsMapTool* mShowHideLabels;
QgsMapTool* mMoveLabel;
QgsMapTool* mRotateFeature;
QgsMapTool* mRotateLabel;
QgsMapTool* mChangeLabelProperties;
} mMapTools;
Expand Down

0 comments on commit 68e7b01

Please sign in to comment.