Skip to content
Permalink
Browse files
added toolbar buttons for start/stop editing
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5396 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 29, 2006
1 parent 3bff720 commit bec5d201d880b255ff60bed031a76d6c8d2c1f16
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -597,6 +597,11 @@ void QgisApp::createActions()
//
// Digitising Toolbar Items
//

mActionStartEditing = new QAction(QIcon(myIconPath+"/mActionStartEditing.png"), tr("Start Editing"), this);
connect(mActionStartEditing, SIGNAL(triggered()), this, SLOT(startEditing()));
mActionStopEditing = new QAction(QIcon(myIconPath+"/mActionStopEditing.png"), tr("Stop Editing"), this);
connect(mActionStopEditing, SIGNAL(triggered()), this, SLOT(stopEditing()));
mActionCapturePoint= new QAction(QIcon(myIconPath+"/mActionCapturePoint.png"), tr("Capture Point"), this);
mActionCapturePoint->setShortcut(tr("."));
mActionCapturePoint->setStatusTip(tr("Capture Points"));
@@ -787,6 +792,8 @@ void QgisApp::createToolBars()
mDigitizeToolBar = addToolBar(tr("Digitizing"));
mDigitizeToolBar->setIconSize(QSize(24,24));
mDigitizeToolBar->setObjectName("Digitizing");
mDigitizeToolBar->addAction(mActionStartEditing);
mDigitizeToolBar->addAction(mActionStopEditing);
mDigitizeToolBar->addAction(mActionCapturePoint);
mDigitizeToolBar->addAction(mActionCaptureLine);
mDigitizeToolBar->addAction(mActionCapturePolygon);
@@ -3392,6 +3399,38 @@ void QgisApp::refreshMapCanvas()
mMapCanvas->refresh();
}

void QgisApp::startEditing()
{
QgsMapLayer* theLayer = mMapLegend->currentLayer();
if(!theLayer)
{
return;
}
//only vectorlayers can be edited
QgsVectorLayer* theVectorLayer = dynamic_cast<QgsVectorLayer*>(theLayer);
if(!theVectorLayer)
{
return;
}
theVectorLayer->startEditing();
}

void QgisApp::stopEditing()
{
QgsMapLayer* theLayer = mMapLegend->currentLayer();
if(!theLayer)
{
return;
}
//only vectorlayers can be edited
QgsVectorLayer* theVectorLayer = dynamic_cast<QgsVectorLayer*>(theLayer);
if(!theVectorLayer)
{
return;
}
theVectorLayer->stopEditing();
}

void QgisApp::showMouseCoordinate(QgsPoint & p)
{
mCoordsLabel->setText(p.stringRep(mMousePrecisionDecimalPlaces));
@@ -4559,6 +4598,18 @@ void QgisApp::activateDeactivateLayerRelatedActions(const QgsMapLayer* layer)

if (dprovider)
{
//start editing/stop editing
if(dprovider->capabilities() & QgsVectorDataProvider::AddFeatures)
{
mActionStartEditing->setEnabled(true);
mActionStopEditing->setEnabled(true);
}
else
{
mActionStartEditing->setEnabled(false);
mActionStopEditing->setEnabled(false);
}

//does provider allow deleting of features?
if(dprovider->capabilities() & QgsVectorDataProvider::DeleteFeatures)
{
@@ -4635,6 +4686,8 @@ void QgisApp::activateDeactivateLayerRelatedActions(const QgsMapLayer* layer)
{
mActionSelect->setEnabled(false);
mActionOpenTable->setEnabled(false);
mActionStartEditing->setEnabled(false);
mActionStopEditing->setEnabled(false);
mActionCapturePoint->setEnabled(false);
mActionCaptureLine->setEnabled(false);
mActionCapturePolygon->setEnabled(false);
@@ -300,6 +300,10 @@ public slots:
void refreshMapCanvas();
//! returns pointer to map legend
QgsLegend *legend() { return mMapLegend; }
//! enables the editing mode of the current layer
void startEditing();
//! disables the editing mode of the current layer
void stopEditing();

public slots:
void showProgress(int theProgress, int theTotalSteps);
@@ -449,6 +453,8 @@ public slots:
QAction *mActionQgisSourceForgePage;
QAction *mActionHelpAbout;
QAction *mArawAction;
QAction *mActionStartEditing;
QAction *mActionStopEditing;
QAction *mActionCapturePoint;
QAction *mActionCaptureLine;
QAction *mActionCapturePolygon;

0 comments on commit bec5d20

Please sign in to comment.