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

(backport of b9b6257)
  • Loading branch information
Sandro Santilli committed Jul 3, 2015
1 parent d60ff95 commit da94916
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -262,6 +262,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 da94916

Please sign in to comment.