Skip to content

Commit

Permalink
Renamed delete hole tool to delete ring per suggestion by Borys.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10705 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed May 2, 2009
1 parent 693f088 commit 5bbbbf9
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 52 deletions.
File renamed without changes
4 changes: 2 additions & 2 deletions python/core/qgsgeometry.sip
Expand Up @@ -289,11 +289,11 @@ not disjoint with existing polygons of the feature*/
// TODO: destruction of created geometries??
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.
@return TRUE on success
@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
@return TRUE on success
Expand Down
2 changes: 1 addition & 1 deletion src/app/CMakeLists.txt
Expand Up @@ -27,7 +27,7 @@ SET(QGIS_APP_SRCS
qgsmaptooladdisland.cpp
qgsmaptooladdring.cpp
qgsmaptoolcapture.cpp
qgsmaptooldeletehole.cpp
qgsmaptooldeletering.cpp
qgsmaptooldeletepart.cpp
qgsmaptooldeletevertex.cpp
qgsmaptooledit.cpp
Expand Down
38 changes: 19 additions & 19 deletions src/app/qgisapp.cpp
Expand Up @@ -157,7 +157,7 @@
#include "qgsmaptooladdisland.h"
#include "qgsmaptooladdring.h"
#include "qgsmaptooladdvertex.h"
#include "qgsmaptooldeletehole.h"
#include "qgsmaptooldeletering.h"
#include "qgsmaptooldeletepart.h"
#include "qgsmaptooldeletevertex.h"
#include "qgsmaptoolidentify.h"
Expand Down Expand Up @@ -469,7 +469,7 @@ QgisApp::~QgisApp()
delete mMapTools.mVertexDelete;
delete mMapTools.mAddRing;
delete mMapTools.mSimplifyFeature;
delete mMapTools.mDeleteHole;
delete mMapTools.mDeleteRing;
delete mMapTools.mDeletePart;
delete mMapTools.mAddIsland;

Expand Down Expand Up @@ -678,10 +678,10 @@ void QgisApp::createActions()
connect( mActionSimplifyFeature, SIGNAL( triggered() ), this, SLOT( simplifyFeature() ) );
mActionSimplifyFeature->setEnabled( false );

mActionDeleteHole = new QAction( getThemeIcon( "mActionDeleteHole.png" ), tr( "Delete Hole" ), this );
mActionDeleteHole->setStatusTip( tr( "Delete Hole" ) );
connect( mActionDeleteHole, SIGNAL( triggered() ), this, SLOT( deleteHole() ) );
mActionDeleteHole->setEnabled( false );
mActionDeleteRing = new QAction( getThemeIcon( "mActionDeleteRing.png" ), tr( "Delete Ring" ), this );
mActionDeleteRing->setStatusTip( tr( "Delete Ring" ) );
connect( mActionDeleteRing, SIGNAL( triggered() ), this, SLOT( deleteRing() ) );
mActionDeleteRing->setEnabled( false );

mActionDeletePart = new QAction( getThemeIcon( "mActionDeletePart.png" ), tr( "Delete Part" ), this );
mActionDeletePart->setStatusTip( tr( "Delete Part" ) );
Expand Down Expand Up @@ -1014,8 +1014,8 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction( mActionAddIsland );
mActionSimplifyFeature->setCheckable( true );
mMapToolGroup->addAction( mActionSimplifyFeature );
mActionDeleteHole->setCheckable( true );
mMapToolGroup->addAction( mActionDeleteHole );
mActionDeleteRing->setCheckable( true );
mMapToolGroup->addAction( mActionDeleteRing );
mActionDeletePart->setCheckable( true );
mMapToolGroup->addAction( mActionDeletePart );
}
Expand Down Expand Up @@ -1104,7 +1104,7 @@ void QgisApp::createMenus()
mEditMenu->addAction( mActionSimplifyFeature );
mEditMenu->addAction( mActionAddRing );
mEditMenu->addAction( mActionAddIsland );
mEditMenu->addAction( mActionDeleteHole );
mEditMenu->addAction( mActionDeleteRing );
mEditMenu->addAction( mActionDeletePart );

if ( layout == QDialogButtonBox::GnomeLayout || layout == QDialogButtonBox::MacLayout )
Expand Down Expand Up @@ -1306,7 +1306,7 @@ void QgisApp::createToolBars()
mAdvancedDigitizeToolBar->addAction( mActionSimplifyFeature );
mAdvancedDigitizeToolBar->addAction( mActionAddRing );
mAdvancedDigitizeToolBar->addAction( mActionAddIsland );
mAdvancedDigitizeToolBar->addAction( mActionDeleteHole );
mAdvancedDigitizeToolBar->addAction( mActionDeleteRing );
mAdvancedDigitizeToolBar->addAction( mActionDeletePart );
mToolbarMenu->addAction( mAdvancedDigitizeToolBar->toggleViewAction() );

Expand Down Expand Up @@ -1534,7 +1534,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionSimplifyFeature->setIcon( getThemeIcon( "/mActionSimplify.png" ) );
mActionAddRing->setIcon( getThemeIcon( "/mActionAddRing.png" ) );
mActionAddIsland->setIcon( getThemeIcon( "/mActionAddIsland.png" ) );
mActionDeleteHole->setIcon( getThemeIcon( "/mActionDeleteHole.png" ) );
mActionDeleteRing->setIcon( getThemeIcon( "/mActionDeleteRing.png" ) );
mActionDeletePart->setIcon( getThemeIcon( "/mActionDeletePart.png" ) );
mActionZoomIn->setIcon( getThemeIcon( "/mActionZoomIn.png" ) );
mActionZoomOut->setIcon( getThemeIcon( "/mActionZoomOut.png" ) );
Expand Down Expand Up @@ -1655,8 +1655,8 @@ void QgisApp::createCanvas()
mMapTools.mAddIsland = new QgsMapToolAddIsland( mMapCanvas );
mMapTools.mSimplifyFeature = new QgsMapToolSimplify( mMapCanvas );
mMapTools.mSimplifyFeature->setAction( mActionSimplifyFeature );
mMapTools.mDeleteHole = new QgsMapToolDeleteHole( mMapCanvas );
mMapTools.mDeleteHole->setAction( mActionDeleteHole );
mMapTools.mDeleteRing = new QgsMapToolDeleteRing( mMapCanvas );
mMapTools.mDeleteRing->setAction( mActionDeleteRing );
mMapTools.mDeletePart = new QgsMapToolDeletePart( mMapCanvas );
mMapTools.mDeletePart->setAction( mActionDeletePart );
//ensure that non edit tool is initialised or we will get crashes in some situations
Expand Down Expand Up @@ -4037,9 +4037,9 @@ void QgisApp::simplifyFeature()
mMapCanvas->setMapTool( mMapTools.mSimplifyFeature );
}

void QgisApp::deleteHole()
void QgisApp::deleteRing()
{
mMapCanvas->setMapTool( mMapTools.mDeleteHole );
mMapCanvas->setMapTool( mMapTools.mDeleteRing );
}

void QgisApp::deletePart()
Expand Down Expand Up @@ -5302,7 +5302,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddIsland->setEnabled( false );
mActionSplitFeatures->setEnabled( false );
mActionSimplifyFeature->setEnabled( false );
mActionDeleteHole->setEnabled( false );
mActionDeleteRing->setEnabled( false );

if ( vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::ChangeGeometries )
{
Expand Down Expand Up @@ -5334,7 +5334,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionCapturePolygon->setVisible( false );
mActionAddRing->setEnabled( false );
mActionAddIsland->setEnabled( false );
mActionDeleteHole->setEnabled( false );
mActionDeleteRing->setEnabled( false );
}
else if ( vlayer->geometryType() == QGis::Polygon )
{
Expand All @@ -5346,7 +5346,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddIsland->setEnabled( true );
mActionSplitFeatures->setEnabled( true );
mActionSimplifyFeature->setEnabled( true );
mActionDeleteHole->setEnabled( true );
mActionDeleteRing->setEnabled( true );
mActionDeletePart->setEnabled( true );
}
else
Expand All @@ -5357,7 +5357,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionAddIsland->setEnabled( false );
mActionSplitFeatures->setEnabled( false );
mActionSimplifyFeature->setEnabled( false );
mActionDeleteHole->setEnabled( false );
mActionDeleteRing->setEnabled( false );
mActionDeletePart->setEnabled( false );
}
mActionCapturePoint->setEnabled( false );
Expand Down
10 changes: 5 additions & 5 deletions src/app/qgisapp.h
Expand Up @@ -223,7 +223,7 @@ class QgisApp : public QMainWindow
QAction *actionAddRing() { return mActionAddRing; }
QAction *actionAddIsland() { return mActionAddIsland; }
QAction *actionSimplifyFeature() { return mActionSimplifyFeature; }
QAction *actionDeleteHole() { return mActionDeleteHole; }
QAction *actionDeleteRing() { return mActionDeleteRing; }
QAction *actionDeletePart() { return mActionDeletePart; }
QAction *actionEditSeparator2() { return mActionEditSeparator2; }

Expand Down Expand Up @@ -502,8 +502,8 @@ class QgisApp : public QMainWindow
void addIsland();
//! simplifies feature
void simplifyFeature();
//! deletes hole in polygon
void deleteHole();
//! deletes ring in polygon
void deleteRing();
//! deletes part of polygon
void deletePart();

Expand Down Expand Up @@ -714,7 +714,7 @@ class QgisApp : public QMainWindow
QAction *mActionAddIsland;
QAction *mActionEditSeparator2;
QAction *mActionSimplifyFeature;
QAction *mActionDeleteHole;
QAction *mActionDeleteRing;
QAction *mActionDeletePart;
QAction *mActionEditSeparator3;

Expand Down Expand Up @@ -833,7 +833,7 @@ class QgisApp : public QMainWindow
QgsMapTool* mAddRing;
QgsMapTool* mAddIsland;
QgsMapTool* mSimplifyFeature;
QgsMapTool* mDeleteHole;
QgsMapTool* mDeleteRing;
QgsMapTool* mDeletePart;
} mMapTools;

Expand Down
@@ -1,5 +1,5 @@
/***************************************************************************
qgsmaptooldeletehole.h - delete a hole from polygon
qgsmaptooldeletering.cpp - delete a ring from polygon
---------------------
begin : April 2009
copyright : (C) 2009 by Richard Kostecky
Expand All @@ -13,7 +13,7 @@
* *
***************************************************************************/

#include "qgsmaptooldeletehole.h"
#include "qgsmaptooldeletering.h"

#include "qgsmapcanvas.h"
#include "qgsvertexmarker.h"
Expand All @@ -22,22 +22,22 @@
#include <QMouseEvent>
#include <QMessageBox>

QgsMapToolDeleteHole::QgsMapToolDeleteHole( QgsMapCanvas* canvas )
QgsMapToolDeleteRing::QgsMapToolDeleteRing( QgsMapCanvas* canvas )
: QgsMapToolVertexEdit( canvas ), mCross( 0 )
{
}

QgsMapToolDeleteHole::~QgsMapToolDeleteHole()
QgsMapToolDeleteRing::~QgsMapToolDeleteRing()
{
delete mCross;
}

void QgsMapToolDeleteHole::canvasMoveEvent( QMouseEvent * e )
void QgsMapToolDeleteRing::canvasMoveEvent( QMouseEvent * e )
{
//nothing to do
}

void QgsMapToolDeleteHole::canvasPressEvent( QMouseEvent * e )
void QgsMapToolDeleteRing::canvasPressEvent( QMouseEvent * e )
{
delete mCross;
mCross = 0;
Expand All @@ -64,7 +64,7 @@ void QgsMapToolDeleteHole::canvasPressEvent( QMouseEvent * e )
}
}

void QgsMapToolDeleteHole::canvasReleaseEvent( QMouseEvent * e )
void QgsMapToolDeleteRing::canvasReleaseEvent( QMouseEvent * e )
{
delete mCross;
mCross = 0;
Expand All @@ -83,13 +83,13 @@ void QgsMapToolDeleteHole::canvasReleaseEvent( QMouseEvent * e )
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
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;
vlayer->featureAtId( fId, f );
Expand All @@ -109,15 +109,15 @@ void QgsMapToolDeleteHole::deleteHole( int fId, int beforeVertexNr, QgsVectorLay
else
return;

if (g->deleteHole( ringNum, partNum ))
if (g->deleteRing( ringNum, partNum ))
{
vlayer->changeGeometry( fId, g );
mCanvas->refresh();
}

}

int QgsMapToolDeleteHole::ringNumInPolygon( QgsGeometry* g, int vertexNr )
int QgsMapToolDeleteRing::ringNumInPolygon( QgsGeometry* g, int vertexNr )
{
QgsPolygon polygon = g->asPolygon();
for (int ring = 0; ring < polygon.count(); ring++)
Expand All @@ -130,7 +130,7 @@ int QgsMapToolDeleteHole::ringNumInPolygon( QgsGeometry* g, int vertexNr )
return -1;
}

int QgsMapToolDeleteHole::ringNumInMultiPolygon( QgsGeometry* g, int vertexNr, int& partNum )
int QgsMapToolDeleteRing::ringNumInMultiPolygon( QgsGeometry* g, int vertexNr, int& partNum )
{
QgsMultiPolygon mpolygon = g->asMultiPolygon();
for (int part = 0; part < mpolygon.count(); part++)
Expand All @@ -151,7 +151,7 @@ int QgsMapToolDeleteHole::ringNumInMultiPolygon( QgsGeometry* g, int vertexNr, i
}


void QgsMapToolDeleteHole::deactivate()
void QgsMapToolDeleteRing::deactivate()
{
delete mCross;
mCross = 0;
Expand Down
@@ -1,5 +1,5 @@
/***************************************************************************
qgsmaptooldeletehole.h - delete a hole from polygon
qgsmaptooldeletering.h - delete a ring from polygon
---------------------
begin : April 2009
copyright : (C) 2009 by Richard Kostecky
Expand All @@ -13,20 +13,19 @@
* *
***************************************************************************/

#ifndef QGSMAPTOOLDELETEHOLE_H
#define QGSMAPTOOLDELETEHOLE_H
#ifndef QGSMAPTOOLDELETERING_H
#define QGSMAPTOOLDELETERING_H

#include "qgsmaptoolvertexedit.h"
#include <QUndoCommand>

class QgsVertexMarker;
/**Map tool to delete vertices from line/polygon features*/

class QgsMapToolDeleteHole: public QgsMapToolVertexEdit
class QgsMapToolDeleteRing : public QgsMapToolVertexEdit
{
public:
QgsMapToolDeleteHole( QgsMapCanvas* canvas );
virtual ~QgsMapToolDeleteHole();
QgsMapToolDeleteRing( QgsMapCanvas* canvas );
virtual ~QgsMapToolDeleteRing();

void canvasMoveEvent( QMouseEvent * e );

Expand All @@ -40,8 +39,8 @@ class QgsMapToolDeleteHole: public QgsMapToolVertexEdit
private:
QgsVertexMarker* mCross;

//! delete hole from the geometry
void deleteHole( int fId, int beforeVertexNr, QgsVectorLayer* vlayer);
//! delete inner ring from the geometry
void deleteRing( int fId, int beforeVertexNr, QgsVectorLayer* vlayer);

//! return ring number in polygon
int ringNumInPolygon( QgsGeometry* g, int vertexNr );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsgeometry.cpp
Expand Up @@ -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)
return FALSE;
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsgeometry.h
Expand Up @@ -332,11 +332,11 @@ class CORE_EXPORT QgsGeometry
@note added in version 1.1 */
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.
@return TRUE on success
@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
@return TRUE on success
Expand Down

0 comments on commit 5bbbbf9

Please sign in to comment.