[GRASS-SVN] r52196 - grass/trunk/display/d.what.rast
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 23 05:31:46 PDT 2012
Author: hamish
Date: 2012-06-23 05:31:46 -0700 (Sat, 23 Jun 2012)
New Revision: 52196
Modified:
grass/trunk/display/d.what.rast/Makefile
grass/trunk/display/d.what.rast/local_proto.h
grass/trunk/display/d.what.rast/main.c
grass/trunk/display/d.what.rast/opencell.c
grass/trunk/display/d.what.rast/show.c
grass/trunk/display/d.what.rast/what.c
Log:
export floats and doubles with correct precision (#335, merge from devbr6)
Modified: grass/trunk/display/d.what.rast/Makefile
===================================================================
--- grass/trunk/display/d.what.rast/Makefile 2012-06-23 12:17:50 UTC (rev 52195)
+++ grass/trunk/display/d.what.rast/Makefile 2012-06-23 12:31:46 UTC (rev 52196)
@@ -3,9 +3,9 @@
PGM = d.what.rast
-LIBES = $(DISPLAYLIB) $(GISLIB)
+LIBES = $(DISPLAYLIB) $(RASTERLIB) $(GISLIB)
-DEPENDENCIES = $(DISPLAYDEP) $(GISDEP)
+DEPENDENCIES = $(DISPLAYDEP) $(RASTERDEP) $(GISDEP)
include $(MODULE_TOPDIR)/include/Make/Module.make
Modified: grass/trunk/display/d.what.rast/local_proto.h
===================================================================
--- grass/trunk/display/d.what.rast/local_proto.h 2012-06-23 12:17:50 UTC (rev 52195)
+++ grass/trunk/display/d.what.rast/local_proto.h 2012-06-23 12:31:46 UTC (rev 52196)
@@ -4,7 +4,8 @@
/* show.c */
int show_cat(int, int, char *, char *, int, char *, int, char *,
RASTER_MAP_TYPE);
-int show_dval(int, int, char *, char *, DCELL, char *, int, char *);
+int show_dval(int, int, char *, char *, DCELL, char *, int, char *,
+ RASTER_MAP_TYPE);
int show_utm(char *, char *, double, double, struct Cell_head *, int, int,
int, char *);
int show_buttons(int);
Modified: grass/trunk/display/d.what.rast/main.c
===================================================================
--- grass/trunk/display/d.what.rast/main.c 2012-06-23 12:17:50 UTC (rev 52195)
+++ grass/trunk/display/d.what.rast/main.c 2012-06-23 12:31:46 UTC (rev 52196)
@@ -23,6 +23,7 @@
#include <string.h>
#include "what.h"
#include <grass/display.h>
+#include <grass/raster.h>
#include <grass/glocale.h>
#include "local_proto.h"
@@ -94,7 +95,7 @@
if (opt1->answers && opt1->answers[0])
rast = opt1->answers;
- if (R_open_driver() != 0)
+ if (D_open_driver() != 0)
G_fatal_error(_("No graphics device selected"));
D_setup(0);
@@ -133,6 +134,6 @@
what(once->answer, terse->answer, colrow->answer, fs->answer, width,
mwidth);
- R_close_driver();
+ D_close_driver();
exit(EXIT_SUCCESS);
}
Modified: grass/trunk/display/d.what.rast/opencell.c
===================================================================
--- grass/trunk/display/d.what.rast/opencell.c 2012-06-23 12:17:50 UTC (rev 52195)
+++ grass/trunk/display/d.what.rast/opencell.c 2012-06-23 12:31:46 UTC (rev 52196)
@@ -1,5 +1,6 @@
#include <string.h>
#include <grass/gis.h>
+#include <grass/raster.h>
#include <grass/glocale.h>
int opencell(char *fullname, char *name, char *mapset)
Modified: grass/trunk/display/d.what.rast/show.c
===================================================================
--- grass/trunk/display/d.what.rast/show.c 2012-06-23 12:17:50 UTC (rev 52195)
+++ grass/trunk/display/d.what.rast/show.c 2012-06-23 12:31:46 UTC (rev 52196)
@@ -1,6 +1,7 @@
-#include <grass/gis.h>
#include <unistd.h>
#include <string.h>
+#include <grass/gis.h>
+#include <grass/raster.h>
static int nlines = 100;
@@ -55,7 +56,7 @@
int show_dval(int width, int mwidth,
char *name, char *mapset, DCELL dval, char *label,
- int terse, char *fs)
+ int terse, char *fs, RASTER_MAP_TYPE map_type)
{
DCELL dcell_val;
char *fname;
@@ -71,10 +72,10 @@
}
else {
if (!isatty(fileno(stdout)))
- fprintf(stdout, "%s, actual %s%f%s%s\n", fname, fs, dval, fs,
- label);
- fprintf(stderr, "%s, actual %s%f%s%s\n", fname, fs, dval, fs,
- label);
+ fprintf(stdout, "%s, actual %s%.*g%s%s\n", fname, fs,
+ map_type == FCELL_TYPE ? 7 : 15, dval, fs, label);
+ fprintf(stderr, "%s, actual %s%.*g%s%s\n", fname, fs,
+ map_type == FCELL_TYPE ? 7 : 15, dval, fs, label);
}
}
else {
@@ -87,10 +88,12 @@
}
else {
if (!isatty(fileno(stdout)))
- fprintf(stdout, "%*s in %-*s, actual (%f)%s\n", width, name,
- mwidth, mapset, dval, label);
- fprintf(stderr, "%*s in %-*s, actual (%f)%s\n", width, name,
- mwidth, mapset, dval, label);
+ fprintf(stdout, "%*s in %-*s, actual (%.*g)%s\n", width, name,
+ mwidth, mapset, map_type == FCELL_TYPE ? 7 : 15,
+ dval, label);
+ fprintf(stderr, "%*s in %-*s, actual (%.*g)%s\n", width, name,
+ mwidth, mapset, map_type == FCELL_TYPE ? 7 : 15, dval,
+ label);
}
}
nlines += 1;
Modified: grass/trunk/display/d.what.rast/what.c
===================================================================
--- grass/trunk/display/d.what.rast/what.c 2012-06-23 12:17:50 UTC (rev 52195)
+++ grass/trunk/display/d.what.rast/what.c 2012-06-23 12:31:46 UTC (rev 52196)
@@ -75,7 +75,7 @@
show_dval(width, mwidth, name[i], mapset[i], dbuf[col],
Rast_get_d_cat(&dbuf[col], &cats[i]), terse,
- fs);
+ fs, map_type[i]);
}
}
while (!once);
More information about the grass-commit
mailing list