[GRASS-SVN] r38129 - in grass/trunk: include lib/raster ps/ps.map
raster/r.info raster/r.los raster/r.param.scale raster/r.support
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jun 30 13:25:24 EDT 2009
Author: martinl
Date: 2009-06-30 13:25:23 -0400 (Tue, 30 Jun 2009)
New Revision: 38129
Modified:
grass/trunk/include/raster.h
grass/trunk/lib/raster/raster_metadata.c
grass/trunk/ps/ps.map/ps_fclrtbl.c
grass/trunk/raster/r.info/main.c
grass/trunk/raster/r.los/main.c
grass/trunk/raster/r.param.scale/close_down.c
grass/trunk/raster/r.support/main.c
Log:
rasterlib: fns from raster_metadata.c renamed, see
http://trac.osgeo.org/grass/wiki/Grass7/RasterLib
Modified: grass/trunk/include/raster.h
===================================================================
--- grass/trunk/include/raster.h 2009-06-30 16:53:15 UTC (rev 38128)
+++ grass/trunk/include/raster.h 2009-06-30 17:25:23 UTC (rev 38129)
@@ -479,13 +479,10 @@
DCELL Rast_get_d_value(const void *, RASTER_MAP_TYPE);
/* raster_metadata.c */
-int Rast_read_raster_units(const char *, const char *, char *);
-int Rast_read_raster_vdatum(const char *, const char *, char *);
-int Rast_write_raster_units(const char *, const char *);
-int Rast_write_raster_vdatum(const char *, const char *);
-int Rast__raster_misc_read_line(const char *, const char *, const char *,
- char *);
-int Rast__raster_misc_write_line(const char *, const char *, const char *);
+int Rast_read_units(const char *, const char *, char *);
+int Rast_read_vdatum(const char *, const char *, char *);
+int Rast_write_units(const char *, const char *);
+int Rast_write_vdatum(const char *, const char *);
/* reclass.c */
int Rast_is_reclass(const char *, const char *, char *, char *);
Modified: grass/trunk/lib/raster/raster_metadata.c
===================================================================
--- grass/trunk/lib/raster/raster_metadata.c 2009-06-30 16:53:15 UTC (rev 38128)
+++ grass/trunk/lib/raster/raster_metadata.c 2009-06-30 17:25:23 UTC (rev 38129)
@@ -1,15 +1,17 @@
-/* raster_metadata.c
- *
- * PURPOSE: functions to read and write raster "units" and "vertical datum"
- * meta-data info
- *
- * Copyright (C) 2007 by Hamish Bowman, and the GRASS Development Team
- * Author(s): Hamish Bowman, Dunedin, New Zealand
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- */
+/*!
+ \file raster/raster_metadata.c
+
+ \brief Raster library - Functions to read and write raster "units"
+ and "vertical datum" meta-data info
+
+ (C) 2007-2009 by Hamish Bowman, and the GRASS Development Team
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Hamish Bowman
+*/
+
#include <stdio.h>
#include <string.h>
@@ -17,74 +19,79 @@
#include <grass/raster.h>
#include <grass/glocale.h>
+static int misc_read_line(const char *, const char *,
+ const char *, char *);
+static int misc_write_line(const char *, const char *,
+ const char *);
/*!
* \brief Get a raster map's units metadata string
*
* Read the raster's units metadata file and put string in str
*
- * \param name
- * \param mapset
- * \param *str string to be populated with data
+ * \param name raster map name
+ * \param mapset mapset name
+ * \param str string to be populated with data
+ *
* \return 0 on success
* \return -1, EOF (fclose() result) on error
*/
-int Rast_read_raster_units(const char *name, const char *mapset, char *str)
+int Rast_read_units(const char *name, const char *mapset, char *str)
{
- return Rast__raster_misc_read_line("units", name, mapset, str);
+ return misc_read_line("units", name, mapset, str);
}
-
/*!
* \brief Write a string to a raster map's units metadata file
*
- * Map must exist in the current mapset.
+ * Raster map must exist in the current mapset.
*
- * \param name
- * \param *str string containing data to be written
+ * \param name raster map name
+ * \param str string containing data to be written
+ *
* \return 0 on success
* \return -1, EOF (fclose() result) on error
*/
-int Rast_write_raster_units(const char *name, const char *str)
+int Rast_write_units(const char *name, const char *str)
{
- return Rast__raster_misc_write_line("units", name, str);
+ return misc_write_line("units", name, str);
}
-
/*!
* \brief Get a raster map's vertical datum metadata string
*
* Read the raster's vertical datum metadata file and put string in str
*
- * \param name
- * \param mapset
- * \param *str string to be populated with data
+ * \param name raster map name
+ * \param mapset mapset name
+ * \param str string to be populated with data
+ *
* \return 0 on success
* \return -1, EOF (fclose() result) on error
*/
-int Rast_read_raster_vdatum(const char *name, const char *mapset, char *str)
+int Rast_read_vdatum(const char *name, const char *mapset, char *str)
{
- return Rast__raster_misc_read_line("vertical_datum", name, mapset, str);
+ return misc_read_line("vertical_datum", name, mapset, str);
}
/*!
* \brief Write a string into a raster's vertical datum metadata file
*
- * Map must exist in the current mapset.
+ * Raster map must exist in the current mapset.
*
- * \param name
- * \param *str string containing data to be written
+ * \param name raster map name
+ * \param str string containing data to be written
+ *
* \return 0 on success
* \return -1, EOF (fclose() result) on error
*/
-int Rast_write_raster_vdatum(const char *name, const char *str)
+int Rast_write_vdatum(const char *name, const char *str)
{
- return Rast__raster_misc_write_line("vertical_datum", name, str);
+ return misc_write_line("vertical_datum", name, str);
}
-
/*!
* \brief Read the first line of a file in cell_misc/
*
@@ -97,8 +104,8 @@
* \return 0 on success
* \return -1, EOF (fclose() result) on error
*/
-int Rast__raster_misc_read_line(const char *elem, const char *name,
- const char *mapset, char *str)
+int misc_read_line(const char *elem, const char *name,
+ const char *mapset, char *str)
{
FILE *fd;
char buff[GNAME_MAX];
@@ -110,7 +117,8 @@
fd = G_fopen_old_misc("cell_misc", elem, name, mapset);
if (!fd) {
- G_warning(_("Can't read %s for [%s in %s]"), elem, name, mapset);
+ G_warning(_("Unable to read %s for raster map <%s@%s>"),
+ elem, name, mapset);
return -1;
}
if (G_getl2(buff, sizeof(buff) - 1, fd) == 0) {
@@ -136,14 +144,14 @@
* \return 0 on success
* \return -1, EOF (fclose() result) on error
*/
-int Rast__raster_misc_write_line(const char *elem, const char *name,
- const char *str)
+int misc_write_line(const char *elem, const char *name,
+ const char *str)
{
FILE *fd;
fd = G_fopen_new_misc("cell_misc", elem, name);
if (fd == NULL) {
- G_warning(_("Can't create %s metadata file for [%s in %s]"),
+ G_warning(_("Unable to create %s metadata file for raster map <%s@%s>"),
elem, name, G_mapset());
return -1;
}
Modified: grass/trunk/ps/ps.map/ps_fclrtbl.c
===================================================================
--- grass/trunk/ps/ps.map/ps_fclrtbl.c 2009-06-30 16:53:15 UTC (rev 38128)
+++ grass/trunk/ps/ps.map/ps_fclrtbl.c 2009-06-30 17:25:23 UTC (rev 38129)
@@ -249,7 +249,7 @@
/* print units label, if present */
- if (Rast_read_raster_units(ct.name, ct.mapset, units) != 0)
+ if (Rast_read_units(ct.name, ct.mapset, units) != 0)
units[0] = '\0';
if(strlen(units)) {
Modified: grass/trunk/raster/r.info/main.c
===================================================================
--- grass/trunk/raster/r.info/main.c 2009-06-30 16:53:15 UTC (rev 38128)
+++ grass/trunk/raster/r.info/main.c 2009-06-30 17:25:23 UTC (rev 38129)
@@ -125,9 +125,9 @@
is_reclass = Rast_get_reclass(name, "", &reclass);
data_type = Rast_map_type(name, "");
- if (Rast_read_raster_units(name, "", units) != 0)
+ if (Rast_read_units(name, "", units) != 0)
units[0] = '\0';
- if (Rast_read_raster_vdatum(name, "", vdatum) != 0)
+ if (Rast_read_vdatum(name, "", vdatum) != 0)
vdatum[0] = '\0';
/*Check the Timestamp */
Modified: grass/trunk/raster/r.los/main.c
===================================================================
--- grass/trunk/raster/r.los/main.c 2009-06-30 16:53:15 UTC (rev 38128)
+++ grass/trunk/raster/r.los/main.c 2009-06-30 17:25:23 UTC (rev 38129)
@@ -413,7 +413,7 @@
sprintf(title, "Line of sight %.2fm above %s", obs_elev, opt3->answer);
Rast_put_cell_title(out_layer, title);
- Rast_write_raster_units(out_layer, "degrees");
+ Rast_write_units(out_layer, "degrees");
Rast_short_history(out_layer, "raster", &history);
Rast_command_history(&history);
Modified: grass/trunk/raster/r.param.scale/close_down.c
===================================================================
--- grass/trunk/raster/r.param.scale/close_down.c 2009-06-30 16:53:15 UTC (rev 38128)
+++ grass/trunk/raster/r.param.scale/close_down.c 2009-06-30 17:25:23 UTC (rev 38129)
@@ -37,7 +37,7 @@
case SLOPE:
strcpy(map_type, "Magnitude of maximum gradient");
- Rast_write_raster_units(rast_out_name, "degrees");
+ Rast_write_units(rast_out_name, "degrees");
strcpy(history.edhist[0],
"Slope is given for steepest slope angle and measured in degrees.");
@@ -46,7 +46,7 @@
case ASPECT:
strcpy(map_type, "Direction of maximum gradient");
- Rast_write_raster_units(rast_out_name, "degrees");
+ Rast_write_units(rast_out_name, "degrees");
strcpy(history.edhist[0],
"Flow direction (aspect): W=0, E=180, N=+90, S=-90 degrees");
Modified: grass/trunk/raster/r.support/main.c
===================================================================
--- grass/trunk/raster/r.support/main.c 2009-06-30 16:53:15 UTC (rev 38128)
+++ grass/trunk/raster/r.support/main.c 2009-06-30 17:25:23 UTC (rev 38129)
@@ -241,10 +241,10 @@
}
if (units_opt->answer)
- Rast_write_raster_units(raster->answer, units_opt->answer);
+ Rast_write_units(raster->answer, units_opt->answer);
if (vdatum_opt->answer)
- Rast_write_raster_vdatum(raster->answer, vdatum_opt->answer);
+ Rast_write_vdatum(raster->answer, vdatum_opt->answer);
if (datasrc1_opt->answer || datasrc2_opt->answer || datadesc_opt->answer) {
Rast_read_history(raster->answer, "", &hist);
More information about the grass-commit
mailing list