GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
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 (const 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 (const struct Map_info *Map, int isle, struct line_pnts *BPoints) |
Returns polygon array of points for given isle. More... | |
int | Vect_get_area_centroid (const struct Map_info *Map, int area) |
Returns centroid id for given area. More... | |
int | Vect_get_area_boundaries (const struct Map_info *Map, int area, struct ilist *List) |
Creates list of boundaries for given area. More... | |
int | Vect_get_isle_boundaries (const struct Map_info *Map, int isle, struct ilist *List) |
Creates list of boundaries for given isle. More... | |
int | Vect_get_area_num_isles (const struct Map_info *Map, int area) |
Returns number of isles for given area. More... | |
int | Vect_get_area_isle (const struct Map_info *Map, int area, int isle) |
Returns isle id for area. More... | |
int | Vect_get_isle_area (const struct Map_info *Map, int isle) |
Returns area id for isle. More... | |
double | Vect_get_area_perimeter (const struct Map_info *Map, int area) |
Returns perimeter of area with perimeter of isles. More... | |
int | Vect_point_in_area (double x, double y, const struct Map_info *Map, int area, struct bound_box *box) |
Check if point is in area. More... | |
double | Vect_get_area_area (const struct Map_info *Map, int area) |
Returns area of area without areas of isles. More... | |
int | Vect_get_area_cats (const struct Map_info *Map, int area, struct line_cats *Cats) |
Get area categories. More... | |
int | Vect_get_area_cat (const struct Map_info *Map, int area, int field) |
Find FIRST category of given field and area. More... | |
int | Vect__get_area_points (const 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 (const 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 | ( | const 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 489 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 | ( | const 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 520 of file vector/Vlib/area.c.
Referenced by Vect__get_area_points(), and Vect_get_isle_points().
double Vect_get_area_area | ( | const 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 376 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 | ( | const 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 452 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 424 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 | ( | const 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 | ( | const 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 237 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 | ( | const 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 | ( | const 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 291 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 | ( | const struct Map_info * | Map, |
int | isle | ||
) |
Returns area id for isle.
Map | vector |
isle | isle number (0 .. nisles - 1) |
Definition at line 264 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 structur | |
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, | ||
const 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 335 of file vector/Vlib/area.c.