[GRASS-SVN] r46925 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 1 15:24:27 EDT 2011


Author: annakrat
Date: 2011-07-01 12:24:27 -0700 (Fri, 01 Jul 2011)
New Revision: 46925

Modified:
   grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
Log:
wxNviz: generating nviz_cmd command - vectors, cutting planes

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-07-01 17:48:46 UTC (rev 46924)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-07-01 19:24:27 UTC (rev 46925)
@@ -1395,8 +1395,71 @@
                 cmd += cmdColorMap.strip(', ') + ' '
             if cmdColorVal.split("=")[1]:
                 cmd += cmdColorVal.strip(', ') + ' '
+                
+        #
+        # vlines
+        #
+        if vectors:
+            cmdLines = cmdLWidth = cmdLHeight = cmdLColor = cmdLMode = cmdLPos = \
+            cmdPoints = cmdPWidth = cmdPSize = cmdPColor = cmdPMarker = cmdPPos = cmdPLayer = ""
+            markers = ['x', 'box', 'sphere', 'cube', 'diamond',
+                       'dec_tree', 'con_tree', 'aster', 'gyro', 'histogram']
+            for vector in vectors:
+                npoints, nlines, nfeatures, mapIs3D = self.lmgr.nviz.VectorInfo(
+                                                      self.tree.GetPyData(vector)[0]['maplayer'])
+                nvizData = self.tree.GetPyData(vector)[0]['nviz']['vector']
+                if nlines > 0:
+                    cmdLines += "%s," % self.tree.GetPyData(vector)[0]['maplayer'].GetName()
+                    cmdLWidth += "%d," % nvizData['lines']['width']['value']
+                    cmdLHeight += "%d," % nvizData['lines']['height']['value']
+                    cmdLColor += "%s," % nvizData['lines']['color']['value']
+                    cmdLMode += "%s," % nvizData['lines']['mode']['type']
+                    cmdLPos += "0,0,%d," % nvizData['lines']['height']['value']
+                if npoints > 0:    
+                    cmdPoints += "%s," % self.tree.GetPyData(vector)[0]['maplayer'].GetName()
+                    cmdPWidth += "%d," % nvizData['points']['width']['value']
+                    cmdPSize += "%d," % nvizData['points']['size']['value']
+                    cmdPColor += "%s," % nvizData['points']['color']['value']
+                    cmdPMarker += "%s," % markers[nvizData['points']['marker']['value']]
+                    cmdPPos += "0,0,%d," % nvizData['points']['height']['value']
+                    cmdPLayer += "1,1,"
+            if cmdLines:
+                cmd += "vline=" + cmdLines.strip(',') + ' '
+                cmd += "vline_width=" + cmdLWidth.strip(',') + ' '
+                cmd += "vline_color=" + cmdLColor.strip(',') + ' '
+                cmd += "vline_height=" + cmdLHeight.strip(',') + ' '
+                cmd += "vline_mode=" + cmdLMode.strip(',') + ' '
+                cmd += "vline_position=" + cmdLPos.strip(',') + ' '
+            if cmdPoints:
+                cmd += "vpoint=" + cmdPoints.strip(',') + ' '
+                cmd += "vpoint_width=" + cmdPWidth.strip(',') + ' '
+                cmd += "vpoint_color=" + cmdPColor.strip(',') + ' '
+                cmd += "vpoint_size=" + cmdPSize.strip(',') + ' '
+                cmd += "vpoint_marker=" + cmdPMarker.strip(',') + ' '
+                cmd += "vpoint_position=" + cmdPPos.strip(',') + ' '
+                cmd += "vpoint_layer=" + cmdPLayer.strip(',') + ' '
+        #
+        # cutting planes
+        #
+        cplane = self.lmgr.nviz.FindWindowById(self.lmgr.nviz.win['cplane']['planes']).GetStringSelection()
+        print cplane
+        try:
+            planeIndex = int(cplane.split()[1])
+        except IndexError:
+            planeIndex = None
+        if planeIndex is not None:
+            shading = ['clear', 'top', 'bottom', 'blend', 'shaded']
+            cmd += "cplane=%d " % planeIndex
+            cmd += "cplane_rotation=%d " % self.cplanes[planeIndex]['rotation']['rot']
+            cmd += "cplane_tilt=%d " % self.cplanes[planeIndex]['rotation']['tilt']
+            cmd += "cplane_position=%d,%d,%d " % (self.cplanes[planeIndex]['position']['x'],
+                                           self.cplanes[planeIndex]['position']['y'],
+                                           self.cplanes[planeIndex]['position']['z'])
+            cmd += "cplane_shading=%s " % shading[self.cplanes[planeIndex]['shading']]
+                                                    
         # 
         # viewpoint
+        #
         subcmd  = "position=%.2f,%.2f " % (self.view['position']['x'], self.view['position']['y'])
         subcmd += "height=%d " % (self.iview['height']['value'])
         subcmd += "perspective=%d " % (self.view['persp']['value'])



More information about the grass-commit mailing list