[GRASS-SVN] r45809 - grass/trunk/display/d.grid
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Mar 30 01:09:00 EDT 2011
Author: hamish
Date: 2011-03-29 22:09:00 -0700 (Tue, 29 Mar 2011)
New Revision: 45809
Modified:
grass/trunk/display/d.grid/fiducial.c
grass/trunk/display/d.grid/local_proto.h
grass/trunk/display/d.grid/main.c
grass/trunk/display/d.grid/plot.c
Log:
new flag to display '.' at grid points (nice as intermediates between grid lines; merge from devbr6)
Modified: grass/trunk/display/d.grid/fiducial.c
===================================================================
--- grass/trunk/display/d.grid/fiducial.c 2011-03-30 05:03:10 UTC (rev 45808)
+++ grass/trunk/display/d.grid/fiducial.c 2011-03-30 05:09:00 UTC (rev 45809)
@@ -9,19 +9,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;
@@ -43,6 +48,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/trunk/display/d.grid/local_proto.h
===================================================================
--- grass/trunk/display/d.grid/local_proto.h 2011-03-30 05:03:10 UTC (rev 45808)
+++ grass/trunk/display/d.grid/local_proto.h 2011-03-30 05:09:00 UTC (rev 45809)
@@ -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/trunk/display/d.grid/main.c
===================================================================
--- grass/trunk/display/d.grid/main.c 2011-03-30 05:03:10 UTC (rev 45808)
+++ grass/trunk/display/d.grid/main.c 2011-03-30 05:09:00 UTC (rev 45809)
@@ -39,7 +39,7 @@
struct GModule *module;
struct Option *opt1, *opt2, *opt3, *opt4, *fsize, *tcolor, *lwidth;
struct Flag *noborder, *notext, *geogrid, *nogrid, *wgs84, *cross,
- *fiducial, *align;
+ *fiducial, *dot, *align;
struct pj_info info_in; /* Proj structures */
struct pj_info info_out; /* Proj structures */
struct Cell_head wind;
@@ -119,6 +119,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");
@@ -169,12 +173,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;
if (align->answer || strcmp(opt2->answer, "0") == 0)
G__get_window(&wind, "", "WIND", G_mapset());
Modified: grass/trunk/display/d.grid/plot.c
===================================================================
--- grass/trunk/display/d.grid/plot.c 2011-03-30 05:03:10 UTC (rev 45808)
+++ grass/trunk/display/d.grid/plot.c 2011-03-30 05:09:00 UTC (rev 45809)
@@ -129,8 +129,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