|
@@ -11,7 +11,7 @@
|
|
|
* Markus Neteler <neteler itc.it>
|
|
|
* Alessandro Frigeri <afrigeri unipg.it>
|
|
|
* Martin Landa <landa.martin gmail.com>
|
|
|
- * PURPOSE: This is an enhanced PostScript version of the p.map program
|
|
|
+ * PURPOSE: Hardcopy PostScript map output utility (based on p.map program)
|
|
|
* COPYRIGHT: (C) 2003-2008, 2011 by the GRASS Development Team
|
|
|
*
|
|
|
* This program is free software under the GNU General
|
|
@@ -37,9 +37,6 @@
|
|
|
#include "border.h"
|
|
|
#include "comment.h"
|
|
|
#include "colortable.h"
|
|
|
-#include "decorate.h"
|
|
|
-#include "ps_info.h"
|
|
|
-#include "group.h"
|
|
|
#include "local_proto.h"
|
|
|
|
|
|
struct border brd;
|
|
@@ -58,7 +55,7 @@ struct comment cmt;
|
|
|
struct PS_group grp;
|
|
|
|
|
|
|
|
|
-#define KEY(x) (strcmp(key,x)==0)
|
|
|
+
|
|
|
|
|
|
FILE *tracefd;
|
|
|
FILE *inputfd;
|
|
@@ -66,25 +63,6 @@ int do_mapinfo;
|
|
|
int do_vlegend;
|
|
|
char *ps_mask_file;
|
|
|
|
|
|
-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]",
|
|
|
- ""
|
|
|
-};
|
|
|
-
|
|
|
int rotate_plot;
|
|
|
int eps_output;
|
|
|
int ps_copies = 1;
|
|
@@ -92,9 +70,6 @@ int ps_copies = 1;
|
|
|
int main(int argc, char *argv[])
|
|
|
{
|
|
|
char buf[1024];
|
|
|
- char name[GNAME_MAX], mapset[GMAPSET_MAX];
|
|
|
- int i;
|
|
|
- int iflag;
|
|
|
int can_reset_scale;
|
|
|
int copies_set;
|
|
|
struct Option *input_file;
|
|
@@ -127,8 +102,9 @@ int main(int argc, char *argv[])
|
|
|
pflag = G_define_flag();
|
|
|
pflag->key = 'p';
|
|
|
pflag->description =
|
|
|
- _("List paper formats ( name width height left right top bottom(margin) )");
|
|
|
-
|
|
|
+ _("List paper formats (name width height left right top bottom(margin))");
|
|
|
+ pflag->suppress_required = YES;
|
|
|
+
|
|
|
eflag = G_define_flag();
|
|
|
eflag->key = 'e';
|
|
|
eflag->description =
|
|
@@ -138,32 +114,25 @@ int main(int argc, char *argv[])
|
|
|
bflag->key = 'b';
|
|
|
bflag->description =
|
|
|
_("Print map-box's position on the page and exit (inches from top-left of paper)");
|
|
|
-
|
|
|
- input_file = G_define_option();
|
|
|
- input_file->key = "input";
|
|
|
- input_file->type = TYPE_STRING;
|
|
|
- input_file->description =
|
|
|
- _("File containing mapping instructions (or use input=- to enter from keyboard)");
|
|
|
- input_file->gisprompt = "old_file,file,input";
|
|
|
- input_file->required = NO;
|
|
|
-
|
|
|
- output_file = G_define_option();
|
|
|
- output_file->key = "output";
|
|
|
- output_file->type = TYPE_STRING;
|
|
|
- output_file->gisprompt = "new_file,file,output";
|
|
|
- output_file->description = _("PostScript output file");
|
|
|
- /* output_file->required = YES; Can omit for -p list page size & exit mode */
|
|
|
-
|
|
|
+ bflag->suppress_required = YES;
|
|
|
+
|
|
|
+ input_file = G_define_standard_option(G_OPT_F_INPUT);
|
|
|
+ input_file->label = _("File containing mapping instructions");
|
|
|
+ input_file->description = _("Use '-' to enter instructions from keyboard)");
|
|
|
+
|
|
|
+ output_file = G_define_standard_option(G_OPT_F_OUTPUT);
|
|
|
+ output_file->description = _("Name for PostScript output file");
|
|
|
+
|
|
|
copies = G_define_option();
|
|
|
copies->key = "copies";
|
|
|
copies->type = TYPE_INTEGER;
|
|
|
copies->options = "1-20";
|
|
|
copies->description = _("Number of copies to print");
|
|
|
copies->required = NO;
|
|
|
-
|
|
|
+
|
|
|
if (G_parser(argc, argv))
|
|
|
exit(EXIT_FAILURE);
|
|
|
-
|
|
|
+
|
|
|
/* Print papers */
|
|
|
if (pflag->answer) {
|
|
|
print_papers();
|
|
@@ -194,7 +163,6 @@ int main(int argc, char *argv[])
|
|
|
m_info.bgcolor = WHITE;
|
|
|
hdr.color = BLACK;
|
|
|
cmt.color = BLACK;
|
|
|
- PS.grid_color = BLACK;
|
|
|
m_info.font = G_store(def_font);
|
|
|
vector.font = G_store(def_font);
|
|
|
hdr.font = G_store(def_font);
|
|
@@ -208,7 +176,6 @@ int main(int argc, char *argv[])
|
|
|
ct.cols = 1;
|
|
|
tracefd = NULL;
|
|
|
inputfd = stdin;
|
|
|
- iflag = 0;
|
|
|
labels.count = 0;
|
|
|
labels.other = NULL;
|
|
|
can_reset_scale = 1;
|
|
@@ -216,62 +183,45 @@ int main(int argc, char *argv[])
|
|
|
grp.do_group = 0;
|
|
|
brd.R = brd.G = brd.B = 0.;
|
|
|
brd.width = 1.;
|
|
|
- PS.grey = 0;
|
|
|
- PS.mask_needed = 0;
|
|
|
- PS.do_header = 0;
|
|
|
+
|
|
|
+ G_zero(&PS, sizeof(struct PS_data));
|
|
|
+ PS.grid_color = BLACK;
|
|
|
PS.min_y = 72.0 * (PS.page_height - PS.top_marg);
|
|
|
PS.set_y = 100.0 * PS.min_y;
|
|
|
- PS.startpanel = 0;
|
|
|
- PS.endpanel = 0;
|
|
|
PS.cell_fd = -1;
|
|
|
- PS.do_outline = 0;
|
|
|
- PS.do_colortable = 0;
|
|
|
PS.do_border = TRUE;
|
|
|
- PS.do_scalebar = 0;
|
|
|
- PS.grid = 0;
|
|
|
- PS.scaletext[0] = 0;
|
|
|
- PS.celltitle[0] = 0;
|
|
|
- PS.commentfile = NULL;
|
|
|
- PS.num_psfiles = 0;
|
|
|
- PS.mask_color = 0;
|
|
|
-
|
|
|
- /* PS.map_* variables are set to 0 (not defined) and then may be reset by 'maploc'.
|
|
|
- * When script is read, main() should call reset_map_location() to reset map size to fit to paper */
|
|
|
-
|
|
|
- PS.map_width = 0;
|
|
|
- PS.map_height = 0;
|
|
|
- PS.map_x_orig = 0;
|
|
|
- PS.map_y_orig = 0;
|
|
|
- PS.map_y_loc = 0;
|
|
|
|
|
|
+ /* PS.map_* variables are set to 0 (not defined) and then may be
|
|
|
+ * reset by 'maploc'. When script is read, main() should call
|
|
|
+ * reset_map_location() to reset map size to fit to paper */
|
|
|
+
|
|
|
/* arguments */
|
|
|
if (input_file->answer && strcmp(input_file->answer, "-")) {
|
|
|
if (NULL == freopen(input_file->answer, "r", stdin))
|
|
|
- G_fatal_error("%s - %s: %s", G_program_name(),
|
|
|
+ G_fatal_error(_("Unable to open file '%s': %s"),
|
|
|
input_file->answer, strerror(errno));
|
|
|
}
|
|
|
|
|
|
if (copies->answer) {
|
|
|
if (sscanf(copies->answer, "%d", &ps_copies) != 1) {
|
|
|
ps_copies = 1;
|
|
|
- error(copies->answer, "", "illegal copies request");
|
|
|
+ error(copies->answer, "", _("illegal copies request"));
|
|
|
}
|
|
|
copies_set = 1;
|
|
|
}
|
|
|
|
|
|
- if (output_file->answer) {
|
|
|
- if ((PS.fp = fopen(output_file->answer, "w")) == NULL)
|
|
|
- G_fatal_error("%s - %s: %s", G_program_name(),
|
|
|
- output_file->answer, strerror(errno));
|
|
|
- }
|
|
|
- else {
|
|
|
- G_message(_("\nERROR: Required parameter <%s> not set:\n (%s).\n"),
|
|
|
- output_file->key, output_file->description);
|
|
|
- G_usage();
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ if (!bflag->answer) {
|
|
|
+ if (output_file->answer) {
|
|
|
+ if ((PS.fp = fopen(output_file->answer, "w")) == NULL)
|
|
|
+ G_fatal_error("Unable to create file '%s': %s",
|
|
|
+ output_file->answer, strerror(errno));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ G_fatal_error(_("Required parameter <%s> not set:\n\t(%s)"),
|
|
|
+ output_file->key, output_file->description);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
/* get current mapset */
|
|
|
PS.cell_mapset = G_mapset();
|
|
|
|
|
@@ -279,451 +229,12 @@ int main(int argc, char *argv[])
|
|
|
G_get_set_window(&PS.w);
|
|
|
Rast_set_window(&PS.w);
|
|
|
|
|
|
- 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;
|
|
|
- }
|
|
|
-
|
|
|
- /* Please, remove before GRASS 7 released */
|
|
|
- if (KEY("verbose")) {
|
|
|
- int verbose;
|
|
|
-
|
|
|
- if (sscanf(data, "%d", &verbose) != 1)
|
|
|
- verbose = G_verbose_std();
|
|
|
-
|
|
|
- G_warning(_("GRASS environment variable GRASS_VERBOSE "
|
|
|
- "is overwritten by VERBOSE mapping instruction. "
|
|
|
- "This mapping instruction is superseded and "
|
|
|
- "will be removed in future versions of GRASS. "
|
|
|
- "Please use --verbose instead."));
|
|
|
-
|
|
|
- if (!G_set_verbose(verbose))
|
|
|
- G_warning(_("Cannot set GRASS_VERBOSE variable."));
|
|
|
-
|
|
|
- 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");
|
|
|
- }
|
|
|
-
|
|
|
+ read_from_keyboard(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();
|
|
|
-
|
|
|
+
|
|
|
if (bflag->answer) {
|
|
|
map_setup();
|
|
|
fprintf(stdout, "bbox=%.3f,%.3f,%.3f,%.3f\n", PS.map_left / 72.0,
|
|
@@ -738,8 +249,8 @@ int main(int argc, char *argv[])
|
|
|
ps_mask_file = G_tempfile();
|
|
|
ps_map();
|
|
|
|
|
|
- G_message(_("PostScript file [%s] successfully written."),
|
|
|
- output_file->answer);
|
|
|
+ G_done_msg(_("PostScript file '%s' successfully written."),
|
|
|
+ output_file->answer);
|
|
|
|
|
|
/* cleanup the tempfiles */
|
|
|
unlink(ps_mask_file);
|