Browse Source

wxNviz: switch (un)loading thematic mapping

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47471 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 14 years ago
parent
commit
bcc6978c4c

+ 1 - 1
gui/wxpython/gui_modules/nviz_mapdisp.py

@@ -1594,7 +1594,7 @@ class GLWindow(MapWindow, glcanvas.GLCanvas):
                                                color = data['thematic']['rgbcolumn'],
                                                color = data['thematic']['rgbcolumn'],
                                                size = data['thematic']['sizecolumn'])
                                                size = data['thematic']['sizecolumn'])
             else:
             else:
-                self._display.UnsetStyleThematic(id = id, layer = data['thematic']['layer'])
+                self._display.UnsetStyleThematic(id = id)
             data['thematic'].pop('update')
             data['thematic'].pop('update')
             
             
         # surface
         # surface

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

@@ -944,10 +944,9 @@ class Nviz(object):
         """!Set thematic style for vector points"""
         """!Set thematic style for vector points"""
         GP_set_style_thematic(id, layer, color, width, size, symbol)
         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):
     def UnsetVectorPointSurface(self, id, surf_id):
         """!Unset reference surface of vector set (points)
         """!Unset reference surface of vector set (points)

+ 1 - 0
include/gstypes.h

@@ -196,6 +196,7 @@ typedef struct g_vect_style
 /* Struct for vector map (thematic mapping) */
 /* Struct for vector map (thematic mapping) */
 typedef struct g_vect_style_thematic
 typedef struct g_vect_style_thematic
 {
 {
+    int active;
     int layer;
     int layer;
     
     
     char *color_column;  
     char *color_column;  

+ 1 - 0
include/ogsf_proto.h

@@ -64,6 +64,7 @@ int GP_get_sitename(int, char **);
 int GP_get_style(int, int *, int *, float *, int *);
 int GP_get_style(int, int *, int *, float *, int *);
 int GP_set_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_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_color(int, const char *);
 int GP_attmode_none(int);
 int GP_attmode_none(int);
 int GP_set_zmode(int, int);
 int GP_set_zmode(int, int);

+ 26 - 0
lib/ogsf/GP2.c

@@ -319,6 +319,7 @@ int GP_set_style_thematic(int id, int layer, const char* color, const char* widt
 	gp->tstyle = (gvstyle_thematic *)G_malloc(sizeof(gvstyle_thematic));
 	gp->tstyle = (gvstyle_thematic *)G_malloc(sizeof(gvstyle_thematic));
     G_zero(gp->tstyle, sizeof(gvstyle_thematic));
     G_zero(gp->tstyle, sizeof(gvstyle_thematic));
     
     
+    gp->tstyle->active = 1;
     gp->tstyle->layer = layer;
     gp->tstyle->layer = layer;
     if (color)
     if (color)
 	gp->tstyle->color_column = G_store(color);
 	gp->tstyle->color_column = G_store(color);
@@ -335,6 +336,31 @@ int GP_set_style_thematic(int id, int layer, const char* color, const char* widt
 }
 }
 
 
 /*!
 /*!
+   \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
    \brief Set z-mode
 
 
    \param id poin set id
    \param id poin set id

+ 1 - 0
lib/ogsf/gp.c

@@ -201,6 +201,7 @@ int gp_set_defaults(geosite * gp)
     gp->hstyle->color = 0xFF0000;
     gp->hstyle->color = 0xFF0000;
     gp->hstyle->size = dim / 150.;
     gp->hstyle->size = dim / 150.;
     gp->hstyle->symbol = ST_X;
     gp->hstyle->symbol = ST_X;
+    gp->tstyle = NULL;
 
 
     return 1;
     return 1;
 }
 }

+ 2 - 2
lib/ogsf/gpd.c

@@ -280,7 +280,7 @@ int gpd_2dsite(geosite * gp, geosurf * gs, int do_fast)
 		    else {
 		    else {
 			if (gpt->highlighted > 0)
 			if (gpt->highlighted > 0)
 			    gpd_obj(gs, gp->hstyle, site);
 			    gpd_obj(gs, gp->hstyle, site);
-			else if (gp->tstyle)
+			else if (gp->tstyle && gp->tstyle->active)
 			    gpd_obj(gs, gpt->style, site);
 			    gpd_obj(gs, gpt->style, site);
 			else
 			else
 			    gpd_obj(gs, gp->style, site);
 			    gpd_obj(gs, gp->style, site);
@@ -372,7 +372,7 @@ int gpd_3dsite(geosite * gp, float xo, float yo, int do_fast)
 	{
 	{
 	    if (gpt->highlighted > 0)
 	    if (gpt->highlighted > 0)
 		gpd_obj(NULL, gp->hstyle, site);
 		gpd_obj(NULL, gp->hstyle, site);
-	    else if (gp->tstyle)
+	    else if (gp->tstyle && gp->tstyle->active)
 		gpd_obj(NULL, gpt->style, site);
 		gpd_obj(NULL, gpt->style, site);
 	    else
 	    else
 		gpd_obj(NULL, gp->style, site);
 		gpd_obj(NULL, gp->style, site);