瀏覽代碼

wxGUI/datacatalog: zoom to first added map (sync with lmgr behaviour)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72386 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 7 年之前
父節點
當前提交
bc91613c6c
共有 1 個文件被更改,包括 7 次插入6 次删除
  1. 7 6
      gui/wxpython/datacatalog/tree.py

+ 7 - 6
gui/wxpython/datacatalog/tree.py

@@ -825,14 +825,15 @@ class DataCatalogTree(LocationMapTree):
             layerName.append(string)
             label = _("Displaying {name}...").format(name=string)
             self.showNotification.emit(message=label)
+            self._giface.lmgr.AddMaps(
+                layerName, self.selected_type.label, True)
+
+            if len(self._giface.GetLayerList()) == 1:
+                # zoom to map if there is only one map layer
+                self._giface.GetMapWindow().ZoomToMap()
+
             label = "d." + self.selected_type.label[:4] + " --q map=" + string + \
                     _(" -- completed. Go to Layers tab for further operations.")
-            if self.selected_type.label == 'vector':
-                self._giface.lmgr.AddMaps(layerName, 'vector', True)
-            elif self.selected_type.label == 'raster':
-                self._giface.lmgr.AddMaps(layerName, 'raster', True)
-            else:
-                self._giface.lmgr.AddMaps(layerName, 'raster_3d', True)
             self.showNotification.emit(message=label)
             Debug.msg(1, "LAYER " + self.selected_layer.label + " DISPLAYED")
         else: