GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Vlib/box.c File Reference
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/Vect.h>
Include dependency graph for Vlib/box.c:

Go to the source code of this file.

Functions

int Vect_point_in_box (double x, double y, double z, BOUND_BOX *Box)
 Tests for point in box. More...
 
int Vect_box_overlap (BOUND_BOX *A, BOUND_BOX *B)
 Tests for overlap of two boxes. More...
 
int Vect_box_copy (BOUND_BOX *A, BOUND_BOX *B)
 Copy box B to box A. More...
 
int Vect_box_extend (BOUND_BOX *A, BOUND_BOX *B)
 Extend box A by box B. More...
 
int Vect_box_clip (double *x, double *y, double *c_x, double *c_y, BOUND_BOX *Box)
 Clip coordinates to box, if necessary, lines extending outside of a box. More...
 
int Vect_get_line_box (struct Map_info *Map, int line, BOUND_BOX *Box)
 Get boundary box of line. More...
 
int Vect_get_area_box (struct Map_info *Map, int area, BOUND_BOX *Box)
 Get boundary box of area. More...
 
int Vect_get_isle_box (struct Map_info *Map, int isle, BOUND_BOX *Box)
 Get boundary box of isle. More...
 
int Vect_get_map_box (struct Map_info *Map, BOUND_BOX *Box)
 Get boundary box of map. More...
 
int Vect_region_box (struct Cell_head *Window, BOUND_BOX *Box)
 Copy region Window to Box. More...
 

Function Documentation

int Vect_box_clip ( double *  x,
double *  y,
double *  c_x,
double *  c_y,
BOUND_BOX *  Box 
)

Clip coordinates to box, if necessary, lines extending outside of a box.

A line represented by the coordinates x, y and c_x, c_y is clipped to the window defined by s (south), n (north), w (west), and e (east). Note that the following constraints must be true: w <e s <n The x and c_x are values to be compared to w and e. The y and c_y are values to be compared to s and n. The x and c_x values returned lie between w and e. The y and c_y values returned lie between s and n.

Parameters
x,ycoordinates (w, e)
c_x,c_ycoordinates (s, n)
Boxboundary box
Returns
1 if any clipping occured
0 otherwise

Definition at line 138 of file Vlib/box.c.

References y.

int Vect_box_copy ( BOUND_BOX *  A,
BOUND_BOX *  B 
)

Copy box B to box A.

Parameters
Aboundary A
Bboundary B
Returns
1

Definition at line 72 of file Vlib/box.c.

Referenced by wxdisplay.DisplayDriver::GetRegionSelected(), V2_delete_line_nat(), V2_write_line_nat(), Vect_build_nat(), and Vect_topo_dump().

int Vect_box_extend ( BOUND_BOX *  A,
BOUND_BOX *  B 
)

Extend box A by box B.

Parameters
Aboundary A
Bboundary B
Returns
1

Definition at line 93 of file Vlib/box.c.

Referenced by wxdisplay.DisplayDriver::GetRegionSelected(), V2_delete_line_nat(), V2_restore_line_nat(), V2_write_line_nat(), and Vect_build_nat().

int Vect_box_overlap ( BOUND_BOX *  A,
BOUND_BOX *  B 
)

Tests for overlap of two boxes.

Parameters
Aboundary box A
Bboundary box B
Returns
1 boxes overlap
0 boxes do not overlap

Definition at line 53 of file Vlib/box.c.

Referenced by V1_read_next_line_nat(), V1_read_next_line_ogr(), and V2_read_next_line_nat().

int Vect_get_area_box ( struct Map_info *  Map,
int  area,
BOUND_BOX *  Box 
)

Get boundary box of area.

Parameters
Mapvector map
areaarea id
[out]Boxbounding box
Returns
1 on success
0 area is dead

Definition at line 247 of file Vlib/box.c.

References NULL.

Referenced by wxdisplay.DisplayDriver::GetRegionSelected(), V2_delete_line_nat(), and Vect_isle_find_area().

int Vect_get_isle_box ( struct Map_info *  Map,
int  isle,
BOUND_BOX *  Box 
)

Get boundary box of isle.

Parameters
Mapvector map
isleisle id
[out]Boxbounding box
Returns
1 on success
0 isle is dead

Definition at line 286 of file Vlib/box.c.

References NULL.

Referenced by V2_delete_line_nat(), and Vect_isle_find_area().

int Vect_get_line_box ( struct Map_info *  Map,
int  line,
BOUND_BOX *  Box 
)

Get boundary box of line.

Parameters
Mapvector map
lineline id
[out]Boxbounding box
Returns
1 on success
0 line is dead

Definition at line 208 of file Vlib/box.c.

References NULL.

Referenced by wxdisplay.DisplayDriver::GetRegionSelected(), wxdigit.IVDigit::OpenBackgroundMap(), V2_read_next_line_nat(), and Vect_break_lines_list().

int Vect_get_map_box ( struct Map_info *  Map,
BOUND_BOX *  Box 
)

Get boundary box of map.

Parameters
Mapvector map
[out]Boxbouding box
Returns
1 on success, 0 on error

Definition at line 323 of file Vlib/box.c.

Referenced by wxdisplay.DisplayDriver::GetMapBoundingBox().

int Vect_point_in_box ( double  x,
double  y,
double  z,
BOUND_BOX *  Box 
)

Tests for point in box.

Parameters
x,y,zcoordinates
Boxboundary box
Returns
1 point is in box
0 point is not in box

Definition at line 33 of file Vlib/box.c.

References N.

int Vect_region_box ( struct Cell_head *  Window,
BOUND_BOX *  Box 
)

Copy region Window to Box.

Parameters
Windowregion structure (raster-based)
[out]Boxboundary box (vector-based)
Returns
1 on success, 0 on error

Definition at line 348 of file Vlib/box.c.