浏览代码

wxGUI/nviz: minor clean up (nviz_mapdisp)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42355 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 年之前
父节点
当前提交
509b94baec

+ 8 - 7
gui/wxpython/gui_modules/mapdisp.py

@@ -308,9 +308,10 @@ class MapFrame(wx.Frame):
         Add defined toolbar to the window
 
         Currently known toolbars are:
-        - map basic map toolbar
-        - digit vector digitizer
-        - georect georectifier
+         - 'map'     - basic map toolbar
+         - 'vdigit'  - vector digitizer
+         - 'georect' - georectifier
+         - 'nviz'    - 3D view mode
         """
         # default toolbar
         if name == "map":
@@ -377,7 +378,7 @@ class MapFrame(wx.Frame):
         # nviz
         elif name == "nviz":
             import nviz
-
+            
             # check for GLCanvas and OpenGL
             msg = None
             if not nviz.haveGLCanvas:
@@ -389,7 +390,7 @@ class MapFrame(wx.Frame):
                 msg = _("Unable to switch to 3D display mode.\nThe Nviz python extension "
                         "was not found or loaded properly.\n"
                         "Switching back to 2D display mode.\n\nDetails: %s" % nviz.errorMsg)
-
+            
             if msg:
                 self.toolbars['map'].combo.SetValue (_("2D view"))
                 wx.MessageBox(parent=self,
@@ -397,13 +398,13 @@ class MapFrame(wx.Frame):
                               caption=_("Error"),
                               style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
                 return
-
+            
             #
             # add Nviz toolbar and disable 2D display mode tools
             #
             self.toolbars['nviz'] = toolbars.NvizToolbar(self, self.Map)
             self.toolbars['map'].Enable2D(False)
-
+            
             #
             # update layer tree (-> enable 3d-rasters)
             #

+ 12 - 12
gui/wxpython/gui_modules/mapdisp_window.py

@@ -483,20 +483,20 @@ class BufferedWindow(MapWindow, wx.Window):
         If self.redrawAll is False on self.pdcTmp content is re-drawn
         """
         Debug.msg(4, "BufferedWindow.OnPaint(): redrawAll=%s" % self.redrawAll)
-
+        
         dc = wx.BufferedPaintDC(self, self.buffer)
         
         ### dc.SetBackground(wx.Brush("White"))
         dc.Clear()
-
+        
         # use PrepareDC to set position correctly
         self.PrepareDC(dc)
-
+        
         # create a clipping rect from our position and size
         # and update region
         rgn = self.GetUpdateRegion().GetBox()
         dc.SetClippingRect(rgn)
-
+        
         switchDraw = False
         if self.redrawAll is None:
             self.redrawAll = True
@@ -505,7 +505,7 @@ class BufferedWindow(MapWindow, wx.Window):
         if self.redrawAll: # redraw pdc and pdcVector
             # draw to the dc using the calculated clipping rect
             self.pdc.DrawToDCClipped(dc, rgn)
-
+            
             # draw vector map layer
             if self.pdcVector:
                 # decorate with GDDC (transparency)
@@ -515,13 +515,13 @@ class BufferedWindow(MapWindow, wx.Window):
                 except NotImplementedError, e:
                     print >> sys.stderr, e
                     self.pdcVector.DrawToDCClipped(dc, rgn)
-
+            
             self.bufferLast = None
         else: # do not redraw pdc and pdcVector
             if self.bufferLast is None:
                 # draw to the dc
                 self.pdc.DrawToDC(dc)
-
+                
                 if self.pdcVector:
                     # decorate with GDDC (transparency)
                     try:
@@ -534,11 +534,11 @@ class BufferedWindow(MapWindow, wx.Window):
                 # store buffered image
                 # self.bufferLast = wx.BitmapFromImage(self.buffer.ConvertToImage())
                 self.bufferLast = dc.GetAsBitmap(wx.Rect(0, 0, self.Map.width, self.Map.height))
-
+            
             pdcLast = self.PseudoDC(vdigit = False)
             pdcLast.DrawBitmap(self.bufferLast, 0, 0, False)
             pdcLast.DrawToDC(dc)
-
+        
         # draw decorations (e.g. region box)
         try:
             gcdc = wx.GCDC(dc)
@@ -546,14 +546,14 @@ class BufferedWindow(MapWindow, wx.Window):
         except NotImplementedError, e:
             print >> sys.stderr, e
             self.pdcDec.DrawToDC(dc)
-
+        
         # draw temporary object on the foreground
         ### self.pdcTmp.DrawToDCClipped(dc, rgn)
         self.pdcTmp.DrawToDC(dc)
-
+        
         if switchDraw:
             self.redrawAll = False
-                
+        
     def OnSize(self, event):
         """!
         Scale map image so that it is

文件差异内容过多而无法显示
+ 235 - 244
gui/wxpython/gui_modules/nviz_mapdisp.py


+ 2 - 2
gui/wxpython/gui_modules/toolbars.py

@@ -1350,8 +1350,8 @@ class NvizToolbar(AbstractToolbar):
             (self.settings, "settings", Icons["nvizSettings"].GetBitmap(),
              wx.ITEM_NORMAL, Icons["nvizSettings"].GetLabel(), Icons["nvizSettings"].GetDesc(),
              self.OnSettings),
-            (self.quit, 'quit', Icons["quit"].GetBitmap(),
-             wx.ITEM_NORMAL, Icons["quit"].GetLabel(), Icons["quit"].GetDesc(),
+            (self.quit, 'quit', Icons["nvizQuit"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["nvizQuit"].GetLabel(), Icons["nvizQuit"].GetDesc(),
              self.OnExit),
             )
     

+ 4 - 3
gui/wxpython/gui_modules/wxnviz.py

@@ -119,7 +119,7 @@ class Nviz(object):
         return Nviz_change_exag(self.data, z_exag)
     
     def Draw(self, quick, quick_mode):
-        """!Draw map
+        """!Draw canvas
         
         Draw quick mode:
          - DRAW_QUICK_SURFACE
@@ -130,6 +130,8 @@ class Nviz(object):
         @param quick if true draw in wiremode
         @param quick_mode quick mode
         """
+        Debug.msg(3, "Nviz::Draw(): quick=%d", quick)
+        
         Nviz_draw_cplane(self.data, -1, -1) # ?
         
         if quick:
@@ -137,8 +139,6 @@ class Nviz(object):
         else:
             Nviz_draw_all(self.data)
         
-        Debug.msg(3, "Nviz::Draw(): quick=%d", quick)
-        
     def EraseMap(self):
         """!Erase map display (with background color)
         """
@@ -1092,3 +1092,4 @@ class Nviz(object):
         ret = GVL_isosurf_set_drawres(id, res, res, res)
         
         return -2 if ret < 0 else 1
+    

+ 1 - 1
gui/wxpython/icons/grass_icons.py

@@ -105,7 +105,7 @@ IconsGrass = {
     "grGcpReload"  : 'gui-redraw.gif',
     "grSettings"   : 'edit-color.gif', 
     # nviz 
-    "nvizSettings" : 'edit-color.gif',  
+    "nvizSettings" : 'edit-color.gif',
     # modeler
     "modelActionAdd" : wx.ART_ERROR,
     "modelDataAdd"   : wx.ART_ERROR,

+ 8 - 4
gui/wxpython/icons/icon.py

@@ -138,10 +138,11 @@ class MetaIcon:
 Icons = {
     # map display
     "displaymap" : MetaIcon (img=Icons["displaymap"],
-                             label=_("Display map")),
+                             label=_("Display map"),
+                             desc = _("Re-render modified map layers")),
     "rendermap"  : MetaIcon (img=Icons["rendermap"],
                              label=_("Re-render map"),
-                             desc=_("Force re-rendering of all layers")),
+                             desc=_("Force re-rendering all map layers")),
     "erase"      : MetaIcon (img=Icons["erase"],
                              label=_("Erase display")),
     "pointer"    : MetaIcon (img=Icons["pointer"],
@@ -334,8 +335,11 @@ Icons = {
                             desc=_("Settings dialog for georectification tool")),
     # nviz
     "nvizSettings": MetaIcon (img=Icons["nvizSettings"],
-                              label=_("Settings"),
-                              desc=_("Show Nviz settings dialog")),
+                              label=_("3D view mode tools"),
+                              desc=_("Show/hide 3D view mode tools dialog")),
+    "nvizQuit": MetaIcon (img=Icons["quit"],
+                          label=_("Quit 3D view mode"),
+                          desc=_("Switch back to 2D view mode")),
     # modeler
     "modelNew" : MetaIcon (img=Icons["fileNew"],
                            label=_("Create new model (Ctrl+N)")),