Browse Source

wxGUI/nviz: more icons (view/data/appearance) in the wxNViz toolbar -
thanks to Robert Szczepanek for new wxNviz icons


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

Martin Landa 14 years ago
parent
commit
9d68d0743c

BIN
gui/icons/grass2/3d-fringe.png


BIN
gui/icons/grass2/3d-light.png


BIN
gui/icons/grass2/3d-raster.png


BIN
gui/icons/grass2/3d-vector.png


BIN
gui/icons/grass2/3d-view.png


BIN
gui/icons/grass2/3d-volume.png


+ 24 - 16
gui/wxpython/gui_modules/nviz_tools.py

@@ -100,7 +100,8 @@ class NvizToolWindow(FN.FlatNotebook):
         """!Create view settings page"""
         """!Create view settings page"""
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel.SetupScrolling(scroll_x = False)
         panel.SetupScrolling(scroll_x = False)
-        self.page['view'] = { 'id' : 0 }
+        self.page['view'] = { 'id' : 0,
+                              'notebook' : self.GetId()}
         
         
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
         box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
@@ -302,10 +303,9 @@ class NvizToolWindow(FN.FlatNotebook):
         """!Create view settings page"""
         """!Create view settings page"""
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel.SetupScrolling(scroll_x = False)
         panel.SetupScrolling(scroll_x = False)
-        self.page['surface'] = {}
-        self.page['surface']['id'] = 1
-        self.page['surface']['panel'] = panel.GetId()
-        
+        self.page['surface'] = { 'id' : 0,
+                                 'panel' : panel.GetId(),
+                                 'notebook' : self.notebookData.GetId() }
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         
         
         self.win['surface'] = {}
         self.win['surface'] = {}
@@ -612,10 +612,9 @@ class NvizToolWindow(FN.FlatNotebook):
         """!Create view settings page"""
         """!Create view settings page"""
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel.SetupScrolling(scroll_x = False)
         panel.SetupScrolling(scroll_x = False)
-        self.page['vector'] = {}
-        self.page['vector']['id'] = 2
-        self.page['vector']['panel'] = panel.GetId()
-        
+        self.page['vector'] = { 'id' : 1,
+                                'panel' : panel.GetId(),
+                                'notebook' : self.notebookData.GetId() }
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         
         
         self.win['vector'] = {}
         self.win['vector'] = {}
@@ -876,10 +875,9 @@ class NvizToolWindow(FN.FlatNotebook):
         """!Create view settings page"""
         """!Create view settings page"""
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel.SetupScrolling(scroll_x = False)
         panel.SetupScrolling(scroll_x = False)
-        self.page['volume'] = {}
-        self.page['volume']['id'] = 3
-        self.page['volume']['panel'] = panel.GetId()
-        
+        self.page['volume'] = { 'id' : 2,
+                                'panel' : panel.GetId(),
+                                'notebook' : self.notebookData.GetId() }
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         
         
         self.win['volume'] = {}
         self.win['volume'] = {}
@@ -1117,7 +1115,8 @@ class NvizToolWindow(FN.FlatNotebook):
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel.SetupScrolling(scroll_x = False)
         panel.SetupScrolling(scroll_x = False)
         
         
-        self.page['light'] = { 'id' : 4 } 
+        self.page['light'] = { 'id' : 0, 
+                               'notebook' : self.notebookAppearance.GetId() }
         self.win['light'] = {}
         self.win['light'] = {}
         
         
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
@@ -1240,7 +1239,8 @@ class NvizToolWindow(FN.FlatNotebook):
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel = SP.ScrolledPanel(parent = self, id = wx.ID_ANY)
         panel.SetupScrolling(scroll_x = False)
         panel.SetupScrolling(scroll_x = False)
         
         
-        self.page['fringe'] = { 'id' : 2 } 
+        self.page['fringe'] = { 'id' : 1,
+                                'notebook' : self.notebookAppearance.GetId() }
         self.win['fringe'] = {}
         self.win['fringe'] = {}
 
 
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
@@ -2783,7 +2783,15 @@ class NvizToolWindow(FN.FlatNotebook):
         
         
     def SetPage(self, name):
     def SetPage(self, name):
         """!Get named page"""
         """!Get named page"""
-        self.SetSelection(self.page[name]['id'])
+        if name == 'view':
+            self.SetSelection(0)
+        elif name in ('surface', 'vector', 'volume'):
+            self.SetSelection(1)
+        else:
+            self.SetSelection(2)
+        win = self.FindWindowById(self.page[name]['notebook'])
+        
+        win.SetSelection(self.page[name]['id'])
 
 
 class PositionWindow(wx.Window):
 class PositionWindow(wx.Window):
     """!Abstract position control window, see subclasses
     """!Abstract position control window, see subclasses

+ 53 - 1
gui/wxpython/gui_modules/toolbars.py

@@ -1535,11 +1535,38 @@ class NvizToolbar(AbstractToolbar):
         
         
     def ToolbarData(self):
     def ToolbarData(self):
         """!Toolbar data"""
         """!Toolbar data"""
+        self.view = wx.NewId()
+        self.surface = wx.NewId()
+        self.vector = wx.NewId()
+        self.volume = wx.NewId()
+        self.light = wx.NewId()
+        self.fringe = wx.NewId()
         self.settings = wx.NewId()
         self.settings = wx.NewId()
         self.quit = wx.NewId()
         self.quit = wx.NewId()
-        
+
         # tool, label, bitmap, kind, shortHelp, longHelp, handler
         # tool, label, bitmap, kind, shortHelp, longHelp, handler
         return   (
         return   (
+            (self.view, "view", Icons["nvizView"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["nvizView"].GetLabel(), Icons["nvizView"].GetDesc(),
+             self.OnShowPage),
+            ("", "", "", "", "", "", ""),
+            (self.surface, "surface", Icons["nvizSurface"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["nvizSurface"].GetLabel(), Icons["nvizSurface"].GetDesc(),
+             self.OnShowPage),
+            (self.vector, "vector", Icons["nvizVector"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["nvizVector"].GetLabel(), Icons["nvizVector"].GetDesc(),
+             self.OnShowPage),
+            (self.volume, "volume", Icons["nvizVolume"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["nvizVolume"].GetLabel(), Icons["nvizVolume"].GetDesc(),
+             self.OnShowPage),
+            ("", "", "", "", "", "", ""),
+            (self.light, "light", Icons["nvizLight"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["nvizLight"].GetLabel(), Icons["nvizLight"].GetDesc(),
+             self.OnShowPage),
+            (self.fringe, "fringe", Icons["nvizFringe"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["nvizFringe"].GetLabel(), Icons["nvizFringe"].GetDesc(),
+             self.OnShowPage),
+            ("", "", "", "", "", "", ""),
             (self.settings, "settings", Icons["nvizSettings"].GetBitmap(),
             (self.settings, "settings", Icons["nvizSettings"].GetBitmap(),
              wx.ITEM_NORMAL, Icons["nvizSettings"].GetLabel(), Icons["nvizSettings"].GetDesc(),
              wx.ITEM_NORMAL, Icons["nvizSettings"].GetLabel(), Icons["nvizSettings"].GetDesc(),
              self.OnSettings),
              self.OnSettings),
@@ -1548,6 +1575,31 @@ class NvizToolbar(AbstractToolbar):
              self.OnExit),
              self.OnExit),
             )
             )
     
     
+    def OnShowPage(self, event):
+        """!Go to the selected page"""
+        lmgr = self.parent.GetLayerManager()
+        if not lmgr or not hasattr(lmgr, "nviz"):
+            event.Skip()
+            return
+        
+        eId = event.GetId()
+        if eId == self.view:
+            lmgr.nviz.SetPage('view')
+        elif eId == self.surface:
+            lmgr.nviz.SetPage('surface')
+        elif eId == self.surface:
+            lmgr.nviz.SetPage('surface')
+        elif eId == self.vector:
+            lmgr.nviz.SetPage('vector')
+        elif eId == self.volume:
+            lmgr.nviz.SetPage('volume')
+        elif eId == self.light:
+            lmgr.nviz.SetPage('light')
+        elif eId == self.fringe:
+            lmgr.nviz.SetPage('fringe')
+        
+        lmgr.Raise()
+        
     def OnSettings(self, event):
     def OnSettings(self, event):
         """!Show nviz notebook page"""
         """!Show nviz notebook page"""
         if not self.settingsDialog:
         if not self.settingsDialog:

+ 7 - 0
gui/wxpython/icons/grass2_icons.py

@@ -109,6 +109,13 @@ IconsGrass2 = {
     "pythonSave"     : 'python-export.png',
     "pythonSave"     : 'python-export.png',
     "modelProperties" : 'options.png',
     "modelProperties" : 'options.png',
     "modelVariables" : 'modeler-variables.png',
     "modelVariables" : 'modeler-variables.png',
+    # 3d view
+    "nvizView"       : '3d-view.png',
+    "nvizSurface"    : '3d-raster.png',
+    "nvizVector"     : '3d-vector.png',
+    "nvizVolume"     : '3d-volume.png',
+    "nvizLight"      : '3d-light.png',
+    "nvizFringe"     : '3d-fringe.png',
     # various
     # various
     "settings"       : 'settings.png',
     "settings"       : 'settings.png',
     'redraw'         : 'redraw.png',
     'redraw'         : 'redraw.png',

+ 7 - 0
gui/wxpython/icons/grass_icons.py

@@ -111,6 +111,13 @@ IconsGrass = {
     "pythonSave"     : wx.ART_ERROR,
     "pythonSave"     : wx.ART_ERROR,
     "modelProperties" : wx.ART_ERROR,
     "modelProperties" : wx.ART_ERROR,
     "modelVariables" : wx.ART_ERROR,
     "modelVariables" : wx.ART_ERROR,
+    # 3d view
+    "nvizView"       : wx.ART_ERROR,
+    "nvizSurface"    : wx.ART_ERROR,
+    "nvizVector"     : wx.ART_ERROR,
+    "nvizVolume"     : wx.ART_ERROR,
+    "nvizLight"      : wx.ART_ERROR,
+    "nvizFringe"     : wx.ART_ERROR,
     # various
     # various
     "settings"       : 'edit-color.gif',
     "settings"       : 'edit-color.gif',
     "redraw"         : 'gui-display.gif',
     "redraw"         : 'gui-display.gif',

+ 12 - 0
gui/wxpython/icons/icon.py

@@ -335,6 +335,18 @@ Icons = {
                             label=_("Settings"),
                             label=_("Settings"),
                             desc=_("Settings dialog for georectification tool")),
                             desc=_("Settings dialog for georectification tool")),
     # nviz
     # nviz
+    "nvizView": MetaIcon (img=Icons["nvizView"],
+                          label=_("Go to view control page")),
+    "nvizSurface": MetaIcon (img=Icons["nvizSurface"],
+                          label=_("Go to surface (raster) control page")),
+    "nvizVector": MetaIcon (img=Icons["nvizVector"],
+                          label=_("Go to vector (2D/3D) control page")),
+    "nvizVolume": MetaIcon (img=Icons["nvizVolume"],
+                          label=_("Go to volume (3D raster) control page")),
+    "nvizLight": MetaIcon (img=Icons["nvizLight"],
+                          label=_("Go to lighting control page")),
+    "nvizFringe": MetaIcon (img=Icons["nvizFringe"],
+                          label=_("Go to fringe control page")),
     "nvizSettings": MetaIcon (img=Icons["settings"],
     "nvizSettings": MetaIcon (img=Icons["settings"],
                               label=_("3D view mode tools"),
                               label=_("3D view mode tools"),
                               desc=_("Show/hide 3D view mode tools dialog")),
                               desc=_("Show/hide 3D view mode tools dialog")),

+ 7 - 0
gui/wxpython/icons/silk_icons.py

@@ -113,6 +113,13 @@ IconsSilk = {
     "pythonSave"     : wx.ART_ERROR,
     "pythonSave"     : wx.ART_ERROR,
     "modelProperties" : wx.ART_ERROR,
     "modelProperties" : wx.ART_ERROR,
     "modelVariables" : wx.ART_ERROR,
     "modelVariables" : wx.ART_ERROR,
+    # 3d view
+    "nvizView"       : wx.ART_ERROR,
+    "nvizSurface"    : wx.ART_ERROR,
+    "nvizVector"     : wx.ART_ERROR,
+    "nvizVolume"     : wx.ART_ERROR,
+    "nvizLight"      : wx.ART_ERROR,
+    "nvizFringe"     : wx.ART_ERROR,
     # various
     # various
     "settings"     : 'color_swatch.png',
     "settings"     : 'color_swatch.png',
     "redraw"       : 'arrow_refresh.png',
     "redraw"       : 'arrow_refresh.png',