[GRASS-SVN] r45808 - grass/branches/develbranch_6/display/d.grid

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 30 01:03:10 EDT 2011


Author: hamish
Date: 2011-03-29 22:03:10 -0700 (Tue, 29 Mar 2011)
New Revision: 45808

Modified:
   grass/branches/develbranch_6/display/d.grid/fiducial.c
   grass/branches/develbranch_6/display/d.grid/local_proto.h
   grass/branches/develbranch_6/display/d.grid/main.c
   grass/branches/develbranch_6/display/d.grid/plot.c
Log:
new flag to display '.' at grid points (nice as intermediates between grid lines)

Modified: grass/branches/develbranch_6/display/d.grid/fiducial.c
===================================================================
--- grass/branches/develbranch_6/display/d.grid/fiducial.c	2011-03-30 03:49:40 UTC (rev 45807)
+++ grass/branches/develbranch_6/display/d.grid/fiducial.c	2011-03-30 05:03:10 UTC (rev 45808)
@@ -8,19 +8,24 @@
 
 void plot_cross(double easting, double northing, int color, double rotation)
 {
-    plot_symbol(easting, northing, color, rotation, "basic/cross1");
+    plot_symbol(easting, northing, color, rotation, "basic/cross1",
+		MARK_CROSS);
 }
 
-
 void plot_fiducial(double easting, double northing, int color,
 		   double rotation)
 {
-    plot_symbol(easting, northing, color, rotation + 45.0, "extra/fiducial");
+    plot_symbol(easting, northing, color, rotation + 45.0, "extra/fiducial",
+		MARK_FIDUCIAL);
 }
 
+void plot_dot(double easting, double northing, int color)
+{
+    plot_symbol(easting, northing, color, 0.0, "basic/point", MARK_DOT);
+}
 
 void plot_symbol(double easting, double northing, int color, double rotation,
-		 char *symbol_name)
+		 char *symbol_name, int mark_type)
 {
     SYMBOL *Symb;
     RGBA_Color *line_color, *fill_color;
@@ -46,6 +51,13 @@
 
     fill_color->a = RGBA_COLOR_NONE;
 
+    if(mark_type == MARK_DOT) {
+	size = 5;
+	fill_color->r = (unsigned char)R;
+	fill_color->g = (unsigned char)G;
+	fill_color->b = (unsigned char)B;
+	fill_color->a = RGBA_COLOR_OPAQUE;
+    }
 
     Symb = S_read(symbol_name);
     if (!Symb)

Modified: grass/branches/develbranch_6/display/d.grid/local_proto.h
===================================================================
--- grass/branches/develbranch_6/display/d.grid/local_proto.h	2011-03-30 03:49:40 UTC (rev 45807)
+++ grass/branches/develbranch_6/display/d.grid/local_proto.h	2011-03-30 05:03:10 UTC (rev 45808)
@@ -17,8 +17,10 @@
 #define MARK_GRID     0
 #define MARK_CROSS    1
 #define MARK_FIDUCIAL 2
+#define MARK_DOT      3
 
 /* fiducial.c */
 void plot_cross(double, double, int, double);
 void plot_fiducial(double, double, int, double);
-void plot_symbol(double, double, int, double, char *);
+void plot_symbol(double, double, int, double, char *, int);
+void plot_dot(double, double, int);

Modified: grass/branches/develbranch_6/display/d.grid/main.c
===================================================================
--- grass/branches/develbranch_6/display/d.grid/main.c	2011-03-30 03:49:40 UTC (rev 45807)
+++ grass/branches/develbranch_6/display/d.grid/main.c	2011-03-30 05:03:10 UTC (rev 45808)
@@ -40,7 +40,7 @@
     struct GModule *module;
     struct Option *opt1, *opt2, *opt3, *opt4, *fsize, *tcolor, *lwidth;
     struct Flag *noborder, *notext, *geogrid, *nogrid, *wgs84, *cross,
-	*fiducial;
+	*fiducial, *dot;
     struct pj_info info_in;	/* Proj structures */
     struct pj_info info_out;	/* Proj structures */
 
@@ -114,6 +114,10 @@
     cross->key = 'c';
     cross->description = _("Draw '+' marks instead of grid lines");
 
+    dot = G_define_flag();
+    dot->key = 'd';
+    dot->description = _("Draw '.' marks instead of grid lines");
+
     fiducial = G_define_flag();
     fiducial->key = 'f';
     fiducial->description = _("Draw fiducial marks instead of grid lines");
@@ -164,12 +168,14 @@
     fontsize = atoi(fsize->answer);
 
     mark_type = MARK_GRID;
-    if (cross->answer && fiducial->answer)
+    if (cross->answer + fiducial->answer + dot->answer > 1)
 	G_fatal_error(_("Choose a single mark style"));
     if (cross->answer)
 	mark_type = MARK_CROSS;
     if (fiducial->answer)
 	mark_type = MARK_FIDUCIAL;
+    if (dot->answer)
+	mark_type = MARK_DOT;
 
     /* get grid size */
     if (geogrid->answer) {

Modified: grass/branches/develbranch_6/display/d.grid/plot.c
===================================================================
--- grass/branches/develbranch_6/display/d.grid/plot.c	2011-03-30 03:49:40 UTC (rev 45807)
+++ grass/branches/develbranch_6/display/d.grid/plot.c	2011-03-30 05:03:10 UTC (rev 45808)
@@ -132,8 +132,10 @@
 	    while (y <= window.north) {
 		if (mark_type == MARK_CROSS)
 		    plot_cross(x, y, gcolor, 0.0);
-		if (mark_type == MARK_FIDUCIAL)
+		else if (mark_type == MARK_FIDUCIAL)
 		    plot_fiducial(x, y, gcolor, 0.0);
+		else if (mark_type == MARK_DOT)
+		    plot_dot(x, y, gcolor);
 		y += grid_size;
 	    }
 	    x += grid_size;



More information about the grass-commit mailing list