28#include "local_proto.h"
31#include "pg_local_proto.h"
34static void V2__add_line_to_topo_sfa(
struct Map_info *,
int,
63 G_debug(3,
"V2_write_line_sfa(): type = %d (format = %d)", type,
85 G_debug(3,
"\tline added to topo with line = %d", line);
109 G_debug(4,
"\tCentroid: x = %f, y = %f, cat = %lu, line = %d",
116 G_warning(
_(
"Unable to calculate centroid for area"));
119 V2__add_line_to_topo_sfa(
Map, line, points, cats);
122 G_debug(3,
"updated lines : %d , updated nodes : %d",
149 G_debug(3,
"V2_rewrite_line_sfa(): line=%d type=%d", (
int)line, type);
152 G_warning(
_(
"Attempt to access feature with invalid id (%d)"),
158 G_warning(
_(
"Unable to rewrite feature (incompatible feature types)"));
183 int ret, i, type, first;
189 G_debug(3,
"V2_delete_line_sfa(): line = %d", (
int)line);
196 G_warning(
_(
"Attempt to access feature with invalid id (%d)"),
206 Line =
Map->plus.Line[line];
226 for (i = 0; i <
Cats->n_cats; i++) {
286 G_fatal_error(
_(
"GRASS is not compiled with PostgreSQL support"));
291 G_warning(
_(
"Unsupported vector map format (%d)"),
Map->format);
304void V2__add_line_to_topo_sfa(
struct Map_info *
Map,
int line,
309 int type, area,
side;
316 G_debug(3,
"V2__add_line_to_topo_sfa(): line = %d npoints = %d", line,
321 Line = plus->
Line[line];
327 if (topo->N1 != topo->N2) {
328 G_warning(
_(
"Boundary is not closed. Skipping."));
333 for (s = 0; s < 2; s++) {
355 G_debug(4,
"Vect_build_line_area(): -> area = %d", area);
366 for (i = 0; i < cats->
n_cats; i++) {
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(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.
int Vect_attach_centroids(struct Map_info *, const struct bound_box *)
(Re)Attach centroids in given bounding box to areas
int V1_delete_line_pg(struct Map_info *, off_t)
Deletes feature at the given offset (level 1)
int Vect_build_line_area(struct Map_info *, int, int)
Build area on given side of line (GV_LEFT or GV_RIGHT)
off_t V1_write_line_ogr(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes feature on level 1 (OGR interface)
int Vect_box_extend(struct bound_box *, const struct bound_box *)
Extend box A by box B.
int Vect_get_point_in_poly(const struct line_pnts *, double *, double *)
Get point inside polygon.
int Vect_get_area_box(struct Map_info *, int, struct bound_box *)
Get bounding box of area.
int V1_delete_line_ogr(struct Map_info *, off_t)
Deletes feature at the given offset on level 1 (OGR interface)
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_get_isle_box(struct Map_info *, int, struct bound_box *)
Get bounding box of isle.
int Vect_attach_isles(struct Map_info *, const struct bound_box *)
(Re)Attach isles in given bounding box to areas
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_append_point(struct line_pnts *, double, double, double)
Appends one point to the end of a line.
int V2_read_line_sfa(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Reads feature from OGR/PostGIS layer on topological level.
int Vect_box_copy(struct bound_box *, const struct bound_box *)
Copy box B to box A.
off_t V1_write_line_pg(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes feature on level 1 (PostGIS interface)
#define GV_FORMAT_POSTGIS
PostGIS format.
#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_AREAS
Topology levels - build areas.
#define GV_BUILD_CENTROIDS
Topology levels - assign centroids to areas.
#define GV_FORMAT_OGR
OGR format.
#define GV_LEFT
Boundary side indicator left/right.
int dig_cidx_add_cat(struct Plus_head *, int, int, int, int)
int dig_del_line(struct Plus_head *, int, double, double, double)
Delete line from Plus_head structure.
int dig_cidx_del_cat(struct Plus_head *, int, int, int, int)
int dig_cidx_add_cat_sorted(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 *)
off_t offset
Offset in coor file for line.
void * topo
Topology info.
Basic topology-related info.
struct P_line ** Line
Array of vector geometries.
int cidx_up_to_date
Category index to be updated.
int update_cidx
Update category index if vector is modified.
struct Plus_head::@10 uplist
List of updated lines/nodes.
struct bound_box box
Bounding box of features.
int built
Highest level of topology currently available.
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.
off_t V2__write_area_ogr(struct Map_info *Map, const struct line_pnts **points, int nparts, const struct line_cats *cats)
Writes area on topological level (OGR Simple Features interface, internal use only)
off_t V2__write_area_pg(struct Map_info *Map, const struct line_pnts **points, int nparts, const struct line_cats *cats)
Writes area on topological level (PostGIS Simple Features interface, internal use only)
int V2_delete_line_sfa(struct Map_info *Map, off_t line)
Deletes feature on level 2 (OGR/PostGIS interface)
off_t V2_rewrite_line_sfa(struct Map_info *Map, off_t line, int type, const struct line_pnts *points, const struct line_cats *cats)
Rewrites feature at the given offset on level 2 (OGR/PostGIS interface, pseudo-topological level)
off_t V2__write_area_sfa(struct Map_info *Map, const struct line_pnts **points, int nparts, const struct line_cats *cats)
Writes area on topological level (Simple Features interface, internal use only)
off_t V2_write_line_sfa(struct Map_info *Map, int type, const struct line_pnts *points, const struct line_cats *cats)
Writes feature on level 2 (OGR/PostGIS interface, pseudo-topological level)