17 #include <sys/types.h> 22 static int add_line(
struct Plus_head *plus,
int lineid,
int type,
const struct line_pnts *Points,
23 const struct bound_box *box, off_t offset)
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]);
98 G_debug(3,
"Add new node: %d", node);
102 G_debug(3,
"Old node found: %d", node);
137 const struct bound_box *box, off_t offset)
148 ret = add_line(plus, plus->
n_lines + 1, type, Points, box, offset);
193 int type,
const struct line_pnts *Points,
194 const struct bound_box *box, off_t offset)
196 if (lineid < 1 || lineid > plus->
n_lines) {
200 return add_line(plus, lineid, type, Points, box, offset);
226 G_debug(3,
"dig_del_line() line = %d", line);
228 Line = plus->
Line[line];
258 while (i < Node->n_lines && Node->
lines[i] != line)
262 G_fatal_error(
_(
"Attempt to delete not registered line %d from node %d"),
267 while (i < Node->n_lines) {
278 G_debug(3,
" node %d has 0 lines -> delete", N1);
298 while (i < Node->n_lines && Node->
lines[i] != -line)
302 G_fatal_error(
_(
"Attempt to delete not registered line %d from node %d"),
307 while (i < Node->n_lines) {
318 G_debug(3,
" node %d has 0 lines -> delete",
N2);
348 Line = plus->
Line[line];
358 "dig_line_get_area(): line = %d, side = %d (left), area = %d",
359 line, side, topo->
left);
364 "dig_line_get_area(): line = %d, side = %d (right), area = %d",
365 line, side, topo->
right);
367 return (topo->
right);
389 Line = plus->
Line[line];
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
plus_t area
Area number, negative for duplicate centroid.
#define GV_LEFT
Boundary side indicator left/right.
plus_t n_klines
Current number of kernels.
off_t offset
Offset in coor file for line.
struct P_line ** Line
Array of vector geometries.
int dig_spidx_del_line(struct Plus_head *, int, double, double, double)
Delete line from spatial index.
plus_t n_plines
Current number of points.
plus_t right
Area number to the right, negative for isle.
struct P_node ** Node
Array of nodes.
void * dig_alloc_topo(char)
Allocate new topo struct.
int n_points
Number of points.
plus_t n_lines
Number of attached lines (size of lines, angle)
plus_t left
Area number to the left, negative for isle.
plus_t * lines
List of connected lines.
int do_uplist
Indicates if the list of updated features is maintained.
#define GV_POINT
Feature types used in memory on run time (may change)
plus_t n_lines
Current number of lines.
int dig_alloc_lines(struct Plus_head *, int)
Reallocate array of pointers to lines.
double * x
Array of X coordinates.
Feature geometry info - coordinates.
Basic topology-related info.
int dig_node_add_line(struct Plus_head *, int, int, const struct line_pnts *, int)
Add line info to node.
int dig_line_set_area(struct Plus_head *plus, plus_t line, int side, plus_t area)
Set area number on line side.
void dig_node_add_updated(struct Plus_head *, int)
Add node to updated.
plus_t alloc_lines
Number of allocated lines.
void * topo
Topology info.
int dig_spidx_del_node(struct Plus_head *, int)
Delete node from spatial index.
float * angles
List of angles of connected lines.
struct P_line * dig_alloc_line()
Allocate new line structure.
Topological feature - node.
void dig_line_add_updated(struct Plus_head *, int, off_t)
Add new line to updated.
plus_t n_flines
Current number of faces.
void dig_free_node(struct P_node *)
Free node structure.
double * y
Array of Y coordinates.
plus_t n_llines
Current number of lines.
int dig_add_node(struct Plus_head *, double, double, double)
Add new node to plus structure.
double * z
Array of Z coordinates.
int dig_find_node(struct Plus_head *, double, double, double)
Find one node by coordinates.
plus_t n_clines
Current number of centroids.
void dig_free_line(struct P_line *)
Free line 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.
struct Plus_head::@10 uplist
List of updated lines/nodes.
int dig_del_line(struct Plus_head *plus, int line, double x, double y, double z)
Delete line from Plus_head structure.
plus_t n_blines
Current number of boundaries.
plus_t dig_line_get_area(struct Plus_head *plus, plus_t line, int side)
Get area number on line side.
int G_debug(int, const char *,...) __attribute__((format(printf
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.