Skip to content

Commit

Permalink
Merge pull request #7659 from lbartoletti/reverseLine
Browse files Browse the repository at this point in the history
[needs-docs][FEATURE] Add reverse line maptools AKA swap direction
  • Loading branch information
nyalldawson committed Sep 4, 2018
2 parents 1f91858 + a7b6bdb commit e10d16e
Show file tree
Hide file tree
Showing 10 changed files with 607 additions and 0 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -704,6 +704,7 @@
<file>themes/default/mIconGPU.svg</file>
<file>themes/default/mAddToProject.svg</file>
<file>themes/default/mDockify.svg</file>
<file>themes/default/mActionReverseLine.svg</file>
<file>themes/default/mActionAdd3DMap.svg</file>
</qresource>
<qresource prefix="/images/tips">
Expand Down
142 changes: 142 additions & 0 deletions images/themes/default/mActionReverseLine.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -98,6 +98,7 @@ SET(QGIS_APP_SRCS
qgsmaptooloffsetpointsymbol.cpp
qgsmaptoolpointsymbol.cpp
qgsmaptoolreshape.cpp
qgsmaptoolreverseline.cpp
qgsmaptoolrotatefeature.cpp
qgsmaptoolrotatelabel.cpp
qgsmaptoolrotatepointsymbols.cpp
Expand Down Expand Up @@ -320,6 +321,7 @@ SET (QGIS_APP_MOC_HDRS
qgsmaptooloffsetpointsymbol.h
qgsmaptoolpointsymbol.h
qgsmaptoolreshape.h
qgsmaptoolreverseline.h
qgsmaptoolrotatefeature.h
qgsmaptoolrotatelabel.h
qgsmaptoolrotatepointsymbols.h
Expand Down
15 changes: 15 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -403,6 +403,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#include "qgsmaptoolmovelabel.h"
#include "qgsmaptoolrotatelabel.h"
#include "qgsmaptoolchangelabelproperties.h"
#include "qgsmaptoolreverseline.h"

#include "vertextool/qgsvertextool.h"

Expand Down Expand Up @@ -1466,6 +1467,7 @@ QgisApp::~QgisApp()
delete mMapTools.mOffsetCurve;
delete mMapTools.mPinLabels;
delete mMapTools.mReshapeFeatures;
delete mMapTools.mReverseLine;
delete mMapTools.mRotateFeature;
delete mMapTools.mRotateLabel;
delete mMapTools.mRotatePointSymbolsTool;
Expand Down Expand Up @@ -2063,6 +2065,7 @@ void QgisApp::createActions()
connect( mActionOffsetPointSymbol, &QAction::triggered, this, &QgisApp::offsetPointSymbol );
connect( mActionSnappingOptions, &QAction::triggered, this, &QgisApp::snappingOptions );
connect( mActionOffsetCurve, &QAction::triggered, this, &QgisApp::offsetCurve );
connect( mActionReverseLine, &QAction::triggered, this, &QgisApp::reverseLine );

// View Menu Items
connect( mActionPan, &QAction::triggered, this, &QgisApp::pan );
Expand Down Expand Up @@ -2354,6 +2357,7 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction( mActionMoveLabel );
mMapToolGroup->addAction( mActionRotateLabel );
mMapToolGroup->addAction( mActionChangeLabelProperties );
mMapToolGroup->addAction( mActionReverseLine );

//
// Preview Modes Group
Expand Down Expand Up @@ -3307,6 +3311,7 @@ void QgisApp::setTheme( const QString &themeName )
mActionDecorationNorthArrow->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/north_arrow.png" ) ) );
mActionDecorationScaleBar->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionScaleBar.svg" ) ) );
mActionDecorationGrid->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/transformed.svg" ) ) );
mActionReverseLine->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionReverseLine.svg" ) ) );

emit currentThemeChanged( themeName );
}
Expand Down Expand Up @@ -3518,6 +3523,8 @@ void QgisApp::createCanvasTools()
mMapTools.mOffsetCurve->setAction( mActionOffsetCurve );
mMapTools.mReshapeFeatures = new QgsMapToolReshape( mMapCanvas );
mMapTools.mReshapeFeatures->setAction( mActionReshapeFeatures );
mMapTools.mReverseLine = new QgsMapToolReverseLine( mMapCanvas );
mMapTools.mReverseLine->setAction( mActionReverseLine );
mMapTools.mSplitFeatures = new QgsMapToolSplitFeatures( mMapCanvas );
mMapTools.mSplitFeatures->setAction( mActionSplitFeatures );
mMapTools.mSplitParts = new QgsMapToolSplitParts( mMapCanvas );
Expand Down Expand Up @@ -7605,6 +7612,11 @@ void QgisApp::deletePart()
mMapCanvas->setMapTool( mMapTools.mDeletePart );
}

void QgisApp::reverseLine()
{
mMapCanvas->setMapTool( mMapTools.mReverseLine );
}

QgsGeometry QgisApp::unionGeometries( const QgsVectorLayer *vl, QgsFeatureList &featureList, bool &canceled )
{
canceled = false;
Expand Down Expand Up @@ -12140,6 +12152,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionPasteStyle->setEnabled( false );
mActionCopyLayer->setEnabled( false );
mActionPasteLayer->setEnabled( false );
mActionReverseLine->setEnabled( false );

mUndoDock->widget()->setEnabled( false );
mActionUndo->setEnabled( false );
Expand Down Expand Up @@ -12214,6 +12227,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionZoomToSelected->setEnabled( isSpatial );
mActionLabeling->setEnabled( isSpatial );
mActionDiagramProperties->setEnabled( isSpatial );
mActionReverseLine->setEnabled( false );

mActionSelectFeatures->setEnabled( isSpatial );
mActionSelectPolygon->setEnabled( isSpatial );
Expand Down Expand Up @@ -12357,6 +12371,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionSplitParts->setEnabled( isEditable && canChangeGeometry && isMultiPart );
mActionSimplifyFeature->setEnabled( isEditable && canChangeGeometry );
mActionOffsetCurve->setEnabled( isEditable && canAddFeatures && canChangeAttributes );
mActionReverseLine->setEnabled( isEditable && canChangeGeometry );

mActionAddRing->setEnabled( false );
mActionFillRing->setEnabled( false );
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -1399,6 +1399,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void rotatePointSymbols();
//! activates the offset point symbol tool
void offsetPointSymbol();
//! activates the reverse line tool
void reverseLine();
//! activates the tool
void setMapTool( QgsMapTool *tool, bool clean = false );

Expand Down Expand Up @@ -2056,6 +2058,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsMapTool *mRotateFeature = nullptr;
QgsMapTool *mRotateLabel = nullptr;
QgsMapTool *mChangeLabelProperties = nullptr;
QgsMapTool *mReverseLine = nullptr ;
} mMapTools;

QgsMapTool *mNonEditMapTool = nullptr;
Expand Down

0 comments on commit e10d16e

Please sign in to comment.