16 #include <sys/types.h>
21 static int add_line(
struct Plus_head *plus,
int lineid,
int type,
25 int node, lp, node_new;
29 line = plus->
Line[lineid];
54 G_debug(3,
"Register node: type = %d, %f,%f", type, Points->
x[0],
62 G_debug(3,
"Add new node: %d", node);
66 G_debug(3,
"Old node found: %d", node);
91 G_debug(3,
"Register node %f,%f", Points->
x[lp], Points->
y[lp]);
96 G_debug(3,
"Add new node: %d", node);
100 G_debug(3,
"Old node found: %d", node);
146 ret = add_line(plus, plus->
n_lines + 1, type, Points, box, offset);
191 const struct bound_box *box, off_t offset)
193 if (lineid < 1 || lineid > plus->
n_lines) {
197 return add_line(plus, lineid, type, Points, box, offset);
223 G_debug(3,
"dig_del_line() line = %d", line);
225 Line = plus->
Line[line];
255 while (i < Node->n_lines && Node->
lines[i] != line)
260 _(
"Attempt to delete not registered line %d from node %d"), line,
265 while (i < Node->n_lines) {
276 G_debug(3,
" node %d has 0 lines -> delete",
N1);
296 while (i < Node->n_lines && Node->
lines[i] != -line)
301 _(
"Attempt to delete not registered line %d from node %d"), -line,
306 while (i < Node->n_lines) {
317 G_debug(3,
" node %d has 0 lines -> delete",
N2);
347 Line = plus->
Line[line];
357 "dig_line_get_area(): line = %d, side = %d (left), area = %d",
358 line, side, topo->
left);
363 "dig_line_get_area(): line = %d, side = %d (right), area = %d",
364 line, side, topo->
right);
366 return (topo->
right);
388 Line = plus->
Line[line];
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
#define GV_POINT
Feature types used in memory on run time (may change)
#define GV_LEFT
Boundary side indicator left/right.
void dig_free_line(struct P_line *)
Free line structure.
void dig_free_node(struct P_node *)
Free node structure.
void dig_node_add_updated(struct Plus_head *, int)
Add node to updated.
int dig_node_add_line(struct Plus_head *, int, int, const struct line_pnts *, int)
Add line info to node.
int dig_find_node(struct Plus_head *, double, double, double)
Find one node by coordinates.
void * dig_alloc_topo(char)
Allocate new topo struct.
int dig_spidx_del_line(struct Plus_head *, int, double, double, double)
Delete line from spatial index.
int dig_alloc_lines(struct Plus_head *, int)
Reallocate array of pointers to lines.
int dig_spidx_del_node(struct Plus_head *, int)
Delete node from spatial index.
void dig_line_add_updated(struct Plus_head *, int, off_t)
Add new line to updated.
struct P_line * dig_alloc_line(void)
Allocate new line structure.
int dig_add_node(struct Plus_head *, double, double, double)
Add new node to plus structure.
int dig_spidx_add_line(struct Plus_head *, int, const struct bound_box *)
Add new line to spatial index.
int dig_add_line(struct Plus_head *plus, int type, const struct line_pnts *Points, const struct bound_box *box, off_t offset)
Add new line to Plus_head structure.
int dig_del_line(struct Plus_head *plus, int line, double x, double y, double z)
Delete line from Plus_head structure.
plus_t dig_line_get_area(struct Plus_head *plus, plus_t line, int side)
Get area number on line side.
int dig_restore_line(struct Plus_head *plus, int lineid, int type, const struct line_pnts *Points, const struct bound_box *box, off_t offset)
Restore line in Plus_head structure.
int dig_line_set_area(struct Plus_head *plus, plus_t line, int side, plus_t area)
Set area number on line side.
off_t offset
Offset in coor file for line.
void * topo
Topology info.
Topological feature - node.
plus_t n_lines
Number of attached lines (size of lines, angle)
float * angles
List of angles of connected lines.
plus_t * lines
List of connected lines.
double z
Z coordinate (used only for 3D data)
plus_t left
Area number to the left, negative for isle.
plus_t right
Area number to the right, negative for isle.
plus_t area
Area number, negative for duplicate centroid.
Basic topology-related info.
int do_uplist
Indicates if the list of updated features is maintained.
plus_t n_klines
Current number of kernels.
plus_t alloc_lines
Number of allocated lines.
struct P_line ** Line
Array of vector geometries.
plus_t n_lines
Current number of lines.
plus_t n_plines
Current number of points.
plus_t n_blines
Current number of boundaries.
plus_t n_clines
Current number of centroids.
struct Plus_head::@10 uplist
List of updated lines/nodes.
struct P_node ** Node
Array of nodes.
plus_t n_flines
Current number of faces.
plus_t n_llines
Current number of lines.
Feature geometry info - coordinates.
double * y
Array of Y coordinates.
double * x
Array of X coordinates.
int n_points
Number of points.
double * z
Array of Z coordinates.