Skip to content

Commit

Permalink
feature scaler base
Browse files Browse the repository at this point in the history
(cherry picked from commit a646509)
  • Loading branch information
roya0045 authored and nyalldawson committed Jan 12, 2021
1 parent 3feda23 commit df52656
Show file tree
Hide file tree
Showing 9 changed files with 900 additions and 1 deletion.
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -399,6 +399,7 @@
<file>themes/default/mActionSaveEdits.svg</file>
<file>themes/default/mActionSaveMapAsImage.svg</file>
<file>themes/default/mActionScaleBar.svg</file>
<file>themes/default/mActionScaleFeature.svg</file>
<file>themes/default/mActionScriptOpen.svg</file>
<file>themes/default/mActionSelect.svg</file>
<file>themes/default/mActionSelectAll.svg</file>
Expand Down
90 changes: 90 additions & 0 deletions images/themes/default/mActionScaleFeature.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -91,6 +91,7 @@ set(QGIS_APP_SRCS
qgsmaptoolreverseline.cpp
qgsmaptoolrotatefeature.cpp
qgsmaptoolrotatepointsymbols.cpp
qgsmaptoolscalefeature.cpp
qgsmaptoolselect.cpp
qgsmaptoolselectionhandler.cpp
qgsmaptoolselectutils.cpp
Expand Down
20 changes: 19 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -467,6 +467,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#include "qgsmaptoolmeasureangle.h"
#include "qgsmaptoolmovefeature.h"
#include "qgsmaptoolrotatefeature.h"
#include "qgsmaptoolscalefeature.h"
#include "qgsmaptooloffsetcurve.h"
#include "qgsmaptooloffsetpointsymbol.h"
#include "qgsmaptoolpan.h"
Expand Down Expand Up @@ -1799,6 +1800,7 @@ QgisApp::~QgisApp()
delete mMapTools.mReshapeFeatures;
delete mMapTools.mReverseLine;
delete mMapTools.mRotateFeature;
delete mMapTools.mScaleFeature;
delete mMapTools.mRotateLabel;
delete mMapTools.mRotatePointSymbolsTool;
delete mMapTools.mOffsetPointSymbolTool;
Expand Down Expand Up @@ -2679,7 +2681,7 @@ void QgisApp::createActions()
connect( mActionMoveFeature, &QAction::triggered, this, &QgisApp::moveFeature );
connect( mActionMoveFeatureCopy, &QAction::triggered, this, &QgisApp::moveFeatureCopy );
connect( mActionRotateFeature, &QAction::triggered, this, &QgisApp::rotateFeature );

connect( mActionScaleFeature, &QAction::triggered, this, &QgisApp::scaleFeature );
connect( mActionReshapeFeatures, &QAction::triggered, this, &QgisApp::reshapeFeatures );
connect( mActionSplitFeatures, &QAction::triggered, this, &QgisApp::splitFeatures );
connect( mActionSplitParts, &QAction::triggered, this, &QgisApp::splitParts );
Expand Down Expand Up @@ -3052,6 +3054,7 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction( mActionMoveFeature );
mMapToolGroup->addAction( mActionMoveFeatureCopy );
mMapToolGroup->addAction( mActionRotateFeature );
mMapToolGroup->addAction( mActionScaleFeature );
mMapToolGroup->addAction( mActionOffsetCurve );
mMapToolGroup->addAction( mActionReshapeFeatures );
mMapToolGroup->addAction( mActionSplitFeatures );
Expand Down Expand Up @@ -3731,6 +3734,7 @@ void QgisApp::createToolBars()

// Cad toolbar
mAdvancedDigitizeToolBar->insertAction( mActionRotateFeature, mAdvancedDigitizingDockWidget->enableAction() );
mAdvancedDigitizeToolBar->insertAction( mActionScaleFeature, mAdvancedDigitizingDockWidget->enableAction() );

// move feature tool button
QToolButton *moveFeatureButton = new QToolButton( mAdvancedDigitizeToolBar );
Expand Down Expand Up @@ -4086,6 +4090,7 @@ void QgisApp::setTheme( const QString &themeName )
mActionMoveFeature->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMoveFeaturePoint.svg" ) ) );
mActionMoveFeatureCopy->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionMoveFeatureCopyPoint.svg" ) ) );
mActionRotateFeature->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRotateFeature.svg" ) ) );
mActionScaleFeature->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionScaleFeature.svg" ) ) );
mActionReshapeFeatures->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionReshape.svg" ) ) );
mActionSplitFeatures->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSplitFeatures.svg" ) ) );
mActionSplitParts->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSplitParts.svg" ) ) );
Expand Down Expand Up @@ -4415,6 +4420,8 @@ void QgisApp::createCanvasTools()
mMapTools.mMoveFeatureCopy->setAction( mActionMoveFeatureCopy );
mMapTools.mRotateFeature = new QgsMapToolRotateFeature( mMapCanvas );
mMapTools.mRotateFeature->setAction( mActionRotateFeature );
mMapTools.mScaleFeature = new QgsMapToolScaleFeature( mMapCanvas );
mMapTools.mScaleFeature->setAction( mActionScaleFeature );
mMapTools.mOffsetCurve = new QgsMapToolOffsetCurve( mMapCanvas );
mMapTools.mOffsetCurve->setAction( mActionOffsetCurve );
mMapTools.mReshapeFeatures = new QgsMapToolReshape( mMapCanvas );
Expand Down Expand Up @@ -9888,6 +9895,11 @@ void QgisApp::rotateFeature()
mMapCanvas->setMapTool( mMapTools.mRotateFeature );
}

void QgisApp::scaleFeature()
{
mMapCanvas->setMapTool( mMapTools.mScaleFeature );
}

void QgisApp::rotateLabel()
{
mMapCanvas->setMapTool( mMapTools.mRotateLabel );
Expand Down Expand Up @@ -14641,6 +14653,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionMoveFeature->setEnabled( false );
mActionMoveFeatureCopy->setEnabled( false );
mActionRotateFeature->setEnabled( false );
mActionScaleFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionVertexTool->setEnabled( false );
mActionVertexToolActiveLayer->setEnabled( false );
Expand Down Expand Up @@ -14848,6 +14861,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionMoveFeature->setEnabled( isEditable && canChangeGeometry );
mActionMoveFeatureCopy->setEnabled( isEditable && canChangeGeometry );
mActionRotateFeature->setEnabled( isEditable && canChangeGeometry );
mActionScaleFeature->setEnabled( isEditable && canChangeGeometry );
mActionVertexTool->setEnabled( isEditable && canChangeGeometry );
mActionVertexToolActiveLayer->setEnabled( isEditable && canChangeGeometry );

Expand Down Expand Up @@ -15044,6 +15058,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionMoveFeature->setEnabled( false );
mActionMoveFeatureCopy->setEnabled( false );
mActionRotateFeature->setEnabled( false );
mActionScaleFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionCopyFeatures->setEnabled( false );
mActionCutFeatures->setEnabled( false );
Expand Down Expand Up @@ -15136,6 +15151,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionMoveFeature->setEnabled( false );
mActionMoveFeatureCopy->setEnabled( false );
mActionRotateFeature->setEnabled( false );
mActionScaleFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionCopyFeatures->setEnabled( false );
mActionCutFeatures->setEnabled( false );
Expand Down Expand Up @@ -15202,6 +15218,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionMoveFeature->setEnabled( false );
mActionMoveFeatureCopy->setEnabled( false );
mActionRotateFeature->setEnabled( false );
mActionScaleFeature->setEnabled( false );
mActionOffsetCurve->setEnabled( false );
mActionCopyFeatures->setEnabled( false );
mActionCutFeatures->setEnabled( false );
Expand Down Expand Up @@ -15268,6 +15285,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionMoveFeature->setEnabled( false );
mActionMoveFeatureCopy->setEnabled( false );
mActionRotateFeature->setEnabled( false );
mActionScaleFeature->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 @@ -483,6 +483,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionMoveFeature() { return mActionMoveFeature; }
QAction *actionMoveFeatureCopy() { return mActionMoveFeatureCopy; }
QAction *actionRotateFeature() { return mActionRotateFeature;}
QAction *actionScaleFeature() { return mActionScaleFeature;}
QAction *actionSplitFeatures() { return mActionSplitFeatures; }
QAction *actionSplitParts() { return mActionSplitParts; }
QAction *actionAddRing() { return mActionAddRing; }
Expand Down Expand Up @@ -1861,6 +1862,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void moveLabel();
//! Activates rotate feature tool
void rotateFeature();
//! Activates scale feature tool
void scaleFeature();
//! Activates rotate label tool
void rotateLabel();
//! Activates label property tool
Expand Down Expand Up @@ -2443,6 +2446,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsMapTool *mShowHideLabels = nullptr;
QgsMapTool *mMoveLabel = nullptr;
QgsMapTool *mRotateFeature = nullptr;
QgsMapTool *mScaleFeature = nullptr;
QgsMapTool *mRotateLabel = nullptr;
QgsMapTool *mChangeLabelProperties = nullptr;
QgsMapTool *mReverseLine = nullptr ;
Expand Down

0 comments on commit df52656

Please sign in to comment.