23#define HUGE_VAL 9999999999999.0
34static int sort_by_size(
const void *a,
const void *
b)
36 BOX_SIZE *
as = (BOX_SIZE *)a;
37 BOX_SIZE *
bs = (BOX_SIZE *)
b;
39 if (
as->size <
bs->size)
42 return (
as->size >
bs->size);
65 G_debug(3,
"Vect_find_node() for %f %f %f maxdist = %f",
ux,
uy,
uz,
92 for (i = 0; i <
nnodes; i++) {
100 G_debug(3,
" nearest node %d in distance %f",
NList->value[node],
105 return (
NList->value[node]);
160 int type,
double maxdist,
int with_z,
169 static int first_time = 1;
173 G_debug(3,
"Vect_find_line_list() for %f %f %f type = %d maxdist = %f",
ux,
204 for (i = 0; i <
List->n_values; i++) {
207 G_debug(3,
" line = %d exclude", line);
268 G_debug(3,
"Vect_find_area() x = %f y = %f",
x, y);
286 G_debug(3,
" %d areas selected by box",
List->n_values);
300 for (i = 0; i <
List->n_values; i++) {
307 if (
List->n_values == 2) {
316 else if (
List->n_values > 2)
319 for (i = 0; i <
List->n_values; i++) {
324 G_debug(3,
" area = %d Vect_point_in_area_outer_ring() = %d", area,
329 Area =
Plus->Area[area];
335 G_debug(3,
" area = %d Vect_point_in_island() = %d", area,
365 static int first = 1;
372 G_debug(3,
"Vect_find_island() x = %f y = %f",
x,
y);
388 G_debug(3,
" %d islands selected by box",
List->n_values);
392 for (i = 0; i <
List->n_values; i++) {
double G_area_of_polygon(const double *, const double *, int)
Area in square meters of polygon.
int G_debug(int, const char *,...) __attribute__((format(printf
int G_begin_polygon_area_calculations(void)
Begin polygon area calculations.
int Vect_get_node_coor(struct Map_info *, int, double *, double *, double *)
Get node coordinates.
int Vect_select_isles_by_box(struct Map_info *, const struct bound_box *, struct boxlist *)
Select isles with bounding boxes by box.
int Vect_point_in_island(double, double, struct Map_info *, int, struct bound_box *)
Determines if a point (X,Y) is inside an island.
struct boxlist * Vect_new_boxlist(int)
Creates and initializes a struct boxlist.
void Vect_destroy_boxlist(struct boxlist *)
Frees all memory associated with a struct boxlist, including the struct itself.
int Vect_get_isle_points(struct Map_info *, int, struct line_pnts *)
Returns polygon array of points for given isle.
void Vect_destroy_list(struct ilist *)
Frees all memory associated with a struct ilist, including the struct itself.
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
int Vect_line_distance(const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *)
Calculate distance of point to line.
double Vect_points_distance(double, double, double, double, double, double, int)
Calculate distance of 2 points.
int Vect_point_in_area_outer_ring(double, double, struct Map_info *, int, struct bound_box *)
Determines if a point (X,Y) is inside an area outer ring. Islands are not considered.
int Vect_select_areas_by_box(struct Map_info *, const struct bound_box *, struct boxlist *)
Select areas with bounding boxes by box.
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_select_lines_by_box(struct Map_info *, const struct bound_box *, int, struct boxlist *)
Select lines with bounding boxes by box.
int Vect_get_isle_box(struct Map_info *, int, struct bound_box *)
Get bounding box of isle.
int Vect_val_in_list(const struct ilist *, int)
Find a given item in the list.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_reset_list(struct ilist *)
Reset ilist structure.
int Vect_select_nodes_by_box(struct Map_info *, const struct bound_box *, struct ilist *)
Select nodes by box.
#define PORT_DOUBLE_MAX
Limits for portable types.
plus_t n_isles
Number of islands inside.
plus_t * isles
1st generation interior islands
Basic topology-related info.
List of bounding boxes with id.
struct bound_box * box
Array of bounding boxes.
Feature geometry info - coordinates.
double * y
Array of Y coordinates.
double * x
Array of X coordinates.
int n_points
Number of points.
int Vect_find_area(struct Map_info *Map, double x, double y)
Find the nearest area.
int Vect_find_line(struct Map_info *map, double ux, double uy, double uz, int type, double maxdist, int with_z, int exclude)
Find the nearest line.
int Vect_find_line_list(struct Map_info *map, double ux, double uy, double uz, int type, double maxdist, int with_z, const struct ilist *exclude, struct ilist *found)
Find the nearest line(s).
int Vect_find_node(struct Map_info *Map, double ux, double uy, double uz, double maxdist, int with_z)
Find the nearest node.
int Vect_find_island(struct Map_info *Map, double x, double y)
Find the nearest island.