浏览代码

wxGUI/nviz: pass only existing maps for surface/3d raster attributes to avoid crashing

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64300 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 年之前
父节点
当前提交
51bada13cd
共有 1 个文件被更改,包括 10 次插入6 次删除
  1. 10 6
      gui/wxpython/nviz/mapwindow.py

+ 10 - 6
gui/wxpython/nviz/mapwindow.py

@@ -1917,9 +1917,11 @@ class GLWindow(MapWindowBase, glcanvas.GLCanvas):
                 elif attrb ==  'transp':
                 elif attrb ==  'transp':
                     self._display.UnsetSurfaceTransp(id) 
                     self._display.UnsetSurfaceTransp(id) 
             else:
             else:
-                if type(value) == types.StringType and \
-                        len(value) <=  0: # ignore empty values (TODO: warning)
-                    continue
+                if type(value) == types.StringType:
+                    if len(value) == 0:  # ignore empty values (TODO: warning)
+                        continue
+                    if map and not grass.find_file(value, element='cell')['fullname']:
+                        continue
                 if attrb ==  'color':
                 if attrb ==  'color':
                     self._display.SetSurfaceColor(id, map, str(value))
                     self._display.SetSurfaceColor(id, map, str(value))
                 elif attrb ==  'mask':
                 elif attrb ==  'mask':
@@ -2025,9 +2027,11 @@ class GLWindow(MapWindowBase, glcanvas.GLCanvas):
                     elif attrb ==  'transp':
                     elif attrb ==  'transp':
                         self._display.UnsetIsosurfaceTransp(id, isosurfId) 
                         self._display.UnsetIsosurfaceTransp(id, isosurfId) 
                 else:
                 else:
-                    if type(value) == types.StringType and \
-                            len(value) <=  0: # ignore empty values (TODO: warning)
-                        continue
+                    if type(value) == types.StringType:
+                        if len(value) == 0:  # ignore empty values (TODO: warning)
+                            continue
+                        if map and not grass.find_file(value, element='grid3')['fullname']:
+                            continue
                     elif attrb ==  'color':
                     elif attrb ==  'color':
                         self._display.SetIsosurfaceColor(id, isosurfId, map, str(value))
                         self._display.SetIsosurfaceColor(id, isosurfId, map, str(value))
                     elif attrb ==  'mask':
                     elif attrb ==  'mask':