18 #include <sys/types.h>
37 int i, s, type, line, counter;
45 G_debug(3,
"Vect_build_nat() build = %d", build);
49 if (build == plus->
built)
53 if (build < plus->built) {
89 else if (type == -2) {
99 G_debug(3,
"Register line: offset = %lu", (
unsigned long)offset);
109 for (c = 0; c < Cats->
n_cats; c++) {
120 "%d primitives registered", plus->
n_lines),
123 "%" PRId64
" vertices registered", npoints),
139 for (line = 1; line <= plus->
n_lines; line++) {
145 Line = plus->
Line[line];
151 for (s = 0; s < 2; s++) {
157 G_debug(3,
"Build area for line = %d, side = %d", line,
163 n_(
"One area built",
"%d areas built", plus->
n_areas),
166 n_(
"One isle built",
"%d isles built", plus->
n_isles),
180 for (i = 1; i <= plus->
n_isles; i++) {
201 for (line = 1; line <= plus->
n_lines; line++) {
203 Line = plus->
Line[line];
216 G_debug(3,
"Centroid (line=%d) in area %d", line,
area);
237 for (i = 1; i <= plus->
n_areas; i++) {
246 for (c = 0; c < Cats->
n_cats; c++) {
int Vect_build_nat(struct Map_info *Map, int build)
Build topology.
void G_percent(long, long, int)
Print percent complete messages.
void G_warning(const char *,...) __attribute__((format(printf
void G_progress(long, int)
Print progress info messages.
void void G_verbose_message(const char *,...) __attribute__((format(printf
void void void G_important_message(const char *,...) __attribute__((format(printf
void G_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int Vect_build_line_area(struct Map_info *, int, int)
Build area on given side of line (GV_LEFT or GV_RIGHT)
void Vect__build_downgrade(struct Map_info *, int)
Downgrade build level (for internal use only)
int Vect_box_extend(struct bound_box *, const struct bound_box *)
Extend box A by box B.
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)
int Vect_attach_isle(struct Map_info *, int, const struct bound_box *)
(Re)Attach isle to area
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_get_isle_box(struct Map_info *, int, struct bound_box *)
Get bounding box of isle.
int Vect_rewind(struct Map_info *)
Rewind vector map to cause reads to start at beginning.
int Vect_read_next_line(struct Map_info *, struct line_pnts *, struct line_cats *)
Read next vector feature.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_find_area(struct Map_info *, double, double)
Find the nearest area.
int Vect_box_copy(struct bound_box *, const struct bound_box *)
Copy box B to box A.
#define GV_BUILD_ATTACH_ISLES
Topology levels - attach islands to areas.
#define GV_BUILD_BASE
Topology levels - basic level (without areas and isles)
#define GV_BUILD_ALL
Topology levels - build everything (currently same as GV_BUILD_CENTROIDS)
#define GV_BUILD_AREAS
Topology levels - build areas.
#define GV_BUILD_CENTROIDS
Topology levels - assign centroids to areas.
#define GV_LEFT
Boundary side indicator left/right.
int dig_cidx_add_cat(struct Plus_head *, int, int, int, int)
int dig_add_line(struct Plus_head *, int, const struct line_pnts *, const struct bound_box *, off_t)
Add new line to Plus_head structure.
int dig_line_box(const struct line_pnts *, struct bound_box *)
#define n_(strs, strp, num)
struct dig_head head
Header info.
struct Plus_head plus
Plus info (topology, version, ...)
plus_t centroid
Number of first centroid within area.
void * topo
Topology info.
plus_t area
Area number, negative for duplicate centroid.
Basic topology-related info.
struct P_line ** Line
Array of vector geometries.
plus_t n_lines
Current number of lines.
plus_t n_blines
Current number of boundaries.
struct P_area ** Area
Array of areas.
plus_t n_clines
Current number of centroids.
plus_t n_isles
Current number of isles.
struct bound_box box
Bounding box of features.
plus_t n_areas
Current number of areas.
int built
Highest level of topology currently available.
off_t last_offset
Offset of last read line.
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.