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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 9 14:33:40 EDT 2011


Author: annakrat
Date: 2011-09-09 11:33:40 -0700 (Fri, 09 Sep 2011)
New Revision: 48223

Modified:
   grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
   grass/trunk/gui/wxpython/gui_modules/preferences.py
Log:
wxNviz: cutting planes: default shading changed, fix cplanes indexing, remove unused functionality

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-09-09 12:54:50 UTC (rev 48222)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-09-09 18:33:40 UTC (rev 48223)
@@ -183,7 +183,7 @@
             cplane = copy.deepcopy(UserSettings.Get(group = 'nviz', key = 'cplane'))
             cplane['on'] = False
             self.cplanes.append(cplane)
-        
+            
     def GetOverlay(self):
         """!Converts rendered overlay files to wx.Image
         
@@ -381,16 +381,6 @@
             toggle.SetValue(False)
             self.mouse['use'] = 'pointer'
             self.SetCursor(self.cursors['default'])
-            
-        if self.mouse['use'] == "cplane":   
-            pos = event.GetPosition()
-            size = self.GetClientSize()
-            x, y, z = self._display.SetCPlaneInteractively(pos[0], size[1] - pos[1])
-            if x is not None: 
-                idx = self._display.GetCPlaneCurrent()
-                self.cplanes[idx]['position']['x'] = x
-                self.cplanes[idx]['position']['y'] = y
-                self.render['quick'] = True
                 
         if self.mouse['use'] == 'arrow':
             pos = event.GetPosition()
@@ -413,14 +403,6 @@
         event.Skip()    
         
     def OnDragging(self, event):
-        if self.mouse['use'] == "cplane":  
-            idx = self._display.GetCPlaneCurrent() 
-            pos = event.GetPosition()
-            size = self.GetClientSize()
-            x, y, z = self._display.SetCPlaneInteractively(pos[0], size[1] - pos[1])
-            if x is not None: 
-                self.cplanes[idx]['position']['x'] = x
-                self.cplanes[idx]['position']['y'] = y 
                 
         if self.mouse['use'] == 'pointer':
             self.DragItem(self.dragid, event)
@@ -507,13 +489,6 @@
             else:
                 self.OnQueryVector(event)
                     
-        elif self.mouse["use"] == 'cplane':
-            self.lmgr.nviz.OnCPlaneChangeDone(None)
-            idx = self._display.GetCPlaneCurrent() 
-            self.lmgr.nviz.UpdateCPlanePage(idx)
-            self.lmgr.nviz.FindWindowByName('cplaneHere').SetValue(False)
-            self.mouse['use'] = 'pointer'
-            self.SetCursor(self.cursors['default'])
         elif self.mouse["use"] in ('arrow', 'scalebar'):
             self.lmgr.nviz.FindWindowById(
                     self.lmgr.nviz.win['decoration'][self.mouse["use"]]['place']).SetValue(False)
@@ -1264,6 +1239,7 @@
             if plane == index:
                 self._display.SelectCPlane(plane)
                 self.cplanes[plane]['on'] = True
+                self._display.SetFenceColor(self.cplanes[plane]['shading'])
             else:
                 self._display.UnselectCPlane(plane)
                 try:
@@ -2126,7 +2102,7 @@
         #
         cplane = self.lmgr.nviz.FindWindowById(self.lmgr.nviz.win['cplane']['planes']).GetStringSelection()
         try:
-            planeIndex = int(cplane.split()[1])
+            planeIndex = int(cplane.split()[-1]) - 1
         except IndexError:
             planeIndex = None
         if planeIndex is not None:

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2011-09-09 12:54:50 UTC (rev 48222)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2011-09-09 18:33:40 UTC (rev 48223)
@@ -953,11 +953,7 @@
                       pos = (3, 1),  flag = wx.EXPAND|wx.ALIGN_RIGHT)
         gridSizer.Add(item = self.FindWindowById(self.win['cplane']['rotation']['tilt']['text']),
                       pos = (3, 2),
-                      flag = wx.ALIGN_CENTER)
-        boxSizer.Add(gridSizer, proportion = 0, flag = wx.EXPAND|wx.ALL, border = 5)
-                    
-        horSizer = wx.BoxSizer(wx.HORIZONTAL)
-        horSizer.Add(item = wx.Size(-1, -1), proportion = 1, flag = wx.ALL, border = 5)            
+                      flag = wx.ALIGN_CENTER)          
         
         # cutting pland height
         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
@@ -973,15 +969,11 @@
         gridSizer.Add(item = self.FindWindowById(self.win['cplane']['position']['z']['text']),
                       pos = (4, 2),
                       flag = wx.ALIGN_CENTER)
-           
-        # 'on display' button
-        posButton = wx.ToggleButton(parent = panel, id = wx.ID_ANY, label = _("On display"))
-        posButton.Bind(wx.EVT_TOGGLEBUTTON, self.OnCPlanePos)
-        posButton.SetName('cplaneHere')
-        self.win['cplane']['cplaneHere'] = posButton.GetId()
         
-        gridSizer.Add(item = posButton, pos = (0, 3), span = (2, 1), flag = wx.EXPAND)
-
+        boxSizer.Add(gridSizer, proportion = 0, flag = wx.EXPAND|wx.ALL, border = 5)
+                    
+        horSizer = wx.BoxSizer(wx.HORIZONTAL)
+        horSizer.Add(item = wx.Size(-1, -1), proportion = 1, flag = wx.ALL, border = 5)  
         # reset
         reset = wx.Button(parent = panel, id = wx.ID_ANY, label = _("Reset"))
         self.win['cplane']['reset'] = reset.GetId()
@@ -3926,7 +3918,7 @@
         """!Cutting plane selected"""
         plane = self.FindWindowById(self.win['cplane']['planes']).GetStringSelection()
         try:
-            planeIndex = int(plane.split()[1])
+            planeIndex = int(plane.split()[-1]) - 1
             self.EnablePage("cplane", enabled = True)
         except:
             planeIndex = -1
@@ -3940,7 +3932,7 @@
         """!Cutting plane is changing"""
         plane = self.FindWindowById(self.win['cplane']['planes']).GetStringSelection()
         try:
-            planeIndex = int(plane.split()[1])
+            planeIndex = int(plane.split()[-1]) - 1
         except:#TODO disabled page
             planeIndex = -1
     
@@ -3980,7 +3972,7 @@
         shading = self.FindWindowById(self.win['cplane']['shading']).GetSelection()
         plane = self.FindWindowById(self.win['cplane']['planes']).GetStringSelection()
         try:
-            planeIndex = int(plane.split()[1])
+            planeIndex = int(plane.split()[-1]) - 1
         except:#TODO disabled page
             planeIndex = -1
             
@@ -3995,7 +3987,7 @@
         """!Reset current cutting plane"""
         plane = self.FindWindowById(self.win['cplane']['planes']).GetStringSelection()
         try:
-            planeIndex = int(plane.split()[1])
+            planeIndex = int(plane.split()[-1]) - 1
         except:#TODO disabled page
             planeIndex = -1
         self.mapWindow.cplanes[planeIndex] = copy.deepcopy(UserSettings.Get(group = 'nviz',
@@ -4004,13 +3996,6 @@
         wx.PostEvent(self.mapWindow, event)
         self.OnCPlaneChangeDone(None)
         self.UpdateCPlanePage(planeIndex)
-        
-    def OnCPlanePos(self, event): 
-        """!Place cutting plane rotation center interactively"""
-        self.mapWindow.mouse['use'] = 'cplane'
-        self.mapWindow.SetCursor(self.mapWindow.cursors["cross"])
-        self.parent.curr_page.maptree.mapdisplay.SetFocus()
-        self.parent.curr_page.maptree.mapdisplay.Raise()
     
     def OnDecorationPlacement(self, event):
         """!Place an arrow/scalebar by clicking on display"""

Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py	2011-09-09 12:54:50 UTC (rev 48222)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py	2011-09-09 18:33:40 UTC (rev 48223)
@@ -575,7 +575,7 @@
                         }
                     },
                 'cplane' : {
-                    'shading': 0,
+                    'shading': 4,
                     'rotation':{
                         'rot': 0, 
                         'tilt': 0



More information about the grass-commit mailing list