window_map.c File Reference

#include <stdlib.h>
#include <grass/gis.h>
#include "G.h"

Include dependency graph for window_map.c:

Go to the source code of this file.

Defines

#define alloc_index(n)   (COLUMN_MAPPING *) G_malloc((n)*sizeof(COLUMN_MAPPING))

Functions

int G__create_window_mapping (int fd)
double G_northing_to_row (double north, struct Cell_head *window)
 northing to row
double G_adjust_east_longitude (double east, double west)
 adjust east longitude
double G_adjust_easting (double east, struct Cell_head *window)
 returns east larger than west
double G_easting_to_col (double east, struct Cell_head *window)
double G_row_to_northing (double row, struct Cell_head *window)
 row to northing
double G_col_to_easting (double col, struct Cell_head *window)
 column to easting
int G_window_rows ()
 number of rows in active region
int G_window_cols ()
 number of columns in active region
int G__init_window ()
int G_row_repeat_nomask (int fd, int row)


Define Documentation

#define alloc_index (  )     (COLUMN_MAPPING *) G_malloc((n)*sizeof(COLUMN_MAPPING))


Function Documentation

int G__create_window_mapping ( int  fd  ) 

int G__init_window (  ) 

double G_adjust_east_longitude ( double  east,
double  west 
)

adjust east longitude

This routine returns an equivalent east that is larger, but no more than 360 larger than the west coordinate. This routine should be used only with latitude-longitude coordinates.

Parameters:
east 
west 
Returns:
double

Definition at line 149 of file window_map.c.

Referenced by G_adjust_easting().

double G_adjust_easting ( double  east,
struct Cell_head *  window 
)

returns east larger than west

If the region projection is PROJECTION_LL, then this routine returns an equivalent east that is larger, but no more than 360 degrees larger, than the coordinate for the western edge of the region. Otherwise no adjustment is made and the original east is returned.

Parameters:
east 
region 
Returns:
double

Definition at line 174 of file window_map.c.

References G_adjust_east_longitude().

double G_col_to_easting ( double  col,
struct Cell_head *  window 
)

column to easting

Converts a column relative to a region to an easting; Note. col is a double: col+0.5 will return the easting for the center of the column; col+0.0 will return the easting for the western edge of the column; and col+1.0 will return the easting for the eastern edge of the column.

Parameters:
col 
region 
Returns:
double

Definition at line 240 of file window_map.c.

Referenced by G_align_window().

double G_easting_to_col ( double  east,
struct Cell_head *  window 
)

Definition at line 186 of file window_map.c.

References G_adjust_easting().

Referenced by G_align_window().

double G_northing_to_row ( double  north,
struct Cell_head *  window 
)

northing to row

Converts a northing relative to a region to a row. Note. the result is a double. Casting it to an integer will give the row number.

Parameters:
north 
region 
Returns:
double

Definition at line 130 of file window_map.c.

Referenced by G_align_window().

int G_row_repeat_nomask ( int  fd,
int  row 
)

Definition at line 314 of file window_map.c.

References fileinfo::C1, and fileinfo::C2.

double G_row_to_northing ( double  row,
struct Cell_head *  window 
)

row to northing

Converts a row relative to a region to a northing; Note. row is a double: row+0.5 will return the northing for the center of the row; row+0.0 will return the northing for the northern edge of the row; and row+1.0 will return the northing for the southern edge of the row. double G_easting_to_col (east, region) easting to column double east; struct Cell_head *region; Converts an easting relative to a region to a column. Note. The result is a double. Casting it to an integer will give the column number.

Parameters:
row 
region 
Returns:
double

Definition at line 218 of file window_map.c.

Referenced by G_align_window().

int G_window_cols (  ) 

number of columns in active region

These routines return the number of rows and columns (respectively) in the active module region. Before raster files can be read or written, it is necessary to known how many rows and columns are in the active region. For example:

  int nrows, cols;
  int row, col; 
  nrows = G_window_rows( ); 
  ncols = G_window_cols( ); 
  for (row = 0; row < nrows; row++)
  {
  <i>read</i> row ...
  for (col = 0; col < ncols; col++)
  {
  process col ...
  }
  }

Parameters:
void 
Returns:
int

Definition at line 289 of file window_map.c.

References G__init_window().

Referenced by G_allocate_c_raster_buf(), G_allocate_cell_buf(), G_allocate_d_raster_buf(), G_allocate_f_raster_buf(), G_allocate_null_buf(), G_allocate_raster_buf(), G_zero_cell_buf(), and G_zero_raster_buf().

int G_window_rows (  ) 

number of rows in active region

Parameters:
void 
Returns:
int

Definition at line 255 of file window_map.c.

References G__init_window().


Generated on Sun Apr 6 17:32:27 2008 for GRASS by  doxygen 1.5.5