Renamed delete hole tool to delete ring per suggestion by Borys.

git-svn-id: http://svn.osgeo.org/qgis/trunk@10705 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
wonder 2009-05-02 19:38:46 +00:00
parent 6ada84ba4c
commit c2d0a40061
9 changed files with 51 additions and 52 deletions

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -289,11 +289,11 @@ not disjoint with existing polygons of the feature*/
// TODO: destruction of created geometries?? // TODO: destruction of created geometries??
QList<QgsGeometry*> asGeometryCollection() /Factory/; QList<QgsGeometry*> asGeometryCollection() /Factory/;
/** delete a hole in polygon or multipolygon. /** delete a ring in polygon or multipolygon.
Ring 0 is outer ring and can't be deleted. Ring 0 is outer ring and can't be deleted.
@return TRUE on success @return TRUE on success
@note added in version 1.2 */ @note added in version 1.2 */
bool deleteHole( int ringNum, int partNum = 0 ); bool deleteRing( int ringNum, int partNum = 0 );
/** delete part identified by the part number /** delete part identified by the part number
@return TRUE on success @return TRUE on success

View File

@ -27,7 +27,7 @@ SET(QGIS_APP_SRCS
qgsmaptooladdisland.cpp qgsmaptooladdisland.cpp
qgsmaptooladdring.cpp qgsmaptooladdring.cpp
qgsmaptoolcapture.cpp qgsmaptoolcapture.cpp
qgsmaptooldeletehole.cpp qgsmaptooldeletering.cpp
qgsmaptooldeletepart.cpp qgsmaptooldeletepart.cpp
qgsmaptooldeletevertex.cpp qgsmaptooldeletevertex.cpp
qgsmaptooledit.cpp qgsmaptooledit.cpp

View File

@ -157,7 +157,7 @@
#include "qgsmaptooladdisland.h" #include "qgsmaptooladdisland.h"
#include "qgsmaptooladdring.h" #include "qgsmaptooladdring.h"
#include "qgsmaptooladdvertex.h" #include "qgsmaptooladdvertex.h"
#include "qgsmaptooldeletehole.h" #include "qgsmaptooldeletering.h"
#include "qgsmaptooldeletepart.h" #include "qgsmaptooldeletepart.h"
#include "qgsmaptooldeletevertex.h" #include "qgsmaptooldeletevertex.h"
#include "qgsmaptoolidentify.h" #include "qgsmaptoolidentify.h"
@ -469,7 +469,7 @@ QgisApp::~QgisApp()
delete mMapTools.mVertexDelete; delete mMapTools.mVertexDelete;
delete mMapTools.mAddRing; delete mMapTools.mAddRing;
delete mMapTools.mSimplifyFeature; delete mMapTools.mSimplifyFeature;
delete mMapTools.mDeleteHole; delete mMapTools.mDeleteRing;
delete mMapTools.mDeletePart; delete mMapTools.mDeletePart;
delete mMapTools.mAddIsland; delete mMapTools.mAddIsland;
@ -678,10 +678,10 @@ void QgisApp::createActions()
connect( mActionSimplifyFeature, SIGNAL( triggered() ), this, SLOT( simplifyFeature() ) ); connect( mActionSimplifyFeature, SIGNAL( triggered() ), this, SLOT( simplifyFeature() ) );
mActionSimplifyFeature->setEnabled( false ); mActionSimplifyFeature->setEnabled( false );
mActionDeleteHole = new QAction( getThemeIcon( "mActionDeleteHole.png" ), tr( "Delete Hole" ), this ); mActionDeleteRing = new QAction( getThemeIcon( "mActionDeleteRing.png" ), tr( "Delete Ring" ), this );
mActionDeleteHole->setStatusTip( tr( "Delete Hole" ) ); mActionDeleteRing->setStatusTip( tr( "Delete Ring" ) );
connect( mActionDeleteHole, SIGNAL( triggered() ), this, SLOT( deleteHole() ) ); connect( mActionDeleteRing, SIGNAL( triggered() ), this, SLOT( deleteRing() ) );
mActionDeleteHole->setEnabled( false ); mActionDeleteRing->setEnabled( false );
mActionDeletePart = new QAction( getThemeIcon( "mActionDeletePart.png" ), tr( "Delete Part" ), this ); mActionDeletePart = new QAction( getThemeIcon( "mActionDeletePart.png" ), tr( "Delete Part" ), this );
mActionDeletePart->setStatusTip( tr( "Delete Part" ) ); mActionDeletePart->setStatusTip( tr( "Delete Part" ) );
@ -1014,8 +1014,8 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction( mActionAddIsland ); mMapToolGroup->addAction( mActionAddIsland );
mActionSimplifyFeature->setCheckable( true ); mActionSimplifyFeature->setCheckable( true );
mMapToolGroup->addAction( mActionSimplifyFeature ); mMapToolGroup->addAction( mActionSimplifyFeature );
mActionDeleteHole->setCheckable( true ); mActionDeleteRing->setCheckable( true );
mMapToolGroup->addAction( mActionDeleteHole ); mMapToolGroup->addAction( mActionDeleteRing );
mActionDeletePart->setCheckable( true ); mActionDeletePart->setCheckable( true );
mMapToolGroup->addAction( mActionDeletePart ); mMapToolGroup->addAction( mActionDeletePart );
} }
@ -1104,7 +1104,7 @@ void QgisApp::createMenus()
mEditMenu->addAction( mActionSimplifyFeature ); mEditMenu->addAction( mActionSimplifyFeature );
mEditMenu->addAction( mActionAddRing ); mEditMenu->addAction( mActionAddRing );
mEditMenu->addAction( mActionAddIsland ); mEditMenu->addAction( mActionAddIsland );
mEditMenu->addAction( mActionDeleteHole ); mEditMenu->addAction( mActionDeleteRing );
mEditMenu->addAction( mActionDeletePart ); mEditMenu->addAction( mActionDeletePart );
if ( layout == QDialogButtonBox::GnomeLayout || layout == QDialogButtonBox::MacLayout ) if ( layout == QDialogButtonBox::GnomeLayout || layout == QDialogButtonBox::MacLayout )
@ -1306,7 +1306,7 @@ void QgisApp::createToolBars()
mAdvancedDigitizeToolBar->addAction( mActionSimplifyFeature ); mAdvancedDigitizeToolBar->addAction( mActionSimplifyFeature );
mAdvancedDigitizeToolBar->addAction( mActionAddRing ); mAdvancedDigitizeToolBar->addAction( mActionAddRing );
mAdvancedDigitizeToolBar->addAction( mActionAddIsland ); mAdvancedDigitizeToolBar->addAction( mActionAddIsland );
mAdvancedDigitizeToolBar->addAction( mActionDeleteHole ); mAdvancedDigitizeToolBar->addAction( mActionDeleteRing );
mAdvancedDigitizeToolBar->addAction( mActionDeletePart ); mAdvancedDigitizeToolBar->addAction( mActionDeletePart );
mToolbarMenu->addAction( mAdvancedDigitizeToolBar->toggleViewAction() ); mToolbarMenu->addAction( mAdvancedDigitizeToolBar->toggleViewAction() );
@ -1534,7 +1534,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionSimplifyFeature->setIcon( getThemeIcon( "/mActionSimplify.png" ) ); mActionSimplifyFeature->setIcon( getThemeIcon( "/mActionSimplify.png" ) );
mActionAddRing->setIcon( getThemeIcon( "/mActionAddRing.png" ) ); mActionAddRing->setIcon( getThemeIcon( "/mActionAddRing.png" ) );
mActionAddIsland->setIcon( getThemeIcon( "/mActionAddIsland.png" ) ); mActionAddIsland->setIcon( getThemeIcon( "/mActionAddIsland.png" ) );
mActionDeleteHole->setIcon( getThemeIcon( "/mActionDeleteHole.png" ) ); mActionDeleteRing->setIcon( getThemeIcon( "/mActionDeleteRing.png" ) );
mActionDeletePart->setIcon( getThemeIcon( "/mActionDeletePart.png" ) ); mActionDeletePart->setIcon( getThemeIcon( "/mActionDeletePart.png" ) );
mActionZoomIn->setIcon( getThemeIcon( "/mActionZoomIn.png" ) ); mActionZoomIn->setIcon( getThemeIcon( "/mActionZoomIn.png" ) );
mActionZoomOut->setIcon( getThemeIcon( "/mActionZoomOut.png" ) ); mActionZoomOut->setIcon( getThemeIcon( "/mActionZoomOut.png" ) );
@ -1655,8 +1655,8 @@ void QgisApp::createCanvas()
mMapTools.mAddIsland = new QgsMapToolAddIsland( mMapCanvas ); mMapTools.mAddIsland = new QgsMapToolAddIsland( mMapCanvas );
mMapTools.mSimplifyFeature = new QgsMapToolSimplify( mMapCanvas ); mMapTools.mSimplifyFeature = new QgsMapToolSimplify( mMapCanvas );
mMapTools.mSimplifyFeature->setAction( mActionSimplifyFeature ); mMapTools.mSimplifyFeature->setAction( mActionSimplifyFeature );
mMapTools.mDeleteHole = new QgsMapToolDeleteHole( mMapCanvas ); mMapTools.mDeleteRing = new QgsMapToolDeleteRing( mMapCanvas );
mMapTools.mDeleteHole->setAction( mActionDeleteHole ); mMapTools.mDeleteRing->setAction( mActionDeleteRing );
mMapTools.mDeletePart = new QgsMapToolDeletePart( mMapCanvas ); mMapTools.mDeletePart = new QgsMapToolDeletePart( mMapCanvas );
mMapTools.mDeletePart->setAction( mActionDeletePart ); mMapTools.mDeletePart->setAction( mActionDeletePart );
//ensure that non edit tool is initialised or we will get crashes in some situations //ensure that non edit tool is initialised or we will get crashes in some situations
@ -4037,9 +4037,9 @@ void QgisApp::simplifyFeature()
mMapCanvas->setMapTool( mMapTools.mSimplifyFeature ); mMapCanvas->setMapTool( mMapTools.mSimplifyFeature );
} }
void QgisApp::deleteHole() void QgisApp::deleteRing()
{ {
mMapCanvas->setMapTool( mMapTools.mDeleteHole ); mMapCanvas->setMapTool( mMapTools.mDeleteRing );
} }
void QgisApp::deletePart() void QgisApp::deletePart()
@ -5302,7 +5302,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddIsland->setEnabled( false ); mActionAddIsland->setEnabled( false );
mActionSplitFeatures->setEnabled( false ); mActionSplitFeatures->setEnabled( false );
mActionSimplifyFeature->setEnabled( false ); mActionSimplifyFeature->setEnabled( false );
mActionDeleteHole->setEnabled( false ); mActionDeleteRing->setEnabled( false );
if ( vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::ChangeGeometries ) if ( vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::ChangeGeometries )
{ {
@ -5334,7 +5334,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionCapturePolygon->setVisible( false ); mActionCapturePolygon->setVisible( false );
mActionAddRing->setEnabled( false ); mActionAddRing->setEnabled( false );
mActionAddIsland->setEnabled( false ); mActionAddIsland->setEnabled( false );
mActionDeleteHole->setEnabled( false ); mActionDeleteRing->setEnabled( false );
} }
else if ( vlayer->geometryType() == QGis::Polygon ) else if ( vlayer->geometryType() == QGis::Polygon )
{ {
@ -5346,7 +5346,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddIsland->setEnabled( true ); mActionAddIsland->setEnabled( true );
mActionSplitFeatures->setEnabled( true ); mActionSplitFeatures->setEnabled( true );
mActionSimplifyFeature->setEnabled( true ); mActionSimplifyFeature->setEnabled( true );
mActionDeleteHole->setEnabled( true ); mActionDeleteRing->setEnabled( true );
mActionDeletePart->setEnabled( true ); mActionDeletePart->setEnabled( true );
} }
else else
@ -5357,7 +5357,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddIsland->setEnabled( false ); mActionAddIsland->setEnabled( false );
mActionSplitFeatures->setEnabled( false ); mActionSplitFeatures->setEnabled( false );
mActionSimplifyFeature->setEnabled( false ); mActionSimplifyFeature->setEnabled( false );
mActionDeleteHole->setEnabled( false ); mActionDeleteRing->setEnabled( false );
mActionDeletePart->setEnabled( false ); mActionDeletePart->setEnabled( false );
} }
mActionCapturePoint->setEnabled( false ); mActionCapturePoint->setEnabled( false );

View File

@ -223,7 +223,7 @@ class QgisApp : public QMainWindow
QAction *actionAddRing() { return mActionAddRing; } QAction *actionAddRing() { return mActionAddRing; }
QAction *actionAddIsland() { return mActionAddIsland; } QAction *actionAddIsland() { return mActionAddIsland; }
QAction *actionSimplifyFeature() { return mActionSimplifyFeature; } QAction *actionSimplifyFeature() { return mActionSimplifyFeature; }
QAction *actionDeleteHole() { return mActionDeleteHole; } QAction *actionDeleteRing() { return mActionDeleteRing; }
QAction *actionDeletePart() { return mActionDeletePart; } QAction *actionDeletePart() { return mActionDeletePart; }
QAction *actionEditSeparator2() { return mActionEditSeparator2; } QAction *actionEditSeparator2() { return mActionEditSeparator2; }
@ -502,8 +502,8 @@ class QgisApp : public QMainWindow
void addIsland(); void addIsland();
//! simplifies feature //! simplifies feature
void simplifyFeature(); void simplifyFeature();
//! deletes hole in polygon //! deletes ring in polygon
void deleteHole(); void deleteRing();
//! deletes part of polygon //! deletes part of polygon
void deletePart(); void deletePart();
@ -714,7 +714,7 @@ class QgisApp : public QMainWindow
QAction *mActionAddIsland; QAction *mActionAddIsland;
QAction *mActionEditSeparator2; QAction *mActionEditSeparator2;
QAction *mActionSimplifyFeature; QAction *mActionSimplifyFeature;
QAction *mActionDeleteHole; QAction *mActionDeleteRing;
QAction *mActionDeletePart; QAction *mActionDeletePart;
QAction *mActionEditSeparator3; QAction *mActionEditSeparator3;
@ -833,7 +833,7 @@ class QgisApp : public QMainWindow
QgsMapTool* mAddRing; QgsMapTool* mAddRing;
QgsMapTool* mAddIsland; QgsMapTool* mAddIsland;
QgsMapTool* mSimplifyFeature; QgsMapTool* mSimplifyFeature;
QgsMapTool* mDeleteHole; QgsMapTool* mDeleteRing;
QgsMapTool* mDeletePart; QgsMapTool* mDeletePart;
} mMapTools; } mMapTools;

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
qgsmaptooldeletehole.h - delete a hole from polygon qgsmaptooldeletering.cpp - delete a ring from polygon
--------------------- ---------------------
begin : April 2009 begin : April 2009
copyright : (C) 2009 by Richard Kostecky copyright : (C) 2009 by Richard Kostecky
@ -13,7 +13,7 @@
* * * *
***************************************************************************/ ***************************************************************************/
#include "qgsmaptooldeletehole.h" #include "qgsmaptooldeletering.h"
#include "qgsmapcanvas.h" #include "qgsmapcanvas.h"
#include "qgsvertexmarker.h" #include "qgsvertexmarker.h"
@ -22,22 +22,22 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <QMessageBox> #include <QMessageBox>
QgsMapToolDeleteHole::QgsMapToolDeleteHole( QgsMapCanvas* canvas ) QgsMapToolDeleteRing::QgsMapToolDeleteRing( QgsMapCanvas* canvas )
: QgsMapToolVertexEdit( canvas ), mCross( 0 ) : QgsMapToolVertexEdit( canvas ), mCross( 0 )
{ {
} }
QgsMapToolDeleteHole::~QgsMapToolDeleteHole() QgsMapToolDeleteRing::~QgsMapToolDeleteRing()
{ {
delete mCross; delete mCross;
} }
void QgsMapToolDeleteHole::canvasMoveEvent( QMouseEvent * e ) void QgsMapToolDeleteRing::canvasMoveEvent( QMouseEvent * e )
{ {
//nothing to do //nothing to do
} }
void QgsMapToolDeleteHole::canvasPressEvent( QMouseEvent * e ) void QgsMapToolDeleteRing::canvasPressEvent( QMouseEvent * e )
{ {
delete mCross; delete mCross;
mCross = 0; mCross = 0;
@ -64,7 +64,7 @@ void QgsMapToolDeleteHole::canvasPressEvent( QMouseEvent * e )
} }
} }
void QgsMapToolDeleteHole::canvasReleaseEvent( QMouseEvent * e ) void QgsMapToolDeleteRing::canvasReleaseEvent( QMouseEvent * e )
{ {
delete mCross; delete mCross;
mCross = 0; mCross = 0;
@ -83,13 +83,13 @@ void QgsMapToolDeleteHole::canvasReleaseEvent( QMouseEvent * e )
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin(); QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it ) for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it )
{ {
deleteHole( sr_it->snappedAtGeometry, sr_it->snappedVertexNr, vlayer); deleteRing( sr_it->snappedAtGeometry, sr_it->snappedVertexNr, vlayer);
} }
} }
} }
void QgsMapToolDeleteHole::deleteHole( int fId, int beforeVertexNr, QgsVectorLayer* vlayer) void QgsMapToolDeleteRing::deleteRing( int fId, int beforeVertexNr, QgsVectorLayer* vlayer)
{ {
QgsFeature f; QgsFeature f;
vlayer->featureAtId( fId, f ); vlayer->featureAtId( fId, f );
@ -109,7 +109,7 @@ void QgsMapToolDeleteHole::deleteHole( int fId, int beforeVertexNr, QgsVectorLay
else else
return; return;
if (g->deleteHole( ringNum, partNum )) if (g->deleteRing( ringNum, partNum ))
{ {
vlayer->changeGeometry( fId, g ); vlayer->changeGeometry( fId, g );
mCanvas->refresh(); mCanvas->refresh();
@ -117,7 +117,7 @@ void QgsMapToolDeleteHole::deleteHole( int fId, int beforeVertexNr, QgsVectorLay
} }
int QgsMapToolDeleteHole::ringNumInPolygon( QgsGeometry* g, int vertexNr ) int QgsMapToolDeleteRing::ringNumInPolygon( QgsGeometry* g, int vertexNr )
{ {
QgsPolygon polygon = g->asPolygon(); QgsPolygon polygon = g->asPolygon();
for (int ring = 0; ring < polygon.count(); ring++) for (int ring = 0; ring < polygon.count(); ring++)
@ -130,7 +130,7 @@ int QgsMapToolDeleteHole::ringNumInPolygon( QgsGeometry* g, int vertexNr )
return -1; return -1;
} }
int QgsMapToolDeleteHole::ringNumInMultiPolygon( QgsGeometry* g, int vertexNr, int& partNum ) int QgsMapToolDeleteRing::ringNumInMultiPolygon( QgsGeometry* g, int vertexNr, int& partNum )
{ {
QgsMultiPolygon mpolygon = g->asMultiPolygon(); QgsMultiPolygon mpolygon = g->asMultiPolygon();
for (int part = 0; part < mpolygon.count(); part++) for (int part = 0; part < mpolygon.count(); part++)
@ -151,7 +151,7 @@ int QgsMapToolDeleteHole::ringNumInMultiPolygon( QgsGeometry* g, int vertexNr, i
} }
void QgsMapToolDeleteHole::deactivate() void QgsMapToolDeleteRing::deactivate()
{ {
delete mCross; delete mCross;
mCross = 0; mCross = 0;

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
qgsmaptooldeletehole.h - delete a hole from polygon qgsmaptooldeletering.h - delete a ring from polygon
--------------------- ---------------------
begin : April 2009 begin : April 2009
copyright : (C) 2009 by Richard Kostecky copyright : (C) 2009 by Richard Kostecky
@ -13,20 +13,19 @@
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef QGSMAPTOOLDELETEHOLE_H #ifndef QGSMAPTOOLDELETERING_H
#define QGSMAPTOOLDELETEHOLE_H #define QGSMAPTOOLDELETERING_H
#include "qgsmaptoolvertexedit.h" #include "qgsmaptoolvertexedit.h"
#include <QUndoCommand>
class QgsVertexMarker; class QgsVertexMarker;
/**Map tool to delete vertices from line/polygon features*/ /**Map tool to delete vertices from line/polygon features*/
class QgsMapToolDeleteHole: public QgsMapToolVertexEdit class QgsMapToolDeleteRing : public QgsMapToolVertexEdit
{ {
public: public:
QgsMapToolDeleteHole( QgsMapCanvas* canvas ); QgsMapToolDeleteRing( QgsMapCanvas* canvas );
virtual ~QgsMapToolDeleteHole(); virtual ~QgsMapToolDeleteRing();
void canvasMoveEvent( QMouseEvent * e ); void canvasMoveEvent( QMouseEvent * e );
@ -40,8 +39,8 @@ class QgsMapToolDeleteHole: public QgsMapToolVertexEdit
private: private:
QgsVertexMarker* mCross; QgsVertexMarker* mCross;
//! delete hole from the geometry //! delete inner ring from the geometry
void deleteHole( int fId, int beforeVertexNr, QgsVectorLayer* vlayer); void deleteRing( int fId, int beforeVertexNr, QgsVectorLayer* vlayer);
//! return ring number in polygon //! return ring number in polygon
int ringNumInPolygon( QgsGeometry* g, int vertexNr ); int ringNumInPolygon( QgsGeometry* g, int vertexNr );

View File

@ -5542,7 +5542,7 @@ QList<QgsGeometry*> QgsGeometry::asGeometryCollection()
} }
bool QgsGeometry::deleteHole( int ringNum, int partNum ) bool QgsGeometry::deleteRing( int ringNum, int partNum )
{ {
if (ringNum <= 0 || partNum < 0) if (ringNum <= 0 || partNum < 0)
return FALSE; return FALSE;

View File

@ -332,11 +332,11 @@ class CORE_EXPORT QgsGeometry
@note added in version 1.1 */ @note added in version 1.1 */
QList<QgsGeometry*> asGeometryCollection(); QList<QgsGeometry*> asGeometryCollection();
/** delete a hole in polygon or multipolygon. /** delete a ring in polygon or multipolygon.
Ring 0 is outer ring and can't be deleted. Ring 0 is outer ring and can't be deleted.
@return TRUE on success @return TRUE on success
@note added in version 1.2 */ @note added in version 1.2 */
bool deleteHole( int ringNum, int partNum = 0 ); bool deleteRing( int ringNum, int partNum = 0 );
/** delete part identified by the part number /** delete part identified by the part number
@return TRUE on success @return TRUE on success