[GRASS-SVN] r38424 - grass/trunk/lib/raster
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 15 08:59:37 EDT 2009
Author: neteler
Date: 2009-07-15 08:59:37 -0400 (Wed, 15 Jul 2009)
New Revision: 38424
Modified:
grass/trunk/lib/raster/R.h
grass/trunk/lib/raster/alloc_cell.c
grass/trunk/lib/raster/cats.c
grass/trunk/lib/raster/cellstats_eq.c
grass/trunk/lib/raster/closecell.c
grass/trunk/lib/raster/color_compat.c
grass/trunk/lib/raster/color_free.c
grass/trunk/lib/raster/color_get.c
grass/trunk/lib/raster/color_hist.c
grass/trunk/lib/raster/color_insrt.c
grass/trunk/lib/raster/color_invrt.c
grass/trunk/lib/raster/color_look.c
grass/trunk/lib/raster/color_org.c
grass/trunk/lib/raster/color_range.c
grass/trunk/lib/raster/color_read.c
grass/trunk/lib/raster/color_rule.c
grass/trunk/lib/raster/color_rules.c
grass/trunk/lib/raster/color_set.c
grass/trunk/lib/raster/color_write.c
grass/trunk/lib/raster/color_xform.c
grass/trunk/lib/raster/fpreclass.c
grass/trunk/lib/raster/gdal.c
grass/trunk/lib/raster/get_cellhd.c
grass/trunk/lib/raster/get_row.c
grass/trunk/lib/raster/get_row_colr.c
grass/trunk/lib/raster/histo_eq.c
grass/trunk/lib/raster/histogram.c
grass/trunk/lib/raster/history.c
grass/trunk/lib/raster/init.c
grass/trunk/lib/raster/interp.c
grass/trunk/lib/raster/null_val.c
grass/trunk/lib/raster/opencell.c
grass/trunk/lib/raster/put_cellhd.c
grass/trunk/lib/raster/put_row.c
grass/trunk/lib/raster/put_title.c
grass/trunk/lib/raster/quant.c
grass/trunk/lib/raster/quant_io.c
grass/trunk/lib/raster/quant_rw.c
grass/trunk/lib/raster/range.c
grass/trunk/lib/raster/raster.c
grass/trunk/lib/raster/raster_metadata.c
grass/trunk/lib/raster/reclass.c
grass/trunk/lib/raster/sample.c
grass/trunk/lib/raster/set_window.c
grass/trunk/lib/raster/window_map.c
Log:
applied ../../tools/grass_indent.sh
Modified: grass/trunk/lib/raster/R.h
===================================================================
--- grass/trunk/lib/raster/R.h 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/R.h 2009-07-15 12:59:37 UTC (rev 38424)
@@ -33,11 +33,9 @@
};
#ifdef HAVE_GDAL
-extern CPLErr Rast_gdal_raster_IO(
- GDALRasterBandH, GDALRWFlag,
- int, int, int, int,
- void *, int, int, GDALDataType,
- int, int);
+extern CPLErr Rast_gdal_raster_IO(GDALRasterBandH, GDALRWFlag,
+ int, int, int, int,
+ void *, int, int, GDALDataType, int, int);
#endif
struct fileinfo /* Information for opened cell files */
Modified: grass/trunk/lib/raster/alloc_cell.c
===================================================================
--- grass/trunk/lib/raster/alloc_cell.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/alloc_cell.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -20,7 +20,8 @@
#define F2I(map_type) \
(map_type == CELL_TYPE ? 0 : (map_type == FCELL_TYPE ? 1 : 2))
-static const int type_size[3] = { sizeof(CELL), sizeof(FCELL), sizeof(DCELL) };
+static const int type_size[3] =
+ { sizeof(CELL), sizeof(FCELL), sizeof(DCELL) };
/*!
* \brief Returns size of a raster cell in bytes.
Modified: grass/trunk/lib/raster/cats.c
===================================================================
--- grass/trunk/lib/raster/cats.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/cats.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -79,10 +79,10 @@
static int get_fmt(char **, char *, int *);
static int cmp(const void *, const void *);
-static int write_cats(const char *element, const char *name, struct Categories *cats);
-static CELL read_cats(const char *element,
- const char *name,
- const char *mapset, struct Categories * pcats, int full);
+static int write_cats(const char *element, const char *name,
+ struct Categories *cats);
+static CELL read_cats(const char *element, const char *name,
+ const char *mapset, struct Categories *pcats, int full);
static struct Categories save_cats;
@@ -106,12 +106,10 @@
{
switch (read_cats("cats", name, mapset, pcats, 1)) {
case -2:
- G_warning(_("Category support for <%s@%s> missing"),
- name, mapset);
+ G_warning(_("Category support for <%s@%s> missing"), name, mapset);
break;
case -1:
- G_warning(_("Category support for <%s@%s> invalid"),
- name, mapset);
+ G_warning(_("Category support for <%s@%s> invalid"), name, mapset);
break;
default:
return 0;
@@ -140,16 +138,16 @@
* \return 0 on success
*/
int Rast_read_vector_cats(const char *name,
- const char *mapset, struct Categories *pcats)
+ const char *mapset, struct Categories *pcats)
{
switch (read_cats("dig_cats", name, mapset, pcats, 1)) {
case -2:
G_warning(_("Category support for vector map <%s@%s> missing"),
- name, mapset);
+ name, mapset);
break;
case -1:
G_warning(_("Category support for vector map <%s@%s> invalid"),
- name, mapset);
+ name, mapset);
break;
default:
return 0;
@@ -159,14 +157,14 @@
}
/*!
- \brief Get number of categories
+ \brief Get number of categories
- \param name raster map name
- \param mapset mapset name
+ \param name raster map name
+ \param mapset mapset name
- \return -1 on error
- \return number of cats
-*/
+ \return -1 on error
+ \return number of cats
+ */
CELL Rast_get_max_c_cat(const char *name, const char *mapset)
{
struct Range range;
@@ -183,7 +181,7 @@
static CELL read_cats(const char *element,
const char *name,
- const char *mapset, struct Categories * pcats, int full)
+ const char *mapset, struct Categories *pcats, int full)
{
FILE *fd;
char buff[1024];
@@ -560,7 +558,7 @@
while (ncols-- > 0) {
i = Rast_quant_get_cell_value(&pcats->q,
- Rast_get_d_value(rast_row, data_type));
+ Rast_get_d_value(rast_row, data_type));
if (Rast_is_c_null_value(&i))
continue;
if (i > pcats->ncats)
@@ -585,28 +583,29 @@
}
/*!
- \brief Get next marked raster categories (DCELL)
+ \brief Get next marked raster categories (DCELL)
- \param pcats pointer to Categories structure
- \param rast1, rast2 cell values (raster range)
- \param[out] count count
+ \param pcats pointer to Categories structure
+ \param rast1, rast2 cell values (raster range)
+ \param[out] count count
- \return NULL if not found
- \return description if found
-*/
+ \return NULL if not found
+ \return description if found
+ */
char *Rast_get_next_marked_d_cat(struct Categories *pcats,
- DCELL * rast1, DCELL * rast2,
- long *count)
+ DCELL * rast1, DCELL * rast2, long *count)
{
char *descr = NULL;
int found, i;
found = 0;
/* pcats->ncats should be == Rast_quant_nof_rules(&pcats->q) */
-
- G_debug(3, "last marked %d nrules %d\n", pcats->last_marked_rule, Rast_quant_nof_rules(&pcats->q));
- for (i = pcats->last_marked_rule + 1; i < Rast_quant_nof_rules(&pcats->q); i++) {
+ G_debug(3, "last marked %d nrules %d\n", pcats->last_marked_rule,
+ Rast_quant_nof_rules(&pcats->q));
+
+ for (i = pcats->last_marked_rule + 1; i < Rast_quant_nof_rules(&pcats->q);
+ i++) {
descr = Rast_get_ith_d_cat(pcats, i, rast1, rast2);
G_debug(5, "%d %d", i, pcats->marks[i]);
if (pcats->marks[i]) {
@@ -624,52 +623,48 @@
}
/*!
- \brief Get next marked raster categories (CELL)
+ \brief Get next marked raster categories (CELL)
- \param pcats pointer to Categories structure
- \param rast1, rast2 cell values (raster range)
- \param[out] count count
+ \param pcats pointer to Categories structure
+ \param rast1, rast2 cell values (raster range)
+ \param[out] count count
- \return NULL if not found
- \return description if found
-*/
+ \return NULL if not found
+ \return description if found
+ */
char *Rast_get_next_marked_c_cat(struct Categories *pcats,
- CELL * rast1, CELL * rast2,
- long *count)
+ CELL * rast1, CELL * rast2, long *count)
{
- return Rast_get_next_marked_cat(pcats, rast1, rast2, count,
- CELL_TYPE);
+ return Rast_get_next_marked_cat(pcats, rast1, rast2, count, CELL_TYPE);
}
/*!
- \brief Get next marked raster categories (FCELL)
+ \brief Get next marked raster categories (FCELL)
- \param pcats pointer to Categories structure
- \param rast1, rast2 cell values (raster range)
- \param[out] count count
+ \param pcats pointer to Categories structure
+ \param rast1, rast2 cell values (raster range)
+ \param[out] count count
- \return NULL if not found
- \return description if found
-*/
+ \return NULL if not found
+ \return description if found
+ */
char *Rast_get_next_marked_f_cat(struct Categories *pcats,
- FCELL * rast1, FCELL * rast2,
- long *count)
+ FCELL * rast1, FCELL * rast2, long *count)
{
- return Rast_get_next_marked_cat(pcats, rast1, rast2, count,
- FCELL_TYPE);
+ return Rast_get_next_marked_cat(pcats, rast1, rast2, count, FCELL_TYPE);
}
/*!
- \brief Get next marked raster categories
+ \brief Get next marked raster categories
- \param pcats pointer to Categories structure
- \param rast1, rast2 cell values (raster range)
- \param[out] count count
- \param data_type map type
+ \param pcats pointer to Categories structure
+ \param rast1, rast2 cell values (raster range)
+ \param[out] count count
+ \param data_type map type
- \return NULL if not found
- \return description if found
-*/
+ \return NULL if not found
+ \return description if found
+ */
char *Rast_get_next_marked_cat(struct Categories *pcats,
void *rast1, void *rast2,
long *count, RASTER_MAP_TYPE data_type)
@@ -839,7 +834,8 @@
}
/* when rule for this range does not exist */
/* DEBUG fprintf (stderr, "Rast_set_d_cat(): New rule: adding %d %p\n", i, pcats->labels); */
- Rast_quant_add_rule(&pcats->q, *rast1, *rast2, pcats->ncats, pcats->ncats);
+ Rast_quant_add_rule(&pcats->q, *rast1, *rast2, pcats->ncats,
+ pcats->ncats);
pcats->ncats++;
if (pcats->nalloc < pcats->ncats) {
/* DEBUG fprintf (stderr, "Rast_set_d_cat(): need more space nalloc = %d ncats = %d\n", pcats->nalloc,pcats->ncats); */
@@ -955,7 +951,8 @@
return write_cats("dig_cats", name, cats);
}
-static int write_cats(const char *element, const char *name, struct Categories *cats)
+static int write_cats(const char *element, const char *name,
+ struct Categories *cats)
{
FILE *fd;
int i, fp_map;
@@ -1175,13 +1172,13 @@
}
/*!
- \brief Set category fmt (?)
+ \brief Set category fmt (?)
- \param fmt
- \param m1,
- \param a1,m2,a2
- \param pcats pointer to Categories structure
-*/
+ \param fmt
+ \param m1,
+ \param a1,m2,a2
+ \param pcats pointer to Categories structure
+ */
void Rast_set_cats_fmt(const char *fmt, double m1, double a1, double m2,
double a2, struct Categories *pcats)
{
@@ -1255,25 +1252,25 @@
}
/*!
- \brief Get number of raster categories
+ \brief Get number of raster categories
- \param pcats pointer to Categories structure
+ \param pcats pointer to Categories structure
- \return number of categories
-*/
+ \return number of categories
+ */
int Rast_number_of_cats(struct Categories *pcats)
{
return pcats->ncats;
}
/*!
- \brief Sort categories
+ \brief Sort categories
- \param pcats pointer to Categories structure
+ \param pcats pointer to Categories structure
- \return -1 on error (nothing to sort)
- \return 0 on success
-*/
+ \return -1 on error (nothing to sort)
+ \return 0 on success
+ */
int Rast_sort_cats(struct Categories *pcats)
{
int *indexes, i, ncats;
@@ -1312,9 +1309,9 @@
CELL index;
Rast_quant_get_ith_rule(&(save_cats.q), *a,
- &min_rast1, &max_rast1, &index, &index);
+ &min_rast1, &max_rast1, &index, &index);
Rast_quant_get_ith_rule(&(save_cats.q), *b,
- &min_rast2, &max_rast2, &index, &index);
+ &min_rast2, &max_rast2, &index, &index);
if (min_rast1 < min_rast2)
return -1;
if (min_rast1 > min_rast2)
Modified: grass/trunk/lib/raster/cellstats_eq.c
===================================================================
--- grass/trunk/lib/raster/cellstats_eq.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/cellstats_eq.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -2,9 +2,9 @@
#include <grass/raster.h>
int Rast_cell_stats_histo_eq(struct Cell_stats *statf, CELL min1, CELL max1, /* input range to be rescaled */
- CELL min2, CELL max2, /* output range */
- int zero, /* include zero if min1 <= 0 <= min2 ? */
- void (*func) (CELL, CELL, CELL))
+ CELL min2, CELL max2, /* output range */
+ int zero, /* include zero if min1 <= 0 <= min2 ? */
+ void (*func) (CELL, CELL, CELL))
{
long count, total;
CELL prev = 0;
Modified: grass/trunk/lib/raster/closecell.c
===================================================================
--- grass/trunk/lib/raster/closecell.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/closecell.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -195,7 +195,7 @@
Rast_quant_add_rule(&fcb->quant, dcell_min, dcell_max,
cell_min, cell_max);
}
- */
+ */
Rast_quant_round(&fcb->quant);
if (Rast_write_quant(fcb->name, fcb->mapset, &fcb->quant) < 0)
G_warning(_("unable to write quant file!"));
@@ -359,16 +359,17 @@
/* write out the rows stored in memory */
for (row = fcb->min_null_row; row < fcb->null_cur_row; row++)
Rast__write_null_bits(null_fd,
- fcb->NULL_ROWS[row - fcb->min_null_row],
- row, fcb->cellhd.cols, fd);
+ fcb->NULL_ROWS[row - fcb->min_null_row],
+ row, fcb->cellhd.cols, fd);
/* write missing rows */
if (fcb->null_cur_row < fcb->cellhd.rows) {
- unsigned char *null_work_buf = Rast__allocate_null_bits(fcb->cellhd.cols);
+ unsigned char *null_work_buf =
+ Rast__allocate_null_bits(fcb->cellhd.cols);
Rast__init_null_bits(null_work_buf, fcb->cellhd.cols);
for (row = fcb->null_cur_row; row < fcb->cellhd.rows; row++)
Rast__write_null_bits(null_fd, null_work_buf, row,
- fcb->cellhd.cols, fd);
+ fcb->cellhd.cols, fd);
G_free(null_work_buf);
}
close(null_fd);
Modified: grass/trunk/lib/raster/color_compat.c
===================================================================
--- grass/trunk/lib/raster/color_compat.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_compat.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -197,7 +197,8 @@
* \param min minimum value
* \param max maximum value
*/
-void Rast_make_grey_scale_fp_colors(struct Colors *colors, DCELL min, DCELL max)
+void Rast_make_grey_scale_fp_colors(struct Colors *colors, DCELL min,
+ DCELL max)
{
Rast_make_fp_colors(colors, "grey", min, max);
}
Modified: grass/trunk/lib/raster/color_free.c
===================================================================
--- grass/trunk/lib/raster/color_free.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_free.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -34,12 +34,12 @@
}
/*!
- \brief Free color rules structure
+ \brief Free color rules structure
- Note: Only for internal use.
+ Note: Only for internal use.
- \param cp pointer to _Color_Info structure
-*/
+ \param cp pointer to _Color_Info structure
+ */
void Rast__color_free_rules(struct _Color_Info_ *cp)
{
struct _Color_Rule_ *rule, *next;
@@ -52,12 +52,12 @@
}
/*!
- \brief Free color rules structure
+ \brief Free color rules structure
- Note: Only for internal use.
+ Note: Only for internal use.
- \param cp pointer to _Color_Info structure
-*/
+ \param cp pointer to _Color_Info structure
+ */
void Rast__color_free_lookup(struct _Color_Info_ *cp)
{
if (cp->lookup.active) {
@@ -70,12 +70,12 @@
}
/*!
- \brief Free color rules structure
+ \brief Free color rules structure
- Note: Only for internal use.
+ Note: Only for internal use.
- \param cp pointer to _Color_Info structure
-*/
+ \param cp pointer to _Color_Info structure
+ */
void Rast__color_free_fp_lookup(struct _Color_Info_ *cp)
{
if (cp->fp_lookup.active) {
@@ -87,14 +87,14 @@
}
/*!
- \brief Reset colors structure
+ \brief Reset colors structure
- Note: Only for internal use.
+ Note: Only for internal use.
- This routine should NOT init the colors.
+ This routine should NOT init the colors.
- \param colors pointer to Colors structure
-*/
+ \param colors pointer to Colors structure
+ */
void Rast__color_reset(struct Colors *colors)
{
Rast__color_free_lookup(&colors->fixed);
Modified: grass/trunk/lib/raster/color_get.c
===================================================================
--- grass/trunk/lib/raster/color_get.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_get.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -65,7 +65,7 @@
* \return 1 if color is set
* \return 0 if color is not set
*/
-int Rast_get_c_color(const CELL *rast,
+int Rast_get_c_color(const CELL * rast,
int *red, int *grn, int *blu, struct Colors *colors)
{
return Rast_get_color(rast, red, grn, blu, colors, CELL_TYPE);
@@ -86,7 +86,7 @@
* \return 1 if color is set
* \return 0 if color is not set
*/
-int Rast_get_f_color(const FCELL *rast,
+int Rast_get_f_color(const FCELL * rast,
int *red, int *grn, int *blu, struct Colors *colors)
{
return Rast_get_color(rast, red, grn, blu, colors, FCELL_TYPE);
@@ -107,7 +107,7 @@
* \return 1 if color is set
* \return 0 if color is not set
*/
-int Rast_get_d_color(const DCELL *rast,
+int Rast_get_d_color(const DCELL * rast,
int *red, int *grn, int *blu, struct Colors *colors)
{
return Rast_get_color(rast, red, grn, blu, colors, DCELL_TYPE);
Modified: grass/trunk/lib/raster/color_hist.c
===================================================================
--- grass/trunk/lib/raster/color_hist.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_hist.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -30,7 +30,7 @@
* \param stalf pointer to Cell_stats structure which holds cell stats info
*/
void Rast_make_histogram_eq_colors(struct Colors *colors,
- struct Cell_stats *statf)
+ struct Cell_stats *statf)
{
long count, total;
CELL prev = 0, cat, val2;
@@ -88,18 +88,19 @@
}
/*!
- \brief Generates histogram with normalized log transformed grey scale.
+ \brief Generates histogram with normalized log transformed grey scale.
- Generates histogram with normalized log transformed grey scale from
- cell stats structure info. Color range is 0-255.
+ Generates histogram with normalized log transformed grey scale from
+ cell stats structure info. Color range is 0-255.
- \param colors pointer to Colors structure which holds color info
- \param stalf pointer to Cell_stats structure which holds cell stats info
- \param min minimum value
- \param max maximum value
-*/
+ \param colors pointer to Colors structure which holds color info
+ \param stalf pointer to Cell_stats structure which holds cell stats info
+ \param min minimum value
+ \param max maximum value
+ */
void Rast_make_histogram_log_colors(struct Colors *colors,
- struct Cell_stats *statf, int min, int max)
+ struct Cell_stats *statf, int min,
+ int max)
{
long count, total;
double lmin, lmax;
Modified: grass/trunk/lib/raster/color_insrt.c
===================================================================
--- grass/trunk/lib/raster/color_insrt.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_insrt.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -12,8 +12,8 @@
#define LIMIT(x) if (x < 0) x = 0; else if (x > 255) x = 255;
int Rast__insert_color_into_lookup(CELL cat,
- int red, int grn, int blu,
- struct _Color_Info_ *cp)
+ int red, int grn, int blu,
+ struct _Color_Info_ *cp)
{
long nalloc;
long i;
Modified: grass/trunk/lib/raster/color_invrt.c
===================================================================
--- grass/trunk/lib/raster/color_invrt.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_invrt.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -1,14 +1,14 @@
/*!
- \file raster/color_invrt.c
+ \file raster/color_invrt.c
- \brief Raster library - Invert colors
+ \brief Raster library - Invert colors
- (C) 2003-2009 by the GRASS Development Team
+ (C) 2003-2009 by 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.
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
- \author Original author CERL
+ \author Original author CERL
*/
#include <grass/gis.h>
Modified: grass/trunk/lib/raster/color_look.c
===================================================================
--- grass/trunk/lib/raster/color_look.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_look.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -53,11 +53,11 @@
/* first lookup the fixed colors */
Rast__lookup_colors((void *)cell, red, grn, blu, set, n, colors, 0, 0,
- CELL_TYPE);
+ CELL_TYPE);
/* now lookup unset colors using the modular rules */
Rast__lookup_colors((void *)cell, red, grn, blu, set, n, colors, 1, 0,
- CELL_TYPE);
+ CELL_TYPE);
}
/*!
@@ -87,10 +87,12 @@
G_zero((char *)set, n * sizeof(unsigned char));
/* first lookup the fixed colors */
- Rast__lookup_colors(raster, red, grn, blu, set, n, colors, 0, 0, map_type);
+ Rast__lookup_colors(raster, red, grn, blu, set, n, colors, 0, 0,
+ map_type);
/* now lookup unset colors using the modular rules */
- Rast__lookup_colors(raster, red, grn, blu, set, n, colors, 1, 0, map_type);
+ Rast__lookup_colors(raster, red, grn, blu, set, n, colors, 1, 0,
+ map_type);
}
/*!
@@ -119,11 +121,11 @@
/* first lookup the fixed colors */
Rast__lookup_colors((void *)fcell, red, grn, blu, set, n, colors, 0, 0,
- FCELL_TYPE);
+ FCELL_TYPE);
/* now lookup unset colors using the modular rules */
Rast__lookup_colors((void *)fcell, red, grn, blu, set, n, colors, 1, 0,
- FCELL_TYPE);
+ FCELL_TYPE);
}
/*!
@@ -152,11 +154,11 @@
/* first lookup the fixed colors */
Rast__lookup_colors((void *)dcell, red, grn, blu, set, n, colors, 0, 0,
- DCELL_TYPE);
+ DCELL_TYPE);
/* now lookup unset colors using the modular rules */
Rast__lookup_colors((void *)dcell, red, grn, blu, set, n, colors, 1, 0,
- DCELL_TYPE);
+ DCELL_TYPE);
}
@@ -404,14 +406,14 @@
}
/*!
- \brief Interpolate color rules
+ \brief Interpolate color rules
- \param val raster cell value
- \param[out] red red value
- \param[out] grn green value
- \param[out] blu blue value
- \param rule pointer to _Color_Rule which holds color rules info
-*/
+ \param val raster cell value
+ \param[out] red red value
+ \param[out] grn green value
+ \param[out] blu blue value
+ \param rule pointer to _Color_Rule which holds color rules info
+ */
void Rast__interpolate_color_rule(DCELL val, unsigned char *red,
unsigned char *grn, unsigned char *blu,
const struct _Color_Rule_ *rule)
Modified: grass/trunk/lib/raster/color_org.c
===================================================================
--- grass/trunk/lib/raster/color_org.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_org.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -128,8 +128,8 @@
G_zero(cp->lookup.set, n * sizeof(unsigned char));
Rast__lookup_colors((void *)cat,
- cp->lookup.red, cp->lookup.grn, cp->lookup.blu,
- cp->lookup.set, n, colors, mod, 1, CELL_TYPE);
+ cp->lookup.red, cp->lookup.grn, cp->lookup.blu,
+ cp->lookup.set, n, colors, mod, 1, CELL_TYPE);
cp->lookup.active = 1;
}
Modified: grass/trunk/lib/raster/color_range.c
===================================================================
--- grass/trunk/lib/raster/color_range.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_range.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -16,11 +16,11 @@
#include <grass/raster.h>
/*!
- \brief Set color range (CELL version)
-
- \param min,max minimum and maximum value
- \param colors pointer to Colors structure which holds color info
-*/
+ \brief Set color range (CELL version)
+
+ \param min,max minimum and maximum value
+ \param colors pointer to Colors structure which holds color info
+ */
void Rast_set_c_color_range(CELL min, CELL max, struct Colors *colors)
{
if (min < max) {
@@ -34,11 +34,11 @@
}
/*!
- \brief Set color range (DCELL version)
+ \brief Set color range (DCELL version)
- \param min,max minimum and maximum value
- \param colors pointer to Colors structure which holds color info
-*/
+ \param min,max minimum and maximum value
+ \param colors pointer to Colors structure which holds color info
+ */
void Rast_set_d_color_range(DCELL min, DCELL max, struct Colors *colors)
{
if (min < max) {
@@ -52,16 +52,17 @@
}
/*!
- \brief Get color range values (CELL)
+ \brief Get color range values (CELL)
- Returns min and max category in the range or huge numbers if the
- color table is defined on floating cell values and not on
- categories.
+ Returns min and max category in the range or huge numbers if the
+ color table is defined on floating cell values and not on
+ categories.
- \param[out] min,max minimum and maximum value
- \param colors pointer to Colors structure which holds color info
+ \param[out] min,max minimum and maximum value
+ \param colors pointer to Colors structure which holds color info
*/
-void Rast_get_c_color_range(CELL * min, CELL * max, const struct Colors *colors)
+void Rast_get_c_color_range(CELL * min, CELL * max,
+ const struct Colors *colors)
{
if (!colors->is_float) {
*min = (CELL) floor(colors->cmin);
@@ -74,16 +75,17 @@
}
/*!
- \brief Get color range values (DELL)
-
- Returns min and max category in the range or huge numbers if the
- color table is defined on floating cell values and not on
- categories.
+ \brief Get color range values (DELL)
- \param[out] min,max minimum and maximum value
- \param colors pointer to Colors structure which holds color info
+ Returns min and max category in the range or huge numbers if the
+ color table is defined on floating cell values and not on
+ categories.
+
+ \param[out] min,max minimum and maximum value
+ \param colors pointer to Colors structure which holds color info
*/
-void Rast_get_d_color_range(DCELL * min, DCELL * max, const struct Colors *colors)
+void Rast_get_d_color_range(DCELL * min, DCELL * max,
+ const struct Colors *colors)
{
*min = colors->cmin;
*max = colors->cmax;
Modified: grass/trunk/lib/raster/color_read.c
===================================================================
--- grass/trunk/lib/raster/color_read.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_read.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -54,7 +54,8 @@
* \return 0 if missing, but default colors generated
* \return 1 on success
*/
-int Rast_read_colors(const char *name, const char *mapset, struct Colors *colors)
+int Rast_read_colors(const char *name, const char *mapset,
+ struct Colors *colors)
{
int fp;
char buf[GNAME_MAX];
@@ -86,7 +87,8 @@
if (!fp) {
if (Rast_read_range(name, mapset, &range) >= 0) {
Rast_get_range_min_max(&range, &min, &max);
- if (!Rast_is_c_null_value(&min) && !Rast_is_c_null_value(&max))
+ if (!Rast_is_c_null_value(&min) &&
+ !Rast_is_c_null_value(&max))
Rast_make_rainbow_colors(colors, min, max);
return 0;
}
@@ -94,7 +96,8 @@
else {
if (Rast_read_fp_range(name, mapset, &drange) >= 0) {
Rast_get_fp_range_min_max(&drange, &dmin, &dmax);
- if (!Rast_is_d_null_value(&dmin) && !Rast_is_d_null_value(&dmax))
+ if (!Rast_is_d_null_value(&dmin) &&
+ !Rast_is_d_null_value(&dmax))
Rast_make_rainbow_fp_colors(colors, dmin, dmax);
return 0;
}
@@ -108,8 +111,7 @@
return 1;
}
- G_warning(_("Color support for <%s@%s> %s"), name, mapset,
- err);
+ G_warning(_("Color support for <%s@%s> %s"), name, mapset, err);
return -1;
}
@@ -283,23 +285,23 @@
else if (modular) {
if (fp_rule)
Rast_add_modular_d_color_rule((DCELL *) & val1, r1, g1,
- b1, (DCELL *) & val2, r2,
- g2, b2, colors);
+ b1, (DCELL *) & val2, r2,
+ g2, b2, colors);
else
- Rast_add_modular_c_color_rule((CELL *) &cat1, r1, g1, b1,
- (CELL *) &cat2, r2, g2, b2, colors);
+ Rast_add_modular_c_color_rule((CELL *) & cat1, r1, g1, b1,
+ (CELL *) & cat2, r2, g2, b2,
+ colors);
}
else {
if (fp_rule)
Rast_add_d_color_rule((DCELL *) & val1, r1, g1, b1,
- (DCELL *) & val2, r2, g2, b2,
- colors);
+ (DCELL *) & val2, r2, g2, b2, colors);
else
- Rast_add_c_color_rule((CELL *) &cat1, r1, g1, b1,
- (CELL *) &cat2, r2, g2, b2, colors);
+ Rast_add_c_color_rule((CELL *) & cat1, r1, g1, b1,
+ (CELL *) & cat2, r2, g2, b2, colors);
}
G_debug(3, "adding rule %ld=%.2lf %d %d %d %ld=%.2lf %d %d %d",
- cat1, val1, r1, g1, b1, cat2, val2, r2, g2, b2);
+ cat1, val1, r1, g1, b1, cat2, val2, r2, g2, b2);
}
return 1;
}
@@ -362,12 +364,12 @@
}
if (zero) {
Rast__insert_color_into_lookup((CELL) 0, red, grn, blu,
- &colors->fixed);
+ &colors->fixed);
zero = 0;
}
else
Rast__insert_color_into_lookup((CELL) n++, red, grn, blu,
- &colors->fixed);
+ &colors->fixed);
}
colors->cmax = n - 1;
Modified: grass/trunk/lib/raster/color_rule.c
===================================================================
--- grass/trunk/lib/raster/color_rule.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_rule.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -34,8 +34,8 @@
* \param[in,out] colors pointer to color table structure
* \return
*/
-void Rast_add_d_color_rule(const DCELL *val1, int r1, int g1, int b1,
- const DCELL *val2, int r2, int g2, int b2,
+void Rast_add_d_color_rule(const DCELL * val1, int r1, int g1, int b1,
+ const DCELL * val2, int r2, int g2, int b2,
struct Colors *colors)
{
add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->fixed,
@@ -55,8 +55,8 @@
* \param[in,out] colors pointer to color table structure
* \return
*/
-void Rast_add_f_color_rule(const FCELL *cat1, int r1, int g1, int b1,
- const FCELL *cat2, int r2, int g2, int b2,
+void Rast_add_f_color_rule(const FCELL * cat1, int r1, int g1, int b1,
+ const FCELL * cat2, int r2, int g2, int b2,
struct Colors *colors)
{
add_color_rule(cat1, r1, g1, b1, cat2, r2, g2, b2, &colors->fixed,
@@ -76,8 +76,8 @@
* \param[in,out] colors pointer to color table structure
* \return
*/
-void Rast_add_c_color_rule(const CELL *cat1, int r1, int g1, int b1,
- const CELL *cat2, int r2, int g2, int b2,
+void Rast_add_c_color_rule(const CELL * cat1, int r1, int g1, int b1,
+ const CELL * cat2, int r2, int g2, int b2,
struct Colors *colors)
{
add_color_rule(cat1, r1, g1, b1, cat2, r2, g2, b2, &colors->fixed,
@@ -127,8 +127,8 @@
* \return -1 on failure
* \return 1 on success
*/
-int Rast_add_modular_d_color_rule(const DCELL *val1, int r1, int g1, int b1,
- const DCELL *val2, int r2, int g2, int b2,
+int Rast_add_modular_d_color_rule(const DCELL * val1, int r1, int g1, int b1,
+ const DCELL * val2, int r2, int g2, int b2,
struct Colors *colors)
{
DCELL min, max;
@@ -157,8 +157,8 @@
* \return -1 on failure
* \return 1 on success
*/
-int Rast_add_modular_f_color_rule(const FCELL *val1, int r1, int g1, int b1,
- const FCELL *val2, int r2, int g2, int b2,
+int Rast_add_modular_f_color_rule(const FCELL * val1, int r1, int g1, int b1,
+ const FCELL * val2, int r2, int g2, int b2,
struct Colors *colors)
{
DCELL min, max;
@@ -187,8 +187,8 @@
* \return -1 on failure
* \return 1 on success
*/
-int Rast_add_modular_c_color_rule(const CELL *val1, int r1, int g1, int b1,
- const CELL *val2, int r2, int g2, int b2,
+int Rast_add_modular_c_color_rule(const CELL * val1, int r1, int g1, int b1,
+ const CELL * val2, int r2, int g2, int b2,
struct Colors *colors)
{
CELL min, max;
@@ -224,7 +224,8 @@
*/
int Rast_add_modular_color_rule(const void *val1, int r1, int g1, int b1,
const void *val2, int r2, int g2, int b2,
- struct Colors *colors, RASTER_MAP_TYPE data_type)
+ struct Colors *colors,
+ RASTER_MAP_TYPE data_type)
{
CELL min, max;
@@ -338,7 +339,7 @@
for (cat = (CELL) min; cat <= (CELL) max; cat++) {
Rast__interpolate_color_rule((DCELL) cat, &red, &grn, &blu, rule);
Rast__insert_color_into_lookup(cat, (int)red, (int)grn, (int)blu,
- cp);
+ cp);
}
G_free(rule);
}
Modified: grass/trunk/lib/raster/color_rules.c
===================================================================
--- grass/trunk/lib/raster/color_rules.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_rules.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -44,8 +44,8 @@
};
int Rast_parse_color_rule(DCELL min, DCELL max, const char *buf,
- DCELL * val, int *r, int *g, int *b,
- int *norm, int *nval, int *dflt)
+ DCELL * val, int *r, int *g, int *b,
+ int *norm, int *nval, int *dflt)
{
char value[80], color[80];
double x;
@@ -124,8 +124,8 @@
}
int Rast_read_color_rule(void *closure, DCELL min, DCELL max,
- DCELL * val, int *r, int *g, int *b,
- int *norm, int *nval, int *dflt)
+ DCELL * val, int *r, int *g, int *b,
+ int *norm, int *nval, int *dflt)
{
char buf[1024];
FILE *fp = closure;
@@ -146,7 +146,8 @@
continue;
ret =
- Rast_parse_color_rule(min, max, buf, val, r, g, b, norm, nval, dflt);
+ Rast_parse_color_rule(min, max, buf, val, r, g, b, norm, nval,
+ dflt);
if (ret == 0)
return 1;
@@ -158,7 +159,7 @@
}
int Rast_read_color_rules(struct Colors *colors, DCELL min, DCELL max,
- read_rule_fn * read_rule, void *closure)
+ read_rule_fn * read_rule, void *closure)
{
struct rule *rule = NULL;
int nrules = 0;
@@ -211,7 +212,7 @@
struct rule *hi = &rule[n];
Rast_add_d_color_rule(&lo->val, lo->r, lo->g, lo->b,
- &hi->val, hi->r, hi->g, hi->b, colors);
+ &hi->val, hi->r, hi->g, hi->b, colors);
}
/* null value and default color set up, if rules are set up by user */
@@ -224,7 +225,8 @@
return 1;
}
-static int load_rules_file(struct Colors *colors, const char *path, DCELL min, DCELL max)
+static int load_rules_file(struct Colors *colors, const char *path, DCELL min,
+ DCELL max)
{
FILE *fp;
int ret;
@@ -234,24 +236,29 @@
if (!fp)
return 0;
- ret = Rast_read_color_rules(colors, min, max, Rast_read_color_rule, (void *)fp);
+ ret =
+ Rast_read_color_rules(colors, min, max, Rast_read_color_rule,
+ (void *)fp);
fclose(fp);
return ret;
}
-int Rast_load_colors(struct Colors *colors, const char *path, CELL min, CELL max)
+int Rast_load_colors(struct Colors *colors, const char *path, CELL min,
+ CELL max)
{
return load_rules_file(colors, path, (DCELL) min, (DCELL) max);
}
-int Rast_load_fp_colors(struct Colors *colors, const char *path, DCELL min, DCELL max)
+int Rast_load_fp_colors(struct Colors *colors, const char *path, DCELL min,
+ DCELL max)
{
return load_rules_file(colors, path, min, max);
}
-static void load_rules_name(struct Colors *colors, const char *name, DCELL min, DCELL max)
+static void load_rules_name(struct Colors *colors, const char *name,
+ DCELL min, DCELL max)
{
char path[GPATH_MAX];
@@ -261,12 +268,14 @@
G_fatal_error(_("Unable to load color rules <%s>"), name);
}
-void Rast_make_colors(struct Colors *colors, const char *name, CELL min, CELL max)
+void Rast_make_colors(struct Colors *colors, const char *name, CELL min,
+ CELL max)
{
return load_rules_name(colors, name, (DCELL) min, (DCELL) max);
}
-void Rast_make_fp_colors(struct Colors *colors, const char *name, DCELL min, DCELL max)
+void Rast_make_fp_colors(struct Colors *colors, const char *name, DCELL min,
+ DCELL max)
{
return load_rules_name(colors, name, min, max);
}
Modified: grass/trunk/lib/raster/color_set.c
===================================================================
--- grass/trunk/lib/raster/color_set.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_set.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -76,7 +76,8 @@
* \param blu blue value
* \param colors pointer to Colors structure which holds color info
*/
-void Rast_set_null_value_color(int red, int grn, int blu, struct Colors *colors)
+void Rast_set_null_value_color(int red, int grn, int blu,
+ struct Colors *colors)
{
colors->null_red = red;
colors->null_grn = grn;
Modified: grass/trunk/lib/raster/color_write.c
===================================================================
--- grass/trunk/lib/raster/color_write.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_write.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -20,7 +20,7 @@
#include <grass/raster.h>
#define PRECISION 30
-#define THRESHOLD .0000000000000000000000000000005 /* .5 * 10 ^(-30) */
+#define THRESHOLD .0000000000000000000000000000005 /* .5 * 10 ^(-30) */
static void write_rules(FILE *, struct _Color_Rule_ *, DCELL, DCELL);
static void write_new_colors(FILE *, struct Colors *);
@@ -74,7 +74,7 @@
* \return -1 on failure
*/
int Rast_write_colors(const char *name, const char *mapset,
- struct Colors *colors)
+ struct Colors *colors)
{
char element[512];
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
@@ -159,7 +159,8 @@
}
/* overall min and max data values in color table */
-static void write_rules(FILE * fd, struct _Color_Rule_ *crules, DCELL dmin, DCELL dmax)
+static void write_rules(FILE * fd, struct _Color_Rule_ *crules, DCELL dmin,
+ DCELL dmax)
{
struct _Color_Rule_ *rule;
char str[100];
Modified: grass/trunk/lib/raster/color_xform.c
===================================================================
--- grass/trunk/lib/raster/color_xform.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/color_xform.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -72,7 +72,8 @@
Rast_get_d_color(&x, &red2, &grn2, &blu2, src);
if (!first)
- Rast_add_c_color_rule(&prev, red, grn, blu, &cat, red2, grn2, blu2, dst);
+ Rast_add_c_color_rule(&prev, red, grn, blu, &cat, red2, grn2,
+ blu2, dst);
sum += count;
first = 0;
@@ -136,7 +137,8 @@
Rast_get_d_color(&x, &red2, &grn2, &blu2, src);
if (!first)
- Rast_add_d_color_rule(&val, red, grn, blu, &val2, red2, grn2, blu2, dst);
+ Rast_add_d_color_rule(&val, red, grn, blu, &val2, red2, grn2,
+ blu2, dst);
first = 0;
if (i == statf->count)
@@ -199,8 +201,7 @@
if (i > 0)
Rast_add_d_color_rule(&prev, red, grn, blu,
- &x, red2, grn2, blu2,
- dst);
+ &x, red2, grn2, blu2, dst);
prev = x;
@@ -262,14 +263,13 @@
if (i > 0) {
DCELL x0 = prev, x1 = x;
+
Rast_add_d_color_rule(&x0, red, grn, blu,
- &x1, red2, grn2, blu2,
- dst);
+ &x1, red2, grn2, blu2, dst);
x0 = -x0;
x1 = -x1;
Rast_add_d_color_rule(&x0, red, grn, blu,
- &x1, red2, grn2, blu2,
- dst);
+ &x1, red2, grn2, blu2, dst);
}
prev = x;
Modified: grass/trunk/lib/raster/fpreclass.c
===================================================================
--- grass/trunk/lib/raster/fpreclass.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/fpreclass.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -341,8 +341,8 @@
/*--------------------------------------------------------------------------*/
int Rast_fpreclass_get_limits(const struct FPReclass *r,
- DCELL * dMin, DCELL * dMax,
- DCELL * rMin, DCELL * rMax)
+ DCELL * dMin, DCELL * dMax,
+ DCELL * rMin, DCELL * rMax)
{
if (NO_EXPLICIT_RULE) {
if (NO_DEFAULT_RULE)
@@ -381,8 +381,8 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_get_ith_rule(const struct FPReclass *r, int i,
- DCELL *dLow, DCELL *dHigh,
- DCELL *rLow, DCELL *rHigh)
+ DCELL * dLow, DCELL * dHigh,
+ DCELL * rLow, DCELL * rHigh)
{
*dLow = r->table[i].dLow;
*dHigh = r->table[i].dHigh;
@@ -413,7 +413,8 @@
/*--------------------------------------------------------------------------*/
void
-Rast_fpreclass_set_neg_infinite_rule(struct FPReclass *r, DCELL dLeft, DCELL c)
+Rast_fpreclass_set_neg_infinite_rule(struct FPReclass *r, DCELL dLeft,
+ DCELL c)
{
r->infiniteDLeft = dLeft;
r->infiniteRLeft = c;
@@ -424,7 +425,7 @@
/*--------------------------------------------------------------------------*/
int Rast_fpreclass_get_neg_infinite_rule(const struct FPReclass *r,
- DCELL *dLeft, DCELL *c)
+ DCELL * dLeft, DCELL * c)
{
if (r->infiniteLeftSet == 0)
return 0;
@@ -437,7 +438,8 @@
/*--------------------------------------------------------------------------*/
-void Rast_fpreclass_set_pos_infinite_rule(struct FPReclass *r, DCELL dRight, DCELL c)
+void Rast_fpreclass_set_pos_infinite_rule(struct FPReclass *r, DCELL dRight,
+ DCELL c)
{
r->infiniteDRight = dRight;
r->infiniteRRight = c;
@@ -448,7 +450,7 @@
/*--------------------------------------------------------------------------*/
int Rast_fpreclass_get_pos_infinite_rule(const struct FPReclass *r,
- DCELL *dRight, DCELL *c)
+ DCELL * dRight, DCELL * c)
{
if (r->infiniteRightSet == 0)
return 0;
@@ -462,8 +464,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_add_rule(struct FPReclass *r,
- DCELL dLow, DCELL dHigh,
- DCELL rLow, DCELL rHigh)
+ DCELL dLow, DCELL dHigh, DCELL rLow, DCELL rHigh)
{
int i;
struct FPReclass_table *p;
@@ -524,10 +525,8 @@
/*--------------------------------------------------------------------------*/
-static DCELL fpreclass_interpolate(
- DCELL dLow, DCELL dHigh,
- DCELL rLow, DCELL rHigh,
- DCELL dValue)
+static DCELL fpreclass_interpolate(DCELL dLow, DCELL dHigh,
+ DCELL rLow, DCELL rHigh, DCELL dValue)
{
if (rLow == rHigh)
return rLow;
@@ -539,7 +538,8 @@
/*--------------------------------------------------------------------------*/
-static DCELL fpreclass_get_default_cell_value(const struct FPReclass *r, DCELL cellVal)
+static DCELL fpreclass_get_default_cell_value(const struct FPReclass *r,
+ DCELL cellVal)
{
DCELL tmp;
@@ -590,7 +590,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_di(const struct FPReclass *r,
- const DCELL *dcell, CELL *cell, int n)
+ const DCELL * dcell, CELL * cell, int n)
{
int i;
@@ -604,7 +604,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_df(const struct FPReclass *r,
- const DCELL *dcell, FCELL *cell, int n)
+ const DCELL * dcell, FCELL * cell, int n)
{
int i;
@@ -618,7 +618,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_dd(const struct FPReclass *r,
- const DCELL *dcell, DCELL *cell, int n)
+ const DCELL * dcell, DCELL * cell, int n)
{
int i;
@@ -632,7 +632,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_fi(const struct FPReclass *r,
- const FCELL *fcell, CELL *cell, int n)
+ const FCELL * fcell, CELL * cell, int n)
{
int i;
@@ -646,7 +646,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_ff(const struct FPReclass *r,
- const FCELL *fcell, FCELL *cell, int n)
+ const FCELL * fcell, FCELL * cell, int n)
{
int i;
@@ -660,7 +660,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_fd(const struct FPReclass *r,
- const FCELL *fcell, DCELL *cell, int n)
+ const FCELL * fcell, DCELL * cell, int n)
{
int i;
@@ -674,7 +674,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_ii(const struct FPReclass *r,
- const CELL *icell, CELL *cell, int n)
+ const CELL * icell, CELL * cell, int n)
{
int i;
@@ -688,7 +688,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_if(const struct FPReclass *r,
- const CELL *icell, FCELL *cell, int n)
+ const CELL * icell, FCELL * cell, int n)
{
int i;
@@ -702,7 +702,7 @@
/*--------------------------------------------------------------------------*/
void Rast_fpreclass_perform_id(const struct FPReclass *r,
- const CELL *icell, DCELL *cell, int n)
+ const CELL * icell, DCELL * cell, int n)
{
int i;
Modified: grass/trunk/lib/raster/gdal.c
===================================================================
--- grass/trunk/lib/raster/gdal.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/gdal.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -25,25 +25,34 @@
# endif
#endif
-static void CPL_STDCALL (*pGDALAllRegister)(void);
-static void CPL_STDCALL (*pGDALClose)(GDALDatasetH);
-static GDALRasterBandH CPL_STDCALL (*pGDALGetRasterBand)(GDALDatasetH, int);
-static GDALDatasetH CPL_STDCALL (*pGDALOpen)(
- const char *pszFilename, GDALAccess eAccess);
-static CPLErr CPL_STDCALL (*pGDALRasterIO)(
- GDALRasterBandH hRBand, GDALRWFlag eRWFlag,
- int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
- void * pBuffer, int nBXSize, int nBYSize,GDALDataType eBDataType,
- int nPixelSpace, int nLineSpace);
-static GDALDriverH CPL_STDCALL (*pGDALGetDriverByName)(const char *);
-static const char * CPL_STDCALL (*pGDALGetMetadataItem)(GDALMajorObjectH, const char *, const char *);
-static GDALDatasetH CPL_STDCALL (*pGDALCreate)(GDALDriverH hDriver, const char *, int, int, int, GDALDataType, char **);
-static GDALDatasetH CPL_STDCALL (*pGDALCreateCopy)(GDALDriverH, const char *, GDALDatasetH, int, char **, GDALProgressFunc, void *);
-static CPLErr CPL_STDCALL (*pGDALSetRasterNoDataValue)(GDALRasterBandH, double);
-static CPLErr CPL_STDCALL (*pGDALSetGeoTransform)(GDALDatasetH, double *);
-static CPLErr CPL_STDCALL (*pGDALSetProjection)(GDALDatasetH, const char *);
-static const char * CPL_STDCALL (*pGDALGetDriverShortName)(GDALDriverH);
-static GDALDriverH CPL_STDCALL (*pGDALGetDatasetDriver)(GDALDatasetH);
+static void CPL_STDCALL(*pGDALAllRegister) (void);
+static void CPL_STDCALL(*pGDALClose) (GDALDatasetH);
+static GDALRasterBandH CPL_STDCALL(*pGDALGetRasterBand) (GDALDatasetH, int);
+static GDALDatasetH CPL_STDCALL(*pGDALOpen) (const char *pszFilename,
+ GDALAccess eAccess);
+static CPLErr CPL_STDCALL(*pGDALRasterIO) (GDALRasterBandH hRBand,
+ GDALRWFlag eRWFlag, int nDSXOff,
+ int nDSYOff, int nDSXSize,
+ int nDSYSize, void *pBuffer,
+ int nBXSize, int nBYSize,
+ GDALDataType eBDataType,
+ int nPixelSpace, int nLineSpace);
+static GDALDriverH CPL_STDCALL(*pGDALGetDriverByName) (const char *);
+static const char *CPL_STDCALL(*pGDALGetMetadataItem) (GDALMajorObjectH,
+ const char *,
+ const char *);
+static GDALDatasetH CPL_STDCALL(*pGDALCreate) (GDALDriverH hDriver,
+ const char *, int, int, int,
+ GDALDataType, char **);
+static GDALDatasetH CPL_STDCALL(*pGDALCreateCopy) (GDALDriverH, const char *,
+ GDALDatasetH, int, char **,
+ GDALProgressFunc, void *);
+static CPLErr CPL_STDCALL(*pGDALSetRasterNoDataValue) (GDALRasterBandH,
+ double);
+static CPLErr CPL_STDCALL(*pGDALSetGeoTransform) (GDALDatasetH, double *);
+static CPLErr CPL_STDCALL(*pGDALSetProjection) (GDALDatasetH, const char *);
+static const char *CPL_STDCALL(*pGDALGetDriverShortName) (GDALDriverH);
+static GDALDriverH CPL_STDCALL(*pGDALGetDatasetDriver) (GDALDatasetH);
#if GDAL_DYNAMIC
# if defined(__unix) && !defined(__unix__)
@@ -81,7 +90,7 @@
static void load_library(void)
{
- static const char * const candidates[] = {
+ static const char *const candidates[] = {
# ifdef __unix__
"libgdal.1.1.so",
"gdal.1.0.so",
@@ -111,40 +120,40 @@
{
load_library();
- pGDALAllRegister = get_symbol("GDALAllRegister");
- pGDALOpen = get_symbol("GDALOpen");
- pGDALClose = get_symbol("GDALClose");
- pGDALGetRasterBand = get_symbol("GDALGetRasterBand");
- pGDALRasterIO = get_symbol("GDALRasterIO");
- pGDALGetDriverByName = get_symbol("GDALGetDriverByName");
- pGDALGetMetadataItem = get_symbol("GDALGetMetadataItem");
- pGDALCreate = get_symbol("GDALCreate");
- pGDALCreateCopy = get_symbol("GDALCreateCopy");
+ pGDALAllRegister = get_symbol("GDALAllRegister");
+ pGDALOpen = get_symbol("GDALOpen");
+ pGDALClose = get_symbol("GDALClose");
+ pGDALGetRasterBand = get_symbol("GDALGetRasterBand");
+ pGDALRasterIO = get_symbol("GDALRasterIO");
+ pGDALGetDriverByName = get_symbol("GDALGetDriverByName");
+ pGDALGetMetadataItem = get_symbol("GDALGetMetadataItem");
+ pGDALCreate = get_symbol("GDALCreate");
+ pGDALCreateCopy = get_symbol("GDALCreateCopy");
pGDALSetRasterNoDataValue = get_symbol("GDALSetRasterNoDataValue");
- pGDALSetGeoTransform = get_symbol("GDALSetGeoTransform");
- pGDALSetProjection = get_symbol("GDALSetProjection");
- pGDALGetDriverShortName = get_symbol("GDALGetDriverShortName");
- pGDALGetDatasetDriver = get_symbol("GDALGetDatasetDriver");
+ pGDALSetGeoTransform = get_symbol("GDALSetGeoTransform");
+ pGDALSetProjection = get_symbol("GDALSetProjection");
+ pGDALGetDriverShortName = get_symbol("GDALGetDriverShortName");
+ pGDALGetDatasetDriver = get_symbol("GDALGetDatasetDriver");
}
#else /* GDAL_DYNAMIC */
static void init_gdal(void)
{
- pGDALAllRegister = &GDALAllRegister;
- pGDALOpen = &GDALOpen;
- pGDALClose = &GDALClose;
- pGDALGetRasterBand = &GDALGetRasterBand;
- pGDALRasterIO = &GDALRasterIO;
- pGDALGetDriverByName = &GDALGetDriverByName;
- pGDALGetMetadataItem = &GDALGetMetadataItem;
- pGDALCreate = &GDALCreate;
- pGDALCreateCopy = &GDALCreateCopy;
+ pGDALAllRegister = &GDALAllRegister;
+ pGDALOpen = &GDALOpen;
+ pGDALClose = &GDALClose;
+ pGDALGetRasterBand = &GDALGetRasterBand;
+ pGDALRasterIO = &GDALRasterIO;
+ pGDALGetDriverByName = &GDALGetDriverByName;
+ pGDALGetMetadataItem = &GDALGetMetadataItem;
+ pGDALCreate = &GDALCreate;
+ pGDALCreateCopy = &GDALCreateCopy;
pGDALSetRasterNoDataValue = &GDALSetRasterNoDataValue;
- pGDALSetGeoTransform = &GDALSetGeoTransform;
- pGDALSetProjection = &GDALSetProjection;
- pGDALGetDriverShortName = &GDALGetDriverShortName;
- pGDALGetDatasetDriver = &GDALGetDatasetDriver;
+ pGDALSetGeoTransform = &GDALSetGeoTransform;
+ pGDALSetProjection = &GDALSetProjection;
+ pGDALGetDriverShortName = &GDALGetDriverShortName;
+ pGDALGetDatasetDriver = &GDALGetDatasetDriver;
}
#endif /* GDAL_DYNAMIC */
@@ -160,7 +169,7 @@
return;
init_gdal();
- (*pGDALAllRegister)();
+ (*pGDALAllRegister) ();
G_initialize_done(&initialized);
#endif
}
@@ -250,13 +259,13 @@
Rast_init_gdal();
- data = (*pGDALOpen)(filename, GA_ReadOnly);
+ data = (*pGDALOpen) (filename, GA_ReadOnly);
if (!data)
return NULL;
- band = (*pGDALGetRasterBand)(data, band_num);
+ band = (*pGDALGetRasterBand) (data, band_num);
if (!band) {
- (*pGDALClose)(data);
+ (*pGDALClose) (data);
return NULL;
}
#endif
@@ -277,14 +286,16 @@
return gdal;
}
-struct GDAL_Options {
+struct GDAL_Options
+{
const char *dir;
const char *ext;
const char *format;
char **options;
};
-static struct state {
+static struct state
+{
int initialized;
struct GDAL_Options opts;
struct Key_Value *projinfo, *projunits;
@@ -313,6 +324,7 @@
}
else {
char path[GPATH_MAX];
+
G__file_name(path, p, "", G_mapset());
st->opts.dir = G_store(path);
if (access(path, 0) != 0)
@@ -331,7 +343,8 @@
G_free_key_value(key_val);
}
-struct GDAL_link *Rast_create_gdal_link(const char *name, RASTER_MAP_TYPE map_type)
+struct GDAL_link *Rast_create_gdal_link(const char *name,
+ RASTER_MAP_TYPE map_type)
{
#ifdef GDAL_LINK
char path[GPATH_MAX];
@@ -397,34 +410,35 @@
break;
}
- driver = (*pGDALGetDriverByName)(st->opts.format);
+ driver = (*pGDALGetDriverByName) (st->opts.format);
if (!driver)
G_fatal_error(_("Unable to get <%s> driver"), st->opts.format);
/* Does driver support GDALCreate ? */
- if ((*pGDALGetMetadataItem)(driver, GDAL_DCAP_CREATE, NULL))
- {
- gdal->data = (*pGDALCreate)(driver, gdal->filename, R__.window.cols, R__.window.rows,
- 1, gdal->type, st->opts.options);
+ if ((*pGDALGetMetadataItem) (driver, GDAL_DCAP_CREATE, NULL)) {
+ gdal->data =
+ (*pGDALCreate) (driver, gdal->filename, R__.window.cols,
+ R__.window.rows, 1, gdal->type, st->opts.options);
if (!gdal->data)
G_fatal_error(_("Unable to create <%s> dataset using <%s> driver"),
name, st->opts.format);
}
/* If not - create MEM driver for intermediate dataset.
* Check if raster can be created at all (with GDALCreateCopy) */
- else if ((*pGDALGetMetadataItem)(driver, GDAL_DCAP_CREATECOPY, NULL)) {
+ else if ((*pGDALGetMetadataItem) (driver, GDAL_DCAP_CREATECOPY, NULL)) {
GDALDriverH mem_driver;
G_message(_("Driver <%s> does not support direct writing. "
"Using MEM driver for intermediate dataset."),
st->opts.format);
- mem_driver = (*pGDALGetDriverByName)("MEM");
+ mem_driver = (*pGDALGetDriverByName) ("MEM");
if (!mem_driver)
G_fatal_error(_("Unable to get in-memory raster driver"));
- gdal->data = (*pGDALCreate)(mem_driver, "", R__.window.cols, R__.window.rows,
- 1, gdal->type, st->opts.options);
+ gdal->data =
+ (*pGDALCreate) (mem_driver, "", R__.window.cols, R__.window.rows,
+ 1, gdal->type, st->opts.options);
if (!gdal->data)
G_fatal_error(_("Unable to create <%s> dataset using memory driver"),
name);
@@ -433,9 +447,9 @@
G_fatal_error(_("Driver <%s> does not support creating rasters"),
st->opts.format);
- gdal->band = (*pGDALGetRasterBand)(gdal->data, gdal->band_num);
+ gdal->band = (*pGDALGetRasterBand) (gdal->data, gdal->band_num);
- (*pGDALSetRasterNoDataValue)(gdal->band, gdal->null_val);
+ (*pGDALSetRasterNoDataValue) (gdal->band, gdal->null_val);
/* Set Geo Transform */
transform[0] = R__.window.west;
@@ -445,11 +459,11 @@
transform[4] = 0.0;
transform[5] = -R__.window.ns_res;
- if ((*pGDALSetGeoTransform)(gdal->data, transform) >= CE_Failure)
+ if ((*pGDALSetGeoTransform) (gdal->data, transform) >= CE_Failure)
G_warning(_("Unable to set geo transform"));
if (st->srswkt)
- if ((*pGDALSetProjection)(gdal->data, st->srswkt) == CE_Failure)
+ if ((*pGDALSetProjection) (gdal->data, st->srswkt) == CE_Failure)
G_warning(_("Unable to set projection"));
fp = G_fopen_new_misc("cell_misc", "gdal", name);
@@ -485,7 +499,7 @@
void Rast_close_gdal_link(struct GDAL_link *gdal)
{
#ifdef GDAL_LINK
- (*pGDALClose)(gdal->data);
+ (*pGDALClose) (gdal->data);
#endif
G_free(gdal->filename);
G_free(gdal);
@@ -494,22 +508,25 @@
int Rast_close_gdal_write_link(struct GDAL_link *gdal)
{
int stat = 1;
+
#ifdef GDAL_LINK
- GDALDriverH src_drv = (*pGDALGetDatasetDriver)(gdal->data);
+ GDALDriverH src_drv = (*pGDALGetDatasetDriver) (gdal->data);
- if (G_strcasecmp((*pGDALGetDriverShortName)(src_drv), "MEM") == 0) {
- GDALDriverH dst_drv = (*pGDALGetDriverByName)(st->opts.format);
- GDALDatasetH dst = (*pGDALCreateCopy)(dst_drv, gdal->filename, gdal->data, FALSE,
- st->opts.options, NULL, NULL);
+ if (G_strcasecmp((*pGDALGetDriverShortName) (src_drv), "MEM") == 0) {
+ GDALDriverH dst_drv = (*pGDALGetDriverByName) (st->opts.format);
+ GDALDatasetH dst =
+ (*pGDALCreateCopy) (dst_drv, gdal->filename, gdal->data, FALSE,
+ st->opts.options, NULL, NULL);
+
if (!dst) {
G_warning(_("Unable to create output file <%s> using driver <%s>"),
gdal->filename, st->opts.format);
stat = -1;
}
- (*pGDALClose)(dst);
+ (*pGDALClose) (dst);
}
- (*pGDALClose)(gdal->data);
+ (*pGDALClose) (gdal->data);
#endif
G_free(gdal->filename);
@@ -519,15 +536,14 @@
}
#ifdef GDAL_LINK
-CPLErr Rast_gdal_raster_IO(
- GDALRasterBandH band, GDALRWFlag rw_flag,
- int x_off, int y_off, int x_size, int y_size,
- void *buffer, int buf_x_size, int buf_y_size, GDALDataType buf_type,
- int pixel_size, int line_size)
+CPLErr Rast_gdal_raster_IO(GDALRasterBandH band, GDALRWFlag rw_flag,
+ int x_off, int y_off, int x_size, int y_size,
+ void *buffer, int buf_x_size, int buf_y_size,
+ GDALDataType buf_type, int pixel_size,
+ int line_size)
{
- return (*pGDALRasterIO)(
- band, rw_flag, x_off, y_off, x_size, y_size,
- buffer, buf_x_size, buf_y_size, buf_type,
- pixel_size, line_size);
+ return (*pGDALRasterIO) (band, rw_flag, x_off, y_off, x_size, y_size,
+ buffer, buf_x_size, buf_y_size, buf_type,
+ pixel_size, line_size);
}
#endif
Modified: grass/trunk/lib/raster/get_cellhd.c
===================================================================
--- grass/trunk/lib/raster/get_cellhd.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/get_cellhd.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -1,13 +1,13 @@
/*!
- \file raster/get_cellhd.c
-
- \brief Raster library - Read raster map header
-
- (C) 2001-2009 by 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.
-
+ \file raster/get_cellhd.c
+
+ \brief Raster library - Read raster map header
+
+ (C) 2001-2009 by 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 Original author CERL
*/
@@ -19,31 +19,31 @@
#include <grass/glocale.h>
/*!
- \brief Read the raster header
-
- The raster header for the raster map <i>name</i> in the specified
- <i>mapset</i> is read into the <i>cellhd</i> structure. If there is
- an error reading the raster header file, a diagnostic message is
- printed and -1 is returned. Otherwise, 0 is returned.
-
- <b>Note</b>:a warning message for errors encountered.
-
- Cell header files may contain either grid cell header information or
- reclass information. If it is a reclass file, it will specify the
- map and mapset names of the actual grid cell file being
- reclassed. Rast_get_cellhd(), upon reading reclass information will go
- read the cell header information for the referenced file. Only one
- reference is allowed.
-
- \param name name of map
- \param mapset mapset that map belongs to
- \param[out] cellhd structure to hold cell header info
-
- \return 0 on success
- \return -1 on error
+ \brief Read the raster header
+
+ The raster header for the raster map <i>name</i> in the specified
+ <i>mapset</i> is read into the <i>cellhd</i> structure. If there is
+ an error reading the raster header file, a diagnostic message is
+ printed and -1 is returned. Otherwise, 0 is returned.
+
+ <b>Note</b>:a warning message for errors encountered.
+
+ Cell header files may contain either grid cell header information or
+ reclass information. If it is a reclass file, it will specify the
+ map and mapset names of the actual grid cell file being
+ reclassed. Rast_get_cellhd(), upon reading reclass information will go
+ read the cell header information for the referenced file. Only one
+ reference is allowed.
+
+ \param name name of map
+ \param mapset mapset that map belongs to
+ \param[out] cellhd structure to hold cell header info
+
+ \return 0 on success
+ \return -1 on error
*/
int Rast_get_cellhd(const char *name, const char *mapset,
- struct Cell_head *cellhd)
+ struct Cell_head *cellhd)
{
FILE *fd;
int is_reclass;
@@ -77,7 +77,7 @@
sprintf(tail, _("which is missing."));
else
sprintf(tail, _("whose header file can't be opened."));
- G_warning ("%s", buf);
+ G_warning("%s", buf);
return -1;
}
}
Modified: grass/trunk/lib/raster/get_row.c
===================================================================
--- grass/trunk/lib/raster/get_row.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/get_row.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -1,14 +1,14 @@
/*!
- \file raster/get_row.c
+ \file raster/get_row.c
- \brief Raster library - Get raster row
+ \brief Raster library - Get raster row
- (C) 2003-2009 by the GRASS Development Team
+ (C) 2003-2009 by 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.
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
- \author Original author CERL
+ \author Original author CERL
*/
#include <string.h>
@@ -188,7 +188,8 @@
}
#ifdef HAVE_GDAL
-static int read_data_gdal(int fd, int row, unsigned char *data_buf, int *nbytes)
+static int read_data_gdal(int fd, int row, unsigned char *data_buf,
+ int *nbytes)
{
struct fileinfo *fcb = &R__.fileinfo[fd];
unsigned char *buf;
@@ -199,13 +200,13 @@
if (fcb->gdal->vflip)
row = fcb->cellhd.rows - 1 - row;
- buf = fcb->gdal->hflip
- ? G__alloca(fcb->cellhd.cols * fcb->cur_nbytes)
+ buf = fcb->gdal->hflip ? G__alloca(fcb->cellhd.cols * fcb->cur_nbytes)
: data_buf;
- err = Rast_gdal_raster_IO(
- fcb->gdal->band, GF_Read, 0, row, fcb->cellhd.cols, 1, buf,
- fcb->cellhd.cols, 1, fcb->gdal->type, 0, 0);
+ err =
+ Rast_gdal_raster_IO(fcb->gdal->band, GF_Read, 0, row,
+ fcb->cellhd.cols, 1, buf, fcb->cellhd.cols, 1,
+ fcb->gdal->type, 0, 0);
if (fcb->gdal->hflip) {
int i;
@@ -367,8 +368,8 @@
#ifdef HAVE_GDAL
static void gdal_values_int(int fd, const unsigned char *data,
- const COLUMN_MAPPING *cmap, int nbytes,
- CELL *cell, int n)
+ const COLUMN_MAPPING * cmap, int nbytes,
+ CELL * cell, int n)
{
struct fileinfo *fcb = &R__.fileinfo[fd];
const unsigned char *d;
@@ -382,18 +383,28 @@
}
if (cmap[i] == cmapold) {
- cell[i] = cell[i-1];
+ cell[i] = cell[i - 1];
continue;
}
d = data + (cmap[i] - 1) * nbytes;
switch (fcb->gdal->type) {
- case GDT_Byte: cell[i] = *(GByte *)d; break;
- case GDT_Int16: cell[i] = *(GInt16 *)d; break;
- case GDT_UInt16: cell[i] = *(GUInt16 *)d; break;
- case GDT_Int32: cell[i] = *(GInt32 *)d; break;
- case GDT_UInt32: cell[i] = *(GUInt32 *)d; break;
+ case GDT_Byte:
+ cell[i] = *(GByte *) d;
+ break;
+ case GDT_Int16:
+ cell[i] = *(GInt16 *) d;
+ break;
+ case GDT_UInt16:
+ cell[i] = *(GUInt16 *) d;
+ break;
+ case GDT_Int32:
+ cell[i] = *(GInt32 *) d;
+ break;
+ case GDT_UInt32:
+ cell[i] = *(GUInt32 *) d;
+ break;
default:
/* shouldn't happen */
Rast_set_c_null_value(&cell[i], 1);
@@ -405,8 +416,8 @@
}
static void gdal_values_float(int fd, const float *data,
- const COLUMN_MAPPING *cmap, int nbytes,
- FCELL *cell, int n)
+ const COLUMN_MAPPING * cmap, int nbytes,
+ FCELL * cell, int n)
{
COLUMN_MAPPING cmapold = 0;
int i;
@@ -418,7 +429,7 @@
}
if (cmap[i] == cmapold) {
- cell[i] = cell[i-1];
+ cell[i] = cell[i - 1];
continue;
}
@@ -429,8 +440,8 @@
}
static void gdal_values_double(int fd, const double *data,
- const COLUMN_MAPPING *cmap, int nbytes,
- DCELL *cell, int n)
+ const COLUMN_MAPPING * cmap, int nbytes,
+ DCELL * cell, int n)
{
COLUMN_MAPPING cmapold = 0;
int i;
@@ -442,7 +453,7 @@
}
if (cmap[i] == cmapold) {
- cell[i] = cell[i-1];
+ cell[i] = cell[i - 1];
continue;
}
@@ -474,14 +485,14 @@
#ifdef HAVE_GDAL
if (fcb->gdal)
- (gdal_values_type[fcb->map_type]) (fd, fcb->data, fcb->col_map,
- fcb->cur_nbytes, cell,
- R__.window.cols);
+ (gdal_values_type[fcb->map_type]) (fd, fcb->data, fcb->col_map,
+ fcb->cur_nbytes, cell,
+ R__.window.cols);
else
#endif
- (cell_values_type[fcb->map_type]) (fd, fcb->data, fcb->col_map,
- fcb->cur_nbytes, cell,
- R__.window.cols);
+ (cell_values_type[fcb->map_type]) (fd, fcb->data, fcb->col_map,
+ fcb->cur_nbytes, cell,
+ R__.window.cols);
}
static void transfer_to_cell_fi(int fd, void *cell)
@@ -494,8 +505,7 @@
for (i = 0; i < R__.window.cols; i++)
((CELL *) cell)[i] = (fcb->col_map[i] == 0)
- ? 0
- : Rast_quant_get_cell_value(&fcb->quant, work_buf[i]);
+ ? 0 : Rast_quant_get_cell_value(&fcb->quant, work_buf[i]);
G__freea(work_buf);
}
@@ -510,8 +520,7 @@
for (i = 0; i < R__.window.cols; i++)
((CELL *) cell)[i] = (fcb->col_map[i] == 0)
- ? 0
- : Rast_quant_get_cell_value(&fcb->quant, work_buf[i]);
+ ? 0 : Rast_quant_get_cell_value(&fcb->quant, work_buf[i]);
G__freea(work_buf);
}
@@ -575,10 +584,11 @@
static int get_map_row_nomask(int fd, void *rast, int row,
RASTER_MAP_TYPE data_type)
{
- static void (*transfer_to_cell_FtypeOtype[3][3])() = {
- {transfer_to_cell_XX, transfer_to_cell_if, transfer_to_cell_id},
- {transfer_to_cell_fi, transfer_to_cell_XX, transfer_to_cell_fd},
- {transfer_to_cell_di, transfer_to_cell_df, transfer_to_cell_XX}
+ static void (*transfer_to_cell_FtypeOtype[3][3]) () = {
+ {
+ transfer_to_cell_XX, transfer_to_cell_if, transfer_to_cell_id}, {
+ transfer_to_cell_fi, transfer_to_cell_XX, transfer_to_cell_fd}, {
+ transfer_to_cell_di, transfer_to_cell_df, transfer_to_cell_XX}
};
struct fileinfo *fcb = &R__.fileinfo[fd];
int r;
@@ -656,7 +666,8 @@
type = data_type;
}
- stat = get_map_row_no_reclass(fd, buf, row, type, null_is_zero, with_mask);
+ stat =
+ get_map_row_no_reclass(fd, buf, row, type, null_is_zero, with_mask);
if (stat < 0) {
if (temp_buf)
G__freea(temp_buf);
@@ -713,8 +724,7 @@
* \return 0 row requested not within window
* \return -1 on error
*/
-int Rast_get_row_nomask(int fd, void *buf, int row,
- RASTER_MAP_TYPE data_type)
+int Rast_get_row_nomask(int fd, void *buf, int row, RASTER_MAP_TYPE data_type)
{
return get_map_row(fd, buf, row, data_type, 0, 0);
}
@@ -733,7 +743,7 @@
* \return 0 row requested not within window
* \return -1 on error
*/
-int Rast_get_c_row_nomask(int fd, CELL *buf, int row)
+int Rast_get_c_row_nomask(int fd, CELL * buf, int row)
{
return Rast_get_row_nomask(fd, buf, row, CELL_TYPE);
}
@@ -970,8 +980,8 @@
(fcb->min_null_row + NULL_ROWS_INMEM - 1 < row))
/* the null row row is not in memory */
{
- unsigned char *null_work_buf = G__alloca(
- Rast__null_bitstream_size(fcb->cellhd.cols));
+ unsigned char *null_work_buf =
+ G__alloca(Rast__null_bitstream_size(fcb->cellhd.cols));
/* read in NULL_ROWS_INMEM rows from null file
so that the requested row is between fcb->min_null_row
@@ -991,7 +1001,8 @@
fd) < 0) {
if (fcb->map_type == CELL_TYPE) {
/* If can't read null row, assume that all map 0's are nulls */
- CELL *mask_buf = G__alloca(R__.window.cols * sizeof(CELL));
+ CELL *mask_buf =
+ G__alloca(R__.window.cols * sizeof(CELL));
get_map_row_nomask(fd, mask_buf, i + fcb->min_null_row,
CELL_TYPE);
@@ -1016,8 +1027,8 @@
flags[j] = 1;
else
flags[j] = Rast__check_null_bit(null_work_buf,
- fcb->col_map[j] - 1,
- fcb->cellhd.cols);
+ fcb->col_map[j] - 1,
+ fcb->cellhd.cols);
}
}
/* remember the null row for i for the future reference */
@@ -1025,8 +1036,10 @@
/*bf-We should take of the size - or we get
zeros running on their own after flags convertions -A.Sh. */
fcb->NULL_ROWS[i] = G_realloc(fcb->NULL_ROWS[i],
- Rast__null_bitstream_size(R__.window.
- cols) + 1);
+ Rast__null_bitstream_size(R__.
+ window.
+ cols) +
+ 1);
if (fcb->NULL_ROWS[i] == NULL)
G_fatal_error("get_null_value_row_nomask: %s",
_("Unable to realloc buffer"));
@@ -1044,7 +1057,7 @@
/* copy null file data translated by column mapping to user null row */
/* the user requested flags row is of size R__.window.cols */
Rast__convert_flags_01(flags, fcb->NULL_ROWS[row - fcb->min_null_row],
- R__.window.cols);
+ R__.window.cols);
}
/*--------------------------------------------------------------------------*/
@@ -1065,7 +1078,8 @@
for (i = 0; i < R__.window.cols; i++)
/* note: using == won't work if the null value is NaN */
- flags[i] = memcmp(&tmp_buf[i], &fcb->gdal->null_val, sizeof(DCELL)) == 0;
+ flags[i] =
+ memcmp(&tmp_buf[i], &fcb->gdal->null_val, sizeof(DCELL)) == 0;
G_free(tmp_buf);
}
@@ -1103,11 +1117,12 @@
{
#ifdef HAVE_GDAL
struct fileinfo *fcb = &R__.fileinfo[fd];
+
if (fcb->gdal)
get_null_value_row_gdal(fd, flags, row);
else
#endif
- get_null_value_row_nomask(fd, flags, row);
+ get_null_value_row_nomask(fd, flags, row);
if (with_mask)
embed_mask(flags, row);
Modified: grass/trunk/lib/raster/get_row_colr.c
===================================================================
--- grass/trunk/lib/raster/get_row_colr.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/get_row_colr.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -38,8 +38,8 @@
* \return 0 on success
*/
int Rast_get_row_colors(int fd, int row, struct Colors *colors,
- unsigned char *red, unsigned char *grn,
- unsigned char *blu, unsigned char *nul)
+ unsigned char *red, unsigned char *grn,
+ unsigned char *blu, unsigned char *nul)
{
int cols = G_window_cols();
int type = Rast_get_map_type(fd);
Modified: grass/trunk/lib/raster/histo_eq.c
===================================================================
--- grass/trunk/lib/raster/histo_eq.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/histo_eq.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -13,7 +13,7 @@
#include <grass/raster.h>
void Rast_histogram_eq(const struct Histogram *histo,
- unsigned char **map, CELL *min, CELL *max)
+ unsigned char **map, CELL * min, CELL * max)
{
int i;
int x;
Modified: grass/trunk/lib/raster/histogram.c
===================================================================
--- grass/trunk/lib/raster/histogram.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/histogram.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -43,7 +43,7 @@
*/
int Rast_read_histogram(const char *name, const char *mapset,
- struct Histogram *histogram)
+ struct Histogram *histogram)
{
FILE *fd = NULL;
long cat;
@@ -159,7 +159,8 @@
* \param histogram: raster histogram
* \return
*/
-void Rast_make_histogram_cs(struct Cell_stats *statf, struct Histogram *histogram)
+void Rast_make_histogram_cs(struct Cell_stats *statf,
+ struct Histogram *histogram)
{
CELL cat;
long count;
@@ -433,8 +434,7 @@
{
histogram->num++;
histogram->list =
- (LIST *) G_realloc(histogram->list,
- histogram->num * sizeof(LIST));
+ (LIST *) G_realloc(histogram->list, histogram->num * sizeof(LIST));
histogram->list[histogram->num - 1].cat = cat;
histogram->list[histogram->num - 1].count = count;
}
Modified: grass/trunk/lib/raster/history.c
===================================================================
--- grass/trunk/lib/raster/history.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/history.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -34,7 +34,8 @@
* \return -1 on error
* \return 0 on success
*/
-int Rast_read_history(const char *name, const char *mapset, struct History *hist)
+int Rast_read_history(const char *name, const char *mapset,
+ struct History *hist)
{
FILE *fd;
@@ -106,16 +107,16 @@
return 0;
}
-void print_history_error(const char *name, const char *mapset, FILE *fd)
+void print_history_error(const char *name, const char *mapset, FILE * fd)
{
if (fd != NULL)
fclose(fd);
-
+
if (mapset) {
G_warning(_("Unable to get history information for <%s@%s>"),
name, mapset);
}
- else { /* write */
+ else { /* write */
G_warning(_("Unable to write history information for <%s>"), name);
}
}
@@ -148,7 +149,7 @@
print_history_error(name, NULL, fd);
return -1;
}
-
+
fprintf(fd, "%s\n", hist->mapid);
fprintf(fd, "%s\n", hist->title);
fprintf(fd, "%s\n", hist->mapset);
@@ -162,7 +163,7 @@
fprintf(fd, "%s\n", hist->edhist[i]);
fclose(fd);
-
+
return 0;
}
@@ -181,7 +182,8 @@
* \param type map type
* \param hist pointer to History structure which holds history info
*/
-void Rast_short_history(const char *name, const char *type, struct History *hist)
+void Rast_short_history(const char *name, const char *type,
+ struct History *hist)
{
strncpy(hist->mapid, G_date(), RECORD_LEN);
strncpy(hist->title, name, RECORD_LEN);
Modified: grass/trunk/lib/raster/init.c
===================================================================
--- grass/trunk/lib/raster/init.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/init.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -1,3 +1,4 @@
+
/**
* \file rasterinit.c
*
Modified: grass/trunk/lib/raster/interp.c
===================================================================
--- grass/trunk/lib/raster/interp.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/interp.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -20,7 +20,7 @@
}
DCELL Rast_interp_bilinear(double u, double v,
- DCELL c00, DCELL c01, DCELL c10, DCELL c11)
+ DCELL c00, DCELL c01, DCELL c10, DCELL c11)
{
DCELL c0 = Rast_interp_linear(u, c00, c01);
DCELL c1 = Rast_interp_linear(u, c10, c11);
@@ -31,14 +31,15 @@
DCELL Rast_interp_cubic(double u, DCELL c0, DCELL c1, DCELL c2, DCELL c3)
{
return (u * (u * (u * (c3 - 3 * c2 + 3 * c1 - c0) +
- (-c3 + 4 * c2 - 5 * c1 + 2 * c0)) + (c2 - c0)) + 2 * c1) / 2;
+ (-c3 + 4 * c2 - 5 * c1 + 2 * c0)) + (c2 - c0)) +
+ 2 * c1) / 2;
}
DCELL Rast_interp_bicubic(double u, double v,
- DCELL c00, DCELL c01, DCELL c02, DCELL c03,
- DCELL c10, DCELL c11, DCELL c12, DCELL c13,
- DCELL c20, DCELL c21, DCELL c22, DCELL c23,
- DCELL c30, DCELL c31, DCELL c32, DCELL c33)
+ DCELL c00, DCELL c01, DCELL c02, DCELL c03,
+ DCELL c10, DCELL c11, DCELL c12, DCELL c13,
+ DCELL c20, DCELL c21, DCELL c22, DCELL c23,
+ DCELL c30, DCELL c31, DCELL c32, DCELL c33)
{
DCELL c0 = Rast_interp_cubic(u, c00, c01, c02, c03);
DCELL c1 = Rast_interp_cubic(u, c10, c11, c12, c13);
Modified: grass/trunk/lib/raster/null_val.c
===================================================================
--- grass/trunk/lib/raster/null_val.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/null_val.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -26,13 +26,13 @@
static void EmbedGivenNulls(void *, char *, RASTER_MAP_TYPE, int);
/*!
- \brief To insert null values into a map. Needs more.....
+ \brief To insert null values into a map. Needs more.....
- \param cell raster values
- \param nulls raster null values
- \param map_type type of raster - CELL, FCELL, DCELL
- \param ncols number of columns
-*/
+ \param cell raster values
+ \param nulls raster null values
+ \param map_type type of raster - CELL, FCELL, DCELL
+ \param ncols number of columns
+ */
void EmbedGivenNulls(void *cell, char *nulls, RASTER_MAP_TYPE map_type,
int ncols)
{
@@ -68,17 +68,17 @@
}
/*!
- \brief To set one or more raster values to null.
+ \brief To set one or more raster values to null.
- It also sets null to zero if null_is_zero is TRUE.
+ It also sets null to zero if null_is_zero is TRUE.
- \param rast pointer to values to set to null
- \param numVals number of values to set to null
- \param null_is_zero flag to indicate if NULL = 0
- \param data_type type of raster - CELL, FCELL, DCELL
-*/
+ \param rast pointer to values to set to null
+ \param numVals number of values to set to null
+ \param null_is_zero flag to indicate if NULL = 0
+ \param data_type type of raster - CELL, FCELL, DCELL
+ */
void Rast__set_null_value(void *rast, int numVals, int null_is_zero,
- RASTER_MAP_TYPE data_type)
+ RASTER_MAP_TYPE data_type)
{
if (null_is_zero) {
G_zero((char *)rast, numVals * Rast_cell_size(data_type));
@@ -89,12 +89,12 @@
}
/*!
- \brief To set one or more raster values to null.
+ \brief To set one or more raster values to null.
- \param buf pointer to values to set to null
- \param numVals number of values to set to null
- \param data_type type of raster - CELL, FCELL, DCELL
-*/
+ \param buf pointer to values to set to null
+ \param numVals number of values to set to null
+ \param data_type type of raster - CELL, FCELL, DCELL
+ */
void Rast_set_null_value(void *buf, int numVals, RASTER_MAP_TYPE data_type)
{
switch (data_type) {
@@ -116,29 +116,30 @@
}
/*!
- \brief To set a number of CELL raster values to NULL.
-
- \param cellVals pointer to CELL values to set to null
- \param numVals number of values to set to null
-*/
-void Rast_set_c_null_value(CELL *cellVals, int numVals)
+ \brief To set a number of CELL raster values to NULL.
+
+ \param cellVals pointer to CELL values to set to null
+ \param numVals number of values to set to null
+ */
+void Rast_set_c_null_value(CELL * cellVals, int numVals)
{
int i; /* counter */
for (i = 0; i < numVals; i++)
- cellVals[i] = (int) 0x80000000;
+ cellVals[i] = (int)0x80000000;
}
/*!
- \brief To set a number of FCELL raster values to NULL.
+ \brief To set a number of FCELL raster values to NULL.
- \param fcellVals pointer to FCELL values to set to null
- \param numVals number of values to set to null
-*/
-void Rast_set_f_null_value(FCELL *fcellVals, int numVals)
+ \param fcellVals pointer to FCELL values to set to null
+ \param numVals number of values to set to null
+ */
+void Rast_set_f_null_value(FCELL * fcellVals, int numVals)
{
static const unsigned char null_bits[4] = {
- 0xFF, 0xFF, 0xFF, 0xFF};
+ 0xFF, 0xFF, 0xFF, 0xFF
+ };
int i;
for (i = 0; i < numVals; i++)
@@ -146,15 +147,16 @@
}
/*!
- \brief To set a number of DCELL raster values to NULL.
-
- \param dcellVals pointer to DCELL values to set to null
- \param numVals number of values to set to null
-*/
-void Rast_set_d_null_value(DCELL *dcellVals, int numVals)
+ \brief To set a number of DCELL raster values to NULL.
+
+ \param dcellVals pointer to DCELL values to set to null
+ \param numVals number of values to set to null
+ */
+void Rast_set_d_null_value(DCELL * dcellVals, int numVals)
{
static const unsigned char null_bits[8] = {
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+ };
int i;
for (i = 0; i < numVals; i++)
@@ -162,17 +164,17 @@
}
/*!
- \brief To check if a raster value is set to NULL
+ \brief To check if a raster value is set to NULL
- - If the <em>data_type</em> is CELL_TYPE, calls Rast_is_c_null_value()
- - If the <em>data_type</em> is FCELL_TYPE, calls Rast_is_f_null_value()
- - If the <em>data_type</em> is DCELL_TYPE, calls Rast_is_d_null_value()
-
- \param rast raster value to check
- \param data_type type of raster - CELL, FCELL, DCELL
+ - If the <em>data_type</em> is CELL_TYPE, calls Rast_is_c_null_value()
+ - If the <em>data_type</em> is FCELL_TYPE, calls Rast_is_f_null_value()
+ - If the <em>data_type</em> is DCELL_TYPE, calls Rast_is_d_null_value()
- \return TRUE if raster value is NULL
- \return FALSE otherwise
+ \param rast raster value to check
+ \param data_type type of raster - CELL, FCELL, DCELL
+
+ \return TRUE if raster value is NULL
+ \return FALSE otherwise
*/
int Rast_is_null_value(const void *rast, RASTER_MAP_TYPE data_type)
{
@@ -193,16 +195,16 @@
}
/*!
- \brief To check if a CELL raster value is set to NULL
+ \brief To check if a CELL raster value is set to NULL
- Returns 1 if <em>cell</em> is NULL, 0 otherwise. This will test if the
- value <em>cell</em> is the largest <tt>int</tt>.
+ Returns 1 if <em>cell</em> is NULL, 0 otherwise. This will test if the
+ value <em>cell</em> is the largest <tt>int</tt>.
- \param cellVal CELL raster value to check
+ \param cellVal CELL raster value to check
- \return TRUE if CELL raster value is NULL
- \return FALSE otherwise
-*/
+ \return TRUE if CELL raster value is NULL
+ \return FALSE otherwise
+ */
int Rast_is_c_null_value(const CELL * cellVal)
{
/* Check if the CELL value matches the null pattern */
@@ -210,123 +212,123 @@
}
/*!
- \brief To check if a FCELL raster value is set to NULL
+ \brief To check if a FCELL raster value is set to NULL
- Returns 1 if <em>fcell</em> is NULL, 0 otherwise. This will test if
- the value <em>fcell</em> is a NaN. It isn't good enough to test for
- a particular NaN bit pattern since the machine code may change this
- bit pattern to a different NaN. The test will be
+ Returns 1 if <em>fcell</em> is NULL, 0 otherwise. This will test if
+ the value <em>fcell</em> is a NaN. It isn't good enough to test for
+ a particular NaN bit pattern since the machine code may change this
+ bit pattern to a different NaN. The test will be
- \code
- if(fcell==0.0) return 0;
- if(fcell>0.0) return 0;
- if(fcell<0.0) return 0;
- return 1;
- \endcode
-
- or (as suggested by Mark Line)
- \code
- return (fcell != fcell);
- \endcode
+ \code
+ if(fcell==0.0) return 0;
+ if(fcell>0.0) return 0;
+ if(fcell<0.0) return 0;
+ return 1;
+ \endcode
- \param fcellVal FCELL raster value to check
+ or (as suggested by Mark Line)
+ \code
+ return (fcell != fcell);
+ \endcode
- \return TRUE if FCELL raster value is NULL
- \return FALSE otherwise
-*/
+ \param fcellVal FCELL raster value to check
+
+ \return TRUE if FCELL raster value is NULL
+ \return FALSE otherwise
+ */
int Rast_is_f_null_value(const FCELL * fcellVal)
{
return *fcellVal != *fcellVal;
}
/*!
- \brief To check if a DCELL raster value is set to NULL
+ \brief To check if a DCELL raster value is set to NULL
- Returns 1 if <em>dcell</em> is NULL, 0 otherwise. This will test if
- the value <em>dcell</em> is a NaN. Same test as in
- Rast_is_f_null_value().
+ Returns 1 if <em>dcell</em> is NULL, 0 otherwise. This will test if
+ the value <em>dcell</em> is a NaN. Same test as in
+ Rast_is_f_null_value().
- \param dcellVal DCELL raster value to check
+ \param dcellVal DCELL raster value to check
- \return TRUE if DCELL raster value is NULL
- \return FALSE otherwise
-*/
+ \return TRUE if DCELL raster value is NULL
+ \return FALSE otherwise
+ */
int Rast_is_d_null_value(const DCELL * dcellVal)
{
return *dcellVal != *dcellVal;
}
/*!
- \brief To insert null values into a map.
+ \brief To insert null values into a map.
- - If the <em>data_type</em> is CELL_TYPE, calls Rast_insert_c_null_values()
- - If the <em>data_type</em> is FCELL_TYPE, calls Rast_insert_f_null_values()
- - If the <em>data_type</em> is DCELL_TYPE, calls Rast_insert_d_null_values()
-
- \param rast pointer raster values
- \param null_row null row
- \param ncols number of columns
- \param data_type type of raster - CELL, FCELL, DCELL
+ - If the <em>data_type</em> is CELL_TYPE, calls Rast_insert_c_null_values()
+ - If the <em>data_type</em> is FCELL_TYPE, calls Rast_insert_f_null_values()
+ - If the <em>data_type</em> is DCELL_TYPE, calls Rast_insert_d_null_values()
+
+ \param rast pointer raster values
+ \param null_row null row
+ \param ncols number of columns
+ \param data_type type of raster - CELL, FCELL, DCELL
*/
void Rast_insert_null_values(void *rast, char *null_row, int ncols,
- RASTER_MAP_TYPE data_type)
+ RASTER_MAP_TYPE data_type)
{
EmbedGivenNulls(rast, null_row, data_type, ncols);
}
/*!
- \brief To insert null values into an integer raster map (CELL)
+ \brief To insert null values into an integer raster map (CELL)
- For each of the <em>count</em> <em>flags</em> which is true(!=0),
- set the corresponding <em>cell</em> to the NULL value.
+ For each of the <em>count</em> <em>flags</em> which is true(!=0),
+ set the corresponding <em>cell</em> to the NULL value.
- \param rast pointer raster values
- \param null_row null row
- \param ncols number of columns
-*/
+ \param rast pointer raster values
+ \param null_row null row
+ \param ncols number of columns
+ */
void Rast_insert_c_null_values(CELL * cellVal, char *null_row, int ncols)
{
EmbedGivenNulls((void *)cellVal, null_row, CELL_TYPE, ncols);
}
/*!
- \brief To insert null values into an floating-point raster map (FCELL)
+ \brief To insert null values into an floating-point raster map (FCELL)
- \param fcellVal pointer raster values
- \param null_row null row
- \param ncols number of columns
-*/
+ \param fcellVal pointer raster values
+ \param null_row null row
+ \param ncols number of columns
+ */
void Rast_insert_f_null_values(FCELL * fcellVal, char *null_row, int ncols)
{
EmbedGivenNulls((void *)fcellVal, null_row, FCELL_TYPE, ncols);
}
/*!
- \brief To insert null values into an floating-point raster map (FCELL)
+ \brief To insert null values into an floating-point raster map (FCELL)
- For each for the <em>count</em> <em>flag</em> which is true(!=0), set
- the corresponding <em>dcell</em> to the NULL value.
+ For each for the <em>count</em> <em>flag</em> which is true(!=0), set
+ the corresponding <em>dcell</em> to the NULL value.
- \param dcellVal pointer raster values
- \param null_row null row
- \param ncols number of columns
-*/
+ \param dcellVal pointer raster values
+ \param null_row null row
+ \param ncols number of columns
+ */
void Rast_insert_d_null_values(DCELL * dcellVal, char *null_row, int ncols)
{
EmbedGivenNulls((void *)dcellVal, null_row, DCELL_TYPE, ncols);
}
/*!
- \brief Check NULL
+ \brief Check NULL
- Note: Only for internal use.
+ Note: Only for internal use.
- \param flags ?
- \param bit_num ?
- \param n ?
+ \param flags ?
+ \param bit_num ?
+ \param n ?
- \return -1 on error
-*/
+ \return -1 on error
+ */
int Rast__check_null_bit(const unsigned char *flags, int bit_num, int n)
{
int ind;
@@ -350,22 +352,22 @@
}
/*!
- \brief Given array of 0/1 of length n starting from column.
+ \brief Given array of 0/1 of length n starting from column.
- Note: Only for internal use.
-
- Given array of 0/1 of length n starting from column set the
- corresponding bits of flags; total number of bits in flags is ncols.
+ Note: Only for internal use.
- \param zero_ones
- \param flags
- \param col
- \param n
- \param ncols
+ Given array of 0/1 of length n starting from column set the
+ corresponding bits of flags; total number of bits in flags is ncols.
- \return 0
- \return 1
-*/
+ \param zero_ones
+ \param flags
+ \param col
+ \param n
+ \param ncols
+
+ \return 0
+ \return 1
+ */
int G__set_flags_from_01_random(const char *zero_ones, unsigned char *flags,
int col, int n, int ncols)
{
@@ -392,7 +394,8 @@
}
else if (count < ncols) {
v = v |
- ((unsigned char)Rast__check_null_bit(flags, count, ncols) << k);
+ ((unsigned char)Rast__check_null_bit(flags, count, ncols)
+ << k);
}
/* otherwise keep this bit the same as it was */
@@ -406,15 +409,16 @@
}
/*!
- \brief ?
+ \brief ?
- Note: Only for internal use.
-
- \param zero_ones
- \param flags
- \param n
-*/
-void Rast__convert_01_flags(const char *zero_ones, unsigned char *flags, int n)
+ Note: Only for internal use.
+
+ \param zero_ones
+ \param flags
+ \param n
+ */
+void Rast__convert_01_flags(const char *zero_ones, unsigned char *flags,
+ int n)
{
unsigned char *v;
int count;
@@ -443,15 +447,16 @@
}
/*!
- \brief ?
+ \brief ?
- Note: Only for internal use.
+ Note: Only for internal use.
- \param zero_ones
- \param flags
- \param n
+ \param zero_ones
+ \param flags
+ \param n
*/
-void Rast__convert_flags_01(char *zero_ones, const unsigned char *flags, int n)
+void Rast__convert_flags_01(char *zero_ones, const unsigned char *flags,
+ int n)
{
const unsigned char *v;
int count;
@@ -477,12 +482,12 @@
}
/*!
- \brief ?
+ \brief ?
- Note: Only for internal use.
+ Note: Only for internal use.
- \param flags
- \param cols
+ \param flags
+ \param cols
*/
void Rast__init_null_bits(unsigned char *flags, int cols)
{
Modified: grass/trunk/lib/raster/opencell.c
===================================================================
--- grass/trunk/lib/raster/opencell.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/opencell.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -80,30 +80,30 @@
RASTER_MAP_TYPE map_type);
/*!
- \brief Open an existing integer raster map (cell)
-
- Opens the existing cell file <i>name</i> in the <i>mapset</i> for
- reading by Rast_get_row() with mapping into the current window.
+ \brief Open an existing integer raster map (cell)
- This routine opens the raster map <i>name</i> in <i>mapset</i> for
- reading. A nonnegative file descriptor is returned if the open is
- successful. Otherwise a diagnostic message is printed and a negative
- value is returned. This routine does quite a bit of work. Since
- GRASS users expect that all raster maps will be resampled into the
- current region, the resampling index for the raster map is prepared
- by this routine after the file is opened. The resampling is based on
- the active module region (see also \ref The_Region}. Preparation
- required for reading the various raster file formats (see \ref
- Raster_File_Format for an explanation of the various raster file
- formats) is also done.
-
- Diagnostics: warning message printed if open fails.
+ Opens the existing cell file <i>name</i> in the <i>mapset</i> for
+ reading by Rast_get_row() with mapping into the current window.
- \param name map name
- \param mapset mapset name where raster map <i>name</i> lives
-
- \return nonnegative file descriptor (int)
- \return -1 on failure
+ This routine opens the raster map <i>name</i> in <i>mapset</i> for
+ reading. A nonnegative file descriptor is returned if the open is
+ successful. Otherwise a diagnostic message is printed and a negative
+ value is returned. This routine does quite a bit of work. Since
+ GRASS users expect that all raster maps will be resampled into the
+ current region, the resampling index for the raster map is prepared
+ by this routine after the file is opened. The resampling is based on
+ the active module region (see also \ref The_Region}. Preparation
+ required for reading the various raster file formats (see \ref
+ Raster_File_Format for an explanation of the various raster file
+ formats) is also done.
+
+ Diagnostics: warning message printed if open fails.
+
+ \param name map name
+ \param mapset mapset name where raster map <i>name</i> lives
+
+ \return nonnegative file descriptor (int)
+ \return -1 on failure
*/
int Rast_open_old(const char *name, const char *mapset)
{
@@ -128,29 +128,29 @@
}
/*! \brief Lower level function, open cell files, supercell files,
- and the MASK file.
+ and the MASK file.
- Actions:
+ Actions:
- opens the named cell file, following reclass reference if
named layer is a reclass layer.
- creates the required mapping between the data and the window
for use by the get_map_row family of routines.
-
- Diagnostics: Errors other than actual open failure will cause a
- diagnostic to be delivered thru G_warning() open failure messages
- are left to the calling routine since the masking logic will want to
- issue a different warning.
-
- Note: This routine does NOT open the MASK layer. If it did we would
- get infinite recursion. This routine is called to open the mask by
- Rast__check_for_auto_masking() which is called by Rast_open_old().
-
- \param name map name
- \param mapset mapset of cell file to be opened
-
- \return open file descriptor
- \return -1 if error
-*/
+
+ Diagnostics: Errors other than actual open failure will cause a
+ diagnostic to be delivered thru G_warning() open failure messages
+ are left to the calling routine since the masking logic will want to
+ issue a different warning.
+
+ Note: This routine does NOT open the MASK layer. If it did we would
+ get infinite recursion. This routine is called to open the mask by
+ Rast__check_for_auto_masking() which is called by Rast_open_old().
+
+ \param name map name
+ \param mapset mapset of cell file to be opened
+
+ \return open file descriptor
+ \return -1 if error
+ */
int Rast__open_old(const char *name, const char *mapset)
{
struct fileinfo *fcb;
@@ -193,8 +193,8 @@
r_mapset = reclass.mapset;
if (G_find_cell2(r_name, r_mapset) == NULL) {
G_warning(_("Unable to open raster map <%s@%s> since it is a reclass "
- "of raster map <%s@%s> which does not exist"),
- name, mapset, r_name, r_mapset);
+ "of raster map <%s@%s> which does not exist"), name,
+ mapset, r_name, r_mapset);
return -1;
}
break;
@@ -224,8 +224,8 @@
if (cellhd.proj != R__.window.proj) {
G_warning(_("Raster map <%s@%s> is in different projection than current region. "
- "Found raster map <%s@%s>, should be <%s>."),
- name, mapset, name, G__projection_name(cellhd.proj),
+ "Found raster map <%s@%s>, should be <%s>."), name, mapset,
+ name, G__projection_name(cellhd.proj),
G__projection_name(R__.window.proj));
return -1;
}
@@ -236,7 +236,7 @@
}
/* when map is int warn if too large cell size */
- if (MAP_TYPE == CELL_TYPE && (unsigned int) CELL_nbytes > sizeof(CELL)) {
+ if (MAP_TYPE == CELL_TYPE && (unsigned int)CELL_nbytes > sizeof(CELL)) {
G_warning(_("Raster map <%s@%s>: bytes per cell (%d) too large"),
name, mapset, CELL_nbytes);
return -1;
@@ -331,7 +331,7 @@
if (fcb->map_type != CELL_TYPE) {
if (fcb->reclass_flag)
Rast_read_quant(fcb->reclass.name, fcb->reclass.mapset,
- &(fcb->quant));
+ &(fcb->quant));
else
Rast_read_quant(fcb->name, fcb->mapset, &(fcb->quant));
}
@@ -351,77 +351,77 @@
}
/*!
- \brief Opens a new cell file in a database (compressed)
+ \brief Opens a new cell file in a database (compressed)
- Opens a new cell file <i>name</i> in the current mapset for writing
- by Rast_put_row().
-
- The file is created and filled with no data it is assumed that the
- new cell file is to conform to the current window.
-
- The file must be written sequentially. Use Rast_open_new_random()
- for non sequential writes.
-
- Note: the open actually creates a temporary file Rast_close() will
- move the temporary file to the cell file and write out the necessary
- support files (cellhd, cats, hist, etc.).
+ Opens a new cell file <i>name</i> in the current mapset for writing
+ by Rast_put_row().
- Diagnostics: warning message printed if open fails
-
- Warning: calls to Rast_set_window() made after opening a new cell file
- may create confusion and should be avoided the new cell file will be
- created to conform to the window at the time of the open.
+ The file is created and filled with no data it is assumed that the
+ new cell file is to conform to the current window.
- \param name map name
+ The file must be written sequentially. Use Rast_open_new_random()
+ for non sequential writes.
- \return open file descriptor ( >= 0) if successful
- \return negative integer if error
-*/
+ Note: the open actually creates a temporary file Rast_close() will
+ move the temporary file to the cell file and write out the necessary
+ support files (cellhd, cats, hist, etc.).
+
+ Diagnostics: warning message printed if open fails
+
+ Warning: calls to Rast_set_window() made after opening a new cell file
+ may create confusion and should be avoided the new cell file will be
+ created to conform to the window at the time of the open.
+
+ \param name map name
+
+ \return open file descriptor ( >= 0) if successful
+ \return negative integer if error
+ */
int Rast_open_c_new(const char *name)
{
return G__open_raster_new(name, OPEN_NEW_COMPRESSED, CELL_TYPE);
}
/*!
- \brief Opens a new cell file in a database (uncompressed)
+ \brief Opens a new cell file in a database (uncompressed)
- See also Rast_open_new().
-
- \param name map name
+ See also Rast_open_new().
- \return open file descriptor ( >= 0) if successful
- \return negative integer if error
-*/
+ \param name map name
+
+ \return open file descriptor ( >= 0) if successful
+ \return negative integer if error
+ */
int Rast_open_c_new_uncompressed(const char *name)
{
return G__open_raster_new(name, OPEN_NEW_UNCOMPRESSED, CELL_TYPE);
}
/*!
- \brief Save histogram for newly create raster map (cell)
+ \brief Save histogram for newly create raster map (cell)
- If newly created cell files should have histograms, set flag=1
- otherwise set flag=0. Applies to subsequent opens.
+ If newly created cell files should have histograms, set flag=1
+ otherwise set flag=0. Applies to subsequent opens.
- \param flag flag indicator
-*/
+ \param flag flag indicator
+ */
void Rast_want_histogram(int flag)
{
R__.want_histogram = flag;
}
/*!
- \brief Sets the format for subsequent opens on new integer cell files
- (uncompressed and random only).
+ \brief Sets the format for subsequent opens on new integer cell files
+ (uncompressed and random only).
- Warning: subsequent put_row calls will only write n+1 bytes per
- cell. If the data requires more, the cell file will be written
- incorrectly (but with n+1 bytes per cell)
+ Warning: subsequent put_row calls will only write n+1 bytes per
+ cell. If the data requires more, the cell file will be written
+ incorrectly (but with n+1 bytes per cell)
- When writing float map: format is -1
+ When writing float map: format is -1
- \param n format
-*/
+ \param n format
+ */
void Rast_set_cell_format(int n)
/* sets the format for integer raster map */
{
@@ -433,12 +433,12 @@
}
/*!
- \brief Get cell value format
+ \brief Get cell value format
- \param v cell
+ \param v cell
- \return cell format
-*/
+ \return cell format
+ */
int Rast_get_cell_format(CELL v)
{
unsigned int i;
@@ -451,44 +451,45 @@
}
/*!
- \brief Opens new fcell file in a database
+ \brief Opens new fcell file in a database
- Opens a new floating-point map <i>name</i> in the current mapset for
- writing. The type of the file (i.e. either double or float) is
- determined and fixed at this point. The default is FCELL_TYPE. In
- order to change this default
+ Opens a new floating-point map <i>name</i> in the current mapset for
+ writing. The type of the file (i.e. either double or float) is
+ determined and fixed at this point. The default is FCELL_TYPE. In
+ order to change this default
- Use Rast_set_fp_type() where type is one of DCELL_TYPE or FCELL_TYPE.
+ Use Rast_set_fp_type() where type is one of DCELL_TYPE or FCELL_TYPE.
- See warnings and notes for Rast_open_new().
+ See warnings and notes for Rast_open_new().
- \param name map name
+ \param name map name
- \return nonnegative file descriptor (int)
- \return -1 on error
-*/
+ \return nonnegative file descriptor (int)
+ \return -1 on error
+ */
int Rast_open_fp_new(const char *name)
{
return G__open_raster_new(name, OPEN_NEW_COMPRESSED, R__.fp_type);
}
/*!
- \brief Opens new fcell file in a database (uncompressed)
+ \brief Opens new fcell file in a database (uncompressed)
- See Rast_open_fp_new() for details.
+ See Rast_open_fp_new() for details.
- \param name map name
+ \param name map name
- \return nonnegative file descriptor (int)
- \return -1 on error
-*/
+ \return nonnegative file descriptor (int)
+ \return -1 on error
+ */
int Rast_open_fp_new_uncompressed(const char *name)
{
return G__open_raster_new(name, OPEN_NEW_UNCOMPRESSED, R__.fp_type);
}
#ifdef HAVE_GDAL
-static int G__open_raster_new_gdal(char *map, char *mapset, RASTER_MAP_TYPE map_type)
+static int G__open_raster_new_gdal(char *map, char *mapset,
+ RASTER_MAP_TYPE map_type)
{
int fd;
struct fileinfo *fcb;
@@ -573,7 +574,7 @@
cell_dir = "fcell";
break;
case DCELL_TYPE:
- nbytes = XDR_DOUBLE_NBYTES;
+ nbytes = XDR_DOUBLE_NBYTES;
cell_dir = "fcell";
break;
default:
@@ -713,19 +714,19 @@
}
/*!
- \brief Set raster map floating-point data format.
-
- This controls the storage type for floating-point maps. It affects
- subsequent calls to G_open_fp_map_new(). The <i>type</i> must be
- one of FCELL_TYPE (float) or DCELL_TYPE (double). The use of this
- routine by applications is discouraged since its use would override
- user preferences.
-
- \param type raster data type
+ \brief Set raster map floating-point data format.
- \return 1 on success
- \return -1 on error
-*/
+ This controls the storage type for floating-point maps. It affects
+ subsequent calls to G_open_fp_map_new(). The <i>type</i> must be
+ one of FCELL_TYPE (float) or DCELL_TYPE (double). The use of this
+ routine by applications is discouraged since its use would override
+ user preferences.
+
+ \param type raster data type
+
+ \return 1 on success
+ \return -1 on error
+ */
int Rast_set_fp_type(RASTER_MAP_TYPE map_type)
{
switch (map_type) {
@@ -740,17 +741,17 @@
}
/*!
- \brief Check if raster map is floating-point
-
- Returns true (1) if raster map <i>name</i> in <i>mapset</i>
- is a floating-point dataset; false(0) otherwise.
-
- \param name map name
- \param mapset mapset name
+ \brief Check if raster map is floating-point
- \return 1 floating-point
- \return 0 int
-*/
+ Returns true (1) if raster map <i>name</i> in <i>mapset</i>
+ is a floating-point dataset; false(0) otherwise.
+
+ \param name map name
+ \param mapset mapset name
+
+ \return 1 floating-point
+ \return 0 int
+ */
int Rast_map_is_fp(const char *name, const char *mapset)
{
char path[GPATH_MAX];
@@ -767,22 +768,22 @@
G__file_name(path, "g3dcell", name, xmapset);
if (access(path, 0) == 0)
return 1;
-
+
return 0;
}
/*!
- \brief Determine raster data type
-
- Determines if the raster map is floating point or integer. Returns
- DCELL_TYPE for double maps, FCELL_TYPE for float maps, CELL_TYPE for
- integer maps, -1 if error has occured
+ \brief Determine raster data type
- \param name map name
- \param mapset mapset where map <i>name</i> lives
+ Determines if the raster map is floating point or integer. Returns
+ DCELL_TYPE for double maps, FCELL_TYPE for float maps, CELL_TYPE for
+ integer maps, -1 if error has occured
- \return raster data type
-*/
+ \param name map name
+ \param mapset mapset where map <i>name</i> lives
+
+ \return raster data type
+ */
RASTER_MAP_TYPE Rast_map_type(const char *name, const char *mapset)
{
char path[GPATH_MAX];
@@ -791,7 +792,8 @@
xmapset = G_find_cell2(name, mapset);
if (!xmapset) {
if (mapset && *mapset)
- G_warning(_("Raster map <%s> not found in mapset <%s>"), name, mapset);
+ G_warning(_("Raster map <%s> not found in mapset <%s>"), name,
+ mapset);
else
G_warning(_("Raster map <%s> not found"), name);
return -1;
@@ -810,15 +812,15 @@
}
/*!
- \brief Determine raster type from descriptor
-
- Determines if the raster map is floating point or integer. Returns
- DCELL_TYPE for double maps, FCELL_TYPE for float maps, CELL_TYPE for
- integer maps, -1 if error has occured
-
- \param fd file descriptor
+ \brief Determine raster type from descriptor
- \return raster data type
+ Determines if the raster map is floating point or integer. Returns
+ DCELL_TYPE for double maps, FCELL_TYPE for float maps, CELL_TYPE for
+ integer maps, -1 if error has occured
+
+ \param fd file descriptor
+
+ \return raster data type
*/
RASTER_MAP_TYPE Rast_get_map_type(int fd)
{
@@ -828,13 +830,13 @@
}
/*!
- \brief Determines whether the floating points cell file has double or float type
+ \brief Determines whether the floating points cell file has double or float type
- \param name map name
- \param mapset mapset where map <i>name</i> lives
-
- \return raster type (fcell, dcell)
-*/
+ \param name map name
+ \param mapset mapset where map <i>name</i> lives
+
+ \return raster type (fcell, dcell)
+ */
RASTER_MAP_TYPE Rast__check_fp_type(const char *name, const char *mapset)
{
char path[GPATH_MAX];
@@ -866,8 +868,7 @@
else if (strcmp(str, "float") == 0)
map_type = FCELL_TYPE;
else {
- G_warning(_("Invalid type: field '%s' in file '%s'"),
- str, path);
+ G_warning(_("Invalid type: field '%s' in file '%s'"), str, path);
G_free_key_value(format_keys);
return -1;
}
@@ -880,7 +881,7 @@
if ((str1 = G_find_key_value("byte_order", format_keys)) != NULL) {
if (strcmp(str1, "xdr") != 0)
G_warning(_("Raster map <%s> is not xdr: byte_order: %s"),
- name, str);
+ name, str);
/* here read and translate byte order if not using xdr */
}
G_free_key_value(format_keys);
@@ -888,61 +889,61 @@
}
/*!
- \brief Opens a new raster map
+ \brief Opens a new raster map
- Opens a new raster map of type <i>wr_type</i>
+ Opens a new raster map of type <i>wr_type</i>
- See warnings and notes for Rast_open_new().
+ See warnings and notes for Rast_open_new().
- Supported data types:
+ Supported data types:
- CELL_TYPE
- FCELL_TYPE
- DCELL_TYPE
-
- On CELL_TYPE calls Rast_open_new() otherwise Rast_open_fp_new().
-
- \param name map name
- \param wr_type raster data type
- \return nonnegative file descriptor (int)
- \return -1 on error
-*/
+ On CELL_TYPE calls Rast_open_new() otherwise Rast_open_fp_new().
+
+ \param name map name
+ \param wr_type raster data type
+
+ \return nonnegative file descriptor (int)
+ \return -1 on error
+ */
int Rast_open_new(const char *name, RASTER_MAP_TYPE wr_type)
{
return G__open_raster_new(name, OPEN_NEW_COMPRESSED, wr_type);
}
/*!
- \brief Opens a new raster map (uncompressed)
+ \brief Opens a new raster map (uncompressed)
- See Rast_open_new().
+ See Rast_open_new().
- \param name map name
- \param wr_type raster data type
+ \param name map name
+ \param wr_type raster data type
- \return nonnegative file descriptor (int)
- \return -1 on error
-*/
+ \return nonnegative file descriptor (int)
+ \return -1 on error
+ */
int Rast_open_new_uncompressed(const char *name, RASTER_MAP_TYPE wr_type)
{
return G__open_raster_new(name, OPEN_NEW_UNCOMPRESSED, wr_type);
}
/*!
- \brief Sets quant translation rules for raster map opened for
- reading.
+ \brief Sets quant translation rules for raster map opened for
+ reading.
- Returned by Rast_open_old(). After calling this function,
- Rast_get_c_row() and Rast_get_c_row() will use rules defined by q
- (instead of using rules defined in map's quant file) to convert floats to
- ints.
-
- \param fd file descriptor (cell file)
- \param q pointer to Quant structure
+ Returned by Rast_open_old(). After calling this function,
+ Rast_get_c_row() and Rast_get_c_row() will use rules defined by q
+ (instead of using rules defined in map's quant file) to convert floats to
+ ints.
- \return 0 success
- \return -1 failure
-*/
+ \param fd file descriptor (cell file)
+ \param q pointer to Quant structure
+
+ \return 0 success
+ \return -1 failure
+ */
int Rast_set_quant_rules(int fd, struct Quant *q)
{
struct fileinfo *fcb = &R__.fileinfo[fd];
@@ -962,7 +963,8 @@
return 0;
}
for (p = &(q->table[q->nofRules - 1]); p >= q->table; p--)
- Rast_quant_add_rule(&fcb->quant, p->dLow, p->dHigh, p->cLow, p->cHigh);
+ Rast_quant_add_rule(&fcb->quant, p->dLow, p->dHigh, p->cLow,
+ p->cHigh);
if (Rast_quant_get_neg_infinite_rule(q, &dcell, &cell) > 0)
Rast_quant_set_neg_infinite_rule(&fcb->quant, dcell, cell);
if (Rast_quant_get_pos_infinite_rule(q, &dcell, &cell) > 0)
Modified: grass/trunk/lib/raster/put_cellhd.c
===================================================================
--- grass/trunk/lib/raster/put_cellhd.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/put_cellhd.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -15,17 +15,17 @@
#include <grass/glocale.h>
/*!
- \brief Writes the raster file header.
+ \brief Writes the raster file header.
- Writes the cell file header information associated with map layer "map"
- into current mapset from the structure "cellhd".
+ Writes the cell file header information associated with map layer "map"
+ into current mapset from the structure "cellhd".
- \param name name of map
- \param cellhd structure holding cell header info
+ \param name name of map
+ \param cellhd structure holding cell header info
- \return 0 on success
- \return -1 on failure
-*/
+ \return 0 on success
+ \return -1 on failure
+ */
int Rast_put_cellhd(const char *name, struct Cell_head *cellhd)
{
FILE *fd;
Modified: grass/trunk/lib/raster/put_row.c
===================================================================
--- grass/trunk/lib/raster/put_row.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/put_row.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -1,14 +1,14 @@
/*!
- \file raster/put_row.c
+ \file raster/put_row.c
- \brief Raster library - Put raster row
+ \brief Raster library - Put raster row
- (C) 2003-2009 by the GRASS Development Team
+ (C) 2003-2009 by 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.
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
- \author Original author CERL
+ \author Original author CERL
*/
/**********************************************************************
@@ -41,8 +41,7 @@
static int convert_and_write_id(int, const CELL *);
static int convert_and_write_df(int, const DCELL *);
static int convert_and_write_fd(int, const FCELL *);
-static int put_raster_row(int, const void *, RASTER_MAP_TYPE,
- int);
+static int put_raster_row(int, const void *, RASTER_MAP_TYPE, int);
static int put_null_value_row(int fd, const char *buf)
{
@@ -64,85 +63,85 @@
}
/*!
- \brief Writes the next row for cell/fcell/dcell file
+ \brief Writes the next row for cell/fcell/dcell file
- Writes the next row for the cell file opened on 'fd' from 'buf' All
- writes go into NEW files that exactly match the current window. The
- file must have been opened with Rast_open_new() and be written
- sequentially, ie no skipping rows.
-
- When the null values are embeded into the data, corresponding cells
- are changed to 0's and the corresponding null value row is written
- into null file.
-
- A map cannot be copied using Rast_get_row() and
- Rast_put_row(). The former resamples the data of the original
- map into a row buffer that matches the current window. The later
- writes out rows associated with the window.
-
- Keeps track of the minimum and maximum cell value for use in
- updating the range file upon close of the cell file. HOWEVER when
- nulls are not embeded, the cells are considered 0's as far as
- updating range is concerned, even if the corresponding cell is null
- in the resulting null file, so programmer should be carefult to set
- all the null values using Rast_set_null_value() or
- G_insert_d_null_values() or G_insert_f_null_values().
+ Writes the next row for the cell file opened on 'fd' from 'buf' All
+ writes go into NEW files that exactly match the current window. The
+ file must have been opened with Rast_open_new() and be written
+ sequentially, ie no skipping rows.
- \param fd file descriptor where data is to be written
- \param buf buffer holding data
- \param data_type raster map type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE)
+ When the null values are embeded into the data, corresponding cells
+ are changed to 0's and the corresponding null value row is written
+ into null file.
- \return 1 on success
- \return -1 on failure
-*/
+ A map cannot be copied using Rast_get_row() and
+ Rast_put_row(). The former resamples the data of the original
+ map into a row buffer that matches the current window. The later
+ writes out rows associated with the window.
+
+ Keeps track of the minimum and maximum cell value for use in
+ updating the range file upon close of the cell file. HOWEVER when
+ nulls are not embeded, the cells are considered 0's as far as
+ updating range is concerned, even if the corresponding cell is null
+ in the resulting null file, so programmer should be carefult to set
+ all the null values using Rast_set_null_value() or
+ G_insert_d_null_values() or G_insert_f_null_values().
+
+ \param fd file descriptor where data is to be written
+ \param buf buffer holding data
+ \param data_type raster map type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE)
+
+ \return 1 on success
+ \return -1 on failure
+ */
int Rast_put_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
{
return put_raster_row(fd, buf, data_type, data_type);
}
/*!
- \brief Writes the next row for cell file (CELL version)
+ \brief Writes the next row for cell file (CELL version)
- See Rast_put_row() for details.
+ See Rast_put_row() for details.
- \param fd file descriptor where data is to be written
- \param buf buffer holding data
+ \param fd file descriptor where data is to be written
+ \param buf buffer holding data
- \return 1 on success
- \return -1 on failure
-*/
+ \return 1 on success
+ \return -1 on failure
+ */
int Rast_put_c_row(int fd, const CELL * buf)
{
return Rast_put_row(fd, buf, CELL_TYPE);
}
/*!
- \brief Writes the next row for fcell file (FCELL version)
+ \brief Writes the next row for fcell file (FCELL version)
- See Rast_put_row() for details.
+ See Rast_put_row() for details.
- \param fd file descriptor where data is to be written
- \param buf buffer holding data
+ \param fd file descriptor where data is to be written
+ \param buf buffer holding data
- \return 1 on success
- \return -1 on failure
-*/
+ \return 1 on success
+ \return -1 on failure
+ */
int Rast_put_f_row(int fd, const FCELL * buf)
{
return Rast_put_row(fd, buf, FCELL_TYPE);
}
/*!
- \brief Writes the next row for dcell file (DCELL version)
+ \brief Writes the next row for dcell file (DCELL version)
- See Rast_put_row() for details.
+ See Rast_put_row() for details.
- \param fd file descriptor where data is to be written
- \param buf buffer holding data
+ \param fd file descriptor where data is to be written
+ \param buf buffer holding data
- \return 1 on success
- \return -1 on failure
-*/
+ \return 1 on success
+ \return -1 on failure
+ */
int Rast_put_d_row(int fd, const DCELL * buf)
{
return Rast_put_row(fd, buf, DCELL_TYPE);
@@ -154,8 +153,8 @@
switch (fcb->open_mode) {
case OPEN_OLD:
- G_warning(_("%s: raster map <%s> not open for write - request ignored"), me,
- fcb->name);
+ G_warning(_("%s: raster map <%s> not open for write - request ignored"),
+ me, fcb->name);
break;
case OPEN_NEW_COMPRESSED:
case OPEN_NEW_UNCOMPRESSED:
@@ -285,7 +284,7 @@
set_file_pointer(fd, row);
xdrmem_create(xdrs, work_buf,
- (unsigned int) fcb->nbytes * fcb->cellhd.cols, XDR_ENCODE);
+ (unsigned int)fcb->nbytes * fcb->cellhd.cols, XDR_ENCODE);
xdr_setpos(xdrs, 0);
if (data_type == FCELL_TYPE) {
@@ -441,7 +440,7 @@
return (nwrite >= total) ? 0 : nwrite;
}
-static int put_data(int fd, char *null_buf, const CELL *cell,
+static int put_data(int fd, char *null_buf, const CELL * cell,
int row, int n, int zeros_r_nulls)
{
struct fileinfo *fcb = &R__.fileinfo[fd];
@@ -487,10 +486,8 @@
/* then compress the data */
nwrite = compressed == 1
- ? rle_compress(compressed_buf + 1, work_buf + 1, n,
- nbytes)
- : zlib_compress(compressed_buf + 1, work_buf + 1, n,
- nbytes);
+ ? rle_compress(compressed_buf + 1, work_buf + 1, n, nbytes)
+ : zlib_compress(compressed_buf + 1, work_buf + 1, n, nbytes);
if (nwrite > 0) {
nwrite++;
@@ -551,16 +548,23 @@
work_buf = G__alloca(n * size);
switch (map_type) {
- case CELL_TYPE: datatype = GDT_Int32; break;
- case FCELL_TYPE: datatype = GDT_Float32; break;
- case DCELL_TYPE: datatype = GDT_Float64; break;
+ case CELL_TYPE:
+ datatype = GDT_Int32;
+ break;
+ case FCELL_TYPE:
+ datatype = GDT_Float32;
+ break;
+ case DCELL_TYPE:
+ datatype = GDT_Float64;
+ break;
}
src = rast;
dst = work_buf;
for (i = 0; i < n; i++) {
- if (Rast_is_null_value(src, map_type) || zeros_r_nulls && !*(CELL *)src)
+ if (Rast_is_null_value(src, map_type) || zeros_r_nulls &&
+ !*(CELL *) src)
Rast_set_d_value(dst, null_val, map_type);
else
memcpy(dst, src, size);
@@ -568,8 +572,9 @@
dst = G_incr_void_ptr(dst, size);
}
- err = Rast_gdal_raster_IO(fcb->gdal->band, GF_Write, 0, row, n, 1, work_buf,
- n, 1, datatype, 0, 0);
+ err =
+ Rast_gdal_raster_IO(fcb->gdal->band, GF_Write, 0, row, n, 1, work_buf,
+ n, 1, datatype, 0, 0);
G__freea(work_buf);
@@ -614,8 +619,8 @@
break;
if (Rast__write_null_bits(null_fd, fcb->NULL_ROWS[i],
- i + fcb->min_null_row,
- fcb->cellhd.cols, fd) < 0)
+ i + fcb->min_null_row,
+ fcb->cellhd.cols, fd) < 0)
return -1;
} /* done writing out memory rows */
@@ -630,19 +635,19 @@
/* remember the null row for i for the future writing */
Rast__convert_01_flags(flags, fcb->NULL_ROWS[row - fcb->min_null_row],
- fcb->cellhd.cols);
+ fcb->cellhd.cols);
return 1;
}
/*!
- \brief Open null file for write
+ \brief Open null file for write
- \param fd file descriptor of raster cell data file
+ \param fd file descriptor of raster cell data file
- \return field descriptor of null data file
- \return -1 on failure
-*/
+ \return field descriptor of null data file
+ \return -1 on failure
+ */
int Rast__open_null_write(int fd)
{
struct fileinfo *fcb = &R__.fileinfo[fd];
@@ -662,17 +667,17 @@
}
/*!
- \brief Write null data
+ \brief Write null data
- \param null_fd file descriptor of null file where data is to be written
- \param flags ?
- \param row row number
- \param col col number
- \param fd file descriptor of cell data file
+ \param null_fd file descriptor of null file where data is to be written
+ \param flags ?
+ \param row row number
+ \param col col number
+ \param fd file descriptor of cell data file
- \return 1 on success
- \return -1 on failure
-*/
+ \return 1 on success
+ \return -1 on failure
+ */
int Rast__write_null_bits(int null_fd, const unsigned char *flags, int row,
int cols, int fd)
{
@@ -786,26 +791,27 @@
}
/*!
- \brief converts a buffer of zero's and ones to bitstream.
+ \brief converts a buffer of zero's and ones to bitstream.
- Stores this bitstream in memory. (the null rows from memory are
- written into null file after the limit is reached, and the place for
- new null rows to be kept in memory is freed. Should not be used by
- application programs.
+ Stores this bitstream in memory. (the null rows from memory are
+ written into null file after the limit is reached, and the place for
+ new null rows to be kept in memory is freed. Should not be used by
+ application programs.
- \param fd file descriptor where data is to be written
- \param buf buffer holding null data
-
- \return 0 if successful
- \return -1 on fail
-*/
+ \param fd file descriptor where data is to be written
+ \param buf buffer holding null data
+
+ \return 0 if successful
+ \return -1 on fail
+ */
static int put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
int zeros_r_nulls)
{
- static int (*convert_and_write_FtypeOtype[3][3])() = {
- {NULL, convert_and_write_if, convert_and_write_id},
- {convert_and_write_fi, NULL, convert_and_write_fd},
- {convert_and_write_di, convert_and_write_df, NULL}
+ static int (*convert_and_write_FtypeOtype[3][3]) () = {
+ {
+ NULL, convert_and_write_if, convert_and_write_id}, {
+ convert_and_write_fi, NULL, convert_and_write_fd}, {
+ convert_and_write_di, convert_and_write_df, NULL}
};
struct fileinfo *fcb = &R__.fileinfo[fd];
char *null_buf;
@@ -821,9 +827,8 @@
null_buf = G__alloca(fcb->cellhd.cols);
G_zero(null_buf, fcb->cellhd.cols);
- switch (put_raster_data(
- fd, null_buf, buf, fcb->cur_row, fcb->cellhd.cols,
- zeros_r_nulls, data_type)) {
+ switch (put_raster_data(fd, null_buf, buf, fcb->cur_row, fcb->cellhd.cols,
+ zeros_r_nulls, data_type)) {
case -1:
G__freea(null_buf);
return -1;
@@ -837,11 +842,11 @@
if (fcb->want_histogram)
Rast_update_cell_stats(buf, fcb->cellhd.cols, &fcb->statf);
Rast__row_update_range(buf, fcb->cellhd.cols, &fcb->range,
- zeros_r_nulls);
+ zeros_r_nulls);
}
else
Rast_row_update_fp_range(buf, fcb->cellhd.cols, &fcb->fp_range,
- data_type);
+ data_type);
fcb->cur_row++;
Modified: grass/trunk/lib/raster/put_title.c
===================================================================
--- grass/trunk/lib/raster/put_title.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/put_title.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -25,9 +25,8 @@
in = out = 0;
in = G_fopen_old("cats", name, mapset);
if (!in) {
- G_warning (_("category information for [%s] in [%s]"
- " missing or invalid"),
- name, mapset);
+ G_warning(_("category information for [%s] in [%s]"
+ " missing or invalid"), name, mapset);
return -1;
}
@@ -35,7 +34,7 @@
out = fopen(tempfile, "w");
if (!out) {
fclose(in);
- G_warning (_("G_put_title - can't create a temp file"));
+ G_warning(_("G_put_title - can't create a temp file"));
return -1;
}
@@ -51,22 +50,22 @@
/* must be #cats line, title line, and label for cat 0 */
if (line < 3) {
- G_warning (_("category information for [%s] in [%s] invalid"),
- name, mapset);
+ G_warning(_("category information for [%s] in [%s] invalid"),
+ name, mapset);
return -1;
}
in = fopen(tempfile, "r");
if (!in) {
- G_warning (_("G_put_title - can't reopen temp file"));
+ G_warning(_("G_put_title - can't reopen temp file"));
return -1;
}
out = G_fopen_new("cats", name);
if (!out) {
fclose(in);
- G_warning (_("can't write category information for [%s] in [%s]"),
- name, mapset);
+ G_warning(_("can't write category information for [%s] in [%s]"),
+ name, mapset);
return -1;
}
Modified: grass/trunk/lib/raster/quant.c
===================================================================
--- grass/trunk/lib/raster/quant.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/quant.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -40,10 +40,10 @@
NO_LEFT_INFINITE_RULE && NO_RIGHT_INFINITE_RULE)
/*!
- \brief Resets the number of defined rules and number of infinite rules to 0
+ \brief Resets the number of defined rules and number of infinite rules to 0
- \param q pointer to Quant structure to be reset
-*/
+ \param q pointer to Quant structure to be reset
+ */
void Rast_quant_clear(struct Quant *q)
{
q->nofRules = 0;
@@ -51,13 +51,13 @@
}
/*!
- \brief Resets and frees allocated memory
+ \brief Resets and frees allocated memory
- Resets the number of defined rules to 0 and free's space allocated
- for rules. Calls Rast_quant_clear().
-
- \param q pointer to Quant structure to be reset
-*/
+ Resets the number of defined rules to 0 and free's space allocated
+ for rules. Calls Rast_quant_clear().
+
+ \param q pointer to Quant structure to be reset
+ */
void Rast_quant_free(struct Quant *q)
{
Rast_quant_clear(q);
@@ -187,25 +187,25 @@
}
/*!
- \brief Returns wether or not quant rules are set to truncate map
+ \brief Returns wether or not quant rules are set to truncate map
- \param quant pointer to Quant structure which holds quant rules info
+ \param quant pointer to Quant structure which holds quant rules info
- \return 1 if truncate is enable
- \return 0 if not truncated
-*/
+ \return 1 if truncate is enable
+ \return 0 if not truncated
+ */
int Rast_quant_is_truncate(const struct Quant *quant)
{
return quant->truncate_only;
}
/*!
- \brief Returns wether or not quant rules are set to round map
- \param quant pointer to Quant structure which holds quant rules info
+ \brief Returns wether or not quant rules are set to round map
+ \param quant pointer to Quant structure which holds quant rules info
- \return 1 is round
- \return 0 not round
-*/
+ \return 1 is round
+ \return 0 not round
+ */
int Rast_quant_is_round(const struct Quant *quant)
{
return quant->round_only;
@@ -285,7 +285,8 @@
* <i>dmax</i>, <i>cmin</i>, and <i>cmax</i> to NULL.
*/
int Rast_quant_get_limits(const struct Quant *q,
- DCELL * dMin, DCELL * dMax, CELL * cMin, CELL * cMax)
+ DCELL * dMin, DCELL * dMax, CELL * cMin,
+ CELL * cMax)
{
if (NO_EXPLICIT_RULE) {
Rast_set_c_null_value(cMin, 1);
@@ -304,36 +305,36 @@
}
/*!
- \brief Returns the number of quantization rules defined.
+ \brief Returns the number of quantization rules defined.
- This number does not include the 2 infinite intervals.
+ This number does not include the 2 infinite intervals.
- \param q pointer to Quant structure which holds quant rules info
-
- \return number of quantization rules
-*/
+ \param q pointer to Quant structure which holds quant rules info
+
+ \return number of quantization rules
+ */
int Rast_quant_nof_rules(const struct Quant *q)
{
return q->nofRules;
}
/*!
- \brief Returns the i'th quantization rule.
+ \brief Returns the i'th quantization rule.
- For 0 <= i < Rast_quant_nof_rules(). A larger value for i means that
- the rule has been added later.
-
- \param q pointer to Quant structure which holds quant rules info
- \param i index
- \param[out] dLow minimum fp value
- \param[out] dHigh maximum fp value
- \param[out] cLow minimum value
- \param[out] cHigh maximum value
-*/
+ For 0 <= i < Rast_quant_nof_rules(). A larger value for i means that
+ the rule has been added later.
+
+ \param q pointer to Quant structure which holds quant rules info
+ \param i index
+ \param[out] dLow minimum fp value
+ \param[out] dHigh maximum fp value
+ \param[out] cLow minimum value
+ \param[out] cHigh maximum value
+ */
void Rast_quant_get_ith_rule(const struct Quant *q,
- int i,
- DCELL * dLow, DCELL * dHigh,
- CELL * cLow, CELL * cHigh)
+ int i,
+ DCELL * dLow, DCELL * dHigh,
+ CELL * cLow, CELL * cHigh)
{
*dLow = q->table[i].dLow;
*dHigh = q->table[i].dHigh;
@@ -360,16 +361,16 @@
}
/*!
- \brief Defines a rule for values "dLeft" and smaller.
+ \brief Defines a rule for values "dLeft" and smaller.
- Values in this range are mapped to "c" if none of the "finite"
- quantization rules applies.
-
- \param q pointer to Quant structure which holds quant rules info
+ Values in this range are mapped to "c" if none of the "finite"
+ quantization rules applies.
- \param dLeft fp value
- \param c value
-*/
+ \param q pointer to Quant structure which holds quant rules info
+
+ \param dLeft fp value
+ \param c value
+ */
void Rast_quant_set_neg_infinite_rule(struct Quant *q, DCELL dLeft, CELL c)
{
q->infiniteDLeft = dLeft;
@@ -385,19 +386,19 @@
}
/*!
- \brief Returns in "dLeft" and "c" the rule values.
+ \brief Returns in "dLeft" and "c" the rule values.
- For the negative infinite interval (see Rast_quant_set_neg_infinite_rule()).
-
- \param q pointer to Quant structure which holds quant rules info
- \param[out] dLeft fp value
- \param[out] c value
+ For the negative infinite interval (see Rast_quant_set_neg_infinite_rule()).
- \return 0 if this rule is not defined
- \return 1 otherwise
-*/
+ \param q pointer to Quant structure which holds quant rules info
+ \param[out] dLeft fp value
+ \param[out] c value
+
+ \return 0 if this rule is not defined
+ \return 1 otherwise
+ */
int Rast_quant_get_neg_infinite_rule(const struct Quant *q,
- DCELL * dLeft, CELL * c)
+ DCELL * dLeft, CELL * c)
{
if (q->infiniteLeftSet == 0)
return 0;
@@ -409,15 +410,15 @@
}
/*!
- \brief Defines a rule for values "dRight" and larger.
+ \brief Defines a rule for values "dRight" and larger.
- Values in this range are mapped to "c" if none of the "finite"
- quantization rules or the negative infinite rule applies.
+ Values in this range are mapped to "c" if none of the "finite"
+ quantization rules or the negative infinite rule applies.
- \param q pointer to Quant structure which holds quant rules info
- \param dRight fp value
- \param c value
-*/
+ \param q pointer to Quant structure which holds quant rules info
+ \param dRight fp value
+ \param c value
+ */
void Rast_quant_set_pos_infinite_rule(struct Quant *q, DCELL dRight, CELL c)
{
q->infiniteDRight = dRight;
@@ -433,19 +434,19 @@
}
/*!
- \brief Returns in "dRight" and "c" the rule values.
+ \brief Returns in "dRight" and "c" the rule values.
- For the positive infinite interval (see Rast_quant_set_pos_infinite_rule()).
+ For the positive infinite interval (see Rast_quant_set_pos_infinite_rule()).
- \param q pointer to Quant structure which holds quant rules info
- \param[out] dRight fp value
- \param[out] c value
+ \param q pointer to Quant structure which holds quant rules info
+ \param[out] dRight fp value
+ \param[out] c value
- \return 0 if this rule is not defined
- \return 1 otherwise
-*/
+ \return 0 if this rule is not defined
+ \return 1 otherwise
+ */
int Rast_quant_get_pos_infinite_rule(const struct Quant *q,
- DCELL * dRight, CELL * c)
+ DCELL * dRight, CELL * c)
{
if (q->infiniteRightSet == 0)
return 0;
@@ -457,26 +458,26 @@
}
/*!
- \brief Adds a new rule to the set of quantization rules.
+ \brief Adds a new rule to the set of quantization rules.
- If dLow < dHigh the rule will be stored with the low and high values
- interchanged.
-
- Note: currently no cleanup of rules is performed, i.e. redundant
- rules are not removed. This can't be changed because Categories
- structure HEAVILY depends of quant rules stored in exactly the same
- order they are entered. So if the cleanup or rearrangement is done in
- the future make a flag for add_rule wether or not to do it, then
- quant will not set this flag.
+ If dLow < dHigh the rule will be stored with the low and high values
+ interchanged.
- \param q pointer to Quant structure which holds quant rules info
- \param dLow minimum fp value
- \param dHigh maximum fp value
- \param cLow minimum value
- \param cHigh maximum value
-*/
+ Note: currently no cleanup of rules is performed, i.e. redundant
+ rules are not removed. This can't be changed because Categories
+ structure HEAVILY depends of quant rules stored in exactly the same
+ order they are entered. So if the cleanup or rearrangement is done in
+ the future make a flag for add_rule wether or not to do it, then
+ quant will not set this flag.
+
+ \param q pointer to Quant structure which holds quant rules info
+ \param dLow minimum fp value
+ \param dHigh maximum fp value
+ \param cLow minimum value
+ \param cHigh maximum value
+ */
void Rast_quant_add_rule(struct Quant *q,
- DCELL dLow, DCELL dHigh, CELL cLow, CELL cHigh)
+ DCELL dLow, DCELL dHigh, CELL cLow, CELL cHigh)
{
int i;
struct Quant_table *p;
@@ -513,12 +514,12 @@
}
/*!
- \brief Rreverses the order in which the qunatization rules are stored.
+ \brief Rreverses the order in which the qunatization rules are stored.
- See also Rast_quant_get_ith_rule() and Rast_quant_perform_d()).
+ See also Rast_quant_get_ith_rule() and Rast_quant_perform_d()).
- \param q pointer to Quant rules which holds quant rules info
-*/
+ \param q pointer to Quant rules which holds quant rules info
+ */
void Rast_quant_reverse_rule_order(struct Quant *q)
{
struct Quant_table tmp;
@@ -706,20 +707,20 @@
}
/*!
- \brief Returns in "cell" the quantized CELL values.
+ \brief Returns in "cell" the quantized CELL values.
- Returns in "cell" the quantized CELL values corresponding to the
- DCELL values stored in "dcell". the number of elements quantized
- is n. quantization is performed by repeated application of
- Rast_quant_get_cell_value().
+ Returns in "cell" the quantized CELL values corresponding to the
+ DCELL values stored in "dcell". the number of elements quantized
+ is n. quantization is performed by repeated application of
+ Rast_quant_get_cell_value().
- \param q pointer to Quant structure which holds quant rules info
- \param dcell pointer to fp cell values array
- \param[out] cell pointer cell values array
- \param n number of cells
-*/
+ \param q pointer to Quant structure which holds quant rules info
+ \param dcell pointer to fp cell values array
+ \param[out] cell pointer cell values array
+ \param n number of cells
+ */
void Rast_quant_perform_d(struct Quant *q,
- const DCELL * dcell, CELL * cell, int n)
+ const DCELL * dcell, CELL * cell, int n)
{
int i;
@@ -731,15 +732,15 @@
}
/*!
- \brief Same as Rast_quant_perform_d(), except the type.
+ \brief Same as Rast_quant_perform_d(), except the type.
- \param q pointer to Quant structure which holds quant rules info
- \param fcell pointer to fp cell values array
- \param[out] cell pointer cell values array
- \param n number of cells
-*/
+ \param q pointer to Quant structure which holds quant rules info
+ \param fcell pointer to fp cell values array
+ \param[out] cell pointer cell values array
+ \param n number of cells
+ */
void Rast_quant_perform_f(struct Quant *q,
- const FCELL * fcell, CELL * cell, int n)
+ const FCELL * fcell, CELL * cell, int n)
{
int i;
@@ -766,19 +767,19 @@
}
/*!
- \brief Returns quant rule which will be applied.
+ \brief Returns quant rule which will be applied.
- Returns quant rule which will be applied when looking up the integer
- quant value for val (used when organizing fp_lookup).
+ Returns quant rule which will be applied when looking up the integer
+ quant value for val (used when organizing fp_lookup).
- \param q pointer to Quant structure which holds quant rules info
- \param val fp cell value
-
- \return pointer to the Quant_table (color rule)
- \return NULL otherwise
-*/
-struct Quant_table *Rast__quant_get_rule_for_d_raster_val(const struct Quant *q,
- DCELL val)
+ \param q pointer to Quant structure which holds quant rules info
+ \param val fp cell value
+
+ \return pointer to the Quant_table (color rule)
+ \return NULL otherwise
+ */
+struct Quant_table *Rast__quant_get_rule_for_d_raster_val(const struct Quant
+ *q, DCELL val)
{
const struct Quant_table *p;
Modified: grass/trunk/lib/raster/quant_io.c
===================================================================
--- grass/trunk/lib/raster/quant_io.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/quant_io.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -88,8 +88,8 @@
return 0;
Rast_get_fp_range_min_max(&fprange, &dMin, &dMax);
if (Rast_is_d_null_value(&dMin) || Rast_is_d_null_value(&dMax)) {
- G_warning (_("The floating data range for %s@%s is empty"),
- name, mapset);
+ G_warning(_("The floating data range for %s@%s is empty"),
+ name, mapset);
return -3;
}
@@ -97,8 +97,8 @@
return 0;
Rast_get_range_min_max(&range, &min, &max);
if (Rast_is_c_null_value(&min) && Rast_is_c_null_value(&max)) {
- G_warning (_("The integer data range for %s@%s is empty"),
- name, mapset);
+ G_warning(_("The integer data range for %s@%s is empty"),
+ name, mapset);
return -3;
}
@@ -110,7 +110,8 @@
/*--------------------------------------------------------------------------*/
-int Rast__quant_import(const char *name, const char *mapset, struct Quant *quant)
+int Rast__quant_import(const char *name, const char *mapset,
+ struct Quant *quant)
{
char buf[1024];
char *err;
@@ -121,9 +122,9 @@
Rast_quant_free(quant);
if (Rast_map_type(name, mapset) == CELL_TYPE) {
- G_warning (_("Rast__quant_import: attempt to open quantization"
- " table for CELL_TYPE file [%s] in mapset {%s]"),
- name, mapset);
+ G_warning(_("Rast__quant_import: attempt to open quantization"
+ " table for CELL_TYPE file [%s] in mapset {%s]"),
+ name, mapset);
return -2;
}
@@ -163,8 +164,8 @@
err = "empty";
}
- G_warning (_("quantization file [%s] in mapset [%s] %s"),
- name, mapset, err);
+ G_warning(_("quantization file [%s] in mapset [%s] %s"),
+ name, mapset, err);
return 0;
}
@@ -277,7 +278,7 @@
int
Rast__quant_export(const char *name, const char *mapset,
- const struct Quant *quant)
+ const struct Quant *quant)
{
char element[GNAME_MAX + 7];
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
Modified: grass/trunk/lib/raster/quant_rw.c
===================================================================
--- grass/trunk/lib/raster/quant_rw.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/quant_rw.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -19,18 +19,18 @@
#include <grass/glocale.h>
/*!
- \brief Writes the quant rules.
+ \brief Writes the quant rules.
- Writes the quant rules which indicate that all floating numbers
- should be truncated instead of applying any quant rules from
- floats to integers.
+ Writes the quant rules which indicate that all floating numbers
+ should be truncated instead of applying any quant rules from
+ floats to integers.
- \param name map name
- \param mapset mapset name
+ \param name map name
+ \param mapset mapset name
- \return -1 on error
- \return 1 on success
-*/
+ \return -1 on error
+ \return 1 on success
+ */
int Rast_truncate_fp_map(const char *name, const char *mapset)
{
struct Quant quant;
@@ -39,26 +39,25 @@
Rast_quant_truncate(&quant);
/* quantize the map */
if (Rast_write_quant(name, mapset, &quant) < 0) {
- G_warning(_("Unable to write quant rules for raster map <%s>"),
- name);
+ G_warning(_("Unable to write quant rules for raster map <%s>"), name);
return -1;
}
return 1;
}
/*!
- \brief Writes the quant rules.
-
- Writes the quant rules which indicate that all floating numbers
- should be rounded instead of applying any quant rules from
- floats to integers.
-
- \param name map name
- \param mapset mapset name
+ \brief Writes the quant rules.
- \return -1 on error
- \return 1 on success
-*/
+ Writes the quant rules which indicate that all floating numbers
+ should be rounded instead of applying any quant rules from
+ floats to integers.
+
+ \param name map name
+ \param mapset mapset name
+
+ \return -1 on error
+ \return 1 on success
+ */
int Rast_round_fp_map(const char *name, const char *mapset)
{
struct Quant quant;
@@ -67,8 +66,7 @@
Rast_quant_round(&quant);
/* round the map */
if (Rast_write_quant(name, mapset, &quant) < 0) {
- G_warning(_("Unable to write quant rules for raster map <%s>"),
- name);
+ G_warning(_("Unable to write quant rules for raster map <%s>"), name);
return -1;
}
return 1;
@@ -98,7 +96,7 @@
* \return 1 on success
*/
int Rast_quantize_fp_map(const char *name, const char *mapset,
- CELL min, CELL max)
+ CELL min, CELL max)
{
DCELL d_min, d_max;
struct FPRange fp_range;
@@ -148,7 +146,7 @@
* \return 1 on success
*/
int Rast_quantize_fp_map_range(const char *name, const char *mapset,
- DCELL d_min, DCELL d_max, CELL min, CELL max)
+ DCELL d_min, DCELL d_max, CELL min, CELL max)
{
struct Quant quant;
@@ -156,8 +154,7 @@
Rast_quant_add_rule(&quant, d_min, d_max, min, max);
/* quantize the map */
if (Rast_write_quant(name, mapset, &quant) < 0) {
- G_warning(_("Unable to write quant rules for raster map <%s>"),
- name);
+ G_warning(_("Unable to write quant rules for raster map <%s>"), name);
return -1;
}
return 1;
@@ -182,7 +179,7 @@
* \return 1 on success
*/
int Rast_write_quant(const char *name, const char *mapset,
- const struct Quant *quant)
+ const struct Quant *quant)
{
CELL cell_min, cell_max;
DCELL d_min, d_max;
@@ -197,8 +194,7 @@
/* first actually write the rules */
if (Rast__quant_export(name, mapset, quant) < 0) {
- G_warning (_("Unable to write quant rules for raster map <%s>"),
- name);
+ G_warning(_("Unable to write quant rules for raster map <%s>"), name);
return -1;
}
Modified: grass/trunk/lib/raster/range.c
===================================================================
--- grass/trunk/lib/raster/range.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/range.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -24,12 +24,12 @@
#define DEFAULT_CELL_MAX 255
/*!
- \brief Remove floating-point range
+ \brief Remove floating-point range
- Note: For internal use only.
+ Note: For internal use only.
- \param name map name
-*/
+ \param name map name
+ */
void Rast__remove_fp_range(const char *name)
{
G_remove_misc("cell_misc", "f_range", name);
@@ -69,7 +69,7 @@
* \return -1 on error
*/
int Rast_read_fp_range(const char *name, const char *mapset,
- struct FPRange *drange)
+ struct FPRange *drange)
{
struct Range range;
int fd;
@@ -100,11 +100,11 @@
if (G_find_file2_misc("cell_misc", "f_range", name, mapset)) {
fd = G_open_old_misc("cell_misc", "f_range", name, mapset);
if (fd < 0) {
- G_warning(_("Unable to read fp range file for <%s@%s>"),
- name, mapset);
- return -1;
+ G_warning(_("Unable to read fp range file for <%s@%s>"),
+ name, mapset);
+ return -1;
}
-
+
if (read(fd, xdr_buf, 2 * XDR_DOUBLE_NBYTES) != 2 * XDR_DOUBLE_NBYTES)
return 2;
@@ -113,18 +113,18 @@
/* if the f_range file exists, but empty */
if (!xdr_double(&xdr_str, &dcell1) || !xdr_double(&xdr_str, &dcell2)) {
- if (fd)
- close(fd);
- G_warning(_("Unable to read fp range file for <%s@%s>"),
- name, mapset);
- return -1;
+ if (fd)
+ close(fd);
+ G_warning(_("Unable to read fp range file for <%s@%s>"),
+ name, mapset);
+ return -1;
}
Rast_update_fp_range(dcell1, drange);
Rast_update_fp_range(dcell2, drange);
close(fd);
}
-
+
return 1;
}
@@ -173,7 +173,7 @@
if (Rast_read_quant(name, mapset, &quant) < 0) {
G_warning(_("Unable to read quant rules for raster map <%s@%s>"),
- name, mapset);
+ name, mapset);
return -1;
}
if (Rast_quant_is_truncate(&quant) || Rast_quant_is_round(&quant)) {
@@ -213,7 +213,7 @@
name, mapset);
return -1;
}
-
+
/* if range file exists but empty */
if (!fgets(buf, sizeof buf, fd))
return 2;
@@ -225,12 +225,12 @@
if (count <= 0) {
if (fd)
fclose(fd);
-
+
G_warning(_("Unable to read range file for <%s@%s>"),
name, mapset);
return -1;
}
-
+
for (n = 0; n < count; n++) {
/* if count==4, the range file is old (4.1) and 0's in it
have to be ignored */
@@ -267,16 +267,14 @@
if (Rast_map_type(name, G_mapset()) != CELL_TYPE) {
G_remove_misc("cell_misc", "range", name); /* remove the old file with this name */
- G_warning(_("Unable to write range file for <%s>"),
- name);
+ G_warning(_("Unable to write range file for <%s>"), name);
return -1;
}
fd = G_fopen_new_misc("cell_misc", "range", name);
if (!fd) {
G_remove_misc("cell_misc", "range", name); /* remove the old file with this name */
- G_warning(_("Unable to write range file for <%s>"),
- name);
+ G_warning(_("Unable to write range file for <%s>"), name);
return -1;
}
@@ -314,11 +312,10 @@
fd = G_open_new_misc("cell_misc", "f_range", name);
if (fd < 0) {
G_remove_misc("cell_misc", "f_range", name);
- G_warning(_("Unable to write range file for <%s>"),
- name);
+ G_warning(_("Unable to write range file for <%s>"), name);
return -1;
}
-
+
/* if range hasn't been updated, write empty file meaning Nulls */
if (range->first_time) {
close(fd);
@@ -330,18 +327,16 @@
if (!xdr_double(&xdr_str, (double *)&(range->min))) {
G_remove_misc("cell_misc", "f_range", name);
- G_warning(_("Unable to write range file for <%s>"),
- name);
+ G_warning(_("Unable to write range file for <%s>"), name);
return -1;
}
-
+
if (!xdr_double(&xdr_str, (double *)&(range->max))) {
G_remove_misc("cell_misc", "f_range", name);
- G_warning(_("Unable to write range file for <%s>"),
- name);
+ G_warning(_("Unable to write range file for <%s>"), name);
return -1;
}
-
+
write(fd, xdr_buf, XDR_DOUBLE_NBYTES * 2);
close(fd);
@@ -415,7 +410,7 @@
* \param n number of values
* \param range pointer to Range structure which holds range info
*/
-void Rast_row_update_range(const CELL *cell, int n, struct Range *range)
+void Rast_row_update_range(const CELL * cell, int n, struct Range *range)
{
Rast__row_update_range(cell, n, range, 0);
}
@@ -430,8 +425,8 @@
* \param range pointer to Range structure which holds range info
* \param ignore_zeros ignore zeros
*/
-void Rast__row_update_range(const CELL *cell, int n,
- struct Range *range, int ignore_zeros)
+void Rast__row_update_range(const CELL * cell, int n,
+ struct Range *range, int ignore_zeros)
{
CELL cat;
@@ -465,7 +460,8 @@
* \param data_type raster type (CELL, FCELL, DCELL)
*/
void Rast_row_update_fp_range(const void *rast, int n,
- struct FPRange *range, RASTER_MAP_TYPE data_type)
+ struct FPRange *range,
+ RASTER_MAP_TYPE data_type)
{
DCELL val = 0L;
@@ -583,7 +579,7 @@
* \param[out] max maximum value
*/
void Rast_get_fp_range_min_max(const struct FPRange *range,
- DCELL *min, DCELL *max)
+ DCELL * min, DCELL * max)
{
if (range->first_time) {
Rast_set_d_null_value(min, 1);
Modified: grass/trunk/lib/raster/raster.c
===================================================================
--- grass/trunk/lib/raster/raster.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/raster.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -72,7 +72,8 @@
* \param n ?
* \param data_type raster type (CELL, FCELL, DCELL)
*/
-void Rast_raster_cpy(void *v1, const void *v2, int n, RASTER_MAP_TYPE data_type)
+void Rast_raster_cpy(void *v1, const void *v2, int n,
+ RASTER_MAP_TYPE data_type)
{
G_copy(v1, v2, n * Rast_cell_size(data_type));
}
@@ -206,9 +207,9 @@
case CELL_TYPE:
return *((const CELL *)rast);
case FCELL_TYPE:
- return (CELL) *((const FCELL *)rast);
+ return (CELL) * ((const FCELL *)rast);
case DCELL_TYPE:
- return (CELL) *((const DCELL *)rast);
+ return (CELL) * ((const DCELL *)rast);
}
return 0;
Modified: grass/trunk/lib/raster/raster_metadata.c
===================================================================
--- grass/trunk/lib/raster/raster_metadata.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/raster_metadata.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -1,16 +1,16 @@
/*!
- \file raster/raster_metadata.c
+ \file raster/raster_metadata.c
- \brief Raster library - Functions to read and write raster "units"
- and "vertical datum" meta-data info
+ \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
+ (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.
+ 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
-*/
+ \author Hamish Bowman
+ */
#include <stdio.h>
#include <string.h>
@@ -19,10 +19,8 @@
#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 *);
+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
@@ -144,8 +142,7 @@
* \return 0 on success
* \return -1, EOF (fclose() result) on error
*/
-int 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;
Modified: grass/trunk/lib/raster/reclass.c
===================================================================
--- grass/trunk/lib/raster/reclass.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/reclass.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -41,7 +41,7 @@
* \return -1 if there was a problem reading the raster header
*/
int Rast_is_reclass(const char *name, const char *mapset, char *rname,
- char *rmapset)
+ char *rmapset)
{
FILE *fd;
int type;
@@ -77,7 +77,7 @@
* \return -1 on error
*/
int Rast_is_reclassed_to(const char *name, const char *mapset, int *nrmaps,
- char ***rmaps)
+ char ***rmaps)
{
FILE *fd;
int i, j, k, l;
@@ -126,17 +126,17 @@
}
/*!
- \brief Get reclass
+ \brief Get reclass
- \param name map name
- \param mapset mapset name
- \param[out] reclass pointer to Reclass structure
+ \param name map name
+ \param mapset mapset name
+ \param[out] reclass pointer to Reclass structure
- \return -1 on error
- \return type code
-*/
+ \return -1 on error
+ \return type code
+ */
int Rast_get_reclass(const char *name, const char *mapset,
- struct Reclass *reclass)
+ struct Reclass *reclass)
{
FILE *fd;
int stat;
@@ -174,10 +174,10 @@
}
/*!
- \brief Free Reclass structure
+ \brief Free Reclass structure
- \param reclass pointer to Reclass structure
-*/
+ \param reclass pointer to Reclass structure
+ */
void Rast_free_reclass(struct Reclass *reclass)
{
switch (reclass->type) {
@@ -249,14 +249,14 @@
}
/*!
- \brief Put reclass
+ \brief Put reclass
- \param name map name
- \param reclass pointer to Reclass structure
-
- \return -1 on error
- \return 1 on success
-*/
+ \param name map name
+ \param reclass pointer to Reclass structure
+
+ \return -1 on error
+ \return 1 on success
+ */
int Rast_put_reclass(const char *name, const struct Reclass *reclass)
{
FILE *fd;
Modified: grass/trunk/lib/raster/sample.c
===================================================================
--- grass/trunk/lib/raster/sample.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/sample.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -12,7 +12,7 @@
(>=v2). Read the file COPYING that comes with GRASS for details.
\author James Darrell McCauley <darrell mccauley-usa.com>, http://mccauley-usa.com/
-*/
+ */
#include <string.h>
#include <unistd.h>
@@ -48,26 +48,28 @@
* \return cell value at given position
*/
DCELL Rast_get_sample(int fd,
- const struct Cell_head *window,
- struct Categories *cats,
- double north, double east,
- int usedesc, INTERP_TYPE itype)
+ const struct Cell_head *window,
+ struct Categories *cats,
+ double north, double east,
+ int usedesc, INTERP_TYPE itype)
{
double retval;
switch (itype) {
case NEAREST:
- retval = Rast_get_sample_nearest(fd, window, cats, north, east, usedesc);
+ retval =
+ Rast_get_sample_nearest(fd, window, cats, north, east, usedesc);
break;
case BILINEAR:
- retval = Rast_get_sample_bilinear(fd, window, cats, north, east, usedesc);
+ retval =
+ Rast_get_sample_bilinear(fd, window, cats, north, east, usedesc);
break;
case CUBIC:
- retval = Rast_get_sample_cubic(fd, window, cats, north, east, usedesc);
+ retval =
+ Rast_get_sample_cubic(fd, window, cats, north, east, usedesc);
break;
default:
- G_fatal_error("Rast_get_sample: %s",
- _("Unknown interpolation type"));
+ G_fatal_error("Rast_get_sample: %s", _("Unknown interpolation type"));
}
return retval;
@@ -89,9 +91,9 @@
* \return cell value at given position
*/
DCELL Rast_get_sample_nearest(int fd,
- const struct Cell_head *window,
- struct Categories *cats,
- double north, double east, int usedesc)
+ const struct Cell_head * window,
+ struct Categories * cats,
+ double north, double east, int usedesc)
{
int row, col;
DCELL result;
@@ -116,7 +118,7 @@
}
if (usedesc) {
- char *buf = Rast_get_c_cat((CELL *) &(maprow[col]), cats);
+ char *buf = Rast_get_c_cat((CELL *) & (maprow[col]), cats);
G_squeeze(buf);
result = scancatlabel(buf);
@@ -124,7 +126,7 @@
else
result = maprow[col];
-done:
+ done:
G_free(maprow);
return result;
@@ -147,9 +149,9 @@
* \return cell value at given position
*/
DCELL Rast_get_sample_bilinear(int fd,
- const struct Cell_head *window,
- struct Categories *cats,
- double north, double east, int usedesc)
+ const struct Cell_head * window,
+ struct Categories * cats,
+ double north, double east, int usedesc)
{
int row, col;
double grid[2][2];
@@ -179,8 +181,10 @@
if (Rast_get_d_row(fd, brow, row + 1) < 0)
raster_row_error(window, north, east);
- if (Rast_is_d_null_value(&arow[col]) || Rast_is_d_null_value(&arow[col + 1]) ||
- Rast_is_d_null_value(&brow[col]) || Rast_is_d_null_value(&brow[col + 1])) {
+ if (Rast_is_d_null_value(&arow[col]) ||
+ Rast_is_d_null_value(&arow[col + 1]) ||
+ Rast_is_d_null_value(&brow[col]) ||
+ Rast_is_d_null_value(&brow[col + 1])) {
Rast_set_d_null_value(&result, 1);
goto done;
}
@@ -194,13 +198,13 @@
if (usedesc) {
char *buf;
- G_squeeze(buf = Rast_get_c_cat((int*) &(arow[col]), cats));
+ G_squeeze(buf = Rast_get_c_cat((int *)&(arow[col]), cats));
grid[0][0] = scancatlabel(buf);
- G_squeeze(buf = Rast_get_c_cat((CELL *) &(arow[col + 1]), cats));
+ G_squeeze(buf = Rast_get_c_cat((CELL *) & (arow[col + 1]), cats));
grid[0][1] = scancatlabel(buf);
- G_squeeze(buf = Rast_get_c_cat((CELL *) &(brow[col]), cats));
+ G_squeeze(buf = Rast_get_c_cat((CELL *) & (brow[col]), cats));
grid[1][0] = scancatlabel(buf);
- G_squeeze(buf = Rast_get_c_cat((CELL *) &(brow[col + 1]), cats));
+ G_squeeze(buf = Rast_get_c_cat((CELL *) & (brow[col + 1]), cats));
grid[1][1] = scancatlabel(buf);
}
else {
@@ -211,9 +215,10 @@
}
result = Rast_interp_bilinear(tcol, trow,
- grid[0][0], grid[0][1], grid[1][0], grid[1][1]);
+ grid[0][0], grid[0][1], grid[1][0],
+ grid[1][1]);
-done:
+ done:
G_free(arow);
G_free(brow);
@@ -236,9 +241,9 @@
* \return cell value at given position
*/
DCELL Rast_get_sample_cubic(int fd,
- const struct Cell_head *window,
- struct Categories *cats,
- double north, double east, int usedesc)
+ const struct Cell_head * window,
+ struct Categories * cats,
+ double north, double east, int usedesc)
{
int i, j, row, col;
double grid[4][4];
@@ -289,7 +294,9 @@
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
- G_squeeze(buf = Rast_get_c_cat((CELL *) &(rows[i][col + j]), cats));
+ G_squeeze(buf =
+ Rast_get_c_cat((CELL *) & (rows[i][col + j]),
+ cats));
grid[i][j] = scancatlabel(buf);
}
}
@@ -301,12 +308,14 @@
}
result = Rast_interp_bicubic(tcol, trow,
- grid[0][0], grid[0][1], grid[0][2], grid[0][3],
- grid[1][0], grid[1][1], grid[1][2], grid[1][3],
- grid[2][0], grid[2][1], grid[2][2], grid[2][3],
- grid[3][0], grid[3][1], grid[3][2], grid[3][3]);
+ grid[0][0], grid[0][1], grid[0][2],
+ grid[0][3], grid[1][0], grid[1][1],
+ grid[1][2], grid[1][3], grid[2][0],
+ grid[2][1], grid[2][2], grid[2][3],
+ grid[3][0], grid[3][1], grid[3][2],
+ grid[3][3]);
-done:
+ done:
for (i = 0; i < 4; i++)
G_free(rows[i]);
Modified: grass/trunk/lib/raster/set_window.c
===================================================================
--- grass/trunk/lib/raster/set_window.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/set_window.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -50,13 +50,14 @@
maskfd = R__.auto_mask > 0 ? R__.mask_fd : -1;
for (i = 0; i < R__.fileinfo_count; i++) {
struct fileinfo *fcb = &R__.fileinfo[i];
+
if (fcb->open_mode == OPEN_OLD) {
if (fcb->cellhd.zone == window->zone &&
fcb->cellhd.proj == window->proj)
continue;
if (i != maskfd) {
G_warning(_("Rast_set_window(): projection/zone differs from that of "
- "currently open raster maps"));
+ "currently open raster maps"));
return -1;
}
}
@@ -92,28 +93,26 @@
Rast__create_window_mapping(i);
/* code commented 10/1999 due to problems */
#if 0
- else
- {
+ else {
/* opened for writing */
- G_free (fcb->data);
- fcb->data = (unsigned char *) G_calloc (R__.window.cols,
- Rast_cell_size(fcb->map_type));
+ G_free(fcb->data);
+ fcb->data = (unsigned char *)G_calloc(R__.window.cols,
+ Rast_cell_size(fcb->
+ map_type));
}
/* allocate null bitstream buffers for reading/writing null rows */
- for (j=0;j< NULL_ROWS_INMEM; j++)
- {
- G_free (fcb->NULL_ROWS[j]);
+ for (j = 0; j < NULL_ROWS_INMEM; j++) {
+ G_free(fcb->NULL_ROWS[j]);
fcb->NULL_ROWS[j] = (R__.window.cols);
}
/* initialize : no NULL rows in memory */
fcb->min_null_row = (-1) * NULL_ROWS_INMEM;
- if(fcb->null_cur_row > 0)
- {
- G_warning(_("Calling Rast_set_window() in the middle of writing map %s"),
- fcb->name);
+ if (fcb->null_cur_row > 0) {
+ G_warning(_("Calling Rast_set_window() in the middle of writing map %s"),
+ fcb->name);
fcb->null_cur_row = 0;
}
#endif
Modified: grass/trunk/lib/raster/window_map.c
===================================================================
--- grass/trunk/lib/raster/window_map.c 2009-07-15 12:29:37 UTC (rev 38423)
+++ grass/trunk/lib/raster/window_map.c 2009-07-15 12:59:37 UTC (rev 38424)
@@ -96,10 +96,10 @@
}
G_debug(3, "create window mapping (%d columns)", R__.window.cols);
-/* for (i = 0; i < R__.window.cols; i++)
- fprintf(stderr, "%s%ld", i % 15 ? " " : "\n", (long)fcb->col_map[i]);
- fprintf(stderr, "\n");
-*/
+ /* for (i = 0; i < R__.window.cols; i++)
+ fprintf(stderr, "%s%ld", i % 15 ? " " : "\n", (long)fcb->col_map[i]);
+ fprintf(stderr, "\n");
+ */
/* compute C1,C2 for row window mapping */
fcb->C1 = R__.window.ns_res / fcb->cellhd.ns_res;
More information about the grass-commit
mailing list