GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
Vector library - area-related functions. More...
#include <stdlib.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include "pg_local_proto.h"
#include "local_proto.h"
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 polygon array of points (outer ring) of given area. More... | |
int | Vect_get_isle_points (struct Map_info *Map, int isle, struct line_pnts *BPoints) |
Returns polygon array of points for given isle. More... | |
int | Vect_get_area_centroid (struct Map_info *Map, int area) |
Returns centroid id for given area. More... | |
int | Vect_get_area_boundaries (struct Map_info *Map, int area, struct ilist *List) |
Creates list of boundaries for given area. More... | |
int | Vect_get_isle_boundaries (struct Map_info *Map, int isle, struct ilist *List) |
Creates list of boundaries for given isle. More... | |
int | Vect_get_area_num_isles (struct Map_info *Map, int area) |
Returns number of isles for given area. More... | |
int | Vect_get_area_isle (struct Map_info *Map, int area, int isle) |
Returns isle id for area. More... | |
int | Vect_get_isle_area (struct Map_info *Map, int isle) |
Returns area id for isle. More... | |
double | Vect_get_area_perimeter (struct Map_info *Map, int area) |
Returns perimeter of area with perimeter of isles. More... | |
int | Vect_point_in_area (double x, double y, struct Map_info *Map, int area, struct bound_box *box) |
Check 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... | |
int | Vect__get_area_points (struct Map_info *Map, const plus_t *lines, int n_lines, struct line_pnts *BPoints) |
Get area boundary points (internal use only) More... | |
int | Vect__get_area_points_nat (struct Map_info *Map, const plus_t *lines, int n_lines, struct line_pnts *BPoints) |
Get area boundary points (native format) More... | |
Vector library - area-related functions.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2009, 2011-2013 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file vector/Vlib/area.c.
int Vect__get_area_points | ( | struct Map_info * | Map, |
const plus_t * | lines, | ||
int | n_lines, | ||
struct line_pnts * | BPoints | ||
) |
Get area boundary points (internal use only)
For PostGIS Topology calls Vect__get_area_points_pg() otherwise Vect__get_area_points_nat(),
Map | pointer to Map_info struct | |
lines | array of boundary lines | |
n_lines | number of lines in array | |
[out] | APoints | pointer to output line_pnts struct |
Definition at line 487 of file vector/Vlib/area.c.
References _, Format_info_pg::cache, Format_info_cache::ctype, Map_info::fInfo, Map_info::format, G_fatal_error(), GV_FORMAT_POSTGIS, Format_info::pg, Format_info_pg::toposchema_name, Vect__get_area_points_nat(), and Vect__get_area_points_pg().
Referenced by Vect_build_line_area(), and Vect_get_area_points().
int Vect__get_area_points_nat | ( | struct Map_info * | Map, |
const plus_t * | lines, | ||
int | n_lines, | ||
struct line_pnts * | BPoints | ||
) |
Get area boundary points (native format)
Used by Vect_build_line_area() and Vect_get_area_points().
Map | pointer to Map_info struct | |
lines | array of boundary lines | |
n_lines | number of lines in array | |
[out] | APoints | pointer to output line_pnts struct |
Definition at line 516 of file vector/Vlib/area.c.
Referenced by Vect__get_area_points(), and Vect_get_isle_points().
double Vect_get_area_area | ( | struct Map_info * | Map, |
int | area | ||
) |
Returns area of area without areas of isles.
Map | pointer to Map_info structure |
area | area id |
Definition at line 375 of file vector/Vlib/area.c.
Creates list of boundaries for given area.
Note that ids in List can be negative. The sign indicates in which direction the boundary should be read (negative for backward).
Map | pointer to Map_info structure | |
area | area id | |
[out] | List | pointer to list of boundaries |
Definition at line 139 of file vector/Vlib/area.c.
int Vect_get_area_cat | ( | struct Map_info * | Map, |
int | area, | ||
int | field | ||
) |
Find FIRST category of given field and area.
Map | pointer to Map_info structure |
area | area id |
field | layer number |
Definition at line 450 of file vector/Vlib/area.c.
References line_cats::cat, line_cats::field, line_cats::n_cats, NULL, Vect_get_area_cats(), Vect_new_cats_struct(), and Vect_reset_cats().
Referenced by vector2perimeters(), and Vedit_delete_areas_cat().
Get area categories.
Map | pointer to Map_info structure | |
area | area id | |
[out] | Cats | list of categories |
Definition at line 423 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 id for given area.
Map | pointer to Map_info structure |
area | area id |
Definition at line 110 of file vector/Vlib/area.c.
References _, Plus_head::Area, P_area::centroid, G_debug(), G_fatal_error(), NULL, and Map_info::plus.
Referenced by Vect_get_area_cats().
int Vect_get_area_isle | ( | struct Map_info * | Map, |
int | area, | ||
int | isle | ||
) |
Returns isle id for area.
Map | pointer to Map_info structure |
area | area id |
isle | isle index (0 .. nisles - 1) |
Definition at line 236 of file vector/Vlib/area.c.
References _, Plus_head::Area, G_debug(), G_fatal_error(), P_area::isles, NULL, and Map_info::plus.
int Vect_get_area_num_isles | ( | struct Map_info * | Map, |
int | area | ||
) |
Returns number of isles for given area.
Map | pointer to Map_info structure |
area | area id |
Definition at line 208 of file vector/Vlib/area.c.
References _, Plus_head::Area, G_debug(), G_fatal_error(), P_area::n_isles, NULL, and Map_info::plus.
double Vect_get_area_perimeter | ( | struct Map_info * | Map, |
int | area | ||
) |
Returns perimeter of area with perimeter of isles.
Map | pointer to Map_info structure |
area | area id |
Definition at line 290 of file vector/Vlib/area.c.
Returns polygon array of points (outer ring) of given area.
Map | pointer to Map_info structure | |
area | area id | |
[out] | BPoints | points array |
Definition at line 37 of file vector/Vlib/area.c.
References _, Plus_head::Area, G_debug(), G_warning(), P_area::lines, P_area::n_lines, NULL, Map_info::plus, Vect__get_area_points(), and Vect_reset_line().
Referenced by vector2perimeters().
int Vect_get_isle_area | ( | struct Map_info * | Map, |
int | isle | ||
) |
Returns area id for isle.
Map | vector |
isle | isle number (0 .. nisles - 1) |
Definition at line 263 of file vector/Vlib/area.c.
References _, P_isle::area, G_debug(), G_fatal_error(), Plus_head::Isle, NULL, and Map_info::plus.
Creates list of boundaries for given isle.
Note that ids in List can be negative. The sign indicates in which direction the boundary should be read (negative for forward).
Map | pointer to Map_info structure | |
isle | island number | |
[out] | List | pointer to list where boundaries are stored |
Definition at line 175 of file vector/Vlib/area.c.
Returns polygon array of points for given isle.
Map | pointer to Map_info structure | |
isle | island id | |
[out] | BPoints | points array |
Definition at line 68 of file vector/Vlib/area.c.
References _, Format_info_pg::cache, Format_info_cache::ctype, Map_info::fInfo, Map_info::format, G_debug(), G_fatal_error(), G_warning(), GV_FORMAT_POSTGIS, Plus_head::Isle, P_isle::lines, P_isle::n_lines, NULL, Format_info::pg, Map_info::plus, Format_info_pg::toposchema_name, Vect__get_area_points_nat(), Vect__get_area_points_pg(), and Vect_reset_line().
int Vect_point_in_area | ( | double | x, |
double | y, | ||
struct Map_info * | Map, | ||
int | area, | ||
struct bound_box * | box | ||
) |
Check if point is in area.
x,y | point coordinates |
Map | pointer to Map_info structure |
area | area id |
box | area bounding box |
Definition at line 334 of file vector/Vlib/area.c.