Skip to content

Commit

Permalink
Merge pull request #2487 from SebDieBln/CopyPasteScaleBasedVisibility
Browse files Browse the repository at this point in the history
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 fbb3dc5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit fbb3dc5

Please sign in to comment.