[GRASS-SVN] r45759 - grass-addons/display/d.barb

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 26 07:22:14 EDT 2011


Author: hamish
Date: 2011-03-26 04:22:14 -0700 (Sat, 26 Mar 2011)
New Revision: 45759

Modified:
   grass-addons/display/d.barb/draw.c
   grass-addons/display/d.barb/grid.c
   grass-addons/display/d.barb/legend.c
   grass-addons/display/d.barb/points.c
Log:
run grass_indent.sh

Modified: grass-addons/display/d.barb/draw.c
===================================================================
--- grass-addons/display/d.barb/draw.c	2011-03-26 11:13:31 UTC (rev 45758)
+++ grass-addons/display/d.barb/draw.c	2011-03-26 11:22:14 UTC (rev 45759)
@@ -6,7 +6,7 @@
 #include <grass/glocale.h>
 #include "local_proto.h"
 
-#define RpD ((2 * M_PI) / 360.) 	/* radians/degree */
+#define RpD ((2 * M_PI) / 360.)	/* radians/degree */
 #define D2R(d) (double)(d * RpD)	/* degrees->radians */
 
 
@@ -16,7 +16,7 @@
 {
     G_debug(3, "in draw_barb()");
 
-//dbg:    unknown_(594578,4920392);
+    //dbg:    unknown_(594578,4920392);
 
     R_standard_color(color);
 
@@ -24,21 +24,23 @@
 	       (int)(D_u_to_d_row(northing) + 0.5));
 
     if (style != TYPE_BARB) {
-	if (velocity == velocity) /* ie not NaN */
+	if (velocity == velocity)	/* ie not NaN */
 	    arrow_mag(easting, northing, compass_deg, velocity, style);
 	else
-	    arrow_360(easting, northing, compass_deg, TYPE_GRASS, scale, style);
+	    arrow_360(easting, northing, compass_deg, TYPE_GRASS, scale,
+		      style);
     }
     else {
 	/* calc barb parameters */
-//dbg: compass_deg=0;
+	//dbg: compass_deg=0;
 	/* draw barb bits */
 	draw_circle(easting, northing, 10.0, FALSE);
-	draw_feather(easting, northing, 10.0 /*radius*/, velocity, compass_deg);
+	draw_feather(easting, northing, 10.0 /*radius */ , velocity,
+		     compass_deg);
 
-//dbg:      int i;
-//	for (i=0; i < 360; i+=20)
-//	    draw_feather(easting, northing, 20.0 /*radius*/, velocity, i);
+	//dbg:      int i;
+	//      for (i=0; i < 360; i+=20)
+	//          draw_feather(easting, northing, 20.0 /*radius*/, velocity, i);
 
     }
 
@@ -57,7 +59,8 @@
 
 /* draw an arrow, with magnitude and direction */
 /* angle is measured in degrees counter-clockwise from east */
-void arrow_mag(double easting, double northing, double theta, double length, int style)
+void arrow_mag(double easting, double northing, double theta, double length,
+	       int style)
 {
     double x, y, dx, dy, tail_x, tail_y;
     double theta_offset;
@@ -86,7 +89,7 @@
 
     if (style == TYPE_ARROW) {
 	theta_offset = theta + 20;
-	if(theta_offset > 360)
+	if (theta_offset > 360)
 	    theta_offset -= 360;
 
 	/* fin 1 */
@@ -124,22 +127,22 @@
 {
     SYMBOL *Symb;
     RGBA_Color *line_color, *fill_color;
-    int R,G,B;
+    int R, G, B;
     int Xpx, Ypx;
     int t, b, l, r;
     int color;
 
     line_color = G_malloc(sizeof(RGBA_Color));
     fill_color = G_malloc(sizeof(RGBA_Color));
-    Symb = S_read( "basic/cross1" );
+    Symb = S_read("basic/cross1");
 
     G_str_to_color("black", &R, &G, &B);
     line_color->r = (unsigned char)R;
     line_color->g = (unsigned char)G;
     line_color->b = (unsigned char)B;
     line_color->a = RGBA_COLOR_OPAQUE;
-//?
-//    R_RGB_color(R, G, B);
+    //?
+    //    R_RGB_color(R, G, B);
 
     color = G_str_to_color("yellow", &R, &G, &B);
     fill_color->r = (unsigned char)R;
@@ -147,20 +150,21 @@
     fill_color->b = (unsigned char)B;
     fill_color->a = RGBA_COLOR_OPAQUE;
 
-    S_stroke( Symb, 6, 0, 0 );
+    S_stroke(Symb, 6, 0, 0);
 
     D_get_screen_window(&t, &b, &l, &r);
     Xpx = (int)((perc_x * (r - l) / 100.) + 0.5);
-    Ypx = (int)(((100. - perc_y) * (b - t) / 100.)+0.5);
+    Ypx = (int)(((100. - perc_y) * (b - t) / 100.) + 0.5);
 
-    D_symbol( Symb, Xpx, Ypx, line_color, fill_color );
+    D_symbol(Symb, Xpx, Ypx, line_color, fill_color);
 
     return;
 }
 
 
 /* draws a circle at the map coords given by e,n.
-    radius is in display pixels, fill is boolean */
+   radius is in display pixels, fill is boolean */
+
 /*** change fill to int=0-8 for cloud cover? ***/
 void draw_circle(double easting, double northing, double radius, int fill)
 {
@@ -170,27 +174,29 @@
 
     G_debug(4, "draw_circle()");
 
-    n = (int)(360 / step) + 1; /* number of vertices */
+    n = (int)(360 / step) + 1;	/* number of vertices */
 
     xi = G_calloc(n + 1, sizeof(int));
     yi = G_calloc(n + 1, sizeof(int));
 
-    /* for loop moving around the circle */ 
+    /* for loop moving around the circle */
     for (i = 0; i <= n; i++) {
 	angle = D2R(step * i);
 	xi[i] = (int)floor(0.5 + D_u_to_d_col(easting) + radius * cos(angle));
-	yi[i] = (int)floor(0.5 + D_u_to_d_row(northing) + radius * sin(angle));
-	G_debug(5, "angle=%.2f   xi[%d]=%d  yi[%d]=%d", step*i, i, xi[i], i, yi[i]);
+	yi[i] =
+	    (int)floor(0.5 + D_u_to_d_row(northing) + radius * sin(angle));
+	G_debug(5, "angle=%.2f   xi[%d]=%d  yi[%d]=%d", step * i, i, xi[i], i,
+		yi[i]);
     }
 
-    /* close it*/
+    /* close it */
     xi[n] = xi[0];
     yi[n] = yi[0];
 
     if (fill)
-        R_polygon_abs(xi, yi, n);
+	R_polygon_abs(xi, yi, n);
     else
-        R_polyline_abs(xi, yi, n);
+	R_polyline_abs(xi, yi, n);
 
     G_free(xi);
     G_free(yi);
@@ -200,13 +206,13 @@
 
 
 /* draws the stem and tail of a wind barb centered at e,n.
-    radius is scaling in display pixels, velocity is assumed as knots,
-    angle is cartesian convention CCW from positive x-axis */
-void draw_feather(double easting, double northing, double radius, double velocity,
-		  double compass_deg)
+   radius is scaling in display pixels, velocity is assumed as knots,
+   angle is cartesian convention CCW from positive x-axis */
+void draw_feather(double easting, double northing, double radius,
+		  double velocity, double compass_deg)
 {
     double x, y, dx, dy, angle, rot_angle, flag_angle1, flag_angle2;
-    double stem_length = 5.;   /* length of tail */
+    double stem_length = 5.;	/* length of tail */
     double xd[4], yd[4];
     int i, xi[4], yi[4];
 
@@ -214,35 +220,36 @@
 
     /* barb points to FROM direction */
     angle = compass_deg - 90;
-    if(angle < 0)
+    if (angle < 0)
 	angle += 360;
-    else if(angle > 360)
+    else if (angle > 360)
 	angle -= 360;
 
     rot_angle = angle + 60;
-    if(rot_angle > 360)
+    if (rot_angle > 360)
 	rot_angle -= 360;
 
     flag_angle1 = rot_angle + 30;
-    if(flag_angle1 > 360)
+    if (flag_angle1 > 360)
 	flag_angle1 -= 360;
     /* for equilateral flag ~150 is good, try 45,195 */
     flag_angle2 = flag_angle1 + 150;
-    if(flag_angle2 > 360)
+    if (flag_angle2 > 360)
 	flag_angle2 -= 360;
 
 
-    G_debug(5, "  compass_deg=%.2f   angle=%.2f   rot_angle=%.2f", compass_deg, angle, rot_angle);
+    G_debug(5, "  compass_deg=%.2f   angle=%.2f   rot_angle=%.2f",
+	    compass_deg, angle, rot_angle);
 
     /* D_line_width(2); */
 
     if (velocity < 5) {
-	/*dot:	draw_circle(easting, northing, 2.0, TRUE); */
-	draw_circle(easting, northing, 3*radius/4, FALSE);
+	/*dot:  draw_circle(easting, northing, 2.0, TRUE); */
+	draw_circle(easting, northing, 3 * radius / 4, FALSE);
 	return;
     }
 
-//R_RGB_color(255, 0, 0);
+    //R_RGB_color(255, 0, 0);
     /* move to head */
     x = D_u_to_d_col(easting) + radius * cos(D2R(angle));
     y = D_u_to_d_row(northing) + radius * sin(D2R(angle));
@@ -254,104 +261,120 @@
     R_cont_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
 
     /* TODO: simplify following into loops */
-  if (velocity < 50) {
-//R_RGB_color(0, 255, 0);
-    if ( velocity >= 10 ) {
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 5) {
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+    if (velocity < 50) {
+	//R_RGB_color(0, 255, 0);
+	if (velocity >= 10) {
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 5) {
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-//R_RGB_color(0, 0, 255);
-    if ( velocity >= 20 ) {
-	dx = D_u_to_d_col(easting) + (stem_length - 0.5) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 0.5) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 15) {
-    	dx = D_u_to_d_col(easting) + (stem_length - 0.5) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 0.5) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	//R_RGB_color(0, 0, 255);
+	if (velocity >= 20) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  0.5) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   0.5) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 15) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  0.5) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   0.5) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-//R_RGB_color(0, 255, 255);
-    if ( velocity >= 30 ) {
-	dx = D_u_to_d_col(easting) + (stem_length - 1) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 1) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 25) {
-    	dx = D_u_to_d_col(easting) + (stem_length - 1) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 1) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	//R_RGB_color(0, 255, 255);
+	if (velocity >= 30) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  1) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   1) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 25) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  1) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   1) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-//R_RGB_color(255, 255, 0);
-    if ( velocity >= 40 ) {
-	dx = D_u_to_d_col(easting) + (stem_length - 1.5) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 1.5) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 35) {
-    	dx = D_u_to_d_col(easting) + (stem_length - 1.5) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 1.5) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	//R_RGB_color(255, 255, 0);
+	if (velocity >= 40) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  1.5) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   1.5) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 35) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  1.5) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   1.5) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-    if (velocity >= 45) {
-    	dx = D_u_to_d_col(easting) + (stem_length - 2) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 2) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	if (velocity >= 45) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  2) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   2) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
     }
-    else
-	return;
-  }
 
 
-//R_RGB_color(255, 0, 255);
+    //R_RGB_color(255, 0, 255);
     /* beyond 50 kts gets a filled triangle (flag) at the end */
-    if ( velocity >= 50 ) {
+    if (velocity >= 50) {
 	/* inner angle is same as barb lines, outer angle is perpendicular to the barb */
-	xd[0] = D_u_to_d_col(easting) + stem_length * radius * cos(D2R(angle));
-	yd[0] = D_u_to_d_row(northing) + stem_length * radius * sin(D2R(angle));
-	xd[1] = xd[0] + radius*2 * cos(D2R(flag_angle1));
-	yd[1] = yd[0] + radius*2 * sin(D2R(flag_angle1));
-	xd[2] = xd[1] + radius*2 * (2/sqrt(3)) * cos(D2R(flag_angle2)); /* cos(30)=sqrt(3)/2 */
-	yd[2] = yd[1] + radius*2 * (2/sqrt(3)) * sin(D2R(flag_angle2));
+	xd[0] =
+	    D_u_to_d_col(easting) + stem_length * radius * cos(D2R(angle));
+	yd[0] =
+	    D_u_to_d_row(northing) + stem_length * radius * sin(D2R(angle));
+	xd[1] = xd[0] + radius * 2 * cos(D2R(flag_angle1));
+	yd[1] = yd[0] + radius * 2 * sin(D2R(flag_angle1));
+	xd[2] = xd[1] + radius * 2 * (2 / sqrt(3)) * cos(D2R(flag_angle2));	/* cos(30)=sqrt(3)/2 */
+	yd[2] = yd[1] + radius * 2 * (2 / sqrt(3)) * sin(D2R(flag_angle2));
 	xd[3] = xd[0];
 	yd[3] = yd[0];
 
@@ -362,105 +385,123 @@
 	R_polygon_abs(xi, yi, 4);
     }
 
-  if ( velocity < 100 ) {
-  
-    if (velocity >= 60) {
-	dx = D_u_to_d_col(easting) + (stem_length - 1.6) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 1.6) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 55) {
-	dx = D_u_to_d_col(easting) + (stem_length - 1.6) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 1.6) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+    if (velocity < 100) {
 
-    if (velocity >= 70) {
-	dx = D_u_to_d_col(easting) + (stem_length - 2.1) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 2.1) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 65) {
-	dx = D_u_to_d_col(easting) + (stem_length - 2.1) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 2.1) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	if (velocity >= 60) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  1.6) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   1.6) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 55) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  1.6) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   1.6) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-    if (velocity >= 80) {
-	dx = D_u_to_d_col(easting) + (stem_length - 2.6) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 2.6) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 75) {
-	dx = D_u_to_d_col(easting) + (stem_length - 2.6) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 2.6) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	if (velocity >= 70) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  2.1) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   2.1) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 65) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  2.1) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   2.1) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-    if (velocity >= 90) {
-	dx = D_u_to_d_col(easting) + (stem_length - 3.1) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 3.1) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 85) {
-	dx = D_u_to_d_col(easting) + (stem_length - 3.1) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 3.1) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	if (velocity >= 80) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  2.6) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   2.6) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 75) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  2.6) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   2.6) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-    if (velocity >= 95) {
-    	dx = D_u_to_d_col(easting) + (stem_length - 3.6) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 3.6) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	if (velocity >= 90) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  3.1) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   3.1) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 85) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  3.1) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   3.1) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
+
+	if (velocity >= 95) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  3.6) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   3.6) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
     }
-    else
-	return;
-  }
 
     /* beyond 100 kts gets two 50kt flags at the end */
-    if ( velocity >= 100 ) {
+    if (velocity >= 100) {
 	/* inner angle is same as barb lines, outer angle is perpendicular to the barb */
 	xd[0] = xd[2];
 	yd[0] = yd[2];
-	xd[1] = xd[0] + radius*2 * cos(D2R(flag_angle1));
-	yd[1] = yd[0] + radius*2 * sin(D2R(flag_angle1));
-	xd[2] = xd[1] + radius*2 * (2/sqrt(3)) * cos(D2R(flag_angle2)); /* cos(30)=sqrt(3)/2 */
-	yd[2] = yd[1] + radius*2 * (2/sqrt(3)) * sin(D2R(flag_angle2));
+	xd[1] = xd[0] + radius * 2 * cos(D2R(flag_angle1));
+	yd[1] = yd[0] + radius * 2 * sin(D2R(flag_angle1));
+	xd[2] = xd[1] + radius * 2 * (2 / sqrt(3)) * cos(D2R(flag_angle2));	/* cos(30)=sqrt(3)/2 */
+	yd[2] = yd[1] + radius * 2 * (2 / sqrt(3)) * sin(D2R(flag_angle2));
 	xd[3] = xd[0];
 	yd[3] = yd[0];
 
@@ -472,112 +513,130 @@
     }
 
 
-  if ( velocity < 150 ) {
+    if (velocity < 150) {
 
-    if (velocity >= 110) {
-	dx = D_u_to_d_col(easting) + (stem_length - 2.8) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 2.8) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 105) {
-	dx = D_u_to_d_col(easting) + (stem_length - 2.8) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 2.8) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	if (velocity >= 110) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  2.8) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   2.8) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 105) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  2.8) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   2.8) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-    if (velocity >= 120) {
-	dx = D_u_to_d_col(easting) + (stem_length - 3.2) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 3.2) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 115) {
-	dx = D_u_to_d_col(easting) + (stem_length - 3.2) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 3.2) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	if (velocity >= 120) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  3.2) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   3.2) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 115) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  3.2) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   3.2) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-    if (velocity >= 130) {
-	dx = D_u_to_d_col(easting) + (stem_length - 3.7) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 3.7) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 125) {
-	dx = D_u_to_d_col(easting) + (stem_length - 3.7) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 3.7) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	if (velocity >= 130) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  3.7) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   3.7) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 125) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  3.7) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   3.7) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-    if (velocity >= 140) {
-	dx = D_u_to_d_col(easting) + (stem_length - 4.2) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 4.2) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius*2 * cos(D2R(rot_angle));
-	y = dy + radius*2 * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else if (velocity >= 135) {
-	dx = D_u_to_d_col(easting) + (stem_length - 4.2) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 4.2) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
-    }
-    else
-	return;
+	if (velocity >= 140) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  4.2) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   4.2) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * 2 * cos(D2R(rot_angle));
+	    y = dy + radius * 2 * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else if (velocity >= 135) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  4.2) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   4.2) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
 
-    if (velocity >= 145) {
-    	dx = D_u_to_d_col(easting) + (stem_length - 4.7) * radius * cos(D2R(angle));
-	dy = D_u_to_d_row(northing) + (stem_length - 4.7) * radius * sin(D2R(angle));
-	R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
-	x = dx + radius * cos(D2R(rot_angle));
-	y = dy + radius * sin(D2R(rot_angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	if (velocity >= 145) {
+	    dx = D_u_to_d_col(easting) + (stem_length -
+					  4.7) * radius * cos(D2R(angle));
+	    dy = D_u_to_d_row(northing) + (stem_length -
+					   4.7) * radius * sin(D2R(angle));
+	    R_move_abs((int)floor(dx + 0.5), (int)floor(dy + 0.5));
+	    x = dx + radius * cos(D2R(rot_angle));
+	    y = dy + radius * sin(D2R(rot_angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
 
-	R_move_abs((int)(D_u_to_d_col(easting) + 0.5),
-		   (int)(D_u_to_d_row(northing) + 0.5));
-	x = D_u_to_d_col(easting) + radius * cos(D2R(angle));
-	y = D_u_to_d_row(northing) + radius * sin(D2R(angle));
-	R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	    R_move_abs((int)(D_u_to_d_col(easting) + 0.5),
+		       (int)(D_u_to_d_row(northing) + 0.5));
+	    x = D_u_to_d_col(easting) + radius * cos(D2R(angle));
+	    y = D_u_to_d_row(northing) + radius * sin(D2R(angle));
+	    R_cont_abs((int)floor(x + 0.5), (int)floor(y + 0.5));
+	}
+	else
+	    return;
     }
-    else
-	return;
-  }
 
 
     /* beyond 150 kts gets three 50kt flags at the end */
-    if ( velocity >= 150 ) {
+    if (velocity >= 150) {
 	/* inner angle is same as barb lines, outer angle is perpendicular to the barb */
 	xd[0] = xd[2];
 	yd[0] = yd[2];
-	xd[1] = xd[0] + radius*2 * cos(D2R(flag_angle1));
-	yd[1] = yd[0] + radius*2 * sin(D2R(flag_angle1));
-	xd[2] = xd[1] + radius*2 * (2/sqrt(3)) * cos(D2R(flag_angle2)); /* cos(30)=sqrt(3)/2 */
-	yd[2] = yd[1] + radius*2 * (2/sqrt(3)) * sin(D2R(flag_angle2));
+	xd[1] = xd[0] + radius * 2 * cos(D2R(flag_angle1));
+	yd[1] = yd[0] + radius * 2 * sin(D2R(flag_angle1));
+	xd[2] = xd[1] + radius * 2 * (2 / sqrt(3)) * cos(D2R(flag_angle2));	/* cos(30)=sqrt(3)/2 */
+	yd[2] = yd[1] + radius * 2 * (2 / sqrt(3)) * sin(D2R(flag_angle2));
 	xd[3] = xd[0];
 	yd[3] = yd[0];
 

Modified: grass-addons/display/d.barb/grid.c
===================================================================
--- grass-addons/display/d.barb/grid.c	2011-03-26 11:13:31 UTC (rev 45758)
+++ grass-addons/display/d.barb/grid.c	2011-03-26 11:22:14 UTC (rev 45759)
@@ -141,7 +141,8 @@
 		    if (aspect_type == TYPE_GRASS)
 			arrow_mag(easting, northing, aspect_f, length, style);
 		    else
-			arrow_mag(easting, northing, 90 - aspect_f, length, style);
+			arrow_mag(easting, northing, 90 - aspect_f, length,
+				  style);
 		}
 		else {
 		    if (aspect_type == TYPE_GRASS) ;	//todo   arrow_360(aspect_f);

Modified: grass-addons/display/d.barb/legend.c
===================================================================
--- grass-addons/display/d.barb/legend.c	2011-03-26 11:13:31 UTC (rev 45758)
+++ grass-addons/display/d.barb/legend.c	2011-03-26 11:22:14 UTC (rev 45759)
@@ -31,12 +31,12 @@
 
 	G_debug(4, "Legend entry: %.15g at [%.2f,%.2f]", velo, px, py);
 
-// frame percent, utm, display pixels, raster array coords.  all -> utm ?
+	// frame percent, utm, display pixels, raster array coords.  all -> utm ?
 	/* convert screen percentage to east,north */
-// check if +.5 rounding is really needed
+	// check if +.5 rounding is really needed
 
 	Xpx = (int)((px * (r - l) / 100.) + 0.5);
-	Ypx = (int)(((100. - py) * (b - t) / 100.)+0.5);
+	Ypx = (int)(((100. - py) * (b - t) / 100.) + 0.5);
 	easting = D_d_to_u_col(Xpx);
 	northing = D_d_to_u_row(Ypx);
 
@@ -51,25 +51,24 @@
 	sprintf(buff, "%s", velo_list[i]);
 
 	/* Y: center justify: */
-	R_move_abs(Xpx, Ypx + key_fontsize/2);
+	R_move_abs(Xpx, Ypx + key_fontsize / 2);
 
 	/* X: right justify the text + 10px buffer (a wee bit more for wind barbs) */
- 	/* text width is 0.81 of text height? so even though we set width 
-           to txsiz with R_text_size(), we still have to reduce.. hmmm */
+	/* text width is 0.81 of text height? so even though we set width 
+	   to txsiz with R_text_size(), we still have to reduce.. hmmm */
 	if (style == TYPE_BARB)
 	    R_move_rel(-20 - (strlen(buff) * key_fontsize * 0.81), 0);
 	else
 	    R_move_rel(-10 - (strlen(buff) * key_fontsize * 0.81), 0);
-	
+
 	R_text_size(key_fontsize, key_fontsize);
 	R_text(buff);
 
 	/* arrow then starts at the given x-percent, to the right of the text */
-	R_move_abs(Xpx, Ypx + key_fontsize/2);
+	R_move_abs(Xpx, Ypx + key_fontsize / 2);
 	draw_barb(easting, northing, velo, angle, color, scale, style);
 
     }
 
     return;
 }
-

Modified: grass-addons/display/d.barb/points.c
===================================================================
--- grass-addons/display/d.barb/points.c	2011-03-26 11:13:31 UTC (rev 45758)
+++ grass-addons/display/d.barb/points.c	2011-03-26 11:22:14 UTC (rev 45759)
@@ -19,21 +19,21 @@
     int i;
     double peak = -DBL_MAX, scale_fact;
 
-//? needed?    static struct line_pnts *Points;
-//    /* Create and initialize struct's where to store points/lines and categories */
-//    Points = Vect_new_line_struct();
-//    Cats = Vect_new_cats_struct();
+    //? needed?    static struct line_pnts *Points;
+    //    /* Create and initialize struct's where to store points/lines and categories */
+    //    Points = Vect_new_line_struct();
+    //    Cats = Vect_new_cats_struct();
 
-    magn = NULL; /* init in case it isn't used */
+    magn = NULL;		/* init in case it isn't used */
 
     G_debug(0, "Doing sparse points ...");
 
     if ((mapset = G_find_vector2(vinput_name, "")) == NULL)
-        G_fatal_error(_("Vector map <%s> not found"), vinput_name);
+	G_fatal_error(_("Vector map <%s> not found"), vinput_name);
 
     /* Predetermine level at which a map will be opened for reading */
     if (Vect_set_open_level(2))
-        G_fatal_error(_("Unable to set predetermined vector open level"));
+	G_fatal_error(_("Unable to set predetermined vector open level"));
 
     /* Open existing vector for reading lib/vector/Vlib/open.c */
     if (1 > Vect_open_old(&vMap, vinput_name, mapset))
@@ -42,15 +42,15 @@
     G_debug(0, "<%s> is open", vinput_name);
 
     /* we need to scan through and find the greatest value in of the
-	magnitude within the current region and scale from that. hence
-	the following complexity ... */
+       magnitude within the current region and scale from that. hence
+       the following complexity ... */
     num_pts = count_pts_in_region(&vMap);
     G_debug(0, "  %d points found in region", num_pts);
 
     coord_x = G_calloc(num_pts + 1, sizeof(double));
     coord_y = G_calloc(num_pts + 1, sizeof(double));
     dirn = G_calloc(num_pts + 1, sizeof(double));
-    if(mag_v_col)
+    if (mag_v_col)
 	magn = G_calloc(num_pts + 1, sizeof(double));
     else
 	magn = NULL;
@@ -59,22 +59,22 @@
 		coord_x, coord_y, dirn, magn);
 
     if (aspect_type == TYPE_GRASS) {
-	for (i=0; i < num_pts; i++) {
-//	    G_debug(0, "in=%.1f  out=%.1f", dirn[i], 90-dirn[i] < 0 ? 360+90-dirn[i] : 90-dirn[i]);
+	for (i = 0; i < num_pts; i++) {
+	    //          G_debug(0, "in=%.1f  out=%.1f", dirn[i], 90-dirn[i] < 0 ? 360+90-dirn[i] : 90-dirn[i]);
 	    dirn[i] = 90 - dirn[i];
 	    if (dirn[i] < 0)
 		dirn[i] += 360;
 	}
     }
 
-// to figure out:
-//   also pass u,v columns and calc dir,mag prior to filling dirn,magn arrays
+    // to figure out:
+    //   also pass u,v columns and calc dir,mag prior to filling dirn,magn arrays
 
 
     /* somehow check, load attributes            see d.vect  */
 
 
-/*
+    /*
        if(is_component) {
        read u attrib;
        read v attrib;
@@ -88,22 +88,22 @@
 
        if (aspect_type == TYPE_COMPASS)
        dir = 90 - dir;
-*/
+     */
     peak = max_magnitude(magn, num_pts);
     G_debug(0, "  peak = %.2f", peak);
     if (style == TYPE_BARB && peak > 150)
 	G_warning(_("Maximum wind barb displayed is 150 knots"));
 
 
-    peak = 1.;    // TODO: window width * 0.20 
-    scale_fact = (peak ) * scale;
+    peak = 1.;			// TODO: window width * 0.20 
+    scale_fact = (peak) * scale;
 
-    for (i=0; i < num_pts; i++) {
+    for (i = 0; i < num_pts; i++) {
 	draw_barb(coord_x[i], coord_y[i], magn[i] * scale_fact, dirn[i],
 		  color, scale, style);
     }
 
-   Vect_close(&vMap);
+    Vect_close(&vMap);
 
     return;
 }
@@ -119,7 +119,7 @@
     G_debug(0, "count_pts_in_region()");
     G_get_window(&window);
     G_debug(0, "  n=%.2f s=%.2f e=%.2f w=%.2f", window.north, window.south,
-    	    window.east, window.west);
+	    window.east, window.west);
 
     /* Create and initialize struct's where to store points/lines and categories */
     Points = Vect_new_line_struct();
@@ -131,15 +131,15 @@
     Vect_rewind(Map);
 
     while (1) {
-        ltype = Vect_read_next_line(Map, Points, Cats);
-        switch (ltype) {
-        case -1:
-            G_fatal_error(_("Can't read vector map"));
-        case -2:                /* EOF */
-            return count;
-        }
+	ltype = Vect_read_next_line(Map, Points, Cats);
+	switch (ltype) {
+	case -1:
+	    G_fatal_error(_("Can't read vector map"));
+	case -2:		/* EOF */
+	    return count;
+	}
 
-	if(! (ltype & GV_POINTS))
+	if (!(ltype & GV_POINTS))
 	    continue;
 
 	if (Points->x[0] > window.east || Points->x[0] < window.west ||
@@ -149,14 +149,15 @@
 	count++;
     }
 
-    return -1; /* shouldn't get here */
+    return -1;			/* shouldn't get here */
 }
 
 
 /* populates arrays */
 /* rather redundant WRT count_pts_in_region() ... */
 void fill_arrays(struct Map_info *Map, int layer, char *dir_u, char *mag_v,
-		int is_uv, double *Xs, double *Ys, double *Dirs, double *Mags)
+		 int is_uv, double *Xs, double *Ys, double *Dirs,
+		 double *Mags)
 {
     int i, ltype, nrec;
     struct line_pnts *Points;
@@ -189,7 +190,7 @@
     Cats = Vect_new_cats_struct();
 
     db_CatValArray_init(&cvarr_dir_u);
-    if(Mags)
+    if (Mags)
 	db_CatValArray_init(&cvarr_mag_v);
 
 
@@ -197,20 +198,23 @@
 				 dir_u, NULL, &cvarr_dir_u);
     G_debug(0, "nrec (%s) = %d", dir_u, nrec);
 
-    if (cvarr_dir_u.ctype != DB_C_TYPE_INT && cvarr_dir_u.ctype != DB_C_TYPE_DOUBLE)
-	G_fatal_error(_("Direction/u column (%s) is not a numeric."),  dir_u);
+    if (cvarr_dir_u.ctype != DB_C_TYPE_INT &&
+	cvarr_dir_u.ctype != DB_C_TYPE_DOUBLE)
+	G_fatal_error(_("Direction/u column (%s) is not a numeric."), dir_u);
 
     if (nrec < 0)
 	G_fatal_error(_("Cannot select data (%s) from table"), dir_u);
     G_debug(0, "%d records selected from table", nrec);
 
-    if(Mags) {
+    if (Mags) {
 	nrec = db_select_CatValArray(driver, fi->table, fi->key,
-	    			     mag_v, NULL, &cvarr_mag_v);
+				     mag_v, NULL, &cvarr_mag_v);
 	G_debug(0, "nrec (%s) = %d", mag_v, nrec);
 
-	if (cvarr_mag_v.ctype != DB_C_TYPE_INT && cvarr_mag_v.ctype != DB_C_TYPE_DOUBLE)
-	    G_fatal_error(_("Magnitude/v column (%s) is not a numeric."),  mag_v);
+	if (cvarr_mag_v.ctype != DB_C_TYPE_INT &&
+	    cvarr_mag_v.ctype != DB_C_TYPE_DOUBLE)
+	    G_fatal_error(_("Magnitude/v column (%s) is not a numeric."),
+			  mag_v);
 
 	if (nrec < 0)
 	    G_fatal_error(_("Cannot select data (%s) from table"), mag_v);
@@ -221,18 +225,18 @@
     i = 0;
 
     while (1) {
-        ltype = Vect_read_next_line(Map, Points, Cats);
-        switch (ltype) {
-        case -1:
+	ltype = Vect_read_next_line(Map, Points, Cats);
+	switch (ltype) {
+	case -1:
 	    db_close_database_shutdown_driver(driver);
-            G_fatal_error(_("Can't read vector map"));
-        case -2:                /* EOF */
+	    G_fatal_error(_("Can't read vector map"));
+	case -2:		/* EOF */
 	    db_close_database_shutdown_driver(driver);
 	    G_debug(0, "  Array fill done.");
-            return;
-        }
+	    return;
+	}
 
-	if(! (ltype & GV_POINTS))
+	if (!(ltype & GV_POINTS))
 	    continue;
 
 	if (Points->x[0] > window.east || Points->x[0] < window.west ||
@@ -241,35 +245,37 @@
 
 	Xs[i] = Points->x[0];
 	Ys[i] = Points->y[0];
-	G_debug(5, "  Xs[%d] = %.2f  Ys[%d] = %.2f  cat = %d",  i, Xs[i],
+	G_debug(5, "  Xs[%d] = %.2f  Ys[%d] = %.2f  cat = %d", i, Xs[i],
 		i, Ys[i], Cats->cat[0]);
 
 	/* Read rotation from db */
-	if (db_CatValArray_get_value(&cvarr_dir_u, Cats->cat[0], &cv_dir_u) != DB_OK)
-	   Dirs[i] = 0.0/0.0; /* NaN */
+	if (db_CatValArray_get_value(&cvarr_dir_u, Cats->cat[0], &cv_dir_u) !=
+	    DB_OK)
+	    Dirs[i] = 0.0 / 0.0;	/* NaN */
 	else
 	    Dirs[i] = cvarr_dir_u.ctype == DB_C_TYPE_INT ?
-		 (double)cv_dir_u->val.i : cv_dir_u->val.d;
+		(double)cv_dir_u->val.i : cv_dir_u->val.d;
 
 
 	/* Read magnitude from db */
-	if(Mags) {
-	    if (db_CatValArray_get_value(&cvarr_mag_v, Cats->cat[0], &cv_mag_v) != DB_OK)
-		Mags[i] = 0.0/0.0; /* NaN */
+	if (Mags) {
+	    if (db_CatValArray_get_value
+		(&cvarr_mag_v, Cats->cat[0], &cv_mag_v) != DB_OK)
+		Mags[i] = 0.0 / 0.0;	/* NaN */
 	    else
 		Mags[i] = cvarr_mag_v.ctype == DB_C_TYPE_INT ?
-			(double)cv_mag_v->val.i : cv_mag_v->val.d;
+		    (double)cv_mag_v->val.i : cv_mag_v->val.d;
 
-	    if(Mags[i] < 0) /* magnitude is scalar and can only be positive */
+	    if (Mags[i] < 0)	/* magnitude is scalar and can only be positive */
 		Mags[i] = 0;
 	}
-	G_debug(5, "    Dirs[%d] = %.2f  Mags[%d] = %.2f",  i, Dirs[i],
+	G_debug(5, "    Dirs[%d] = %.2f  Mags[%d] = %.2f", i, Dirs[i],
 		i, Mags[i]);
 	i++;
     }
 
     db_close_database_shutdown_driver(driver);
-    return; /* shouldn't get here */
+    return;			/* shouldn't get here */
 }
 
 
@@ -278,8 +284,9 @@
 {
     double maxmag = -DBL_MAX;
     int i;
-    for(i = 0; i < n; i++) {
-	if(magn[i] > maxmag)
+
+    for (i = 0; i < n; i++) {
+	if (magn[i] > maxmag)
 	    maxmag = magn[i];
     }
     return maxmag;



More information about the grass-commit mailing list