Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DBManager TopoViewer: zoom on topology if first load
Fixes #13064
  • Loading branch information
Sandro Santilli committed Jul 2, 2015
1 parent b9edb74 commit b9b6257
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -267,6 +267,16 @@ def run(item, action, mainwindow):
legend.setLayerExpanded(layer, False)

finally:

# Set canvas extent to topology extent, if not yet initialized
canvas = iface.mapCanvas()
if ( canvas.fullExtent().isNull() ):
ext = node_extent
ext.combineExtentWith(edge_extent)
# Grow by 1/20 of largest side
ext = ext.buffer(max(ext.width(),ext.height())/20)
canvas.setExtent(ext)

# restore canvas render flag
iface.mapCanvas().setRenderFlag(prevRenderFlagState)

Expand Down

0 comments on commit b9b6257

Please sign in to comment.