GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-bea8435a9e
|
Vector library - spatial index (lower level functions) More...
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <grass/vector.h>
#include <grass/glocale.h>
Go to the source code of this file.
Functions | |
int | dig_spidx_init (struct Plus_head *Plus) |
Initit spatial index (nodes, lines, areas, isles) More... | |
void | dig_spidx_free_nodes (struct Plus_head *Plus) |
Free spatial index for nodes. More... | |
void | dig_spidx_free_lines (struct Plus_head *Plus) |
Free spatial index for lines. More... | |
void | dig_spidx_free_areas (struct Plus_head *Plus) |
Reset spatial index for areas. More... | |
void | dig_spidx_free_isles (struct Plus_head *Plus) |
Reset spatial index for isles. More... | |
void | dig_spidx_free (struct Plus_head *Plus) |
Free spatial index (nodes, lines, areas, isles) More... | |
int | dig_spidx_add_node (struct Plus_head *Plus, int node, double x, double y, double z) |
Add new node to spatial index. More... | |
int | dig_spidx_add_line (struct Plus_head *Plus, int line, const struct bound_box *box) |
Add new line to spatial index. More... | |
int | dig_spidx_add_area (struct Plus_head *Plus, int area, const struct bound_box *box) |
Add new area to spatial index. More... | |
int | dig_spidx_add_isle (struct Plus_head *Plus, int isle, const struct bound_box *box) |
Add new island to spatial index. More... | |
int | dig_spidx_del_node (struct Plus_head *Plus, int node) |
Delete node from spatial index. More... | |
int | dig_spidx_del_line (struct Plus_head *Plus, int line, double x, double y, double z) |
Delete line from spatial index. More... | |
int | dig_spidx_del_area (struct Plus_head *Plus, int area) |
Delete area from spatial index. More... | |
int | dig_spidx_del_isle (struct Plus_head *Plus, int isle) |
Delete isle from spatial index. More... | |
int | dig_select_nodes (struct Plus_head *Plus, const struct bound_box *box, struct ilist *list) |
Select nodes by bbox. More... | |
int | dig_find_node (struct Plus_head *Plus, double x, double y, double z) |
Find one node by coordinates. More... | |
int | dig_select_lines (struct Plus_head *Plus, const struct bound_box *box, struct boxlist *list) |
Select lines with boxes by box. More... | |
int | dig_find_line_box (struct Plus_head *Plus, int line, struct bound_box *box) |
Find box for line. More... | |
int | dig_select_areas (struct Plus_head *Plus, const struct bound_box *box, struct boxlist *list) |
Select areas with boxes by box. More... | |
int | dig_find_area_box (struct Plus_head *Plus, int area, struct bound_box *box) |
Find bounding box for given area. More... | |
int | dig_select_isles (struct Plus_head *Plus, const struct bound_box *box, struct boxlist *list) |
Select isles with boxes by box. More... | |
int | dig_find_isle_box (struct Plus_head *Plus, int isle, struct bound_box *box) |
Find box for isle. More... | |
Vector library - spatial index (lower level functions)
Vector library - spatial index - read/write (lower level functions)
Lower level functions for reading/writing/manipulating vectors.
(C) 2001-2009 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 spindex.c.
Find bounding box for given area.
Plus | pointer to Plus_head structure | |
area | area id | |
[out] | box | bounding box |
Definition at line 919 of file spindex.c.
References Plus_head::Area, Plus_head::Area_spidx, RTree_Rect::boundary, G_debug(), G_malloc, if(), Plus_head::Line, P_area::lines, P_topo_b::N1, Plus_head::Node, RTreeSearch(), Plus_head::Spidx_new, P_line::topo, P_node::x, P_node::y, and P_node::z.
Referenced by Vect_get_area_box().
Find box for isle.
Plus | pointer to Plus_head structure | |
isle | isle id | |
[out] | box | bounding box |
Definition at line 1015 of file spindex.c.
References RTree_Rect::boundary, G_debug(), G_malloc, if(), Plus_head::Isle, Plus_head::Isle_spidx, Plus_head::Line, P_isle::lines, P_topo_b::N1, Plus_head::Node, RTreeSearch(), Plus_head::Spidx_new, P_line::topo, P_node::x, P_node::y, and P_node::z.
Referenced by Vect_get_isle_box().
int dig_find_node | ( | struct Plus_head * | Plus, |
double | x, | ||
double | y, | ||
double | z | ||
) |
Find one node by coordinates.
Plus | pointer to Plus_head structure |
x,y,z | coordinates |
Definition at line 718 of file spindex.c.
References RTree_Rect::boundary, G_debug(), G_malloc, Plus_head::Node_spidx, RTreeSearch(), Plus_head::Spidx_new, and x.
int dig_select_areas | ( | struct Plus_head * | Plus, |
const struct bound_box * | box, | ||
struct boxlist * | list | ||
) |
Select areas with boxes by box.
Plus | pointer to Plus_head structure |
box | bounding box |
list | boxlist of selected areas |
Definition at line 876 of file spindex.c.
References Plus_head::Area_spidx, bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_malloc, bound_box::N, RTreeSearch(), bound_box::S, Plus_head::Spidx_new, bound_box::T, and bound_box::W.
int dig_select_isles | ( | struct Plus_head * | Plus, |
const struct bound_box * | box, | ||
struct boxlist * | list | ||
) |
Select isles with boxes by box.
Plus | pointer to Plus_head structure |
box | bounding box |
list | boxlist of selected isles |
Definition at line 972 of file spindex.c.
References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_malloc, Plus_head::Isle_spidx, bound_box::N, RTreeSearch(), bound_box::S, Plus_head::Spidx_new, bound_box::T, and bound_box::W.
Referenced by Vect_select_isles_by_box().
int dig_select_lines | ( | struct Plus_head * | Plus, |
const struct bound_box * | box, | ||
struct boxlist * | list | ||
) |
Select lines with boxes by box.
Plus | pointer to Plus_head structure |
box | bounding box |
list | boxlist of selected lines |
Definition at line 760 of file spindex.c.
References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_malloc, Plus_head::Line_spidx, bound_box::N, RTreeSearch(), bound_box::S, Plus_head::Spidx_new, bound_box::T, and bound_box::W.
Select nodes by bbox.
Plus | pointer to Plus_head structure |
box | bounding box |
list | list of selected lines |
Definition at line 669 of file spindex.c.
References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_malloc, bound_box::N, Plus_head::Node_spidx, RTreeSearch(), bound_box::S, Plus_head::Spidx_new, bound_box::T, and bound_box::W.
Referenced by Vect_select_nodes_by_box().
Add new area to spatial index.
Plus | pointer to Plus_head structure |
area | area id |
box | bounding box |
Definition at line 360 of file spindex.c.
References Plus_head::Area_spidx, bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_malloc, bound_box::N, RTreeInsertRect(), bound_box::S, bound_box::T, and bound_box::W.
Add new island to spatial index.
Plus | pointer to Plus_head structure |
isle | isle id |
box | bounding box |
Definition at line 395 of file spindex.c.
References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_malloc, Plus_head::Isle_spidx, bound_box::N, RTreeInsertRect(), bound_box::S, bound_box::T, and bound_box::W.
int dig_spidx_add_node | ( | struct Plus_head * | Plus, |
int | node, | ||
double | x, | ||
double | y, | ||
double | z | ||
) |
Add new node to spatial index.
Plus | pointer to Plus_head structure |
node | node id |
x,y,z | node coordinates |
Definition at line 291 of file spindex.c.
References RTree_Rect::boundary, G_debug(), G_malloc, Plus_head::Node_spidx, RTreeInsertRect(), and x.
Referenced by dig_add_node().
int dig_spidx_del_area | ( | struct Plus_head * | Plus, |
int | area | ||
) |
Delete area from spatial index.
G_fatal_error() called on error.
Plus | pointer to Plus_head structure |
area | area id |
Definition at line 515 of file spindex.c.
References _, Plus_head::Area, Plus_head::Area_spidx, RTree_Rect::boundary, G_debug(), G_fatal_error(), G_malloc, Plus_head::Line, P_area::lines, P_topo_b::N1, Plus_head::Node, NULL, RTreeDeleteRect(), P_line::topo, P_node::x, P_node::y, and P_node::z.
int dig_spidx_del_isle | ( | struct Plus_head * | Plus, |
int | isle | ||
) |
Delete isle from spatial index.
G_fatal_error() called on error.
Plus | pointer to Plus_head structure |
isle | isle id |
Definition at line 568 of file spindex.c.
References _, RTree_Rect::boundary, G_debug(), G_fatal_error(), G_malloc, Plus_head::Isle, Plus_head::Isle_spidx, Plus_head::Line, P_isle::lines, P_topo_b::N1, Plus_head::Node, RTreeDeleteRect(), P_line::topo, P_node::x, P_node::y, and P_node::z.
int dig_spidx_del_line | ( | struct Plus_head * | Plus, |
int | line, | ||
double | x, | ||
double | y, | ||
double | z | ||
) |
Delete line from spatial index.
G_fatal_error() called on error.
Plus | pointer to Plus_head structure |
line | line id |
x,y,z | coordinates |
int dig_spidx_del_node | ( | struct Plus_head * | Plus, |
int | node | ||
) |
Delete node from spatial index.
G_fatal_error() called on error.
Plus | pointer to Plus_head structure |
node | node id |
Definition at line 430 of file spindex.c.
References _, RTree_Rect::boundary, G_debug(), G_fatal_error(), G_malloc, Plus_head::Node, Plus_head::Node_spidx, RTreeDeleteRect(), P_node::x, P_node::y, and P_node::z.
void dig_spidx_free | ( | struct Plus_head * | Plus | ) |
Free spatial index (nodes, lines, areas, isles)
Plus | pointer to Plus_head structure |
Definition at line 243 of file spindex.c.
References Plus_head::Area_spidx, RTree::fd, Plus_head::Isle_spidx, Plus_head::Line_spidx, Plus_head::Node_spidx, RTreeDestroyTree(), and Plus_head::Spidx_new.
Referenced by dig_free_plus(), and dig_Rd_spidx().
void dig_spidx_free_areas | ( | struct Plus_head * | Plus | ) |
Reset spatial index for areas.
Plus | pointer to Plus_head structure |
Definition at line 177 of file spindex.c.
References Plus_head::Area_spidx, RTree::fd, and Plus_head::with_z.
void dig_spidx_free_isles | ( | struct Plus_head * | Plus | ) |
Reset spatial index for isles.
Plus | pointer to Plus_head structure |
Definition at line 210 of file spindex.c.
References RTree::fd, Plus_head::Isle_spidx, and Plus_head::with_z.
void dig_spidx_free_lines | ( | struct Plus_head * | Plus | ) |
Free spatial index for lines.
Plus | pointer to Plus_head structure |
Definition at line 144 of file spindex.c.
References RTree::fd, Plus_head::Line_spidx, and Plus_head::with_z.
void dig_spidx_free_nodes | ( | struct Plus_head * | Plus | ) |
Free spatial index for nodes.
Plus | pointer to Plus_head structure |
Definition at line 111 of file spindex.c.
References RTree::fd, Plus_head::Node_spidx, and Plus_head::with_z.
int dig_spidx_init | ( | struct Plus_head * | Plus | ) |
Initit spatial index (nodes, lines, areas, isles)
Plus | pointer to Plus_head structure |
Definition at line 35 of file spindex.c.
References G_debug(), Plus_head::Spidx_file, Plus_head::spidx_with_z, and Plus_head::with_z.
Referenced by dig_init_plus(), and dig_Rd_spidx().