Skip to content

Commit

Permalink
[FEATURE] Added a new "node" tool (in advanced digitizing toolbar).
Browse files Browse the repository at this point in the history
Integrates add, move and delete vertex tools for faster editing.

Contributed by Richard Kostecky, qgis-mapper team.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10890 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jun 6, 2009
1 parent b967172 commit 98e7dd0
Show file tree
Hide file tree
Showing 7 changed files with 1,196 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Markus Neteler
Maurizio Napolitano
Paul Ramsey
Peter Ersts
Richard Kostecky
Stefanie Tellex
Tom Russo
Tyler Mitchell
Expand Down
Binary file added images/themes/default/mActionNodeTool.png
Loading
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SET(QGIS_APP_SRCS
qgsmaptoolidentify.cpp
qgsmaptoolmovefeature.cpp
qgsmaptoolmovevertex.cpp
qgsmaptoolnodetool.cpp
qgsmaptoolselect.cpp
qgsmaptoolsimplify.cpp
qgsmaptoolsplitfeatures.cpp
Expand Down
23 changes: 22 additions & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
#include "qgsmaptoolidentify.h"
#include "qgsmaptoolmovefeature.h"
#include "qgsmaptoolmovevertex.h"
#include "qgsmaptoolnodetool.h"
#include "qgsmaptoolpan.h"
#include "qgsmaptoolselect.h"
#include "qgsmaptoolsplitfeatures.h"
Expand Down Expand Up @@ -475,6 +476,7 @@ QgisApp::~QgisApp()
delete mMapTools.mDeleteRing;
delete mMapTools.mDeletePart;
delete mMapTools.mAddIsland;
delete mMapTools.mNodeTool;

delete mPythonConsole;
delete mPythonUtils;
Expand Down Expand Up @@ -710,6 +712,11 @@ void QgisApp::createActions()
connect( mActionMergeFeatures, SIGNAL(triggered()), this, SLOT(mergeSelectedFeatures()));
mActionMergeFeatures->setEnabled(false);

mActionNodeTool = new QAction( getThemeIcon( "mActionNodeTool.png" ), tr( "Node Tool" ), this );
shortcuts->registerAction( mActionNodeTool );
mActionNodeTool->setStatusTip( tr( "Node Tool" ) );
connect( mActionNodeTool, SIGNAL( triggered() ), this, SLOT( nodeTool() ) );
mActionNodeTool->setEnabled( false );

// View Menu Items

Expand Down Expand Up @@ -1061,6 +1068,9 @@ void QgisApp::createActionGroups()
mActionDeletePart->setCheckable( true );
mMapToolGroup->addAction( mActionDeletePart );
mMapToolGroup->addAction( mActionMergeFeatures);
mActionNodeTool->setCheckable( true );
mMapToolGroup->addAction( mActionNodeTool );

}

void QgisApp::createMenus()
Expand Down Expand Up @@ -1150,7 +1160,8 @@ void QgisApp::createMenus()
mEditMenu->addAction( mActionDeleteRing );
mEditMenu->addAction( mActionDeletePart );
mEditMenu->addAction( mActionMergeFeatures );

mEditMenu->addAction( mActionNodeTool );

if ( layout == QDialogButtonBox::GnomeLayout || layout == QDialogButtonBox::MacLayout )
{
mActionEditSeparator3 = mEditMenu->addSeparator();
Expand Down Expand Up @@ -1355,6 +1366,7 @@ void QgisApp::createToolBars()
mAdvancedDigitizeToolBar->addAction( mActionDeleteRing );
mAdvancedDigitizeToolBar->addAction( mActionDeletePart );
mAdvancedDigitizeToolBar->addAction( mActionMergeFeatures );
mAdvancedDigitizeToolBar->addAction( mActionNodeTool );
mToolbarMenu->addAction( mAdvancedDigitizeToolBar->toggleViewAction() );


Expand Down Expand Up @@ -1707,6 +1719,8 @@ void QgisApp::createCanvas()
mMapTools.mDeleteRing->setAction( mActionDeleteRing );
mMapTools.mDeletePart = new QgsMapToolDeletePart( mMapCanvas );
mMapTools.mDeletePart->setAction( mActionDeletePart );
mMapTools.mNodeTool = new QgsMapToolNodeTool( mMapCanvas );
mMapTools.mNodeTool->setAction( mActionNodeTool );
//ensure that non edit tool is initialised or we will get crashes in some situations
mNonEditMapTool = mMapTools.mPan;
}
Expand Down Expand Up @@ -4228,6 +4242,11 @@ void QgisApp::mergeSelectedFeatures()
}
}

void QgisApp::nodeTool()
{
mMapCanvas->setMapTool( mMapTools.mNodeTool );
}

void QgisApp::splitFeatures()
{
mMapCanvas->setMapTool( mMapTools.mSplitFeatures );
Expand Down Expand Up @@ -5472,10 +5491,12 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
if ( vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::ChangeGeometries )
{
mActionMoveFeature->setEnabled( true );
mActionNodeTool->setEnabled( true );
}
else
{
mActionMoveFeature->setEnabled( false );
mActionNodeTool->setEnabled( false );
}

if ( vlayer->geometryType() == QGis::Point )
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class QgisApp : public QMainWindow
QAction *actionSimplifyFeature() { return mActionSimplifyFeature; }
QAction *actionDeleteRing() { return mActionDeleteRing; }
QAction *actionDeletePart() { return mActionDeletePart; }
QAction *actionNodeTool() { return mActionNodeTool; }
QAction *actionEditSeparator2() { return mActionEditSeparator2; }

QAction *actionPan() { return mActionPan; }
Expand Down Expand Up @@ -513,6 +514,8 @@ class QgisApp : public QMainWindow
void deletePart();
//! merges the selected features together
void mergeSelectedFeatures();
//! provides operations with nodes
void nodeTool();

//! activates the selection tool
void select();
Expand Down Expand Up @@ -727,6 +730,7 @@ class QgisApp : public QMainWindow
QAction *mActionDeleteRing;
QAction *mActionDeletePart;
QAction *mActionMergeFeatures;
QAction *mActionNodeTool;
QAction *mActionEditSeparator3;

QAction *mActionPan;
Expand Down Expand Up @@ -847,6 +851,7 @@ class QgisApp : public QMainWindow
QgsMapTool* mSimplifyFeature;
QgsMapTool* mDeleteRing;
QgsMapTool* mDeletePart;
QgsMapTool* mNodeTool;
} mMapTools;

QgsMapTool *mNonEditMapTool;
Expand Down
Loading

0 comments on commit 98e7dd0

Please sign in to comment.