[GRASS-SVN] r47471 - in grass/trunk: gui/wxpython/gui_modules include lib/ogsf

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 7 03:43:05 EDT 2011


Author: annakrat
Date: 2011-08-07 00:43:05 -0700 (Sun, 07 Aug 2011)
New Revision: 47471

Modified:
   grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/wxnviz.py
   grass/trunk/include/gstypes.h
   grass/trunk/include/ogsf_proto.h
   grass/trunk/lib/ogsf/GP2.c
   grass/trunk/lib/ogsf/gp.c
   grass/trunk/lib/ogsf/gpd.c
Log:
wxNviz: switch (un)loading thematic mapping

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-08-06 19:37:29 UTC (rev 47470)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2011-08-07 07:43:05 UTC (rev 47471)
@@ -1594,7 +1594,7 @@
                                                color = data['thematic']['rgbcolumn'],
                                                size = data['thematic']['sizecolumn'])
             else:
-                self._display.UnsetStyleThematic(id = id, layer = data['thematic']['layer'])
+                self._display.UnsetStyleThematic(id = id)
             data['thematic'].pop('update')
             
         # surface

Modified: grass/trunk/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxnviz.py	2011-08-06 19:37:29 UTC (rev 47470)
+++ grass/trunk/gui/wxpython/gui_modules/wxnviz.py	2011-08-07 07:43:05 UTC (rev 47471)
@@ -944,10 +944,9 @@
         """!Set thematic style for vector points"""
         GP_set_style_thematic(id, layer, color, width, size, symbol)
         
-    def UnsetStyleThematic(self, id, layer):
-        """!Set thematic style None for vector points"""
-        # this should be done in another way
-        GP_set_style_thematic(id, layer, None, None, None, None)
+    def UnsetStyleThematic(self, id):
+        """!Unset thematic style for vector points"""
+        GP_unset_style_thematic(id)
         
     def UnsetVectorPointSurface(self, id, surf_id):
         """!Unset reference surface of vector set (points)

Modified: grass/trunk/include/gstypes.h
===================================================================
--- grass/trunk/include/gstypes.h	2011-08-06 19:37:29 UTC (rev 47470)
+++ grass/trunk/include/gstypes.h	2011-08-07 07:43:05 UTC (rev 47471)
@@ -196,6 +196,7 @@
 /* Struct for vector map (thematic mapping) */
 typedef struct g_vect_style_thematic
 {
+    int active;
     int layer;
     
     char *color_column;  

Modified: grass/trunk/include/ogsf_proto.h
===================================================================
--- grass/trunk/include/ogsf_proto.h	2011-08-06 19:37:29 UTC (rev 47470)
+++ grass/trunk/include/ogsf_proto.h	2011-08-07 07:43:05 UTC (rev 47471)
@@ -64,6 +64,7 @@
 int GP_get_style(int, int *, int *, float *, int *);
 int GP_set_style(int, int, int, float, int);
 int GP_set_style_thematic(int, int, const char *, const char *, const char *, const char *);
+int GP_unset_style_thematic(int);
 int GP_attmode_color(int, const char *);
 int GP_attmode_none(int);
 int GP_set_zmode(int, int);

Modified: grass/trunk/lib/ogsf/GP2.c
===================================================================
--- grass/trunk/lib/ogsf/GP2.c	2011-08-06 19:37:29 UTC (rev 47470)
+++ grass/trunk/lib/ogsf/GP2.c	2011-08-07 07:43:05 UTC (rev 47471)
@@ -319,6 +319,7 @@
 	gp->tstyle = (gvstyle_thematic *)G_malloc(sizeof(gvstyle_thematic));
     G_zero(gp->tstyle, sizeof(gvstyle_thematic));
     
+    gp->tstyle->active = 1;
     gp->tstyle->layer = layer;
     if (color)
 	gp->tstyle->color_column = G_store(color);
@@ -335,6 +336,31 @@
 }
 
 /*!
+   \brief Make style for thematic mapping inactive
+   
+   \param id point set id
+
+   \return 1 on success
+   \return -1 on error (point set not found)
+ */
+int GP_unset_style_thematic(int id)
+{
+    geosite *gp;
+
+    G_debug(4, "GP_unset_style_thematic(): id=%d", id);
+
+    if (NULL == (gp = gp_get_site(id))) {
+	return -1;
+    }
+
+    if (gp->tstyle) {
+	gp->tstyle->active = 0;
+    }
+
+    return 1;
+}
+
+/*!
    \brief Set z-mode
 
    \param id poin set id

Modified: grass/trunk/lib/ogsf/gp.c
===================================================================
--- grass/trunk/lib/ogsf/gp.c	2011-08-06 19:37:29 UTC (rev 47470)
+++ grass/trunk/lib/ogsf/gp.c	2011-08-07 07:43:05 UTC (rev 47471)
@@ -201,6 +201,7 @@
     gp->hstyle->color = 0xFF0000;
     gp->hstyle->size = dim / 150.;
     gp->hstyle->symbol = ST_X;
+    gp->tstyle = NULL;
 
     return 1;
 }

Modified: grass/trunk/lib/ogsf/gpd.c
===================================================================
--- grass/trunk/lib/ogsf/gpd.c	2011-08-06 19:37:29 UTC (rev 47470)
+++ grass/trunk/lib/ogsf/gpd.c	2011-08-07 07:43:05 UTC (rev 47471)
@@ -280,7 +280,7 @@
 		    else {
 			if (gpt->highlighted > 0)
 			    gpd_obj(gs, gp->hstyle, site);
-			else if (gp->tstyle)
+			else if (gp->tstyle && gp->tstyle->active)
 			    gpd_obj(gs, gpt->style, site);
 			else
 			    gpd_obj(gs, gp->style, site);
@@ -372,7 +372,7 @@
 	{
 	    if (gpt->highlighted > 0)
 		gpd_obj(NULL, gp->hstyle, site);
-	    else if (gp->tstyle)
+	    else if (gp->tstyle && gp->tstyle->active)
 		gpd_obj(NULL, gpt->style, site);
 	    else
 		gpd_obj(NULL, gp->style, site);



More information about the grass-commit mailing list