[GRASS-SVN] r45585 - grass/trunk/ps/ps.map
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Mar 6 06:57:18 EST 2011
Author: martinl
Date: 2011-03-06 03:57:18 -0800 (Sun, 06 Mar 2011)
New Revision: 45585
Added:
grass/trunk/ps/ps.map/r_instructions.c
Removed:
grass/trunk/ps/ps.map/read_key.c
Modified:
grass/trunk/ps/ps.map/local_proto.h
grass/trunk/ps/ps.map/main.c
Log:
ps.map: read_from_keyboard() renamed to read_instructions()
Modified: grass/trunk/ps/ps.map/local_proto.h
===================================================================
--- grass/trunk/ps/ps.map/local_proto.h 2011-03-06 10:45:16 UTC (rev 45584)
+++ grass/trunk/ps/ps.map/local_proto.h 2011-03-06 11:57:18 UTC (rev 45585)
@@ -198,10 +198,10 @@
void reset_map_location(void);
void print_papers(void);
-/* read_key.c */
-void read_from_keyboard(FILE *, struct PS_data *, int, int, int,
- struct scalebar *, int *, int *,
- struct PS_group *);
+/* r_instructions.c */
+void read_instructions(FILE *, struct PS_data *, int, int, int,
+ struct scalebar *, int *, int *,
+ struct PS_group *);
/* r_border.c */
int read_border(void);
Modified: grass/trunk/ps/ps.map/main.c
===================================================================
--- grass/trunk/ps/ps.map/main.c 2011-03-06 10:45:16 UTC (rev 45584)
+++ grass/trunk/ps/ps.map/main.c 2011-03-06 11:57:18 UTC (rev 45585)
@@ -245,8 +245,8 @@
G_get_set_window(&PS.w);
Rast_set_window(&PS.w);
- read_from_keyboard(inputfd, &PS, copies_set, ps_copies, can_reset_scale,
- &sb, &do_mapinfo, &do_vlegend, &grp);
+ read_instructions(inputfd, &PS, copies_set, ps_copies, can_reset_scale,
+ &sb, &do_mapinfo, &do_vlegend, &grp);
/* reset map location base on 'paper' on 'location' */
reset_map_location();
Copied: grass/trunk/ps/ps.map/r_instructions.c (from rev 45580, grass/trunk/ps/ps.map/read_key.c)
===================================================================
--- grass/trunk/ps/ps.map/r_instructions.c (rev 0)
+++ grass/trunk/ps/ps.map/r_instructions.c 2011-03-06 11:57:18 UTC (rev 45585)
@@ -0,0 +1,464 @@
+#include <string.h>
+
+#include <grass/colors.h>
+#include <grass/imagery.h>
+#include <grass/glocale.h>
+
+#include "local_proto.h"
+
+#define KEY(x) (strcmp(key,x)==0)
+
+static char *help[] = {
+ "rast rastermap setcolor val_range(s) color",
+ "vpoints vector points map scalebar [f|s]",
+ "vlines vector lines map paper [a4|a3|us-letter|...]",
+ "vareas vector areas map maploc x y [width height]",
+ "labels labelfile text east north text",
+ "region regionfile line east north east north",
+ "grid spacing point east north",
+ "geogrid spacing header",
+ "outline mapinfo",
+ "colortable [y|n] vlegend",
+ "comments [unix-file] psfile PostScript include file",
+ "read unix-file eps Encapsulated PostScript file",
+ "rectangle east north east north",
+ "scale 1:#|# inches|# panels|1 inch = # miles",
+ "border [y|n]",
+ ""
+};
+
+void read_instructions(FILE *inputfd, struct PS_data *PS,
+ int copies_set, int ps_copies, int can_reset_scale,
+ struct scalebar *sb, int *do_mapinfo, int *do_vlegend,
+ struct PS_group *grp)
+{
+ int i;
+ int iflag;
+ char name[GNAME_MAX], mapset[GMAPSET_MAX];
+ char buf[1024];
+
+ iflag = 0;
+
+ while (1) {
+ char *key;
+ char *data;
+
+ if (!input(1, buf, help)) {
+ if (!iflag) {
+ if (G_getl2(buf, 12, inputfd))
+ G_warning(_("Data exists after final 'end' instruction!"));
+ break;
+ }
+ iflag = 0;
+ continue;
+ }
+ if (!key_data(buf, &key, &data))
+ continue;
+
+ if (KEY("read")) {
+ if (inputfd != stdin)
+ fclose(inputfd);
+
+ if (sscanf(data, "%s", name) != 1) {
+ error(key, data, "no file specified");
+ inputfd = stdin;
+ }
+ else if ((inputfd = fopen(name, "r")) == NULL) {
+ error(key, data, "unable to open");
+ inputfd = stdin;
+ }
+ else
+ iflag = 1;
+ continue;
+ }
+
+ if (KEY("paper")) {
+ if (strlen(data) > 0) {
+ set_paper(data);
+ }
+ read_paper();
+
+ continue;
+ }
+
+ if (KEY("maploc")) {
+ int n;
+ double x, y, w, h;
+
+ n = sscanf(data, "%lf %lf %lf %lf", &x, &y, &w, &h);
+ if (n == 2 || n == 4) {
+ PS->map_x_orig = x;
+ PS->map_y_loc = y;
+ if (n == 4) {
+ PS->map_width = w;
+ PS->map_height = h;
+ }
+ }
+ else {
+ error(key, data, "illegal maploc request");
+ gobble_input();
+ }
+ continue;
+ }
+
+ if (KEY("copies")) {
+ int n, copies;
+
+ if (copies_set)
+ continue;
+ n = sscanf(data, "%d", &copies);
+ if (n != 1 || copies < 1 || copies > 20) {
+ ps_copies = 1;
+ error(key, data, "illegal copies request");
+ }
+ ps_copies = copies;
+ continue;
+ }
+
+ if (KEY("setcolor")) {
+ float R, G, B;
+ int r, g, b;
+ int color;
+ int count;
+ DCELL *val_list;
+ DCELL dmin, dmax;
+ char colorbuf[100];
+ char catsbuf[100];
+
+ if (PS->cell_fd < 0) {
+ error(key, data, "no raster map selected yet");
+ continue;
+ }
+ if (sscanf(data, "%s %[^\n]", catsbuf, colorbuf) == 2) {
+ color = get_color_number(colorbuf);
+ if (color < 0) {
+ error(key, data, "illegal color");
+ continue;
+ }
+ get_color_rgb(color, &R, &G, &B);
+ r = 255.0 * R;
+ g = 255.0 * G;
+ b = 255.0 * B;
+
+ if (strncmp(catsbuf, "null", 4) == 0) {
+ Rast_set_null_value_color(r, g, b, &(PS->colors));
+ continue;
+ }
+ if (strncmp(catsbuf, "default", 7) == 0) {
+ Rast_set_default_color(r, g, b, &(PS->colors));
+ continue;
+ }
+ if ((count = parse_val_list(catsbuf, &val_list)) < 0) {
+ error(key, data, "illegal value list");
+ continue;
+ }
+ for (i = 0; i < count; i += 2) {
+ dmin = val_list[i];
+ dmax = val_list[i + 1];
+ Rast_add_d_color_rule(&dmin, r, g, b, &dmax, r, g, b,
+ &(PS->colors));
+ }
+ G_free(val_list);
+ }
+ continue;
+ }
+
+ if (KEY("colortable")) {
+ PS->do_colortable = 0;
+ /*
+ if (PS->cell_fd < 0)
+ error(key, data, "no raster map selected yet");
+ else
+ */
+ PS->do_colortable = yesno(key, data);
+ if (PS->do_colortable)
+ read_colortable();
+ continue;
+ }
+
+ if (KEY("border")) {
+ PS->do_border = yesno(key, data);
+ if (PS->do_border)
+ read_border();
+ continue;
+ }
+
+ if (KEY("scalebar")) {
+ if (G_projection() == PROJECTION_LL) {
+ error(key, data,
+ "scalebar is not appropriate for this projection");
+ gobble_input();
+ }
+ PS->do_scalebar = 1;
+ if (sscanf(data, "%s", sb->type) != 1)
+ strcpy(sb->type, "f"); /* default to fancy scalebar */
+ read_scalebar();
+ if (sb->length <= 0.) {
+ error(key, data, "Bad scalebar length");
+ gobble_input();
+ }
+ continue;
+ }
+
+ if (KEY("text")) {
+ double e, n;
+ char east[50], north[50];
+ char text[1024];
+
+ if (sscanf(data, "%s %s %[^\n]", east, north, text) == 3
+ && (scan_easting(east, &e) && scan_northing(north, &n)))
+ read_text(east, north, text);
+ else {
+ gobble_input();
+ error(key, data, "illegal text request");
+ }
+ continue;
+ }
+
+ if (KEY("point")) {
+ double e, n;
+ char east[50], north[50];
+
+ if (sscanf(data, "%s %s", east, north) == 2
+ && (scan_easting(east, &e) && scan_northing(north, &n)))
+ read_point(e, n);
+ else {
+ gobble_input();
+ error(key, data, "illegal point request");
+ }
+ continue;
+ }
+
+ if (KEY("eps")) {
+ double e, n;
+ char east[50], north[50];
+
+ if (sscanf(data, "%s %s", east, north) == 2
+ && (scan_easting(east, &e) && scan_northing(north, &n)))
+ read_eps(e, n);
+ else {
+ gobble_input();
+ error(key, data, "illegal eps request");
+ }
+ continue;
+ }
+
+ if (KEY("line")) {
+ char east1[50], north1[50];
+ char east2[50], north2[50];
+ double e1, n1, e2, n2;
+
+ if (sscanf(data, "%s %s %s %s", east1, north1, east2, north2) == 4
+ && (scan_easting(east1, &e1) && scan_easting(east2, &e2)
+ && scan_northing(north1, &n1) &&
+ scan_northing(north2, &n2)))
+ read_line(e1, n1, e2, n2);
+ else {
+ gobble_input();
+ error(key, data, "illegal line request");
+ }
+ continue;
+ }
+
+ if (KEY("rectangle")) {
+ char east1[50], north1[50];
+ char east2[50], north2[50];
+ double e1, n1, e2, n2;
+
+ if (sscanf(data, "%s %s %s %s", east1, north1, east2, north2) == 4
+ && (scan_easting(east1, &e1) && scan_easting(east2, &e2)
+ && scan_northing(north1, &n1) &&
+ scan_northing(north2, &n2)))
+ read_rectangle(e1, n1, e2, n2);
+ else {
+ gobble_input();
+ error(key, data, "illegal rectangle request");
+ }
+ continue;
+ }
+
+ if (KEY("comments")) {
+ switch (sscanf(data, "%s %s", name, mapset)) {
+ case 1:
+ read_comment(name);
+ break;
+ case 2:
+ error(key, data, "illegal comments request");
+ break;
+ default:
+ read_comment("");
+ break;
+ }
+ continue;
+ }
+
+ if (KEY("scale")) {
+ if (!can_reset_scale)
+ continue;
+ if (check_scale(data))
+ strcpy(PS->scaletext, data);
+ else {
+ PS->scaletext[0] = 0;
+ error(key, data, "illegal scale request");
+ }
+ continue;
+ }
+
+ if (KEY("labels")) {
+ if (scan_gis("paint/labels", "label", key, data, name, mapset, 1))
+ read_labels(name, mapset);
+ continue;
+ }
+
+ if (KEY("header")) {
+ read_header();
+ PS->do_header = 1;
+ continue;
+ }
+
+ if (KEY("mapinfo")) {
+ read_info();
+ *do_mapinfo = 1;
+ continue;
+ }
+
+ if (KEY("vlegend")) {
+ read_vlegend();
+ *do_vlegend = 1;
+ continue;
+ }
+
+ if (KEY("outline")) {
+ if (PS->cell_fd < 0) {
+ error(key, data, "no raster map selected yet");
+ gobble_input();
+ }
+ else
+ read_outline();
+ continue;
+ }
+
+ if (KEY("cell") || KEY("rast") || KEY("raster")) {
+ if (scan_gis("cell", "raster", key, data, name, mapset, 0))
+ read_cell(name, mapset);
+ continue;
+ }
+
+ if (KEY("greyrast") || KEY("grayrast")) {
+ if (scan_gis("cell", "raster", key, data, name, mapset, 0))
+ read_cell(name, mapset);
+ PS->grey = 1;
+ continue;
+ }
+
+ if (KEY("group")) {
+ G_strip(data);
+ if (I_find_group(data)) {
+ grp->group_name = G_store(data);
+ grp->do_group = 1;
+ read_group();
+ }
+ else
+ error(key, data, "group not found");
+ continue;
+ }
+
+ if (KEY("rgb")) {
+ G_strip(data);
+ grp->do_group = 1;
+ read_rgb(key, data);
+ continue;
+ }
+
+ if (KEY("vpoints")) {
+ if (scan_gis("vector", "vector", key, data, name, mapset, 1))
+ read_vpoints(name, mapset);
+ continue;
+ }
+
+ if (KEY("vlines")) {
+ if (scan_gis("vector", "vector", key, data, name, mapset, 1))
+ read_vlines(name, mapset);
+ continue;
+ }
+
+ if (KEY("vareas")) {
+ if (scan_gis("vector", "vector", key, data, name, mapset, 1))
+ read_vareas(name, mapset);
+ continue;
+ }
+
+ if (KEY("window") || KEY("region")) {
+ if (scan_gis("windows", "region definition", key, data, name,
+ mapset, 1))
+ read_wind(name, mapset);
+ continue;
+ }
+
+ if (KEY("grid")) {
+ PS->grid = -1;
+ PS->grid_numbers = 0;
+ sscanf(data, "%d", &(PS->grid));
+ if (PS->grid < 0) {
+ PS->grid = 0;
+ error(key, data, "illegal grid spacing");
+ gobble_input();
+ }
+ else
+ getgrid();
+ continue;
+ }
+
+ if (KEY("geogrid")) {
+ if (G_projection() == PROJECTION_XY) {
+ error(key, data,
+ "geogrid is not available for this projection");
+ gobble_input();
+ }
+ /* if (G_projection() == PROJECTION_LL)
+ G_message(_("geogrid referenced to [???] ellipsoid")); */
+ PS->geogrid = -1.;
+ PS->geogrid_numbers = 0;
+ sscanf(data, "%d %s", &(PS->geogrid), PS->geogridunit);
+ if (PS->geogrid < 0) {
+ PS->geogrid = 0;
+ error(key, data, "illegal geo-grid spacing");
+ gobble_input();
+ }
+ else
+ getgeogrid();
+ continue;
+ }
+
+ if (KEY("psfile")) {
+ if (PS->num_psfiles >= MAX_PSFILES)
+ continue;
+ G_strip(data);
+ PS->psfiles[PS->num_psfiles] = G_store(data);
+ PS->num_psfiles++;
+ continue;
+ }
+
+ if (KEY("maskcolor")) {
+ int ret, r, g, b;
+
+ ret = G_str_to_color(data, &r, &g, &b);
+ if (ret == 1) {
+ PS->mask_r = r / 255.0;
+ PS->mask_g = g / 255.0;
+ PS->mask_b = b / 255.0;
+ PS->mask_color = 1;
+ continue;
+ }
+ else if (ret == 2) { /* none */
+ continue;
+ }
+ else {
+ error(key, data, "illegal color request");
+ }
+ }
+
+ if (*key)
+ error(key, "", "illegal request");
+ }
+}
Deleted: grass/trunk/ps/ps.map/read_key.c
===================================================================
--- grass/trunk/ps/ps.map/read_key.c 2011-03-06 10:45:16 UTC (rev 45584)
+++ grass/trunk/ps/ps.map/read_key.c 2011-03-06 11:57:18 UTC (rev 45585)
@@ -1,464 +0,0 @@
-#include <string.h>
-
-#include <grass/colors.h>
-#include <grass/imagery.h>
-#include <grass/glocale.h>
-
-#include "local_proto.h"
-
-#define KEY(x) (strcmp(key,x)==0)
-
-static char *help[] = {
- "rast rastermap setcolor val_range(s) color",
- "vpoints vector points map scalebar [f|s]",
- "vlines vector lines map paper [a4|a3|us-letter|...]",
- "vareas vector areas map maploc x y [width height]",
- "labels labelfile text east north text",
- "region regionfile line east north east north",
- "grid spacing point east north",
- "geogrid spacing header",
- "outline mapinfo",
- "colortable [y|n] vlegend",
- "comments [unix-file] psfile PostScript include file",
- "read unix-file eps Encapsulated PostScript file",
- "rectangle east north east north",
- "scale 1:#|# inches|# panels|1 inch = # miles",
- "border [y|n]",
- ""
-};
-
-void read_from_keyboard(FILE *inputfd, struct PS_data *PS,
- int copies_set, int ps_copies, int can_reset_scale,
- struct scalebar *sb, int *do_mapinfo, int *do_vlegend,
- struct PS_group *grp)
-{
- int i;
- int iflag;
- char name[GNAME_MAX], mapset[GMAPSET_MAX];
- char buf[1024];
-
- iflag = 0;
-
- while (1) {
- char *key;
- char *data;
-
- if (!input(1, buf, help)) {
- if (!iflag) {
- if (G_getl2(buf, 12, inputfd))
- G_warning(_("Data exists after final 'end' instruction!"));
- break;
- }
- iflag = 0;
- continue;
- }
- if (!key_data(buf, &key, &data))
- continue;
-
- if (KEY("read")) {
- if (inputfd != stdin)
- fclose(inputfd);
-
- if (sscanf(data, "%s", name) != 1) {
- error(key, data, "no file specified");
- inputfd = stdin;
- }
- else if ((inputfd = fopen(name, "r")) == NULL) {
- error(key, data, "unable to open");
- inputfd = stdin;
- }
- else
- iflag = 1;
- continue;
- }
-
- if (KEY("paper")) {
- if (strlen(data) > 0) {
- set_paper(data);
- }
- read_paper();
-
- continue;
- }
-
- if (KEY("maploc")) {
- int n;
- double x, y, w, h;
-
- n = sscanf(data, "%lf %lf %lf %lf", &x, &y, &w, &h);
- if (n == 2 || n == 4) {
- PS->map_x_orig = x;
- PS->map_y_loc = y;
- if (n == 4) {
- PS->map_width = w;
- PS->map_height = h;
- }
- }
- else {
- error(key, data, "illegal maploc request");
- gobble_input();
- }
- continue;
- }
-
- if (KEY("copies")) {
- int n, copies;
-
- if (copies_set)
- continue;
- n = sscanf(data, "%d", &copies);
- if (n != 1 || copies < 1 || copies > 20) {
- ps_copies = 1;
- error(key, data, "illegal copies request");
- }
- ps_copies = copies;
- continue;
- }
-
- if (KEY("setcolor")) {
- float R, G, B;
- int r, g, b;
- int color;
- int count;
- DCELL *val_list;
- DCELL dmin, dmax;
- char colorbuf[100];
- char catsbuf[100];
-
- if (PS->cell_fd < 0) {
- error(key, data, "no raster map selected yet");
- continue;
- }
- if (sscanf(data, "%s %[^\n]", catsbuf, colorbuf) == 2) {
- color = get_color_number(colorbuf);
- if (color < 0) {
- error(key, data, "illegal color");
- continue;
- }
- get_color_rgb(color, &R, &G, &B);
- r = 255.0 * R;
- g = 255.0 * G;
- b = 255.0 * B;
-
- if (strncmp(catsbuf, "null", 4) == 0) {
- Rast_set_null_value_color(r, g, b, &(PS->colors));
- continue;
- }
- if (strncmp(catsbuf, "default", 7) == 0) {
- Rast_set_default_color(r, g, b, &(PS->colors));
- continue;
- }
- if ((count = parse_val_list(catsbuf, &val_list)) < 0) {
- error(key, data, "illegal value list");
- continue;
- }
- for (i = 0; i < count; i += 2) {
- dmin = val_list[i];
- dmax = val_list[i + 1];
- Rast_add_d_color_rule(&dmin, r, g, b, &dmax, r, g, b,
- &(PS->colors));
- }
- G_free(val_list);
- }
- continue;
- }
-
- if (KEY("colortable")) {
- PS->do_colortable = 0;
- /*
- if (PS->cell_fd < 0)
- error(key, data, "no raster map selected yet");
- else
- */
- PS->do_colortable = yesno(key, data);
- if (PS->do_colortable)
- read_colortable();
- continue;
- }
-
- if (KEY("border")) {
- PS->do_border = yesno(key, data);
- if (PS->do_border)
- read_border();
- continue;
- }
-
- if (KEY("scalebar")) {
- if (G_projection() == PROJECTION_LL) {
- error(key, data,
- "scalebar is not appropriate for this projection");
- gobble_input();
- }
- PS->do_scalebar = 1;
- if (sscanf(data, "%s", sb->type) != 1)
- strcpy(sb->type, "f"); /* default to fancy scalebar */
- read_scalebar();
- if (sb->length <= 0.) {
- error(key, data, "Bad scalebar length");
- gobble_input();
- }
- continue;
- }
-
- if (KEY("text")) {
- double e, n;
- char east[50], north[50];
- char text[1024];
-
- if (sscanf(data, "%s %s %[^\n]", east, north, text) == 3
- && (scan_easting(east, &e) && scan_northing(north, &n)))
- read_text(east, north, text);
- else {
- gobble_input();
- error(key, data, "illegal text request");
- }
- continue;
- }
-
- if (KEY("point")) {
- double e, n;
- char east[50], north[50];
-
- if (sscanf(data, "%s %s", east, north) == 2
- && (scan_easting(east, &e) && scan_northing(north, &n)))
- read_point(e, n);
- else {
- gobble_input();
- error(key, data, "illegal point request");
- }
- continue;
- }
-
- if (KEY("eps")) {
- double e, n;
- char east[50], north[50];
-
- if (sscanf(data, "%s %s", east, north) == 2
- && (scan_easting(east, &e) && scan_northing(north, &n)))
- read_eps(e, n);
- else {
- gobble_input();
- error(key, data, "illegal eps request");
- }
- continue;
- }
-
- if (KEY("line")) {
- char east1[50], north1[50];
- char east2[50], north2[50];
- double e1, n1, e2, n2;
-
- if (sscanf(data, "%s %s %s %s", east1, north1, east2, north2) == 4
- && (scan_easting(east1, &e1) && scan_easting(east2, &e2)
- && scan_northing(north1, &n1) &&
- scan_northing(north2, &n2)))
- read_line(e1, n1, e2, n2);
- else {
- gobble_input();
- error(key, data, "illegal line request");
- }
- continue;
- }
-
- if (KEY("rectangle")) {
- char east1[50], north1[50];
- char east2[50], north2[50];
- double e1, n1, e2, n2;
-
- if (sscanf(data, "%s %s %s %s", east1, north1, east2, north2) == 4
- && (scan_easting(east1, &e1) && scan_easting(east2, &e2)
- && scan_northing(north1, &n1) &&
- scan_northing(north2, &n2)))
- read_rectangle(e1, n1, e2, n2);
- else {
- gobble_input();
- error(key, data, "illegal rectangle request");
- }
- continue;
- }
-
- if (KEY("comments")) {
- switch (sscanf(data, "%s %s", name, mapset)) {
- case 1:
- read_comment(name);
- break;
- case 2:
- error(key, data, "illegal comments request");
- break;
- default:
- read_comment("");
- break;
- }
- continue;
- }
-
- if (KEY("scale")) {
- if (!can_reset_scale)
- continue;
- if (check_scale(data))
- strcpy(PS->scaletext, data);
- else {
- PS->scaletext[0] = 0;
- error(key, data, "illegal scale request");
- }
- continue;
- }
-
- if (KEY("labels")) {
- if (scan_gis("paint/labels", "label", key, data, name, mapset, 1))
- read_labels(name, mapset);
- continue;
- }
-
- if (KEY("header")) {
- read_header();
- PS->do_header = 1;
- continue;
- }
-
- if (KEY("mapinfo")) {
- read_info();
- *do_mapinfo = 1;
- continue;
- }
-
- if (KEY("vlegend")) {
- read_vlegend();
- *do_vlegend = 1;
- continue;
- }
-
- if (KEY("outline")) {
- if (PS->cell_fd < 0) {
- error(key, data, "no raster map selected yet");
- gobble_input();
- }
- else
- read_outline();
- continue;
- }
-
- if (KEY("cell") || KEY("rast") || KEY("raster")) {
- if (scan_gis("cell", "raster", key, data, name, mapset, 0))
- read_cell(name, mapset);
- continue;
- }
-
- if (KEY("greyrast") || KEY("grayrast")) {
- if (scan_gis("cell", "raster", key, data, name, mapset, 0))
- read_cell(name, mapset);
- PS->grey = 1;
- continue;
- }
-
- if (KEY("group")) {
- G_strip(data);
- if (I_find_group(data)) {
- grp->group_name = G_store(data);
- grp->do_group = 1;
- read_group();
- }
- else
- error(key, data, "group not found");
- continue;
- }
-
- if (KEY("rgb")) {
- G_strip(data);
- grp->do_group = 1;
- read_rgb(key, data);
- continue;
- }
-
- if (KEY("vpoints")) {
- if (scan_gis("vector", "vector", key, data, name, mapset, 1))
- read_vpoints(name, mapset);
- continue;
- }
-
- if (KEY("vlines")) {
- if (scan_gis("vector", "vector", key, data, name, mapset, 1))
- read_vlines(name, mapset);
- continue;
- }
-
- if (KEY("vareas")) {
- if (scan_gis("vector", "vector", key, data, name, mapset, 1))
- read_vareas(name, mapset);
- continue;
- }
-
- if (KEY("window") || KEY("region")) {
- if (scan_gis("windows", "region definition", key, data, name,
- mapset, 1))
- read_wind(name, mapset);
- continue;
- }
-
- if (KEY("grid")) {
- PS->grid = -1;
- PS->grid_numbers = 0;
- sscanf(data, "%d", &(PS->grid));
- if (PS->grid < 0) {
- PS->grid = 0;
- error(key, data, "illegal grid spacing");
- gobble_input();
- }
- else
- getgrid();
- continue;
- }
-
- if (KEY("geogrid")) {
- if (G_projection() == PROJECTION_XY) {
- error(key, data,
- "geogrid is not available for this projection");
- gobble_input();
- }
- /* if (G_projection() == PROJECTION_LL)
- G_message(_("geogrid referenced to [???] ellipsoid")); */
- PS->geogrid = -1.;
- PS->geogrid_numbers = 0;
- sscanf(data, "%d %s", &(PS->geogrid), PS->geogridunit);
- if (PS->geogrid < 0) {
- PS->geogrid = 0;
- error(key, data, "illegal geo-grid spacing");
- gobble_input();
- }
- else
- getgeogrid();
- continue;
- }
-
- if (KEY("psfile")) {
- if (PS->num_psfiles >= MAX_PSFILES)
- continue;
- G_strip(data);
- PS->psfiles[PS->num_psfiles] = G_store(data);
- PS->num_psfiles++;
- continue;
- }
-
- if (KEY("maskcolor")) {
- int ret, r, g, b;
-
- ret = G_str_to_color(data, &r, &g, &b);
- if (ret == 1) {
- PS->mask_r = r / 255.0;
- PS->mask_g = g / 255.0;
- PS->mask_b = b / 255.0;
- PS->mask_color = 1;
- continue;
- }
- else if (ret == 2) { /* none */
- continue;
- }
- else {
- error(key, data, "illegal color request");
- }
- }
-
- if (*key)
- error(key, "", "illegal request");
- }
-}
More information about the grass-commit
mailing list