mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
added toolbar buttons for start/stop editing
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5396 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
3bff720e1b
commit
bec5d201d8
BIN
images/themes/default/mActionStartEditing.png
Normal file
BIN
images/themes/default/mActionStartEditing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 959 B |
BIN
images/themes/default/mActionStopEditing.png
Normal file
BIN
images/themes/default/mActionStopEditing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 875 B |
@ -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 @@ private:
|
||||
QAction *mActionQgisSourceForgePage;
|
||||
QAction *mActionHelpAbout;
|
||||
QAction *mArawAction;
|
||||
QAction *mActionStartEditing;
|
||||
QAction *mActionStopEditing;
|
||||
QAction *mActionCapturePoint;
|
||||
QAction *mActionCaptureLine;
|
||||
QAction *mActionCapturePolygon;
|
||||
|
Loading…
x
Reference in New Issue
Block a user