22 #include "pg_local_proto.h" 25 #include "local_proto.h" 43 G_debug(3,
"Vect_get_area_points(): area = %d", area);
47 Area = Plus->
Area[area];
50 G_warning(
_(
"Attempt to read points of nonexistent area"));
74 G_debug(3,
"Vect_get_isle_points(): isle = %d", isle);
78 Isle = Plus->
Isle[isle];
81 G_warning(
_(
"Attempt to read points of nonexistent isle"));
115 G_debug(3,
"Vect_get_area_centroid(): area = %d", area);
118 Area = Plus->
Area[area];
121 G_fatal_error(
_(
"Attempt to read topo for dead area (%d)"), area);
145 G_debug(3,
"Vect_get_area_boundaries(): area = %d", area);
150 Area = Plus->
Area[area];
153 G_fatal_error(
_(
"Attempt to read topo for dead area (%d)"), area);
155 for (i = 0; i < Area->
n_lines; i++) {
156 line = Area->
lines[i];
181 G_debug(3,
"Vect_get_isle_boundaries(): isle = %d", isle);
186 Isle = Plus->
Isle[isle];
189 G_fatal_error(
_(
"Attempt to read topo for dead isle (%d)"), isle);
191 for (i = 0; i < Isle->
n_lines; i++) {
192 line = Isle->
lines[i];
213 G_debug(3,
"Vect_get_area_num_isles(): area = %d", area);
216 Area = Plus->
Area[area];
219 G_fatal_error(
_(
"Attempt to read topo for dead area (%d)"), area);
242 G_debug(3,
"Vect_get_area_isle(): area = %d isle = %d", area, isle);
245 Area = Plus->
Area[area];
248 G_fatal_error(
_(
"Attempt to read topo for dead area (%d)"), area);
252 return (Area->
isles[isle]);
269 G_debug(3,
"Vect_get_isle_area(): isle = %d", isle);
272 Isle = Plus->
Isle[isle];
275 G_fatal_error(
_(
"Attempt to read topo for dead isle (%d)"), isle);
299 G_debug(3,
"Vect_get_area_perimeter(): area = %d", area);
303 Area = Plus->
Area[area];
310 for (i = 0; i < Area->
n_isles; i++) {
318 G_debug(3,
" perimeter = %f", d);
345 Area = Plus->
Area[area];
357 for (i = 0; i < Area->
n_isles; i++) {
358 isle = Area->
isles[i];
383 static int first_time = 1;
385 G_debug(3,
"Vect_get_area_area(): area = %d", area);
387 if (first_time == 1) {
394 Area = Plus->
Area[area];
401 for (i = 0; i < Area->
n_isles; i++) {
409 G_debug(3,
" area = %f", size);
466 for (i = 0; i < Cats->
n_cats; i++) {
467 if (Cats->
field[i] == field) {
499 G_fatal_error(
_(
"GRASS is not compiled with PostgreSQL support"));
523 int i, line, aline, dir;
530 for (i = 0; i < n_lines; i++) {
533 G_debug(5,
" append line(%d) = %d", i, line);
int Vect_get_area_cat(const struct Map_info *Map, int area, int field)
Find FIRST category of given field and area.
int Vect_append_points(struct line_pnts *, const struct line_pnts *, int)
Appends points to the end of a line.
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)
#define GV_FORWARD
Line direction indicator forward/backward.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int Vect_get_area_cats(const struct Map_info *Map, int area, struct line_cats *Cats)
Get area categories.
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.
int Vect_point_in_island(double, double, const struct Map_info *, int, struct bound_box *)
Determines if a point (X,Y) is inside an island.
int Vect_reset_list(struct ilist *)
Reset ilist structure.
int Vect_get_area_boundaries(const struct Map_info *Map, int area, struct ilist *List)
Creates list of boundaries for given area.
int Vect_point_in_area_outer_ring(double, double, const struct Map_info *, int, struct bound_box *)
Determines if a point (X,Y) is inside an area outer ring. Islands are not considered.
struct P_area ** Area
Array of areas.
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)
int n_points
Number of points.
int n_values
Number of values in the list.
struct Format_info fInfo
Format info for non-native formats.
struct P_isle ** Isle
Array of isles.
double Vect_line_geodesic_length(const struct line_pnts *)
Calculate line length.
plus_t * isles
1st generation interior islands
plus_t centroid
Number of first centroid within area.
int Vect_line_prune(struct line_pnts *)
Remove duplicate points, i.e. zero length segments.
plus_t n_lines
Number of boundary lines.
int Vect_get_area_centroid(const struct Map_info *Map, int area)
Returns centroid id for given area.
int G_begin_polygon_area_calculations(void)
Begin polygon area calculations.
double * x
Array of X coordinates.
Feature geometry info - coordinates.
plus_t * lines
List of boundary lines.
double Vect_get_area_area(const struct Map_info *Map, int area)
Returns area of area without areas of isles.
Basic topology-related info.
int Vect_get_isle_boundaries(const struct Map_info *Map, int isle, struct ilist *List)
Creates list of boundaries for given isle.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int n_cats
Number of categories attached to element.
int * cat
Array of categories.
int Vect_get_isle_area(const struct Map_info *Map, int isle)
Returns area id for isle.
plus_t * lines
List of boundary lines.
struct Plus_head plus
Plus info (topology, version, ...)
int Vect_reset_cats(struct line_cats *)
Reset category structure to make sure cats structure is clean to be re-used.
int Vect_get_isle_box(const struct Map_info *, int, struct bound_box *)
Get bounding box of isle.
plus_t n_isles
Number of islands inside.
int Vect_get_area_num_isles(const struct Map_info *Map, int area)
Returns number of isles for given area.
#define GV_FORMAT_POSTGIS
PostGIS format.
double * y
Array of Y coordinates.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect__get_area_points_pg(const struct Map_info *Map, const plus_t *lines, int n_lines, struct line_pnts *APoints)
Get area boundary points (PostGIS Topology)
double Vect_get_area_perimeter(const struct Map_info *Map, int area)
Returns perimeter of area with perimeter of isles.
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
void G_warning(const char *,...) __attribute__((format(printf
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.
int format
Map format (native, ogr, postgis)
int * field
Array of layers (fields)
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
int Vect_get_isle_points(const struct Map_info *Map, int isle, struct line_pnts *BPoints)
Returns polygon array of points for given isle.
plus_t n_lines
Number of boundary lines.
int Vect_read_line(const struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
plus_t area
Area it exists w/in, if any.
int Vect_get_area_isle(const struct Map_info *Map, int area, int isle)
Returns isle id for area.
int G_debug(int, const char *,...) __attribute__((format(printf
double G_area_of_polygon(const double *, const double *, int)
Area in square meters of polygon.
void Vect_reset_line(struct line_pnts *)
Reset line.