[GRASS-SVN] r41260 - grass/branches/develbranch_6/display/d.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 2 05:42:05 EST 2010


Author: hamish
Date: 2010-03-02 05:42:04 -0500 (Tue, 02 Mar 2010)
New Revision: 41260

Modified:
   grass/branches/develbranch_6/display/d.vect/local_proto.h
   grass/branches/develbranch_6/display/d.vect/main.c
   grass/branches/develbranch_6/display/d.vect/plot1.c
Log:
use size= option as scale factor when size_column is used (merge from trunk r41252)

Modified: grass/branches/develbranch_6/display/d.vect/local_proto.h
===================================================================
--- grass/branches/develbranch_6/display/d.vect/local_proto.h	2010-03-02 10:25:29 UTC (rev 41259)
+++ grass/branches/develbranch_6/display/d.vect/local_proto.h	2010-03-02 10:42:04 UTC (rev 41260)
@@ -4,7 +4,7 @@
 int close_vect(FILE *);
 int plot1(struct Map_info *, int, int, struct cat_list *,
 	  const struct color_rgb *, const struct color_rgb *, int, char *,
-	  int, char *, char *, int, int, int, char *, int, char *, double,
+	  double, char *, char *, int, int, int, char *, int, char *, double,
 	  int, char *);
 int label(struct Map_info *, int, int, struct cat_list *, LATTR *, int);
 int topo(struct Map_info *, int, int, LATTR *);

Modified: grass/branches/develbranch_6/display/d.vect/main.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/main.c	2010-03-02 10:25:29 UTC (rev 41259)
+++ grass/branches/develbranch_6/display/d.vect/main.c	2010-03-02 10:42:04 UTC (rev 41260)
@@ -83,7 +83,7 @@
     int r, g, b;
     int has_color, has_fcolor;
     struct color_rgb color, fcolor;
-    int size;
+    double size;
     int default_width;
     double width_scale;
     int verbose = FALSE;
@@ -224,10 +224,12 @@
 
     size_opt = G_define_option();
     size_opt->key = "size";
-    size_opt->type = TYPE_INTEGER;
+    size_opt->type = TYPE_DOUBLE;
     size_opt->answer = "5";
     size_opt->guisection = _("Symbols");
-    size_opt->description = _("Symbol size");
+    size_opt->label = _("Symbol size");
+    size_opt->description =
+	_("When used with the size_column option this becomes the scale factor");
 
     sizecolumn_opt = G_define_standard_option(G_OPT_COLUMN);
     sizecolumn_opt->key = "size_column";
@@ -479,7 +481,7 @@
 	G_fatal_error(_("Unknown color: '%s'"), fcolor_opt->answer);
     }
 
-    size = atoi(size_opt->answer);
+    size = atof(size_opt->answer);
 
     /* Make sure map is available */
     mapset = G_find_vector2(map_name, "");

Modified: grass/branches/develbranch_6/display/d.vect/plot1.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/plot1.c	2010-03-02 10:25:29 UTC (rev 41259)
+++ grass/branches/develbranch_6/display/d.vect/plot1.c	2010-03-02 10:42:04 UTC (rev 41260)
@@ -128,7 +128,7 @@
 /* *************************************************************** */
 int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 	  const struct color_rgb *color, const struct color_rgb *fcolor,
-	  int chcat, char *symbol_name, int size, char *size_column,
+	  int chcat, char *symbol_name, double size, char *size_column,
 	  char *rot_column, int id_flag, int table_colors_flag,
 	  int cats_color_flag, char *rgb_column, int default_width,
 	  char *width_column, double width_scale, int z_color_flag,
@@ -158,7 +158,7 @@
     SYMBOL *Symb = NULL;
     double var_size, rotation;
 
-    var_size = (double)size;
+    var_size = size;
     rotation = 0.0;
     nerror_rgb = 0;
 
@@ -337,7 +337,7 @@
 	if (Symb == NULL)
 	    G_warning(_("Unable to read symbol, unable to display points"));
 	else
-	    S_stroke(Symb, size, 0.0, 0);
+	    S_stroke(Symb, (int)(size + 0.5), 0.0, 0);
     }
 
     if (open_db)
@@ -580,10 +580,10 @@
 		    /* Read symbol size from db for current symbol # */
 		    if (db_CatValArray_get_value(&cvarr_size, cat, &cv_size) !=
 			DB_OK) {
-			var_size = (double)size;
+			var_size = size;
 		    }
 		    else {
-			var_size =
+			var_size = size *
 			    (cvarr_size.ctype == DB_C_TYPE_INT ?
 			     (double)cv_size->val.i : cv_size->val.d);
 
@@ -591,12 +591,12 @@
 			    G_warning(_("Error in symbol size column (%s), element %d "
 					"with cat %d: symbol size [%f]"),
 				      size_column, line, cat, var_size);
-			    var_size = (double)size;
+			    var_size = size;
 			}
 		    }
 		}		/* end if cat */
 		else {
-		    var_size = (double)size;
+		    var_size = size;
 		}
 	    }		/* end if nrec_size */
 
@@ -653,7 +653,7 @@
 		D_symbol(Symb, x0, y0, line_color, fill_color);
 
 	    /* reset to defaults */
-	    var_size = (double)size;
+	    var_size = size;
 	    rotation = 0.0;
 	}
 	else if (color || custom_rgb || (z_color_flag && Vect_is_3d(Map))) {



More information about the grass-commit mailing list