62 G_debug(3,
"nlines = %d", nlines);
64 for (i = 0; i < nlines; i++) {
81 G_debug(4,
" line1 = %d angle1 = %e line2 = %d angle2 = %e",
82 line1, angle1, line2, angle2);
84 if (angle2 == angle1) {
86 double length1, length2;
91 int short_type, long_type,
type;
92 double x, y, z, nx, ny, nz;
94 G_debug(4,
" identical angles -> clean");
100 Points->
x[0], Points->
y[0], 0.0, Points->
x[1],
101 Points->
y[1], 0.0, 0);
108 Points->
x[np - 1], Points->
y[np - 1], 0.0,
109 Points->
x[np - 2], Points->
y[np - 2], 0.0, 0);
115 Points->
x[0], Points->
y[0], 0.0, Points->
x[1],
116 Points->
y[1], 0.0, 0);
123 Points->
x[np - 1], Points->
y[np - 1], 0.0,
124 Points->
x[np - 2], Points->
y[np - 2], 0.0, 0);
127 G_debug(4,
" length1 = %f length2 = %f", length1, length2);
129 if (length1 < length2) {
142 if (short_line > 0) {
162 Map, abs(short_line), short_type, Points, SCats);
171 if (abs(line1) == abs(line2)) {
173 long_line = new_short_line;
175 long_line = -new_short_line;
184 for (j = 0; j < SCats->
n_cats; j++) {
187 for (j = 0; j < LCats->
n_cats; j++) {
int Vect_clean_small_angles_at_nodes(struct Map_info *Map, int otype, struct Map_info *Err)
Clean small angles at nodes.
void G_percent(long, long, int)
Print percent complete messages.
void void G_verbose_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
off_t Vect_rewrite_line(struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
Rewrites existing feature (topological level required)
int Vect_get_node_coor(struct Map_info *, int, double *, double *, double *)
Get node coordinates.
int Vect_reset_cats(struct line_cats *)
Reset category structure to make sure cats structure is clean to be re-used.
float Vect_get_node_line_angle(struct Map_info *, int, int)
Angle of segment of the line connected to the node.
int Vect_cat_set(struct line_cats *, int, int)
Add new field/cat to category structure if doesn't exist yet.
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
double Vect_points_distance(double, double, double, double, double, double, int)
Calculate distance of 2 points.
int Vect_delete_line(struct Map_info *, off_t)
Delete existing feature (topological level required)
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_get_node_n_lines(struct Map_info *, int)
Get number of lines for node.
plus_t Vect_get_num_nodes(struct Map_info *)
Get number of nodes in vector map.
int Vect_line_delete_point(struct line_pnts *, int)
Delete point at given index and move all points above down.
int Vect_node_alive(struct Map_info *, int)
Check if node is alive or dead (topological level required)
void Vect_reset_line(struct line_pnts *)
Reset line.
int Vect_get_node_line(struct Map_info *, int, int)
Get line id for node line index.
int Vect_line_prune(struct line_pnts *)
Remove duplicate points, i.e. zero length segments.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_append_point(struct line_pnts *, double, double, double)
Appends one point to the end of a line.
struct Plus_head plus
Plus info (topology, version, ...)
struct P_line ** Line
Array of vector geometries.
int * field
Array of layers (fields)
int * cat
Array of categories.
int n_cats
Number of categories attached to element.
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.