浏览代码

Imported debug as Debug.
Removed item= parameters (not valid anymore) from AddLayer.
Fixed a bug in command file reading.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39891 15284696-431f-4ddb-bdfa-cd5b030d7da7

Huidae Cho 15 年之前
父节点
当前提交
40c034f876
共有 2 个文件被更改,包括 17 次插入7 次删除
  1. 15 3
      gui/wxpython/gui_modules/mapdisp_command.py
  2. 2 4
      gui/wxpython/gui_modules/render.py

+ 15 - 3
gui/wxpython/gui_modules/mapdisp_command.py

@@ -17,6 +17,7 @@ for details.
 import sys
 import time
 
+from debug import Debug
 from threading import Thread
 
 class Command(Thread):
@@ -48,10 +49,21 @@ class Command(Thread):
                 try:
                     Debug.msg (3, "Command.run(): cmd=%s" % (line))
 
-                    self.map.AddLayer(item=None, type="raster",
+                    cmd = line.split(" ")
+                    opacity = 1
+                    if " opacity=" in line:
+                        cmd2 = cmd
+                        cmd = []
+                        for c in cmd2:
+                            if c.find("opacity=") == 0:
+                                opacity = float(c.split("=")[1]) / 100
+                            else:
+                                cmd.append(c)
+
+                    self.map.AddLayer(type="raster",
                                       name='',
-                                      command=line,
-                                      l_opacity=1)
+                                      command=cmd,
+                                      l_opacity=opacity)
 
                     self.parent.redraw =True
 

+ 2 - 4
gui/wxpython/gui_modules/render.py

@@ -1335,14 +1335,12 @@ if __name__ == "__main__":
     map.width = 640
     map.height = 480
 
-    map.AddLayer(item=None,
-                 type="raster",
+    map.AddLayer(type="raster",
                  name="elevation.dem",
                  command = ["d.rast", "elevation.dem@PERMANENT", "catlist=1000-1500", "-i"],
                  l_opacity=.7)
 
-    map.AddLayer(item=None,
-                 type="vector",
+    map.AddLayer(type="vector",
                  name="streams",
                  command = ["d.vect", "streams@PERMANENT", "color=red", "width=3", "type=line"])