|
@@ -11,7 +11,7 @@ int write_grid(struct grid_description *grid_info, struct Map_info *Map, int nbr
|
|
|
int i, k, j;
|
|
|
int rows, cols;
|
|
|
int num_v_rows, num_v_cols;
|
|
|
- double x, y, x_len;
|
|
|
+ double x, y, x_len, y_len;
|
|
|
double sx, sy;
|
|
|
double width, length;
|
|
|
double next_x, next_y;
|
|
@@ -36,10 +36,10 @@ int write_grid(struct grid_description *grid_info, struct Map_info *Map, int nbr
|
|
|
* line is less than half way around the globe
|
|
|
*/
|
|
|
x_len = length / (1. * nbreaks + 1);
|
|
|
+ y_len = width / (1. * nbreaks + 1);
|
|
|
|
|
|
/* write out all the vector lengths (x vectors) of the entire grid */
|
|
|
G_verbose_message(_("Writing out vector rows..."));
|
|
|
-
|
|
|
y = grid_info->origin_y;
|
|
|
for (i = 0; i < num_v_rows; ++i) {
|
|
|
double startx;
|
|
@@ -79,29 +79,37 @@ int write_grid(struct grid_description *grid_info, struct Map_info *Map, int nbr
|
|
|
/* write out all the vector widths (y vectors) of the entire grid */
|
|
|
G_verbose_message(_("Writing out vector columns..."));
|
|
|
x = grid_info->origin_x;
|
|
|
- for (k = 0; k < num_v_cols; ++k) {
|
|
|
- y = grid_info->origin_y;
|
|
|
- G_percent(k, num_v_cols, 2);
|
|
|
-
|
|
|
- i = 0;
|
|
|
- do {
|
|
|
- next_y = y + width;
|
|
|
-
|
|
|
- sx = x;
|
|
|
- sy = y;
|
|
|
- snext_y = next_y;
|
|
|
- dum = x;
|
|
|
- rotate(&x, &y, grid_info->origin_x, grid_info->origin_y, angle);
|
|
|
- rotate(&dum, &next_y, grid_info->origin_x, grid_info->origin_y,
|
|
|
- angle);
|
|
|
-
|
|
|
- write_vect(x, y, dum, next_y, Map, Points, out_type);
|
|
|
-
|
|
|
- x = sx;
|
|
|
- y = next_y = snext_y;
|
|
|
- i++;
|
|
|
- } while (i < rows);
|
|
|
- /* To get exactly the same coordinates as above, x+=length is wrong */
|
|
|
+ for (i = 0; i < num_v_cols; ++i) {
|
|
|
+ double starty;
|
|
|
+ starty = grid_info->origin_y;
|
|
|
+ G_percent(i, num_v_cols, 2);
|
|
|
+
|
|
|
+ for (k = 0; k < rows; k++) {
|
|
|
+ y = starty;
|
|
|
+ j = 0;
|
|
|
+ do {
|
|
|
+ if (j < nbreaks)
|
|
|
+ next_y = y + y_len;
|
|
|
+ else
|
|
|
+ next_y = starty + width;
|
|
|
+
|
|
|
+ sx = x;
|
|
|
+ sy = y;
|
|
|
+ snext_y = next_y;
|
|
|
+ dum = x;
|
|
|
+ rotate(&x, &y, grid_info->origin_x, grid_info->origin_y, angle);
|
|
|
+ rotate(&dum, &next_y, grid_info->origin_x, grid_info->origin_y,
|
|
|
+ angle);
|
|
|
+
|
|
|
+ write_vect(x, y, dum, next_y, Map, Points, out_type);
|
|
|
+
|
|
|
+ x = sx;
|
|
|
+ y = next_y = snext_y;
|
|
|
+ j++;
|
|
|
+ } while (j <= nbreaks);
|
|
|
+ /* To get exactly the same coordinates as above, y+=width is wrong */
|
|
|
+ starty += width;
|
|
|
+ }
|
|
|
x += length;
|
|
|
}
|
|
|
|