Skip to content

Commit

Permalink
Move raster-specific functions from lib/gis to lib/raster:
Browse files Browse the repository at this point in the history
 G_align_window -> Rast_align_window
 G_window_rows -> Rast_window_rows
 G_window_cols -> Rast_window_cols
 G_northing_to_row -> Rast_northing_to_row
 G_easting_to_col -> Rast_easting_to_col
 G_row_to_northing -> Rast_row_to_northing
 G_col_to_easting -> Rast_col_to_easting


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40771 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
glynnc committed Feb 1, 2010
1 parent 62ec330 commit df4d81a
Show file tree
Hide file tree
Showing 181 changed files with 736 additions and 729 deletions.
12 changes: 6 additions & 6 deletions display/d.profile/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ static void get_region_range(int fd)
{
DCELL *buf = Rast_allocate_d_buf();

int nrows = G_window_rows();
int ncols = G_window_cols();
int nrows = Rast_window_rows();
int ncols = Rast_window_cols();
int row, col;

min = 1e300;
Expand Down Expand Up @@ -133,8 +133,8 @@ static int get_cell(DCELL *result, int fd, double x, double y)
x -= col + 0.5;
y -= row + 0.5;

if (row < 0 || row + 1 >= G_window_rows() ||
col < 0 || col + 1 >= G_window_cols()) {
if (row < 0 || row + 1 >= Rast_window_rows() ||
col < 0 || col + 1 >= Rast_window_cols()) {
Rast_set_d_null_value(result, 1);
return 0;
}
Expand Down Expand Up @@ -237,8 +237,8 @@ int main(int argc, char **argv)
G_scan_easting( profile->answers[i+0], &x, G_projection());
G_scan_northing(profile->answers[i+1], &y, G_projection());

p->x = G_easting_to_col (x, &window);
p->y = G_northing_to_row(y, &window);
p->x = Rast_easting_to_col (x, &window);
p->y = Rast_northing_to_row(y, &window);

if (num_points > 0) {
const struct point *prev = &points[num_points-1];
Expand Down
4 changes: 2 additions & 2 deletions display/d.rast/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ static int cell_draw(const char *name,
int cur_A_row;
int ncols, nrows;

ncols = G_window_cols();
nrows = G_window_rows();
ncols = Rast_window_cols();
nrows = Rast_window_rows();

/* Set up the screen, conversions, and graphics */
D_setup(0);
Expand Down
4 changes: 2 additions & 2 deletions doc/raster/r.example/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ int main(int argc, char *argv[])
inrast = Rast_allocate_buf(data_type);

/* Allocate output buffer, use input map data_type */
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outrast = Rast_allocate_buf(data_type);

/* controlling, if we can write the raster */
Expand Down
4 changes: 2 additions & 2 deletions general/g.region/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ int main(int argc, char *argv[])
}

if (flag.res_set->answer)
G_align_window(&window, &temp_window);
Rast_align_window(&window, &temp_window);

Vect_close(&Map);
}
Expand Down Expand Up @@ -783,7 +783,7 @@ int main(int argc, char *argv[])
if (!mapset)
G_fatal_error(_("Raster map <%s> not found"), name);
Rast_get_cellhd(name, mapset, &temp_window);
G_align_window(&window, &temp_window);
Rast_align_window(&window, &temp_window);
}

/* save= */
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.albedo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ int main(int argc, char *argv[])
G_fatal_error(_("At least two raster maps are required"));

/* Allocate output buffer, use input map data_type */
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outrast = Rast_allocate_buf(out_data_type);

/* Create New raster files */
Expand Down
6 changes: 3 additions & 3 deletions imagery/i.atcorr/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static void write_fp_to_cell (int ofd, FCELL* buf)

cbuf = (CELL*)Rast_allocate_buf(CELL_TYPE);

for(col = 0; col < G_window_cols(); col++) cbuf[col] = round_c(buf[col]);
for(col = 0; col < Rast_window_cols(); col++) cbuf[col] = round_c(buf[col]);
Rast_put_row(ofd, cbuf, CELL_TYPE);
}

Expand Down Expand Up @@ -295,8 +295,8 @@ static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
if(ivis_fd >= 0) vis = (FCELL*)Rast_allocate_buf(FCELL_TYPE);

G_verbose_message(_("Percent complete..."));
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

for(row = 0; row < nrows; row++)
{
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.biomass/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ int main(int argc, char *argv[])
infd_wa = Rast_open_old(wa, "");
inrast_wa = Rast_allocate_d_buf();

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outrast1 = Rast_allocate_d_buf();

/* Create New raster files */
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.cca/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ int main(int argc, char *argv[])
}

/* do the transform */
transform(datafds, outfds, G_window_rows(), G_window_cols(), q, bands,
transform(datafds, outfds, Rast_window_rows(), Rast_window_cols(), q, bands,
outbandmin, outbandmax);

/* make grey scale color table */
Expand Down
8 changes: 4 additions & 4 deletions imagery/i.class/cellhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ int Outline_cellhd(View * view, struct Cell_head *cellhd)
int row, col;
int top, bottom, left, right;

row = G_northing_to_row(cellhd->north, &view->cell.head) + .5;
row = Rast_northing_to_row(cellhd->north, &view->cell.head) + .5;
top = row_to_view(view, row);
col = G_easting_to_col(cellhd->west, &view->cell.head) + .5;
col = Rast_easting_to_col(cellhd->west, &view->cell.head) + .5;
left = col_to_view(view, col);
row = G_northing_to_row(cellhd->south, &view->cell.head) + .5;
row = Rast_northing_to_row(cellhd->south, &view->cell.head) + .5;
bottom = row_to_view(view, row);
col = G_easting_to_col(cellhd->east, &view->cell.head) + .5;
col = Rast_easting_to_col(cellhd->east, &view->cell.head) + .5;
right = col_to_view(view, col);

Outline_box(top, bottom, left, right);
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.class/draw_cell.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ int draw_cell(View * view, int overlay)
display_title(view);

Rast_set_window(&view->cell.head);
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

left = view->cell.left;
top = view->cell.top;
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.class/outline.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ int outline(void)
temp.x = view_to_col(Region.view, A[cur].x);
tmp_n = row_to_northing(&(Region.view->cell.head), temp.y, 0.5);
tmp_e = col_to_easting(&(Region.view->cell.head), temp.x, 0.5);
tmp[cur].y = G_northing_to_row(tmp_n, &Band_cellhd);
tmp[cur].x = G_easting_to_col(tmp_e, &Band_cellhd);
tmp[cur].y = Rast_northing_to_row(tmp_n, &Band_cellhd);
tmp[cur].x = Rast_easting_to_col(tmp_e, &Band_cellhd);
}

/* find first edge which is not horizontal */
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.class/signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ int display_signature(void)

fd = Rast_open_c_new(MASK);
buffer = Rast_allocate_c_buf();
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

for (row = 0; row < nrows; row++) {
readbands(nbands, row);
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.cluster/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ int main(int argc, char *argv[])


G_get_window(&window);
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

I_cluster_clear(&C);

Expand Down
4 changes: 2 additions & 2 deletions imagery/i.eb.eta/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ int main(int argc, char *argv[])
infd_tempk = Rast_open_old(tempk, "");
inrast_tempk = Rast_allocate_d_buf();

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outrast1 = Rast_allocate_d_buf();

outfd1 = Rast_open_new(result1, DCELL_TYPE);
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.eb.evapfr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ int main(int argc, char *argv[])
inrast_h0 = Rast_allocate_d_buf();

/***************************************************/
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outrast1 = Rast_allocate_d_buf();

if (makin)
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.eb.h_SEBAL01/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ int main(int argc, char *argv[])
ymin = cellhd.south;
ymax = cellhd.north;

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

/***************************************************/
/* Allocate output buffer */
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.eb.soilheatflux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ int main(int argc, char *argv[])
infd_time = Rast_open_old(time, "");
inrast_time = Rast_allocate_d_buf();

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outrast = Rast_allocate_d_buf();

/* Create New raster files */
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.emissivity/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ int main(int argc, char *argv[])
inr = Rast_allocate_d_buf();

/***************************************************/
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outr = Rast_allocate_d_buf();

/* Create New raster files */
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.evapo.time_integration/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ int main(int argc, char *argv[])
G_fatal_error(_("The min specified input map is two"));

/* Allocate output buffer, use input map data_type */
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outrast = Rast_allocate_buf(out_data_type);


Expand Down
4 changes: 2 additions & 2 deletions imagery/i.fft/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ int main(int argc, char *argv[])
G_get_set_window(&window); /* get the current window for later */

/* get the rows and columns in the current window */
rows = G_window_rows();
cols = G_window_cols();
rows = Rast_window_rows();
cols = Rast_window_cols();
totsize = rows * cols;

/* Allocate appropriate memory for the structure containing
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.gensig/covariance.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ int compute_covariances(struct files *files, struct Signature *S)
for (b2 = 0; b2 < S->nbands; b2++)
S->sig[n].var[b1][b2] = 0.0;

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
class = (CELL *) G_calloc(ncols, sizeof(CELL));

G_message(_("Calculating class covariance matrices..."));
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.gensig/get_train.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ int get_training_classes(struct files *files, struct Signature *S)
fd = files->train_fd;
cell = files->train_cell;

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

/* determine the categories in the map */
I_init_signatures(S, files->nbands);
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.gensig/means.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ int compute_means(struct files *files, struct Signature *S)
for (b = 0; b < S->nbands; b++) /* for each band file */
S->sig[n].mean[b] = 0.0;

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
class = (CELL *) G_calloc(ncols, sizeof(CELL));

G_message(_("Calculating class means..."));
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.gensigset/get_train.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ int get_training_classes(struct parms *parms,
fd = files->train_fd;
cell = files->train_cell;

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

/* determine the non-zero categories in the map */
I_InitSigSet(S);
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.gensigset/read_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ int read_data(struct files *files, struct SigSet *S)
CELL *class;
struct ClassData *Data;

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
class = (CELL *) G_calloc(ncols, sizeof(CELL));

G_message(_("Reading raster maps..."));
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.his.rgb/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);

/* get dimension of the image */
rows = G_window_rows();
cols = G_window_cols();
rows = Rast_window_rows();
cols = Rast_window_cols();

openfiles(opt_hue->answer, opt_int->answer, opt_sat->answer,
opt_red->answer, opt_green->answer, opt_blue->answer,
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.ifft/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ int main(int argc, char *argv[])
Rast_set_window(&realhead); /* set the window to the whole cell map */

/* get the rows and columns in the current window */
rows = G_window_rows();
cols = G_window_cols();
rows = Rast_window_rows();
cols = Rast_window_cols();
totsize = rows * cols;

/* Allocate appropriate memory for the structure containing
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.latlong/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ int main(int argc, char *argv[])
xmax = cellhd.east;
ymin = cellhd.south;
ymax = cellhd.north;
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

/*Stolen from r.sun */
/* Set up parameters for projection to lat/long if necessary */
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.maxlik/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ int main(int argc, char *argv[])

open_files();

nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();

for (row = 0; row < nrows; row++) {
G_percent(row, nrows, 2);
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.modis.qc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ int main(int argc, char *argv[])
inrast = Rast_allocate_c_buf();

G_debug(3, "number of rows %d", cellhd.rows);
nrows = G_window_rows();
ncols = G_window_cols();
nrows = Rast_window_rows();
ncols = Rast_window_cols();
outrast = Rast_allocate_c_buf();

/* Create New raster files */
Expand Down
Loading

0 comments on commit df4d81a

Please sign in to comment.