Skip to content
Permalink
Browse files

Merge pull request #2487 from SebDieBln/CopyPasteScaleBasedVisibility

Make copy/paste style aware of scale based visibility (fixes #13746)
  • Loading branch information
m-kuhn committed Nov 20, 2015
2 parents d795e50 + a5b2a06 commit fbb3dc5050491b94cd1dce61d327e494d2f3da30
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/app/qgisapp.cpp
@@ -6808,6 +6808,10 @@ void QgisApp::copyStyle( QgsMapLayer * sourceLayer )
rootNode.setAttribute( "version", QString( "%1" ).arg( QGis::QGIS_VERSION ) );
doc.appendChild( rootNode );

rootNode.setAttribute( "hasScaleBasedVisibilityFlag", selectionLayer->hasScaleBasedVisibility() ? 1 : 0 );
rootNode.setAttribute( "minimumScale", QString::number( selectionLayer->minimumScale() ) );
rootNode.setAttribute( "maximumScale", QString::number( selectionLayer->maximumScale() ) );

/*
* Check to see if the layer is vector - in which case we should also copy its geometryType
* to avoid eventually pasting to a layer with a different geometry
@@ -6889,6 +6893,10 @@ void QgisApp::pasteStyle( QgsMapLayer * destinationLayer )
return;
}

selectionLayer->setScaleBasedVisibility( rootNode.attribute( "hasScaleBasedVisibilityFlag" ).toInt() == 1 );
selectionLayer->setMinimumScale( rootNode.attribute( "minimumScale" ).toFloat() );
selectionLayer->setMaximumScale( rootNode.attribute( "maximumScale" ).toFloat() );

mLayerTreeView->refreshLayerSymbology( selectionLayer->id() );
mMapCanvas->clearCache();
mMapCanvas->refresh();

0 comments on commit fbb3dc5

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