Skip to content

Commit

Permalink
Hide / show vector layer editing tool based on context of layer type …
Browse files Browse the repository at this point in the history
…and editing status

git-svn-id: http://svn.osgeo.org/qgis/trunk@10394 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Mar 21, 2009
1 parent 014692f commit 82c5709
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,10 +1554,13 @@ void QgisApp::createCanvas()
mMapTools.mMeasureArea->setAction( mActionMeasureArea );
mMapTools.mCapturePoint = new QgsMapToolAddFeature( mMapCanvas, QgsMapToolCapture::CapturePoint );
mMapTools.mCapturePoint->setAction( mActionCapturePoint );
mActionCapturePoint->setVisible( false );
mMapTools.mCaptureLine = new QgsMapToolAddFeature( mMapCanvas, QgsMapToolCapture::CaptureLine );
mMapTools.mCaptureLine->setAction( mActionCaptureLine );
mActionCaptureLine->setVisible( false );
mMapTools.mCapturePolygon = new QgsMapToolAddFeature( mMapCanvas, QgsMapToolCapture::CapturePolygon );
mMapTools.mCapturePolygon->setAction( mActionCapturePolygon );
mActionCapturePolygon->setVisible( false );
mMapTools.mMoveFeature = new QgsMapToolMoveFeature( mMapCanvas );
mMapTools.mMoveFeature->setAction( mActionMoveFeature );
mMapTools.mSplitFeatures = new QgsMapToolSplitFeatures( mMapCanvas );
Expand Down Expand Up @@ -5028,13 +5031,17 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
if ( vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::AddFeatures )
{
mActionCapturePoint->setEnabled( true );
mActionCapturePoint->setVisible( true );
}
else
{
mActionCapturePoint->setEnabled( false );
mActionCapturePoint->setVisible( false );
}
mActionCaptureLine->setEnabled( false );
mActionCapturePolygon->setEnabled( false );
mActionCaptureLine->setVisible( false );
mActionCapturePolygon->setVisible( false );
mActionAddVertex->setEnabled( false );
mActionDeleteVertex->setEnabled( false );
mActionMoveVertex->setEnabled( false );
Expand All @@ -5056,15 +5063,19 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
if ( vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::AddFeatures )
{
mActionCaptureLine->setEnabled( true );
mActionCaptureLine->setVisible( true );
mActionSplitFeatures->setEnabled( true );
}
else
{
mActionCaptureLine->setEnabled( false );
mActionCaptureLine->setVisible( false );
mActionSplitFeatures->setEnabled( false );
}
mActionCapturePoint->setEnabled( false );
mActionCapturePolygon->setEnabled( false );
mActionCapturePoint->setVisible( false );
mActionCapturePolygon->setVisible( false );
mActionAddRing->setEnabled( false );
mActionAddIsland->setEnabled( false );
}
Expand All @@ -5073,19 +5084,23 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
if ( vlayer->isEditable() && dprovider->capabilities() & QgsVectorDataProvider::AddFeatures )
{
mActionCapturePolygon->setEnabled( true );
mActionCapturePolygon->setVisible( true );
mActionAddRing->setEnabled( true );
mActionAddIsland->setEnabled( true );
mActionSplitFeatures->setEnabled( true );
}
else
{
mActionCapturePolygon->setEnabled( false );
mActionCapturePolygon->setVisible( false );
mActionAddRing->setEnabled( false );
mActionAddIsland->setEnabled( false );
mActionSplitFeatures->setEnabled( false );
}
mActionCapturePoint->setEnabled( false );
mActionCaptureLine->setEnabled( false );
mActionCapturePoint->setVisible( false );
mActionCaptureLine->setVisible( false );
}

//are add/delete/move vertex supported?
Expand Down

0 comments on commit 82c5709

Please sign in to comment.