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

Go to the source code of this file.

Functions

int Vect_get_area_points (struct Map_info *Map, int area, struct line_pnts *BPoints)
 Returns the polygon array of points in BPoints. More...
 
int Vect_get_isle_points (struct Map_info *Map, int isle, struct line_pnts *BPoints)
 Returns the polygon array of points in BPoints. More...
 
int Vect_get_area_centroid (struct Map_info *Map, int area)
 Returns centroid number of area. More...
 
int Vect_get_area_boundaries (struct Map_info *Map, int area, struct ilist *List)
 Creates list of boundaries for area. More...
 
int Vect_get_isle_boundaries (struct Map_info *Map, int isle, struct ilist *List)
 Creates list of boundaries for isle. More...
 
int Vect_get_area_num_isles (struct Map_info *Map, int area)
 Returns number of isles for area. More...
 
int Vect_get_area_isle (struct Map_info *Map, int area, int isle)
 Returns isle for area. More...
 
int Vect_get_isle_area (struct Map_info *Map, int isle)
 Returns area for isle. More...
 
double Vect_area_perimeter (struct line_pnts *Points)
 Calculate area perimeter. More...
 
int Vect_point_in_area (struct Map_info *Map, int area, double x, double y)
 Returns 1 if point is in area. More...
 
double Vect_get_area_area (struct Map_info *Map, int area)
 Returns area of area without areas of isles. More...
 
int Vect_get_area_cats (struct Map_info *Map, int area, struct line_cats *Cats)
 Get area categories. More...
 
int Vect_get_area_cat (struct Map_info *Map, int area, int field)
 Find FIRST category of given field and area. More...
 

Function Documentation

double Vect_area_perimeter ( struct line_pnts *  Points)

Calculate area perimeter.

Parameters
Pointslist of points defining area boundary
Returns
area perimeter

Definition at line 328 of file vector/Vlib/area.c.

References Vect_line_length().

Referenced by wxdigit.IVDigit::GetAreaPerimeter().

double Vect_get_area_area ( struct Map_info *  Map,
int  area 
)

Returns area of area without areas of isles.

Parameters
Mapvector map
areaarea id
Returns
area of area without areas of isles

Definition at line 379 of file vector/Vlib/area.c.

References G_area_of_polygon(), G_begin_polygon_area_calculations(), G_debug(), tools::size, Vect_destroy_line_struct(), Vect_get_area_points(), Vect_get_isle_points(), and Vect_new_line_struct().

Referenced by wxdigit.IVDigit::GetAreaSize(), and Vect_remove_small_areas().

int Vect_get_area_boundaries ( struct Map_info *  Map,
int  area,
struct ilist *  List 
)

Creates list of boundaries for area.

Parameters
Mapvector map
areaarea id
Listpointer to list of boundaries
Returns
number of boundaries

Definition at line 179 of file vector/Vlib/area.c.

References G_debug(), G_fatal_error(), NULL, Vect_list_append(), and Vect_reset_list().

Referenced by Vect_remove_small_areas().

int Vect_get_area_cat ( struct Map_info *  Map,
int  area,
int  field 
)

Find FIRST category of given field and area.

Parameters
Mapvector map
areaarea id
fieldlayer number
Returns
first found category of given field
-1 no centroid or no category found

Definition at line 453 of file vector/Vlib/area.c.

References NULL, Vect_get_area_cats(), Vect_new_cats_struct(), and Vect_reset_cats().

int Vect_get_area_cats ( struct Map_info *  Map,
int  area,
struct line_cats *  Cats 
)

Get area categories.

Parameters
Mapvector map
areaarea id
[out]Catslist of categories
Returns
0 OK centroid found (but may be without categories)
1 no centroid found

Definition at line 425 of file vector/Vlib/area.c.

References NULL, Vect_get_area_centroid(), Vect_read_line(), and Vect_reset_cats().

Referenced by Vect_get_area_cat().

int Vect_get_area_centroid ( struct Map_info *  Map,
int  area 
)

Returns centroid number of area.

Parameters
Mapvector map
areaarea id
Returns
centroid number of area
0 if no centroid found

Definition at line 153 of file vector/Vlib/area.c.

References G_debug(), G_fatal_error(), and NULL.

Referenced by wxdigit.IVDigit::InitCats(), Vect_build_partial(), Vect_get_area_cats(), Vect_overlay_and(), Vect_remove_small_areas(), Vect_set_varray_from_cat_list(), and Vect_set_varray_from_db().

int Vect_get_area_isle ( struct Map_info *  Map,
int  area,
int  isle 
)

Returns isle for area.

Parameters
Mapvector map
areaarea id
isleisle id
Returns
isles for area
0 if no isle found

Definition at line 275 of file vector/Vlib/area.c.

References G_debug(), G_fatal_error(), and NULL.

Referenced by Vect_area_buffer2(), Vect_get_point_in_area(), and Vect_read_area_geos().

int Vect_get_area_num_isles ( struct Map_info *  Map,
int  area 
)

Returns number of isles for area.

Parameters
Mapvector map
areaarea id
Returns
number of isles for area
0 if area not found

Definition at line 246 of file vector/Vlib/area.c.

References G_debug(), G_fatal_error(), and NULL.

Referenced by Vect_area_buffer2(), Vect_get_point_in_area(), and Vect_read_area_geos().

int Vect_get_area_points ( struct Map_info *  Map,
int  area,
struct line_pnts *  BPoints 
)

Returns the polygon array of points in BPoints.

Parameters
Mapvector map
areaarea id
[out]BPointspoints array
Returns
number of points
-1 on error

Definition at line 37 of file vector/Vlib/area.c.

References G_debug(), G_fatal_error(), G_warning(), NULL, Vect_append_points(), Vect_new_line_struct(), and Vect_read_line().

Referenced by wxdigit.IVDigit::GetAreaPerimeter(), Gv_load_vect(), Vect_area_buffer2(), Vect_get_area_area(), Vect_get_point_in_area(), Vect_isle_find_area(), and Vect_tin_get_z().

int Vect_get_isle_area ( struct Map_info *  Map,
int  isle 
)

Returns area for isle.

Parameters
Mapvector
isleisland number
Returns
area id
0 area not found

Definition at line 302 of file vector/Vlib/area.c.

References G_debug(), G_fatal_error(), and NULL.

Referenced by Vect_select_areas_by_polygon().

int Vect_get_isle_boundaries ( struct Map_info *  Map,
int  isle,
struct ilist *  List 
)

Creates list of boundaries for isle.

Parameters
Mapvector map
isleisland number
Listpointer to list where boundaries are stored
Returns
number of boundaries

Definition at line 213 of file vector/Vlib/area.c.

References G_debug(), G_fatal_error(), NULL, Vect_list_append(), and Vect_reset_list().

int Vect_get_isle_points ( struct Map_info *  Map,
int  isle,
struct line_pnts *  BPoints 
)

Returns the polygon array of points in BPoints.

Parameters
Mapvector map
isleisland id
[out]BPointspoints array
Returns
number of points or -1 on error

Definition at line 98 of file vector/Vlib/area.c.

References G_debug(), G_fatal_error(), NULL, Vect_append_points(), Vect_new_line_struct(), and Vect_read_line().

Referenced by Vect_area_buffer2(), Vect_find_island(), Vect_get_area_area(), and Vect_get_point_in_area().

int Vect_point_in_area ( struct Map_info *  Map,
int  area,
double  x,
double  y 
)

Returns 1 if point is in area.

Parameters
Mapvector map
areaarea id
x,ypoint coordinates
Returns
1 if point is in area
0 if not

Definition at line 344 of file vector/Vlib/area.c.

References NULL, Vect_point_in_area_outer_ring(), and Vect_point_in_island().

Referenced by Vect_find_area().