[GRASS-SVN] r33146 - in grass/trunk: display/d.colortable
display/d.his display/d.histogram display/d.legend
display/d.path display/d.rast display/d.rast.arrow
display/d.rast.num display/d.rgb display/d.thematic.area
display/d.title display/d.vect display/d.vect.chart
display/d.zoom lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Aug 28 18:19:06 EDT 2008
Author: glynn
Date: 2008-08-28 18:19:05 -0400 (Thu, 28 Aug 2008)
New Revision: 33146
Modified:
grass/trunk/display/d.colortable/main.c
grass/trunk/display/d.his/main.c
grass/trunk/display/d.histogram/dhist.h
grass/trunk/display/d.histogram/get_stats.c
grass/trunk/display/d.histogram/main.c
grass/trunk/display/d.legend/main.c
grass/trunk/display/d.path/main.c
grass/trunk/display/d.rast.arrow/main.c
grass/trunk/display/d.rast.num/main.c
grass/trunk/display/d.rast/colors.c
grass/trunk/display/d.rast/display.c
grass/trunk/display/d.rast/local_proto.h
grass/trunk/display/d.rast/main.c
grass/trunk/display/d.rgb/main.c
grass/trunk/display/d.thematic.area/main.c
grass/trunk/display/d.title/fancy.c
grass/trunk/display/d.title/local_proto.h
grass/trunk/display/d.title/main.c
grass/trunk/display/d.title/normal.c
grass/trunk/display/d.title/options.h
grass/trunk/display/d.vect.chart/main.c
grass/trunk/display/d.vect/main.c
grass/trunk/display/d.zoom/main.c
grass/trunk/lib/gis/nme_in_mps.c
Log:
Remove unused code
Modified: grass/trunk/display/d.colortable/main.c
===================================================================
--- grass/trunk/display/d.colortable/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.colortable/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -34,8 +34,6 @@
int lines;
int cols;
- char buff[256];
- char *mapset;
struct FPRange fp_range;
struct Colors colors;
double ratio;
@@ -98,10 +96,7 @@
exit(EXIT_FAILURE);
map_name = opt1->answer;
- mapset = G_find_cell2(map_name, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), map_name);
- fp = G_raster_map_is_fp(map_name, mapset);
+ fp = G_raster_map_is_fp(map_name, "");
if (opt2->answer != NULL) {
new_colr = D_translate_color(opt2->answer);
@@ -113,12 +108,9 @@
else
lines = 0;
if (opt3->answer != NULL) {
- if (fp) {
- sprintf(buff,
- "%s is fp map. Ignoring lines and drawing continuous color ramp",
- map_name);
- G_warning(buff);
- }
+ if (fp)
+ G_warning("<%s> is floating-point; ignoring lines and drawing continuous color ramp",
+ map_name);
else
sscanf(opt3->answer, "%d", &lines);
}
@@ -127,24 +119,21 @@
cols = 1;
else
cols = 0;
- if (opt4->answer != NULL) {
- if (fp) {
- sprintf(buff,
- "%s is fp map. Ignoring cols and drawing continuous color ramp",
- map_name);
- G_warning(buff);
- }
+ if (opt4->answer) {
+ if (fp)
+ G_warning("<%s> is floating-point; ignoring cols and drawing continuous color ramp",
+ map_name);
else
sscanf(opt4->answer, "%d", &cols);
}
/* Make sure map is available */
- if (G_read_colors(map_name, mapset, &colors) == -1)
- G_fatal_error("R_color file for [%s] not available", map_name);
- if (G_read_fp_range(map_name, mapset, &fp_range) == -1)
- G_fatal_error("Range file for [%s] not available", map_name);
+ if (G_read_colors(map_name, "", &colors) == -1)
+ G_fatal_error(_("Color file for <%s> not available"), map_name);
+ if (G_read_fp_range(map_name, "", &fp_range) == -1)
+ G_fatal_error(_("Range file for <%s> not available"), map_name);
if (R_open_driver() != 0)
- G_fatal_error("No graphics device selected");
+ G_fatal_error(_("No graphics device selected"));
D_setup_unity(0);
D_get_src(&t, &b, &l, &r);
Modified: grass/trunk/display/d.his/main.c
===================================================================
--- grass/trunk/display/d.his/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.his/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -35,7 +35,6 @@
unsigned char *sat_n, *sat_r;
unsigned char *dummy;
CELL *r_array, *g_array, *b_array;
- char *mapset;
char *name_h, *name_i, *name_s;
int intensity;
int saturation;
@@ -121,12 +120,8 @@
/* Get name of layer to be used for hue */
name_h = opt_h->answer;
- mapset = G_find_cell2(name_h, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), opt_h->answer);
-
/* Make sure map is available */
- if ((hue_file = G_open_cell_old(name_h, mapset)) == -1)
+ if ((hue_file = G_open_cell_old(name_h, "")) == -1)
G_fatal_error(_("Unable to open raster map <%s>"), name_h);
hue_r = G_malloc(window.cols);
@@ -137,7 +132,7 @@
dummy = G_malloc(window.cols);
/* Reading color lookup table */
- if (G_read_colors(name_h, mapset, &hue_colors) == -1)
+ if (G_read_colors(name_h, "", &hue_colors) == -1)
G_fatal_error(_("Color file for <%s> not available"), name_h);
int_used = 0;
@@ -145,23 +140,18 @@
if (opt_i->answer != NULL) {
/* Get name of layer to be used for intensity */
name_i = opt_i->answer;
- mapset = G_find_cell2(name_i, "");
- if (mapset != NULL) {
- int_used = 1;
- /* Make sure map is available */
- if ((int_file = G_open_cell_old(name_i, mapset)) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name_i);
+ int_used = 1;
- int_r = G_malloc(window.cols);
- int_n = G_malloc(window.cols);
+ /* Make sure map is available */
+ if ((int_file = G_open_cell_old(name_i, "")) == -1)
+ G_fatal_error(_("Unable to open raster map <%s>"), name_i);
- /* Reading color lookup table */
- if (G_read_colors(name_i, mapset, &int_colors) == -1)
- G_fatal_error(_("Color file for <%s> not available"), name_i);
- }
- else
- G_fatal_error(_("Raster map <%s> not found"), name_i);
+ int_r = G_malloc(window.cols);
+ int_n = G_malloc(window.cols);
+ /* Reading color lookup table */
+ if (G_read_colors(name_i, "", &int_colors) == -1)
+ G_fatal_error(_("Color file for <%s> not available"), name_i);
}
sat_used = 0;
@@ -169,23 +159,18 @@
if (opt_s->answer != NULL) {
/* Get name of layer to be used for saturation */
name_s = opt_s->answer;
- mapset = G_find_cell2(name_s, "");
- if (mapset != NULL) {
- sat_used = 1;
+ sat_used = 1;
- /* Make sure map is available */
- if ((sat_file = G_open_cell_old(name_s, mapset)) == -1)
- G_fatal_error("Unable to open raster map <%s>", name_s);
+ /* Make sure map is available */
+ if ((sat_file = G_open_cell_old(name_s, "")) == -1)
+ G_fatal_error("Unable to open raster map <%s>", name_s);
- sat_r = G_malloc(window.cols);
- sat_n = G_malloc(window.cols);
+ sat_r = G_malloc(window.cols);
+ sat_n = G_malloc(window.cols);
- /* Reading color lookup table */
- if (G_read_colors(name_s, mapset, &sat_colors) == -1)
- G_fatal_error(_("Color file for <%s> not available"), name_s);
- }
- else
- G_fatal_error(_("Raster map <%s> not found"), name_s);
+ /* Reading color lookup table */
+ if (G_read_colors(name_s, "", &sat_colors) == -1)
+ G_fatal_error(_("Color file for <%s> not available"), name_s);
}
r_array = G_allocate_cell_buf();
Modified: grass/trunk/display/d.histogram/dhist.h
===================================================================
--- grass/trunk/display/d.histogram/dhist.h 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.histogram/dhist.h 2008-08-28 22:19:05 UTC (rev 33146)
@@ -41,7 +41,7 @@
int draw_slice(struct Colors *, int, DCELL, DCELL, int, double, double,
double, double, double);
/* get_stats.c */
-int get_stats(char *, char *, struct stat_list *, int);
+int get_stats(const char *, struct stat_list *, int);
/* pie.c */
int pie(struct stat_list *, struct Colors *);
Modified: grass/trunk/display/d.histogram/get_stats.c
===================================================================
--- grass/trunk/display/d.histogram/get_stats.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.histogram/get_stats.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -34,13 +34,12 @@
return cmd;
}
-int get_stats(char *mapname, char *mapset, struct stat_list *dist_stats, /* linked list of stats */
+int get_stats(const char *mapname, struct stat_list *dist_stats, /* linked list of stats */
int quiet)
{
char buf[1024]; /* input buffer for reading stats */
int done = 0;
char *tempfile; /* temp file name */
- char *fullname;
char *cmd;
FILE *fd; /* temp file pointer */
@@ -51,30 +50,29 @@
/* write stats to a temp file */
tempfile = G_tempfile();
- fullname = G_fully_qualified_name(mapname, mapset);
- is_fp = G_raster_map_is_fp(mapname, mapset);
+ is_fp = G_raster_map_is_fp(mapname, "");
if (is_fp) {
if (cat_ranges) {
- if (G_read_raster_cats(mapname, mapset, &cats) < 0)
+ if (G_read_raster_cats(mapname, "", &cats) < 0)
G_fatal_error("Can't read category file");
if (G_number_of_raster_cats(&cats) <= 0) {
G_warning("There are no labeled cats, using nsteps argument");
cat_ranges = 0;
}
}
- if (G_read_fp_range(map_name, mapset, &fp_range) <= 0)
+ if (G_read_fp_range(map_name, "", &fp_range) <= 0)
G_fatal_error("Can't read frange file");
}
if (cat_ranges) {
cmd = mk_command("r.stats -Cr%s%s \"%s\" > \"%s\"\n", 4,
type == COUNT ? "c" : "a", quiet ? "q" : "",
- fullname, tempfile);
+ mapname, tempfile);
}
else {
sprintf(buf, "%d", nsteps);
cmd = mk_command("r.stats -r%s%s \"%s\" nsteps=%s > \"%s\"\n", 5,
type == COUNT ? "c" : "a", quiet ? "q" : "",
- fullname, buf, tempfile);
+ mapname, buf, tempfile);
}
if (system(cmd))
Modified: grass/trunk/display/d.histogram/main.c
===================================================================
--- grass/trunk/display/d.histogram/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.histogram/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -60,11 +60,10 @@
{
int text_height;
int text_width;
- char *mapset;
struct Categories cats;
struct Range range;
struct Colors pcolors;
- char title[512];
+ char title[GNAME_MAX];
double tt, tb, tl, tr;
double t, b, l, r;
int quiet;
@@ -169,24 +168,19 @@
nodata = flag1->answer;
quiet = flag2->answer ? YES : NO;
- /* Make sure map is available */
- mapset = G_find_cell2(map_name, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), map_name);
-
- if (G_read_colors(map_name, mapset, &pcolors) == -1)
+ if (G_read_colors(map_name, "", &pcolors) == -1)
G_fatal_error(_("Color file for <%s> not available"), map_name);
- if (G_read_cats(map_name, mapset, &cats) == -1)
+ if (G_read_cats(map_name, "", &cats) == -1)
G_fatal_error(_("Category file for <%s> not available"), map_name);
- if (G_read_range(map_name, mapset, &range) == -1)
+ if (G_read_range(map_name, "", &range) == -1)
G_fatal_error(_("Range information for <%s> not available"),
map_name);
/* get the distribution statistics */
- get_stats(map_name, mapset, &dist_stats, quiet);
+ get_stats(map_name, &dist_stats, quiet);
/* set up the graphics driver and initialize its color-table */
@@ -201,7 +195,7 @@
D_erase(bg_opt->answer);
/* draw a title for */
- sprintf(title, "%s in mapset %s", map_name, mapset);
+ sprintf(title, "%s", map_name);
text_height = (b - t) * 0.05;
text_width = (r - l) * 0.05 * 0.50;
R_text_size(text_width, text_height);
Modified: grass/trunk/display/d.legend/main.c
===================================================================
--- grass/trunk/display/d.legend/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.legend/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -37,7 +37,6 @@
int main(int argc, char **argv)
{
- char *mapset;
char buff[512];
char *map_name;
int black;
@@ -244,22 +243,17 @@
}
- /* Make sure map is available */
- mapset = G_find_cell2(map_name, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), map_name);
-
- if (G_read_colors(map_name, mapset, &colors) == -1)
+ if (G_read_colors(map_name, "", &colors) == -1)
G_fatal_error(_("Color file for <%s> not available"), map_name);
- fp = G_raster_map_is_fp(map_name, mapset);
+ fp = G_raster_map_is_fp(map_name, "");
if (fp && !use_catlist) {
do_smooth = TRUE;
/* fprintf(stderr, "FP map found - switching gradient legend on\n"); */
flip = !flip;
}
- if (G_read_cats(map_name, mapset, &cats) == -1)
+ if (G_read_cats(map_name, "", &cats) == -1)
G_warning(_("Category file for <%s> not available"), map_name);
G_set_c_null_value(&null_cell, 1);
@@ -324,7 +318,7 @@
/* How many categories to show */
if (!fp) {
- if (G_read_range(map_name, mapset, &range) == -1)
+ if (G_read_range(map_name, "", &range) == -1)
G_fatal_error(_("Range information for <%s> not available (run r.support)"),
map_name);
@@ -486,7 +480,7 @@
}
}
else { /* is fp */
- if (G_read_fp_range(map_name, mapset, &fprange) == -1)
+ if (G_read_fp_range(map_name, "", &fprange) == -1)
G_fatal_error(_("Range information for <%s> not available"),
map_name);
Modified: grass/trunk/display/d.path/main.c
===================================================================
--- grass/trunk/display/d.path/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.path/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -35,7 +35,6 @@
struct Option *color_opt, *hcolor_opt, *bgcolor_opt, *coor_opt;
struct Flag *geo_f, *bold_f;
struct GModule *module;
- char *mapset;
struct Map_info Map;
int type, afield, nfield, geo;
struct color_rgb color, hcolor, bgcolor;
@@ -181,13 +180,8 @@
else
geo = 0;
- mapset = G_find_vector2(map->answer, NULL);
-
- if (mapset == NULL)
- G_fatal_error(_("Vector map <%s> not found"), map->answer);
-
Vect_set_open_level(2);
- Vect_open_old(&Map, map->answer, mapset);
+ Vect_open_old(&Map, map->answer, "");
D_setup(0);
Modified: grass/trunk/display/d.rast/colors.c
===================================================================
--- grass/trunk/display/d.rast/colors.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.rast/colors.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -16,7 +16,7 @@
return list;
}
-int get_rgb(char *color, int *r, int *g, int *b)
+int get_rgb(const char *color, int *r, int *g, int *b)
{
float fr, fg, fb;
Modified: grass/trunk/display/d.rast/display.c
===================================================================
--- grass/trunk/display/d.rast/display.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.rast/display.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -6,27 +6,18 @@
#include "local_proto.h"
#include <grass/glocale.h>
-static int cell_draw(char *, char *, struct Colors *, int, int,
- RASTER_MAP_TYPE);
+static int cell_draw(const char *, struct Colors *, int, int, RASTER_MAP_TYPE);
-int display(char *name,
- char *mapset,
+int display(const char *name,
int overlay,
char *bg, RASTER_MAP_TYPE data_type, int invert)
{
struct Colors colors;
int r, g, b;
- if (G_read_colors(name, mapset, &colors) == -1)
+ if (G_read_colors(name, "", &colors) == -1)
G_fatal_error(_("Color file for <%s> not available"), name);
- /***DEBUG ***
- if (G_write_colors(name, mapset, &colors) == -1)
- G_fatal_error("can't write colors");
- if (G_read_colors(name, mapset, &colors) == -1)
- G_fatal_error("Color file for [%s] not available", name) ;
- *********/
-
if (bg) {
get_rgb(bg, &r, &g, &b);
G_set_null_value_color(r, g, b, &colors);
@@ -35,7 +26,7 @@
D_setup(0);
/* Go draw the raster map */
- cell_draw(name, mapset, &colors, overlay, invert, data_type);
+ cell_draw(name, &colors, overlay, invert, data_type);
/* release the colors now */
G_free_colors(&colors);
@@ -43,8 +34,7 @@
return 0;
}
-static int cell_draw(char *name,
- char *mapset,
+static int cell_draw(const char *name,
struct Colors *colors,
int overlay, int invert, RASTER_MAP_TYPE data_type)
{
@@ -61,7 +51,7 @@
D_set_overlay_mode(overlay);
/* Make sure map is available */
- if ((cellfile = G_open_cell_old(name, mapset)) == -1)
+ if ((cellfile = G_open_cell_old(name, "")) == -1)
G_fatal_error(_("Unable to open raster map <%s>"), name);
/* Allocate space for cell buffer */
Modified: grass/trunk/display/d.rast/local_proto.h
===================================================================
--- grass/trunk/display/d.rast/local_proto.h 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.rast/local_proto.h 2008-08-28 22:19:05 UTC (rev 33146)
@@ -1,9 +1,9 @@
/* colors.c */
char *color_list(void);
-int get_rgb(char *, int *, int *, int *);
+int get_rgb(const char *, int *, int *, int *);
/* display.c */
-int display(char *, char *, int, char *, RASTER_MAP_TYPE, int);
+int display(const char *, int, char *, RASTER_MAP_TYPE, int);
int mask_raster_array(void *, int, int, RASTER_MAP_TYPE);
/* main.c */
Modified: grass/trunk/display/d.rast/main.c
===================================================================
--- grass/trunk/display/d.rast/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.rast/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -34,7 +34,6 @@
int main(int argc, char **argv)
{
- char *mapset;
char *name;
int overlay;
int invert, fp;
@@ -102,15 +101,10 @@
overlay = !flag_n->answer;
invert = flag_i->answer;
- /* Make sure map is available */
- mapset = G_find_cell2(name, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), name);
-
if (R_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
- fp = G_raster_map_is_fp(name, mapset);
+ fp = G_raster_map_is_fp(name, "");
if (catlist->answer) {
if (fp)
G_warning(_("Ignoring catlist: map is floating point (please use 'val=')"));
@@ -127,9 +121,9 @@
/* use DCELL even if the map is FCELL */
if (fp)
- display(name, mapset, overlay, bg->answer, DCELL_TYPE, invert);
+ display(name, overlay, bg->answer, DCELL_TYPE, invert);
else
- display(name, mapset, overlay, bg->answer, CELL_TYPE, invert);
+ display(name, overlay, bg->answer, CELL_TYPE, invert);
R_close_driver();
Modified: grass/trunk/display/d.rast.arrow/main.c
===================================================================
--- grass/trunk/display/d.rast.arrow/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.rast.arrow/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -59,8 +59,7 @@
static void draw_x(void);
static void unknown_(void);
-static char *mapset;
-static char layer_name[128];
+static char *layer_name;
static int map_type, arrow_color, grid_color, x_color, unknown_color;
static int row, col;
@@ -76,7 +75,7 @@
double scale;
int skip, no_arrow;
- char *mag_map = NULL, *mag_mapset = NULL;
+ char *mag_map = NULL;
void *mag_raster_row = NULL, *mag_ptr = NULL;
double length = -1;
int mag_fd = -1;
@@ -172,9 +171,7 @@
exit(EXIT_FAILURE);
- strncpy(layer_name, opt1->answer, sizeof(layer_name) - 1);
- if ((mapset = G_find_cell2(layer_name, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), layer_name);
+ layer_name = opt1->answer;
arrow_color = D_translate_color(opt3->answer);
x_color = D_translate_color(opt5->answer);
@@ -210,8 +207,6 @@
G_fatal_error(_("Magnitude is only supported for GRASS and compass aspect maps."));
mag_map = opt7->answer;
- if ((mag_mapset = G_find_cell2(mag_map, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), mag_map);
}
else if (scale != 1.0)
G_warning(_("Scale option requires magnitude_map"));
@@ -235,7 +230,7 @@
/* figure out arrow scaling if using a magnitude map */
if (opt7->answer) {
G_init_fp_range(&range); /* really needed? */
- if (G_read_fp_range(mag_map, mag_mapset, &range) != 1)
+ if (G_read_fp_range(mag_map, "", &range) != 1)
G_fatal_error(_("Problem reading range file"));
G_get_fp_range_min_max(&range, &mag_min, &mag_max);
@@ -261,7 +256,7 @@
}
/* open the raster map */
- layer_fd = G_open_cell_old(layer_name, mapset);
+ layer_fd = G_open_cell_old(layer_name, "");
if (layer_fd < 0)
G_fatal_error(_("Unable to open raster map <%s>"), layer_name);
@@ -273,7 +268,7 @@
if (opt7->answer) {
/* open the magnitude raster map */
- mag_fd = G_open_cell_old(mag_map, mag_mapset);
+ mag_fd = G_open_cell_old(mag_map, "");
if (mag_fd < 0)
G_fatal_error("Unable to open raster map <%s>", mag_map);
Modified: grass/trunk/display/d.rast.num/main.c
===================================================================
--- grass/trunk/display/d.rast.num/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.rast.num/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -50,8 +50,7 @@
int main(int argc, char **argv)
{
DCELL *cell;
- char *mapset;
- char full_name[128];
+ char *map_name;
int fixed_color, grid_color;
int R, G, B;
int layer_fd;
@@ -110,7 +109,7 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- strcpy(full_name, opt1->answer);
+ map_name = opt1->answer;
if (strcmp("none", opt2->answer) == 0)
grid_color = -1;
@@ -122,13 +121,9 @@
else
fixed_color = 1;
- mapset = G_find_cell(full_name, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), full_name);
-
- layer_fd = G_open_cell_old(full_name, mapset);
+ layer_fd = G_open_cell_old(map_name, "");
if (layer_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), full_name);
+ G_fatal_error(_("Unable to open raster map <%s>"), map_name);
/* determine the inputmap type (CELL/FCELL/DCELL) */
inmap_type = G_get_raster_map_type(layer_fd);
@@ -192,8 +187,8 @@
cell = G_allocate_raster_buf(map_type);
/* read the color table in the color structures of the displayed map */
- if (G_read_colors(full_name, mapset, &colors) == -1)
- G_fatal_error(_("Color file for <%s> not available"), full_name);
+ if (G_read_colors(map_name, "", &colors) == -1)
+ G_fatal_error(_("Color file for <%s> not available"), map_name);
/* fixed text color */
if (fixed_color == 1)
Modified: grass/trunk/display/d.rgb/main.c
===================================================================
--- grass/trunk/display/d.rgb/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.rgb/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -39,7 +39,6 @@
int main(int argc, char **argv)
{
struct band B[3];
- char *mapset;
int row;
int next_row;
struct Cell_head window;
@@ -89,18 +88,14 @@
/* Get name of layer to be used */
char *name = B[i].opt->answer;
- mapset = G_find_cell2(name, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), name);
-
/* Make sure map is available */
- if ((B[i].file = G_open_cell_old(name, mapset)) == -1)
+ if ((B[i].file = G_open_cell_old(name, "")) == -1)
G_fatal_error(_("Unable to open raster map <%s>"), name);
B[i].type = G_get_raster_map_type(B[i].file);
/* Reading color lookup table */
- if (G_read_colors(name, mapset, &B[i].colors) == -1)
+ if (G_read_colors(name, "", &B[i].colors) == -1)
G_fatal_error(_("Color file for <%s> not available"), name);
B[i].array = G_allocate_raster_buf(B[i].type);
Modified: grass/trunk/display/d.thematic.area/main.c
===================================================================
--- grass/trunk/display/d.thematic.area/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.thematic.area/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -32,7 +32,6 @@
int main(int argc, char **argv)
{
- char *mapset;
int ret, level;
int i, stat = 0;
int nclass = 0, nbreaks, *frequencies, boxsize, textsize, ypos;
@@ -204,15 +203,8 @@
strcpy(map_name, map_opt->answer);
-
- /* Make sure map is available */
- mapset = G_find_vector2(map_name, "");
-
- if (mapset == NULL)
- G_fatal_error(_("Vector map <%s> not found"), map_name);
-
/* open vector */
- level = Vect_open_old(&Map, map_name, mapset);
+ level = Vect_open_old(&Map, map_name, "");
if (level < 2)
G_fatal_error(_("%s: You must build topology on vector map. Run v.build."),
Modified: grass/trunk/display/d.title/fancy.c
===================================================================
--- grass/trunk/display/d.title/fancy.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.title/fancy.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -1,15 +1,18 @@
#include <grass/gis.h>
#include "options.h"
-void fancy(char *mapset, struct Cell_head *window, struct Categories *cats,
- FILE * fp)
+void fancy(struct Cell_head *window, struct Categories *cats, FILE * fp)
{
+ char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
+
+ G__unqualified_name(map_name, G_mapset(), xname, xmapset);
+
fprintf(fp, ".C %s\n", "green");
fprintf(fp, ".S %f\n", size + 1.0);
fprintf(fp, "LOCATION: %s\n", G_location());
fprintf(fp, ".C %s\n", color);
fprintf(fp, ".S %f\n", size);
- fprintf(fp, "%s in %s\n", map_name, mapset);
+ fprintf(fp, "%s in %s\n", xname, xmapset);
fprintf(fp, "%s\n", cats->title);
fprintf(fp, "North: %10.2f South: %10.2f\n",
window->north, window->south);
Modified: grass/trunk/display/d.title/local_proto.h
===================================================================
--- grass/trunk/display/d.title/local_proto.h 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.title/local_proto.h 2008-08-28 22:19:05 UTC (rev 33146)
@@ -1,5 +1,5 @@
/* fancy.c */
-void fancy(char *, struct Cell_head *, struct Categories *, FILE *);
+void fancy(struct Cell_head *, struct Categories *, FILE *);
/* normal.c */
-void normal(char *, struct Cell_head *, struct Categories *, int, FILE *);
+void normal(struct Cell_head *, struct Categories *, int, FILE *);
Modified: grass/trunk/display/d.title/main.c
===================================================================
--- grass/trunk/display/d.title/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.title/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -26,14 +26,13 @@
#include "options.h"
#include "local_proto.h"
-char map_name[GNAME_MAX];
-char color[128];
+const char *map_name;
+const char *color;
float size;
int type;
int main(int argc, char **argv)
{
- char *mapset;
struct Cell_head window;
struct Categories cats;
struct GModule *module;
@@ -89,9 +88,9 @@
exit(EXIT_FAILURE);
- strcpy(map_name, opt1->answer);
+ map_name = opt1->answer;
- strcpy(color, opt2->answer);
+ color = opt2->answer;
if (opt3->answer != NULL)
sscanf(opt3->answer, "%f", &size);
@@ -104,20 +103,15 @@
if (!strlen(map_name))
G_fatal_error(_("No map name given"));
- /* Make sure map is available */
- mapset = G_find_cell(map_name, "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), map_name);
+ if (G_get_cellhd(map_name, "", &window) == -1)
+ G_fatal_error(_("Unable to read header of raster map <%s>"),
+ map_name);
- if (G_get_cellhd(map_name, mapset, &window) == -1)
- G_fatal_error(_("Unable to read header of raster map <%s@%s>"),
- map_name, mapset);
+ if (G_read_cats(map_name, "", &cats) == -1)
+ G_fatal_error(_("Unable to read category file of raster map <%s>"),
+ map_name);
- if (G_read_cats(map_name, mapset, &cats) == -1)
- G_fatal_error(_("Unable to read category file of raster map <%s@%s>"),
- map_name, mapset);
-
if (draw->answer) {
tmpfile = G_convert_dirseps_to_host(G_tempfile());
if (!(fp = fopen(tmpfile, "w")))
@@ -128,9 +122,9 @@
if (type == NORMAL)
- normal(mapset, &window, &cats, simple_mode->answer, fp);
+ normal(&window, &cats, simple_mode->answer, fp);
else
- fancy(mapset, &window, &cats, fp);
+ fancy(&window, &cats, fp);
if (draw->answer) {
Modified: grass/trunk/display/d.title/normal.c
===================================================================
--- grass/trunk/display/d.title/normal.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.title/normal.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -1,10 +1,14 @@
#include <grass/gis.h>
#include "options.h"
+#include "local_proto.h"
-void normal(char *mapset, struct Cell_head *window, struct Categories *cats,
+void normal(struct Cell_head *window, struct Categories *cats,
int simple, FILE * fp)
{
+ char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
+ G__unqualified_name(map_name, G_mapset(), xname, xmapset);
+
fprintf(fp, ".C %s\n", color);
fprintf(fp, ".S %f\n", size);
@@ -13,7 +17,7 @@
}
else {
fprintf(fp, "LOCATION: %s\n", G_location());
- fprintf(fp, "%s in %s\n", map_name, mapset);
+ fprintf(fp, "%s in %s\n", xname, xmapset);
fprintf(fp, "%s\n", cats->title);
fprintf(fp, "North: %10.2f South: %10.2f\n",
window->north, window->south);
Modified: grass/trunk/display/d.title/options.h
===================================================================
--- grass/trunk/display/d.title/options.h 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.title/options.h 2008-08-28 22:19:05 UTC (rev 33146)
@@ -1,6 +1,6 @@
-extern char map_name[GNAME_MAX];
-extern char color[128];
+extern const char *map_name;
+extern const char *color;
extern float size;
extern int type;
Modified: grass/trunk/display/d.vect/main.c
===================================================================
--- grass/trunk/display/d.vect/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.vect/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -77,7 +77,6 @@
int main(int argc, char **argv)
{
- char *mapset;
int ret, level;
int i, stat = 0, type, area, display;
int chcat = 0;
@@ -465,19 +464,13 @@
else
S_stroke(Symb, size, 0.0, 0);
- /* Make sure map is available */
- mapset = G_find_vector2(map_name, "");
-
- if (mapset == NULL)
- G_fatal_error(_("Vector map <%s> not found"), map_name);
-
/* if where_opt was specified select categories from db
* otherwise parse cat_opt */
Clist = Vect_new_cat_list();
Clist->field = atoi(field_opt->answer);
/* open vector */
- level = Vect_open_old(&Map, map_name, mapset);
+ level = Vect_open_old(&Map, map_name, "");
if (where_opt->answer) {
if (Clist->field < 1)
Modified: grass/trunk/display/d.vect.chart/main.c
===================================================================
--- grass/trunk/display/d.vect.chart/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.vect.chart/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -29,7 +29,7 @@
int main(int argc, char **argv)
{
- char *mapset, *p;
+ char *p;
int y_center;
int i, j, ret, type, field, ctype, ncols;
COLOR ocolor, *colors;
@@ -240,14 +240,9 @@
size = atoi(size_opt->answer);
scale = atof(scale_opt->answer);
- /* Make sure map is available */
- mapset = G_find_vector2(map_opt->answer, NULL);
- if (mapset == NULL)
- G_fatal_error(_("Vector map <%s> not found"), map_opt->answer);
-
/* open vector */
Vect_set_open_level(2);
- Vect_open_old(&Map, map_opt->answer, mapset);
+ Vect_open_old(&Map, map_opt->answer, "");
ctype = CTYPE_PIE;
if (ctype_opt->answer[0] == 'b')
Modified: grass/trunk/display/d.zoom/main.c
===================================================================
--- grass/trunk/display/d.zoom/main.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/display/d.zoom/main.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -47,7 +47,7 @@
struct GModule *module;
double magnify;
int i, first = 1;
- char *mapset, *map;
+ char *map;
double ux1, uy1, ux2, uy2;
struct Cell_head window, defwin, currwin, tmpwin;
@@ -138,11 +138,7 @@
nrasts = i;
for (i = 0; i < nrasts; i++) {
- mapset = G_find_cell2(rast[i], "");
- if (mapset == NULL)
- G_fatal_error(_("Raster map <%s> not found"), rast[i]);
-
- if (G_get_cellhd(rast[i], mapset, &window) >= 0) {
+ if (G_get_cellhd(rast[i], "", &window) >= 0) {
if (first) {
first = 0;
U_east = window.east;
@@ -172,11 +168,7 @@
nvects = i;
for (i = 0; i < nvects; i++) {
- mapset = G_find_vector2(vect[i], "");
- if (mapset == NULL)
- G_fatal_error(_("Vector map <%s> not found"), vect[i]);
-
- if (Vect_open_old(&Map, vect[i], mapset) >= 2) {
+ if (Vect_open_old(&Map, vect[i], "") >= 2) {
Vect_get_map_box(&Map, &box);
if (first) {
first = 0;
Modified: grass/trunk/lib/gis/nme_in_mps.c
===================================================================
--- grass/trunk/lib/gis/nme_in_mps.c 2008-08-28 22:05:46 UTC (rev 33145)
+++ grass/trunk/lib/gis/nme_in_mps.c 2008-08-28 22:19:05 UTC (rev 33146)
@@ -17,30 +17,6 @@
#include <grass/gis.h>
/*!
- \brief Checks to see if 'name_in' is in the format: <name> in <mapset>
-
- \param name_in full map name
- \param[out] name_out map name
- \param[out] mapset mapset name
-
- \return 1 name_in is in this format.
- name_out will contain the simple <name>
- mapset will contain <mapset>
- \return 0 name_in is not in this format
- name_out and mapset are undefined (changed)
- */
-#ifndef COMMENTED_OUT
-int G__name_in_mapset(const char *name_in, char *name_out, char *mapset)
-{
- char in[1024];
-
- *in = 0;
- return (sscanf(name_in, "%s %s %s", name_out, in, mapset) == 3 &&
- strcmp(in, "in") == 0);
-}
-#endif
-
-/*!
\brief Check if map name is fully qualified (map @ mapset)
Note:
More information about the grass-commit
mailing list