[GRASS-SVN] r32227 - in grass/trunk: gui/wxpython/gui_modules gui/wxpython/nviz include lib/nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 23 10:55:18 EDT 2008


Author: martinl
Date: 2008-07-23 10:55:18 -0400 (Wed, 23 Jul 2008)
New Revision: 32227

Modified:
   grass/trunk/gui/wxpython/gui_modules/nviz.py
   grass/trunk/gui/wxpython/nviz/draw.cpp
   grass/trunk/gui/wxpython/nviz/nviz.h
   grass/trunk/include/nviz.h
   grass/trunk/lib/nviz/draw.c
Log:
nviz2/wxGUI: render vector features OnVectorHeight()

Modified: grass/trunk/gui/wxpython/gui_modules/nviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz.py	2008-07-23 13:50:23 UTC (rev 32226)
+++ grass/trunk/gui/wxpython/gui_modules/nviz.py	2008-07-23 14:55:18 UTC (rev 32227)
@@ -78,7 +78,11 @@
         self.parent = parent # MapFrame
 
         self.init = False
-        self.render = True # render in full resolution
+        # render mode 
+        self.render = { 'quick' : False,
+                        # do not render vector lines in quick mode
+                        'vlines' : False,
+                        'vpoints' : False }
 
         # list of loaded map layers
         self.layers = {}
@@ -239,7 +243,7 @@
         #glRotatef((self.y - self.lastY) * yScale, 1.0, 0.0, 0.0);
         #glRotatef((self.x - self.lastX) * xScale, 0.0, 1.0, 0.0);
 
-        if self.render:
+        if self.render['quick'] is False:
             self.parent.onRenderGauge.Show()
             self.parent.onRenderGauge.SetRange(2)
             self.parent.onRenderGauge.SetValue(0)
@@ -256,12 +260,15 @@
 
             self.update.remove('view')
 
-        if self.render is True:
+        if self.render['quick'] is False:
             self.parent.onRenderGauge.SetValue(1)
             wx.Yield()
-            self.nvizClass.Draw(False)
-        elif self.render is False:
-            self.nvizClass.Draw(True) # quick
+            self.nvizClass.Draw(False, False, False)
+        elif self.render['quick'] is True:
+            # quick
+            self.nvizClass.Draw(True,
+                                self.render['vlines'],
+                                self.render['vpoints'])
         else: # None -> reuse last rendered image
             pass # TODO
 
@@ -269,7 +276,7 @@
 
         stop = time.clock()
 
-        if self.render:
+        if self.render['quick'] is False:
             self.parent.onRenderGauge.SetValue(2)
             # hide process bar
             self.parent.onRenderGauge.Hide()
@@ -279,8 +286,8 @@
         #
         # self.parent.StatusbarUpdate()
 
-        Debug.msg(3, "GLWindow.UpdateMap(): render=%s, -> time=%g" % \
-                      (self.render, (stop-start)))
+        Debug.msg(3, "GLWindow.UpdateMap(): quick=%d, -> time=%g" % \
+                      (self.render['quick'], (stop-start)))
 
         # print stop-start
 
@@ -2098,12 +2105,12 @@
         if winName == 'z-exag':
             self.mapWindow.update.append('z-exag')
         
-        self.mapWindow.render = False
+        self.mapWindow.render['quick'] = True
         self.mapWindow.Refresh(False)
 
     def OnViewChanged(self, event):
         """View changed, render in full resolution"""
-        self.mapWindow.render = True
+        self.mapWindow.render['quick'] = False
         self.mapWindow.Refresh(False)
 
     def OnViewChangedSpin(self, event):
@@ -2610,12 +2617,21 @@
 
         self.mapWindow.UpdateLayerProperties()
 
-        self.mapWindow.render = False
+        self.mapWindow.render['quick'] = True
+        self.mapWindow.render['v' + vtype] = True
         self.mapWindow.Refresh(False)
     
     def OnVectorHeightFull(self, event):
         """Vector height changed, render in full resolution"""
-        self.mapWindow.render = True
+        id = event.GetId()
+        if id == self.win['vector']['lines']['height']['spin'] or \
+                id == self.win['vector']['lines']['height']['slider']:
+            vtype = 'lines'
+        else:
+            vtype = 'points'
+
+        self.mapWindow.render['quick'] = False
+        self.mapWindow.render['v' + vtype] = False
         self.mapWindow.Refresh(False)
 
     def OnVectorHeightSpin(self, event):
@@ -2895,11 +2911,11 @@
                 self.mapWindow.view['pos']['y'] = y
             self.mapWindow.update.append('view')
 
-            self.mapWindow.render = False
+            self.mapWindow.render['quick'] = True
             self.mapWindow.Refresh(eraseBackground=False)
 
         elif event.LeftUp():
-            self.mapWindow.render = True
+            self.mapWindow.render['quick'] = False
             self.mapWindow.Refresh(eraseBackground=False)
         
         event.Skip()

Modified: grass/trunk/gui/wxpython/nviz/draw.cpp
===================================================================
--- grass/trunk/gui/wxpython/nviz/draw.cpp	2008-07-23 13:50:23 UTC (rev 32226)
+++ grass/trunk/gui/wxpython/nviz/draw.cpp	2008-07-23 14:55:18 UTC (rev 32227)
@@ -24,15 +24,15 @@
 
   \param quick true for forcing coarse draw mode 
 */
-void Nviz::Draw(bool quick)
+void Nviz::Draw(bool quick, bool quick_vlines, bool quick_vpoints)
 {
     Nviz_draw_cplane(data, -1, -1); // ?
 
     if (quick) {
-	Nviz_draw_quick(data); 
+	Nviz_draw_quick(data, quick_vlines, quick_vpoints); 
     }
     else {
-      Nviz_draw_all (data); 
+	Nviz_draw_all (data); 
     }
 
     G_debug(1, "Nviz::Draw(): quick=%d",

Modified: grass/trunk/gui/wxpython/nviz/nviz.h
===================================================================
--- grass/trunk/gui/wxpython/nviz/nviz.h	2008-07-23 13:50:23 UTC (rev 32226)
+++ grass/trunk/gui/wxpython/nviz/nviz.h	2008-07-23 14:55:18 UTC (rev 32227)
@@ -64,7 +64,7 @@
     int UnloadVector(int, bool);
 
     /* draw.cpp */
-    void Draw(bool);
+    void Draw(bool, bool, bool);
     void EraseMap();
 
     /* surface.cpp */

Modified: grass/trunk/include/nviz.h
===================================================================
--- grass/trunk/include/nviz.h	2008-07-23 13:50:23 UTC (rev 32226)
+++ grass/trunk/include/nviz.h	2008-07-23 14:55:18 UTC (rev 32227)
@@ -151,7 +151,7 @@
 int Nviz_draw_all_site(nv_data *);
 int Nviz_draw_all_vol(nv_data *);
 int Nviz_draw_all(nv_data *);
-int Nviz_draw_quick(nv_data *);
+int Nviz_draw_quick(nv_data *, int, int);
 
 /* exag.c */
 int Nviz_get_exag_height(float *, float *, float *);

Modified: grass/trunk/lib/nviz/draw.c
===================================================================
--- grass/trunk/lib/nviz/draw.c	2008-07-23 13:50:23 UTC (rev 32226)
+++ grass/trunk/lib/nviz/draw.c	2008-07-23 14:55:18 UTC (rev 32227)
@@ -238,7 +238,8 @@
 
   \return 1
 */
-int Nviz_draw_quick(nv_data *data)
+int Nviz_draw_quick(nv_data *data,
+		    int draw_vlines, int draw_vpoints)
 {
     GS_set_draw(GSD_BACK);
     
@@ -249,10 +250,14 @@
     /* draw surfaces */
     GS_alldraw_wire();
 
-    /* draw vector */
-    /* GV_alldraw_fastvect(); is broken */
-    /* GV_alldraw_vect(); */
+    /* draw vector lines */
+    if (draw_vlines)
+	GV_alldraw_fastvect();
 
+    /* draw vector points */
+    if (draw_vpoints)
+	GP_alldraw_site();
+
     /*
     vol_list = GVL_get_vol_list(&max);
     max = GVL_num_vols();



More information about the grass-commit mailing list