Skip to content
Permalink
Browse files

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

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10705 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed May 2, 2009
1 parent 693f088 commit 5bbbbf98bf93883d575ec6ccd058fc04b7f377dc
File renamed without changes.
@@ -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
@@ -27,7 +27,7 @@ SET(QGIS_APP_SRCS
qgsmaptooladdisland.cpp
qgsmaptooladdring.cpp
qgsmaptoolcapture.cpp
qgsmaptooldeletehole.cpp
qgsmaptooldeletering.cpp
qgsmaptooldeletepart.cpp
qgsmaptooldeletevertex.cpp
qgsmaptooledit.cpp
@@ -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"
@@ -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;

@@ -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" ) );
@@ -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 );
}
@@ -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 )
@@ -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() );

@@ -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" ) );
@@ -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
@@ -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()
@@ -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 )
{
@@ -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 )
{
@@ -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
@@ -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 );
@@ -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; }

@@ -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();

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

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

@@ -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
@@ -13,7 +13,7 @@
* *
***************************************************************************/

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

#include "qgsmapcanvas.h"
#include "qgsvertexmarker.h"
@@ -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;
@@ -64,7 +64,7 @@ void QgsMapToolDeleteHole::canvasPressEvent( QMouseEvent * e )
}
}

void QgsMapToolDeleteHole::canvasReleaseEvent( QMouseEvent * e )
void QgsMapToolDeleteRing::canvasReleaseEvent( QMouseEvent * e )
{
delete mCross;
mCross = 0;
@@ -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 );
@@ -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++)
@@ -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++)
@@ -151,7 +151,7 @@ int QgsMapToolDeleteHole::ringNumInMultiPolygon( QgsGeometry* g, int vertexNr, i
}


void QgsMapToolDeleteHole::deactivate()
void QgsMapToolDeleteRing::deactivate()
{
delete mCross;
mCross = 0;
@@ -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
@@ -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 );

@@ -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 );
@@ -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;
@@ -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

0 comments on commit 5bbbbf9

Please sign in to comment.
You can’t perform that action at this time.