[GRASS-SVN] r62337 - in grass-addons/grass7: imagery/i.segment.gsoc raster/r.hydrodem raster/r.los raster/r.stream.basins vector/v.surf.mass
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 22 00:48:50 PDT 2014
Author: neteler
Date: 2014-10-22 00:48:50 -0700 (Wed, 22 Oct 2014)
New Revision: 62337
Modified:
grass-addons/grass7/imagery/i.segment.gsoc/create_isegs.c
grass-addons/grass7/imagery/i.segment.gsoc/open_files.c
grass-addons/grass7/imagery/i.segment.gsoc/write_output.c
grass-addons/grass7/raster/r.hydrodem/bseg.c
grass-addons/grass7/raster/r.hydrodem/cseg.c
grass-addons/grass7/raster/r.hydrodem/dseg.c
grass-addons/grass7/raster/r.hydrodem/seg.c
grass-addons/grass7/raster/r.los/delete.c
grass-addons/grass7/raster/r.los/main.c
grass-addons/grass7/raster/r.los/mark_pts.c
grass-addons/grass7/raster/r.los/pts_elim.c
grass-addons/grass7/raster/r.stream.basins/basins_fill.c
grass-addons/grass7/raster/r.stream.basins/basins_inputs.c
grass-addons/grass7/raster/r.stream.basins/io.c
grass-addons/grass7/vector/v.surf.mass/main.c
Log:
libsegment: function prefixes change from segment_ to Segment_ (trac #2422)
Modified: grass-addons/grass7/imagery/i.segment.gsoc/create_isegs.c
===================================================================
--- grass-addons/grass7/imagery/i.segment.gsoc/create_isegs.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/imagery/i.segment.gsoc/create_isegs.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -109,7 +109,7 @@
for (row = 0; row < files->nrows; row++) {
for (col = 0; col < files->ncols; col++) {
- segment_get(&files->bounds_seg, &files->bounds_val, row,
+ Segment_get(&files->bounds_seg, &files->bounds_val, row,
col);
if (files->bounds_val == files->current_bound &&
!(FLAG_GET(files->orig_null_flag, row, col))) {
@@ -303,7 +303,7 @@
/* ******** find Ri's most similar neighbor ******** */
Ri_bestn = NULL;
Ri_similarity = threshold + 1; /* set current similarity to max value */
- segment_get(&files->bands_seg, (void *)files->bands_val, Ri_head->row, Ri_head->col); /* current segment values */
+ Segment_get(&files->bands_seg, (void *)files->bands_val, Ri_head->row, Ri_head->col); /* current segment values */
/* for each of Ri's neighbors */
for (current = Rin_head; current != NULL;
@@ -409,7 +409,7 @@
/* ******** find Rk's most similar neighbor ******** */
Rk_similarity = Ri_similarity; /*Ri gets first priority - ties won't change anything, so we'll accept Ri and Rk as mutually best neighbors */
- segment_get(&files->bands_seg, (void *)files->bands_val, Rk_head->row, Rk_head->col); /* current segment values */
+ Segment_get(&files->bands_seg, (void *)files->bands_val, Rk_head->row, Rk_head->col); /* current segment values */
/* check similarity for each of Rk's neighbors */
for (current = Rkn_head; current != NULL;
@@ -587,7 +587,7 @@
/* find Ri's most similar neighbor */
Ri_bestn = NULL;
Ri_similarity = DBL_MAX; /* set current similarity to max value */
- segment_get(&files->bands_seg, (void *)files->bands_val, Ri_head->row, Ri_head->col); /* current segment values */
+ Segment_get(&files->bands_seg, (void *)files->bands_val, Ri_head->row, Ri_head->col); /* current segment values */
/* for each of Ri's neighbors */
for (current = Rin_head; current != NULL;
@@ -689,7 +689,7 @@
/* *** initialize data *** */
borderPixels = 0;
- segment_get(&files->iseg_seg, &R_iseg, (*R_head)->row, (*R_head)->col);
+ Segment_get(&files->iseg_seg, &R_iseg, (*R_head)->row, (*R_head)->col);
if (R_iseg == 0) { /* if seeds were provided, this is just a single non-seed pixel, only return neighbors that are segments or seeds */
@@ -707,7 +707,7 @@
)
continue;
- segment_get(&files->iseg_seg, ¤t_seg_ID,
+ Segment_get(&files->iseg_seg, ¤t_seg_ID,
pixel_neighbors[n][0], pixel_neighbors[n][1]);
if (current_seg_ID > 0) {
@@ -771,7 +771,7 @@
tree_pix.col = pixel_neighbors[n][1];
if (rbtree_find(no_check_tree, &tree_pix) == FALSE) { /* want to check this neighbor */
- segment_get(&files->iseg_seg, ¤t_seg_ID,
+ Segment_get(&files->iseg_seg, ¤t_seg_ID,
pixel_neighbors[n][0], pixel_neighbors[n][1]);
rbtree_insert(no_check_tree, &tree_pix); /* don't check it again */
@@ -827,7 +827,7 @@
pixel_iter != NULL;
pixel_iter = pixel_iter->next) {
- segment_get(&files->iseg_seg,
+ Segment_get(&files->iseg_seg,
&temp_ID, pixel_iter->row,
pixel_iter->col);
@@ -845,14 +845,14 @@
} /*end if for pixel_neighbor was in "don't check" list */
/* even if no_check tree, if we are using shape measurements we need to count if there is a shared border. */
else if (functions->radio_weight < 1) {
- segment_get(&files->iseg_seg, ¤t_seg_ID,
+ Segment_get(&files->iseg_seg, ¤t_seg_ID,
pixel_neighbors[n][0], pixel_neighbors[n][1]);
if (current_seg_ID != R_iseg) {
for (pixel_iter = *neighbors_head;
pixel_iter != NULL;
pixel_iter = pixel_iter->next) {
- segment_get(&files->iseg_seg,
+ Segment_get(&files->iseg_seg,
&temp_ID, pixel_iter->row,
pixel_iter->col);
@@ -930,7 +930,7 @@
/* similarity / distance functions between two points based on their input raster values */
/* assumes first point values already saved in files->bands_seg */
- /* speed enhancement: segment_get was already done for a[] values in the main function.
+ /* speed enhancement: Segment_get was already done for a[] values in the main function.
* Could remove a[] from these parameters, reducing number of parameters in
* function call could provide a speed improvement. */
@@ -943,7 +943,7 @@
int n;
/* get values for pixel b */
- segment_get(&files->bands_seg, (void *)files->second_val, b->row, b->col);
+ Segment_get(&files->bands_seg, (void *)files->second_val, b->row, b->col);
/* euclidean distance, sum the square differences for each dimension */
for (n = 0; n < files->nbands; n++) {
@@ -1011,7 +1011,7 @@
int n;
/* get values for pixel b */
- segment_get(&files->bands_seg, (void *)files->second_val, b->row, b->col);
+ Segment_get(&files->bands_seg, (void *)files->second_val, b->row, b->col);
/* Manhattan distance, sum the absolute difference between values for each dimension */
for (n = 0; n < files->nbands; n++) {
@@ -1050,16 +1050,16 @@
/*get input values */
/*speed enhancement: Confirm if we can assume we already have
- * bands_val for Ri, so don't need to segment_get() again?
+ * bands_val for Ri, so don't need to Segment_get() again?
* note...current very_close implementation requires
* getting this value again... */
- segment_get(&files->bands_seg, (void *)files->bands_val, Ri_head->row,
+ Segment_get(&files->bands_seg, (void *)files->bands_val, Ri_head->row,
Ri_head->col);
- segment_get(&files->bands_seg, (void *)files->second_val,
+ Segment_get(&files->bands_seg, (void *)files->second_val,
Rk_head->row, Rk_head->col);
- segment_get(&files->iseg_seg, &Rk_iseg, Rk_head->row, Rk_head->col);
- segment_get(&files->iseg_seg, &Ri_iseg, Ri_head->row, Ri_head->col);
+ Segment_get(&files->iseg_seg, &Rk_iseg, Rk_head->row, Rk_head->col);
+ Segment_get(&files->iseg_seg, &Ri_iseg, Ri_head->row, Ri_head->col);
for (n = 0; n < files->nbands; n++) {
files->bands_val[n] =
@@ -1085,14 +1085,14 @@
/* for each member of Ri and Rk, write new average bands values and segment values */
for (current = Ri_head; current != NULL; current = current->next) {
- segment_put(&files->bands_seg, (void *)files->bands_val,
+ Segment_put(&files->bands_seg, (void *)files->bands_val,
current->row, current->col);
FLAG_UNSET(files->candidate_flag, current->row, current->col); /*candidate pixel flag, only one merge allowed per t iteration */
}
for (current = Rk_head; current != NULL; current = current->next) {
- segment_put(&files->bands_seg, (void *)files->bands_val,
+ Segment_put(&files->bands_seg, (void *)files->bands_val,
current->row, current->col);
- segment_put(&files->iseg_seg, &Ri_iseg, current->row, current->col);
+ Segment_put(&files->iseg_seg, &Ri_iseg, current->row, current->col);
FLAG_UNSET(files->candidate_flag, current->row, current->col);
}
@@ -1119,7 +1119,7 @@
if (R_head->next != NULL) {
/* total up bands values for all pixels */
for (current = R_head; current != NULL; current = current->next) {
- segment_get(&files->bands_seg, (void *)files->bands_val,
+ Segment_get(&files->bands_seg, (void *)files->bands_val,
current->row, current->col);
for (n = 0; n < files->nbands; n++) {
files->second_val[n] += files->bands_val[n];
@@ -1139,7 +1139,7 @@
/* save the results */
for (current = R_head; current != NULL; current = current->next) {
- segment_put(&files->bands_seg, (void *)files->second_val,
+ Segment_put(&files->bands_seg, (void *)files->second_val,
current->row, current->col);
}
Modified: grass-addons/grass7/imagery/i.segment.gsoc/open_files.c
===================================================================
--- grass-addons/grass7/imagery/i.segment.gsoc/open_files.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/imagery/i.segment.gsoc/open_files.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -144,7 +144,7 @@
G_debug(1, "Data element size, in: %d", inlen);
G_debug(1, "number of segments to have in memory: %d", nseg);
- if (segment_open
+ if (Segment_open
(&files->bands_seg, G_tempfile(), files->nrows, files->ncols, srows,
scols, inlen, nseg) != TRUE)
G_fatal_error("Unable to create input temporary files");
@@ -162,14 +162,14 @@
files->bands_val = (double *)G_malloc(inlen);
files->second_val = (double *)G_malloc(inlen);
- if (segment_open
+ if (Segment_open
(&files->iseg_seg, G_tempfile(), files->nrows, files->ncols, srows,
scols, sizeof(int), nseg) != TRUE)
G_fatal_error(_("Unable to allocate memory for initial segment ID's"));
/* bounds/constraints (start with processing constraints to get any possible NULL values) */
if (files->bounds_map != NULL) {
- if (segment_open
+ if (Segment_open
(&files->bounds_seg, G_tempfile(), files->nrows, files->ncols,
srows, scols, sizeof(int), nseg) != TRUE)
G_fatal_error(_("Unable to create bounds temporary files"));
@@ -181,7 +181,7 @@
Rast_get_c_row(bounds_fd, boundsbuf, row);
for (col = 0; col < files->ncols; col++) {
files->bounds_val = boundsbuf[col];
- segment_put(&files->bounds_seg, &files->bounds_val, row, col);
+ Segment_put(&files->bounds_seg, &files->bounds_val, row, col);
if (Rast_is_c_null_value(&boundsbuf[col]) == TRUE) {
FLAG_SET(files->null_flag, row, col);
}
@@ -228,7 +228,7 @@
files->bands_val[Ref.nfiles + 4] = row; /*max row */
files->bands_val[Ref.nfiles + 5] = row; /*min row */
- segment_put(&files->bands_seg, (void *)files->bands_val, row, col); /* store input bands */
+ Segment_put(&files->bands_seg, (void *)files->bands_val, row, col); /* store input bands */
if (null_check != -1) { /*good pixel */
FLAG_UNSET(files->null_flag, row, col); /*flag */
if (files->seeds_map != NULL) {
@@ -239,14 +239,14 @@
else {
FLAG_SET(files->seeds_flag, row, col); /* RAM enhancement, but it might cost speed. Could look for seg ID > 0 instead of using seed_flag. */
/* seed value is starting segment ID. */
- segment_put(&files->iseg_seg, ptr, row, col);
+ Segment_put(&files->iseg_seg, ptr, row, col);
}
ptr = G_incr_void_ptr(ptr, ptrsize);
}
else { /* no seeds provided */
s++; /* sequentially number all pixels with their own segment ID */
if (s < INT_MAX) { /* Check that the starting seeds aren't too large. */
- segment_put(&files->iseg_seg, &s, row, col); /*starting segment number */
+ Segment_put(&files->iseg_seg, &s, row, col); /*starting segment number */
FLAG_SET(files->seeds_flag, row, col); /*all pixels are seeds */
}
else
@@ -325,7 +325,7 @@
for (current = R_head; current != NULL;
current = current->next) {
- segment_put(&files->iseg_seg, &s, current->row,
+ Segment_put(&files->iseg_seg, &s, current->row,
current->col);
FLAG_UNSET(files->candidate_flag, current->row,
current->col);
Modified: grass-addons/grass7/imagery/i.segment.gsoc/write_output.c
===================================================================
--- grass-addons/grass7/imagery/i.segment.gsoc/write_output.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/imagery/i.segment.gsoc/write_output.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -20,8 +20,8 @@
meanbuf = Rast_allocate_d_buf();
/* force all data to disk */
- segment_flush(&files->bands_seg);
- segment_flush(&files->iseg_seg);
+ Segment_flush(&files->bands_seg);
+ Segment_flush(&files->iseg_seg);
/* open output raster map */
out_fd = Rast_open_new(files->out_name, CELL_TYPE);
@@ -33,10 +33,10 @@
Rast_set_c_null_value(outbuf, files->ncols); /*set buffer to NULLs, only write those that weren't originally masked */
Rast_set_d_null_value(meanbuf, files->ncols);
for (col = 0; col < files->ncols; col++) {
- segment_get(&files->bands_seg, (void *)files->bands_val, row,
+ Segment_get(&files->bands_seg, (void *)files->bands_val, row,
col);
if (!(FLAG_GET(files->null_flag, row, col))) {
- segment_get(&files->iseg_seg, &(outbuf[col]), row, col);
+ Segment_get(&files->iseg_seg, &(outbuf[col]), row, col);
meanbuf[col] = files->bands_val[0];
}
}
@@ -75,14 +75,14 @@
{
/* close segmentation files and output raster */
- segment_close(&files->bands_seg);
+ Segment_close(&files->bands_seg);
if (files->bounds_map != NULL)
- segment_close(&files->bounds_seg);
+ Segment_close(&files->bounds_seg);
G_free(files->bands_val);
G_free(files->second_val);
- segment_close(&files->iseg_seg);
+ Segment_close(&files->iseg_seg);
flag_destroy(files->null_flag);
flag_destroy(files->candidate_flag);
Modified: grass-addons/grass7/raster/r.hydrodem/bseg.c
===================================================================
--- grass-addons/grass7/raster/r.hydrodem/bseg.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.hydrodem/bseg.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -19,7 +19,7 @@
G_warning(_("bseg_open(): unable to create segment file"));
return -2;
}
- if (0 > (errflag = segment_format(fd, Rast_window_rows(),
+ if (0 > (errflag = Segment_format(fd, Rast_window_rows(),
Rast_window_cols(), srows, scols,
sizeof(char)))) {
close(fd);
@@ -39,7 +39,7 @@
G_warning(_("bseg_open(): unable to re-open segment file"));
return -4;
}
- if (0 > (errflag = segment_init(&(bseg->seg), fd, nsegs_in_memory))) {
+ if (0 > (errflag = Segment_init(&(bseg->seg), fd, nsegs_in_memory))) {
close(fd);
unlink(filename);
if (errflag == -1) {
@@ -58,7 +58,7 @@
int bseg_close(BSEG *bseg)
{
- segment_release(&(bseg->seg));
+ Segment_release(&(bseg->seg));
close(bseg->fd);
unlink(bseg->filename);
if (bseg->name) {
@@ -74,7 +74,7 @@
int bseg_put(BSEG *bseg, char *value, int row, int col)
{
- if (segment_put(&(bseg->seg), value, row, col) < 0) {
+ if (Segment_put(&(bseg->seg), value, row, col) < 0) {
G_warning(_("bseg_put(): could not write segment file"));
return -1;
}
@@ -83,7 +83,7 @@
int bseg_put_row(BSEG *bseg, char *value, int row)
{
- if (segment_put_row(&(bseg->seg), value, row) < 0) {
+ if (Segment_put_row(&(bseg->seg), value, row) < 0) {
G_warning(_("bseg_put_row(): could not write segment file"));
return -1;
}
@@ -92,7 +92,7 @@
int bseg_get(BSEG *bseg, char *value, int row, int col)
{
- if (segment_get(&(bseg->seg), value, row, col) < 0) {
+ if (Segment_get(&(bseg->seg), value, row, col) < 0) {
G_warning(_("bseg_get(): could not read segment file"));
return -1;
}
Modified: grass-addons/grass7/raster/r.hydrodem/cseg.c
===================================================================
--- grass-addons/grass7/raster/r.hydrodem/cseg.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.hydrodem/cseg.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -21,7 +21,7 @@
}
if (0 >
(errflag =
- segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
+ Segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
sizeof(CELL)))) {
close(fd);
unlink(filename);
@@ -40,7 +40,7 @@
G_warning(_("cseg_open(): unable to re-open segment file"));
return -4;
}
- if (0 > (errflag = segment_init(&(cseg->seg), fd, nsegs_in_memory))) {
+ if (0 > (errflag = Segment_init(&(cseg->seg), fd, nsegs_in_memory))) {
close(fd);
unlink(filename);
if (errflag == -1) {
@@ -59,7 +59,7 @@
int cseg_close(CSEG *cseg)
{
- segment_release(&(cseg->seg));
+ Segment_release(&(cseg->seg));
close(cseg->fd);
unlink(cseg->filename);
if (cseg->name) {
@@ -75,7 +75,7 @@
int cseg_put(CSEG *cseg, CELL *value, int row, int col)
{
- if (segment_put(&(cseg->seg), value, row, col) < 0) {
+ if (Segment_put(&(cseg->seg), value, row, col) < 0) {
G_warning(_("cseg_put(): could not write segment file"));
return -1;
}
@@ -84,7 +84,7 @@
int cseg_put_row(CSEG *cseg, CELL *value, int row)
{
- if (segment_put_row(&(cseg->seg), value, row) < 0) {
+ if (Segment_put_row(&(cseg->seg), value, row) < 0) {
G_warning(_("cseg_put_row(): could not write segment file"));
return -1;
}
@@ -93,7 +93,7 @@
int cseg_get(CSEG *cseg, CELL *value, int row, int col)
{
- if (segment_get(&(cseg->seg), value, row, col) < 0) {
+ if (Segment_get(&(cseg->seg), value, row, col) < 0) {
G_warning(_("cseg_get(): could not read segment file"));
return -1;
}
@@ -114,7 +114,7 @@
buffer = Rast_allocate_c_buf();
for (row = 0; row < nrows; row++) {
Rast_get_c_row(map_fd, buffer, row);
- if (segment_put_row(&(cseg->seg), buffer, row) < 0) {
+ if (Segment_put_row(&(cseg->seg), buffer, row) < 0) {
G_free(buffer);
Rast_close(map_fd);
G_warning(_("cseg_read_cell(): unable to segment put row for <%s> in <%s>"),
@@ -141,10 +141,10 @@
map_fd = Rast_open_c_new(map_name);
nrows = Rast_window_rows();
buffer = Rast_allocate_c_buf();
- segment_flush(&(cseg->seg));
+ Segment_flush(&(cseg->seg));
for (row = 0; row < nrows; row++) {
G_percent(row, nrows, 1);
- segment_get_row(&(cseg->seg), buffer, row);
+ Segment_get_row(&(cseg->seg), buffer, row);
Rast_put_row(map_fd, buffer, CELL_TYPE);
}
G_percent(row, nrows, 1); /* finish it */
Modified: grass-addons/grass7/raster/r.hydrodem/dseg.c
===================================================================
--- grass-addons/grass7/raster/r.hydrodem/dseg.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.hydrodem/dseg.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -21,7 +21,7 @@
}
if (0 >
(errflag =
- segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
+ Segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
sizeof(DCELL)))) {
close(fd);
unlink(filename);
@@ -40,7 +40,7 @@
G_warning(_("dseg_open(): unable to re-open segment file"));
return -4;
}
- if (0 > (errflag = segment_init(&(dseg->seg), fd, nsegs_in_memory))) {
+ if (0 > (errflag = Segment_init(&(dseg->seg), fd, nsegs_in_memory))) {
close(fd);
unlink(filename);
if (errflag == -1) {
@@ -59,7 +59,7 @@
int dseg_close(DSEG *dseg)
{
- segment_release(&(dseg->seg));
+ Segment_release(&(dseg->seg));
close(dseg->fd);
unlink(dseg->filename);
if (dseg->name) {
@@ -75,7 +75,7 @@
int dseg_put(DSEG *dseg, DCELL *value, int row, int col)
{
- if (segment_put(&(dseg->seg), (DCELL *) value, row, col) < 0) {
+ if (Segment_put(&(dseg->seg), (DCELL *) value, row, col) < 0) {
G_warning(_("dseg_put(): could not write segment file"));
return -1;
}
@@ -84,7 +84,7 @@
int dseg_put_row(DSEG *dseg, DCELL *value, int row)
{
- if (segment_put_row(&(dseg->seg), (DCELL *) value, row) < 0) {
+ if (Segment_put_row(&(dseg->seg), (DCELL *) value, row) < 0) {
G_warning(_("dseg_put(): could not write segment file"));
return -1;
}
@@ -93,7 +93,7 @@
int dseg_get(DSEG *dseg, DCELL *value, int row, int col)
{
- if (segment_get(&(dseg->seg), (DCELL *) value, row, col) < 0) {
+ if (Segment_get(&(dseg->seg), (DCELL *) value, row, col) < 0) {
G_warning(_("dseg_get(): could not read segment file"));
return -1;
}
@@ -115,7 +115,7 @@
dbuffer = Rast_allocate_d_buf();
for (row = 0; row < nrows; row++) {
Rast_get_d_row(map_fd, dbuffer, row);
- if (segment_put_row(&(dseg->seg), (DCELL *) dbuffer, row) < 0) {
+ if (Segment_put_row(&(dseg->seg), (DCELL *) dbuffer, row) < 0) {
G_free(dbuffer);
Rast_close(map_fd);
G_warning(_("dseg_read_raster(): unable to segment put row for <%s> in <%s>"),
@@ -143,10 +143,10 @@
nrows = Rast_window_rows();
ncols = Rast_window_cols();
dbuffer = Rast_allocate_d_buf();
- segment_flush(&(dseg->seg));
+ Segment_flush(&(dseg->seg));
for (row = 0; row < nrows; row++) {
G_percent(row, nrows, 1);
- segment_get_row(&(dseg->seg), (DCELL *) dbuffer, row);
+ Segment_get_row(&(dseg->seg), (DCELL *) dbuffer, row);
Rast_put_row(map_fd, dbuffer, DCELL_TYPE);
}
G_percent(row, nrows, 1); /* finish it */
Modified: grass-addons/grass7/raster/r.hydrodem/seg.c
===================================================================
--- grass-addons/grass7/raster/r.hydrodem/seg.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.hydrodem/seg.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -20,10 +20,10 @@
return -2;
}
if (fill)
- errflag = segment_format(fd, nrows, ncols, row_in_seg,
+ errflag = Segment_format(fd, nrows, ncols, row_in_seg,
col_in_seg, size_struct);
else
- errflag = segment_format_nofill(fd, nrows, ncols, row_in_seg,
+ errflag = Segment_format_nofill(fd, nrows, ncols, row_in_seg,
col_in_seg, size_struct);
if (0 > errflag) {
@@ -44,7 +44,7 @@
G_warning(_("seg_open(): unable to re-open segment file"));
return -4;
}
- if (0 > (errflag = segment_init(&(sseg->seg), fd, nsegs_in_memory))) {
+ if (0 > (errflag = Segment_init(&(sseg->seg), fd, nsegs_in_memory))) {
close(fd);
unlink(filename);
if (errflag == -1) {
@@ -63,7 +63,7 @@
int seg_close(SSEG *sseg)
{
- segment_release(&(sseg->seg));
+ Segment_release(&(sseg->seg));
close(sseg->fd);
unlink(sseg->filename);
return 0;
@@ -71,7 +71,7 @@
int seg_put(SSEG *sseg, char *value, int row, int col)
{
- if (segment_put(&(sseg->seg), value, row, col) < 0) {
+ if (Segment_put(&(sseg->seg), value, row, col) < 0) {
G_warning(_("seg_put(): could not write segment file"));
return -1;
}
@@ -80,7 +80,7 @@
int seg_put_row(SSEG *sseg, char *value, int row)
{
- if (segment_put_row(&(sseg->seg), value, row) < 0) {
+ if (Segment_put_row(&(sseg->seg), value, row) < 0) {
G_warning(_("seg_put_row(): could not write segment file"));
return -1;
}
@@ -89,7 +89,7 @@
int seg_get(SSEG *sseg, char *value, int row, int col)
{
- if (segment_get(&(sseg->seg), value, row, col) < 0) {
+ if (Segment_get(&(sseg->seg), value, row, col) < 0) {
G_warning(_("seg_get(): could not read segment file"));
return -1;
}
@@ -98,7 +98,7 @@
int seg_get_row(SSEG *sseg, char *value, int row)
{
- if (segment_get_row(&(sseg->seg), value, row) < 0) {
+ if (Segment_get_row(&(sseg->seg), value, row) < 0) {
G_warning(_("seg_get_row(): could not read segment file"));
return -1;
}
@@ -107,6 +107,6 @@
int seg_flush(SSEG *sseg)
{
- segment_flush(&(sseg->seg));
+ Segment_flush(&(sseg->seg));
return 0;
}
Modified: grass-addons/grass7/raster/r.los/delete.c
===================================================================
--- grass-addons/grass7/raster/r.los/delete.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.los/delete.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -31,7 +31,7 @@
/* mark deleted points by light brownish color */
data = 1;
value = &data;
- segment_put(seg_out_p, value,
+ Segment_put(seg_out_p, value,
row_viewpt - PT_TO_DELETE_Y, PT_TO_DELETE_X + col_viewpt);
/* If first and last point. This fixes a bug in r.los. See pts_elim.c for details */
Modified: grass-addons/grass7/raster/r.los/main.c
===================================================================
--- grass-addons/grass7/raster/r.los/main.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.los/main.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -218,19 +218,19 @@
/* output layer and pattern layer (if present) */
in_name = G_tempfile();
in_fd = creat(in_name, 0666);
- segment_format(in_fd, nrows, ncols,
+ Segment_format(in_fd, nrows, ncols,
submatrix_rows, submatrix_cols, lenth_data_item);
close(in_fd);
out_name = G_tempfile();
out_fd = creat(out_name, 0666);
- segment_format(out_fd, nrows, ncols,
+ Segment_format(out_fd, nrows, ncols,
submatrix_rows, submatrix_cols, lenth_data_item);
close(out_fd);
if (patt_flag == TRUE) {
patt_name = G_tempfile();
patt_fd = creat(patt_name, 0666);
- segment_format(patt_fd, nrows, ncols,
+ Segment_format(patt_fd, nrows, ncols,
submatrix_rows, submatrix_cols, sizeof(CELL));
close(patt_fd);
}
@@ -250,22 +250,22 @@
/* open, initialize and segment all files */
in_fd = open(in_name, 2);
- segment_init(&seg_in, in_fd, 4);
+ Segment_init(&seg_in, in_fd, 4);
out_fd = open(out_name, 2);
- segment_init(&seg_out, out_fd, 4);
+ Segment_init(&seg_out, out_fd, 4);
if (patt_flag == TRUE) {
patt_fd = open(patt_name, 2);
- segment_init(&seg_patt, patt_fd, 4);
+ Segment_init(&seg_patt, patt_fd, 4);
for (row = 0; row < nrows; row++) {
Rast_get_row(patt, cell, row, CELL_TYPE);
- segment_put_row(&seg_patt, cell, row);
+ Segment_put_row(&seg_patt, cell, row);
}
}
for (row = 0; row < nrows; row++) {
Rast_get_row(old, fcell, row, FCELL_TYPE);
- segment_put_row(&seg_in, fcell, row);
+ Segment_put_row(&seg_in, fcell, row);
}
/* calc map array coordinates for viewing point */
@@ -274,7 +274,7 @@
/* read elevation of viewing point */
value = &viewpt_elev;
- segment_get(&seg_in, value, row_viewpt, col_viewpt);
+ Segment_get(&seg_in, value, row_viewpt, col_viewpt);
viewpt_elev += obs_elev;
/* DO LOS ANALYSIS FOR SIXTEEN SEGMENTS */
@@ -356,16 +356,16 @@
/* mark viewpt on output map */
data = 180;
value = &data;
- segment_put(&seg_out, value, row_viewpt, col_viewpt);
+ Segment_put(&seg_out, value, row_viewpt, col_viewpt);
- /* write pending updates by segment_put() to outputmap */
- segment_flush(&seg_out);
+ /* write pending updates by Segment_put() to outputmap */
+ Segment_flush(&seg_out);
/* convert output submatrices to full cell overlay */
for (row = 0; row < nrows; row++) {
int col;
- segment_get_row(&seg_out, fcell, row);
+ Segment_get_row(&seg_out, fcell, row);
for (col = 0; col < ncols; col++)
/* set to NULL if beyond max_dist (0) or blocked view (1) */
if (fcell[col] == 0 || fcell[col] == 1)
@@ -373,11 +373,11 @@
Rast_put_row(new, fcell, FCELL_TYPE);
}
- segment_release(&seg_in); /* release memory */
- segment_release(&seg_out);
+ Segment_release(&seg_in); /* release memory */
+ Segment_release(&seg_out);
if (patt_flag == TRUE)
- segment_release(&seg_patt);
+ Segment_release(&seg_patt);
close(in_fd); /* close all files */
close(out_fd);
Modified: grass-addons/grass7/raster/r.los/mark_pts.c
===================================================================
--- grass-addons/grass7/raster/r.los/mark_pts.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.los/mark_pts.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -29,7 +29,7 @@
PT_TO_MARK = head;
while (PT_TO_MARK != NULL) { /* loop till end of list */
- segment_get(seg_out_p, &data,
+ Segment_get(seg_out_p, &data,
row_viewpt - PT_TO_MARK_Y, PT_TO_MARK_X + col_viewpt);
if (data != (FCELL) 1) { /* point has not been deleted previously */
@@ -38,7 +38,7 @@
+ COLOR_SHIFT);
end of old data */
data = (FCELL) (PT_TO_MARK_INCL * 57.325 + 90.0);
- segment_put(seg_out_p, &data,
+ Segment_put(seg_out_p, &data,
row_viewpt - PT_TO_MARK_Y, PT_TO_MARK_X + col_viewpt);
}
Modified: grass-addons/grass7/raster/r.los/pts_elim.c
===================================================================
--- grass-addons/grass7/raster/r.los/pts_elim.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.los/pts_elim.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -110,7 +110,7 @@
/* if pattern layer specified, check to see if checked */
/* point is of interest. If not, delete it from list */
if (patt_flag == 1) {
- segment_get(seg_patt_p, &mask,
+ Segment_get(seg_patt_p, &mask,
row_viewpt - CHECKED_PT_Y,
col_viewpt + CHECKED_PT_X);
@@ -199,7 +199,7 @@
/* if pattern layer specified, check if blocking point */
/* itself is an area of interest. If not, of no use */
if (patt_flag == 1) {
- segment_get(seg_patt_p, &mask, row_viewpt - BLOCKING_PT_Y,
+ Segment_get(seg_patt_p, &mask, row_viewpt - BLOCKING_PT_Y,
col_viewpt + BLOCKING_PT_X);
if (mask == 0 || Rast_is_null_value(&mask, CELL_TYPE)) {
@@ -302,7 +302,7 @@
dist = sqrt(del_x * del_x + del_y * del_y) * window.ns_res;
- segment_get(seg_in_p, &picked_pt_elev, row_viewpt - y, x + col_viewpt);
+ Segment_get(seg_in_p, &picked_pt_elev, row_viewpt - y, x + col_viewpt);
if (docurv) /* decrease height of target point */
picked_pt_elev = picked_pt_elev - ((dist * dist) / (2 * ellps_a));
Modified: grass-addons/grass7/raster/r.stream.basins/basins_fill.c
===================================================================
--- grass-addons/grass7/raster/r.stream.basins/basins_fill.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.stream.basins/basins_fill.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -80,7 +80,7 @@
for (i = 0; i < outlets_num; ++i) {
basins_cell = &outlets[i].val;
- segment_put(basins, basins_cell, outlets[i].r, outlets[i].c);
+ Segment_put(basins, basins_cell, outlets[i].r, outlets[i].c);
}
return 0;
}
@@ -147,7 +147,7 @@
G_debug(1, "processing outlet at row %d col %d", r, c);
- segment_put(basins, &val, r, c);
+ Segment_put(basins, &val, r, c);
while (tail != head) {
for (i = 1; i < 9; i++) {
@@ -159,11 +159,11 @@
j = DIAG(i);
/* contributing cell, not yet assigned to a basin */
- segment_get(basins, &basins_cell, next_r, next_c);
- segment_get(dirs, &dirs_cell, next_r, next_c);
+ Segment_get(basins, &basins_cell, next_r, next_c);
+ Segment_get(dirs, &dirs_cell, next_r, next_c);
if (dirs_cell == j && basins_cell == 0) {
- segment_put(basins, &val, next_r, next_c);
+ Segment_put(basins, &val, next_r, next_c);
n_cell.r = next_r;
n_cell.c = next_c;
fifo_insert(n_cell);
Modified: grass-addons/grass7/raster/r.stream.basins/basins_inputs.c
===================================================================
--- grass-addons/grass7/raster/r.stream.basins/basins_inputs.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.stream.basins/basins_inputs.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -207,7 +207,7 @@
for (r = 0; r < nrows; ++r)
for (c = 0; c < ncols; ++c) {
- segment_get(streams, &streams_cell, r, c);
+ Segment_get(streams, &streams_cell, r, c);
if (streams_cell > 0) {
if (outlets_num > 6 * (out_max - 1))
G_fatal_error(_("Stream and direction maps probably do not match"));
@@ -217,13 +217,13 @@
(OUTLET *) G_realloc(outlets,
out_max * 6 * sizeof(OUTLET));
- segment_get(dirs, &dirs_cell, r, c);
+ Segment_get(dirs, &dirs_cell, r, c);
d = abs(dirs_cell); /* abs */
if (NOT_IN_REGION(d))
next_stream = -1; /* border */
else {
- segment_get(streams, &streams_next_cell, NR(d), NC(d));
+ Segment_get(streams, &streams_next_cell, NR(d), NC(d));
next_stream =
(streams_next_cell > 0) ? streams_next_cell : -1;
}
Modified: grass-addons/grass7/raster/r.stream.basins/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.basins/io.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/raster/r.stream.basins/io.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -301,7 +301,7 @@
fd = creat(filename, 0666);
if (0 >
- segment_format(fd, seg->nrows, seg->ncols, srows, scols,
+ Segment_format(fd, seg->nrows, seg->ncols, srows, scols,
seg->data_size)) {
close(fd);
unlink(filename);
@@ -314,7 +314,7 @@
G_fatal_error(_("Unable re-open file '%s'"), filename);
}
- if (0 > (fd = segment_init(&(seg->seg), fd, number_of_segs))) {
+ if (0 > (fd = Segment_init(&(seg->seg), fd, number_of_segs))) {
unlink(filename);
G_fatal_error(_("Unable to init segment file or out of memory"));
}
@@ -437,7 +437,7 @@
}
}
- if (0 > segment_put_row(&(seg->seg), target_buffer, r)) {
+ if (0 > Segment_put_row(&(seg->seg), target_buffer, r)) {
G_free(input_buffer);
G_free(target_buffer);
Rast_close(input_fd);
@@ -466,7 +466,7 @@
for (r = 0; r < seg->nrows; ++r)
for (c = 0; c < seg->ncols; ++c)
- segment_put(&(seg->seg), &value, r, c);
+ Segment_put(&(seg->seg), &value, r, c);
return 0;
}
@@ -498,13 +498,13 @@
G_message(_("Writing raster map <%s>..."), output_map_name);
output_fd = Rast_open_new(output_map_name, output_data_type);
output_buffer = Rast_allocate_buf(output_data_type);
- segment_flush(&(seg->seg));
+ Segment_flush(&(seg->seg));
/* writing */
for (r = 0; r < seg->nrows; ++r) {
G_percent(r, seg->nrows, 2);
- if (0 > segment_get_row(&(seg->seg), output_buffer, r))
+ if (0 > Segment_get_row(&(seg->seg), output_buffer, r))
G_warning(_("Unable to segment read row %d for raster map <%s>"),
r, output_map_name);
@@ -551,7 +551,7 @@
/*
* release segment close files, set pointers to null;
*/
- segment_release(&(seg->seg));
+ Segment_release(&(seg->seg));
close(seg->fd);
unlink(seg->filename);
Modified: grass-addons/grass7/vector/v.surf.mass/main.c
===================================================================
--- grass-addons/grass7/vector/v.surf.mass/main.c 2014-10-22 07:37:07 UTC (rev 62336)
+++ grass-addons/grass7/vector/v.surf.mass/main.c 2014-10-22 07:48:50 UTC (rev 62337)
@@ -216,7 +216,7 @@
/* initialize */
G_message(_("Initializing..."));
- if (segment_open(&out_seg, G_tempfile(),
+ if (Segment_open(&out_seg, G_tempfile(),
nrows, ncols, srows, scols,
sizeof(struct lcell), segments_in_memory) != 1)
G_fatal_error(_("Can not create temporary file"));
@@ -371,7 +371,7 @@
}
}
}
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
}
}
G_percent(row, nrows, 2);
@@ -444,7 +444,7 @@
}
}
if (inside) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (!Rast_is_d_null_value(&thiscell.weight)) {
thiscell.area = i;
ap = &areas[thiscell.area];
@@ -456,7 +456,7 @@
}
if (ap->weight == 0)
ap->weight = thiscell.weight != 0.0;
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
}
}
}
@@ -476,7 +476,7 @@
G_percent(row, nrows, 2);
for (col = 0; col < ncols; col++) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (areas[thiscell.area].count > 0 &&
!Rast_is_d_null_value(&thiscell.interp)) {
@@ -496,7 +496,7 @@
}
if (areas[thiscell.area].count == 0)
thiscell.interp = outside_val;
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
}
}
G_percent(row, nrows, 2);
@@ -523,20 +523,20 @@
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (thiscell.area > 0 &&
!Rast_is_d_null_value(&thiscell.interp)) {
ap = &areas[thiscell.area];
thiscell.interp *= thiscell.weight;
ap->interp += thiscell.interp;
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
}
}
}
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (thiscell.area > 0 &&
!Rast_is_d_null_value(&thiscell.interp)) {
@@ -545,7 +545,7 @@
if (ap->interp != 0)
value = ap->value / ap->interp;
thiscell.interp = value * thiscell.interp;
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
}
}
}
@@ -563,7 +563,7 @@
for (col = 0; col < ncols; col++) {
int count = 0;
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (thiscell.area == 0 ||
Rast_is_d_null_value(&thiscell.interp))
continue;
@@ -580,7 +580,7 @@
if (nrow == row && ncol == col)
continue;
- segment_get(&out_seg, &ngbrcell, nrow, ncol);
+ Segment_get(&out_seg, &ngbrcell, nrow, ncol);
if (!Rast_is_d_null_value(&ngbrcell.interp)) {
value += ngbrcell.interp;
count++;
@@ -600,7 +600,7 @@
if (thiscell.interp + thiscell.adj < 0)
thiscell.adj = -thiscell.interp;
}
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
areas[thiscell.area].adj += thiscell.adj;
areas[thiscell.area].interp += thiscell.interp + thiscell.adj;
@@ -624,7 +624,7 @@
/* Step 3 */
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (thiscell.area > 0 &&
!Rast_is_d_null_value(&thiscell.interp)) {
@@ -632,7 +632,7 @@
if (negative || (!negative && interp >= 0)) {
thiscell.interp = interp;
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
value = thiscell.adj + areas[thiscell.area].adj;
if (maxadj < value * value) {
@@ -659,7 +659,7 @@
/* Step 5 */
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (thiscell.area > 0 &&
!Rast_is_d_null_value(&thiscell.interp)) {
@@ -673,7 +673,7 @@
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (thiscell.area > 0 &&
!Rast_is_d_null_value(&thiscell.interp)) {
@@ -694,7 +694,7 @@
if (negative || (!negative && interp >= 0))
thiscell.interp = interp;
}
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
}
}
}
@@ -704,7 +704,7 @@
/* Step 2 */
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
if (thiscell.area > 0 &&
!Rast_is_d_null_value(&thiscell.interp)) {
/* multiplication with area scale factor */
@@ -721,7 +721,7 @@
if (negative || (!negative && interp >= 0)) {
value = thiscell.interp - interp;
thiscell.interp = interp;
- segment_put(&out_seg, &thiscell, row, col);
+ Segment_put(&out_seg, &thiscell, row, col);
if (maxadj < value * value) {
maxadj = value * value;
@@ -754,14 +754,14 @@
for (row = 0; row < nrows; row++) {
G_percent(row, nrows, 2);
for (col = 0; col < ncols; col++) {
- segment_get(&out_seg, &thiscell, row, col);
+ Segment_get(&out_seg, &thiscell, row, col);
drastbuf[col] = thiscell.interp;
}
Rast_put_d_row(out_fd, drastbuf);
}
G_percent(row, nrows, 2);
- segment_close(&out_seg);
+ Segment_close(&out_seg);
Rast_close(out_fd);
Rast_short_history(out_opt->answer, "raster", &history);
More information about the grass-commit
mailing list