Skip to content
Permalink
Browse files

DBManager TopoViewer: zoom on topology if first load

Fixes #13064
  • Loading branch information
Sandro Santilli
Sandro Santilli committed Jul 2, 2015
1 parent b9edb74 commit b9b6257eb7b6d475c4f9e0a5a540c9267aa87c95
Showing with 10 additions and 0 deletions.
  1. +10 −0 python/plugins/db_manager/db_plugins/postgis/plugins/qgis_topoview/__init__.py
@@ -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)

0 comments on commit b9b6257

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