40static void init_parts(
struct geom_parts *);
41static void reset_parts(
struct geom_parts *);
42static void free_parts(
struct geom_parts *);
43static void add_part(
struct geom_parts *,
int);
44static void del_part(
struct geom_parts *);
48 struct line_pnts *,
int,
struct geom_parts *);
51#include "pg_local_proto.h"
56static void build_pg(
struct Map_info *,
int);
62static void build_ogr(
struct Map_info *,
int);
67void init_parts(
struct geom_parts *
parts)
75void reset_parts(
struct geom_parts *
parts)
83void free_parts(
struct geom_parts *
parts)
106void del_part(
struct geom_parts *
parts)
115 struct geom_parts *
parts)
125 for (i = 0; i <
parts->n_parts; i++) {
138 struct geom_parts *
parts)
157 G_debug(4,
"Line registered with line = %d", line);
174 add_parts_to_offset(offset,
parts);
185 struct geom_parts *
parts)
241 lines[0] = -lines[0];
271 G_warning(
_(
"Unable to calculate centroid for area %d"),
285 Line = plus->
Line[line];
291 Area->centroid = line;
315 struct geom_parts
parts;
355 G_warning(
_(
"Feature %d without geometry skipped"), fid);
376 G_message(
n_(
"One primitive registered",
"%d primitives registered",
379 G_message(
n_(
"One vertex registered",
"%d vertices registered", npoints),
397 struct geom_parts *
parts)
399 int i,
ret, npoints, line;
411 G_debug(4,
"add_geometry_ogr() FID = %d",
FID);
423 ogr_info->cache.lines_types[0] = -1;
439 npoints +=
ogr_info->cache.lines[0]->n_points;
448 for (i = 0; i <
nPoints; i++) {
453 npoints +=
ogr_info->cache.lines[0]->n_points;
470 ogr_info->cache.lines_alloc *
sizeof(
int));
473 i <
ogr_info->cache.lines_alloc; i++) {
475 ogr_info->cache.lines_types[i] = -1;
487 for (i = 0; i <
nPoints; i++) {
515 lines[0] = -lines[0];
542 G_warning(
_(
"Unable to calculate centroid for area %d"),
549 G_debug(4,
" Centroid: %f, %f", x, y);
555 Line = plus->
Line[line];
561 Area->centroid = line;
571 G_debug(4,
"%d geoms -> next level", nParts);
574 if (nParts >
ogr_info->cache.lines_alloc) {
575 ogr_info->cache.lines_alloc += nParts;
581 ogr_info->cache.lines_alloc *
sizeof(
int));
583 for (i =
ogr_info->cache.lines_alloc - nParts;
584 i <
ogr_info->cache.lines_alloc; i++) {
586 ogr_info->cache.lines_types[i] = -1;
591 for (i = 0; i < nParts; i++) {
617 struct geom_parts
parts;
662 G_message(
n_(
"One primitive registered",
"%d primitives registered",
665 G_message(
n_(
"One vertex registered",
"%d vertices registered", npoints),
669 G_warning(
n_(
"One feature without geometry skipped",
670 "%d features without geometry skipped",
nskipped),
719 G_fatal_error(
_(
"GRASS is not compiled with PostgreSQL support"));
724 "Vect__build_sfa()");
748 G_warning(
_(
"Feature index is built only for non-native formats. "
749 "Nothing to dump."));
754 offset = &(
Map->fInfo.ogr.offset);
756 offset = &(
Map->fInfo.pg.offset);
758 fprintf(
out,
"---------- FEATURE INDEX DUMP ----------\n");
767 "number of features: %d\n\noffset : value (fid or part idx):\n",
769 for (i = 0; i < offset->
array_num; i++) {
int Vect__build_sfa(struct Map_info *Map, int build)
Build pseudo-topology (for simple features) - internal use only.
int Vect_fidx_dump(struct Map_info *Map, FILE *out)
Dump feature index to file.
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
void G_progress(long, int)
Print progress info messages.
void G_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.
plus_t Vect_get_num_lines(struct Map_info *)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
int Vect_get_point_in_poly_isl(const struct line_pnts *, const struct line_pnts **, int, double *, double *)
Get point inside polygon but outside the islands specifiled in IPoints.
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.
const char * Vect_maptype_info(struct Map_info *)
Gets vector map format (as string)
int Vect_maptype(struct Map_info *)
Gets vector map format.
const char * Vect_get_finfo_geometry_type(struct Map_info *)
Get geometry type as string (relevant only for non-native formats)
void Vect_reset_line(struct line_pnts *)
Reset line.
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 Vect_box_copy(struct bound_box *, const struct bound_box *)
Copy box B to box A.
SF_FeatureType
Simple feature types.
#define GV_FORMAT_POSTGIS
PostGIS format.
#define GV_POINT
Feature types used in memory on run time (may change)
#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_DIRECT
OGR format (direct access)
#define GV_FORMAT_OGR
OGR format.
int dig_add_isle(struct Plus_head *, int, plus_t *, struct bound_box *)
Allocate space for new island and create boundary info from array.
int dig_area_add_isle(struct Plus_head *, int, int)
Add isle to area if does not exist yet.
int dig_cidx_add_cat(struct Plus_head *, int, int, int, int)
int dig_add_area(struct Plus_head *, int, plus_t *, struct bound_box *)
Allocate space for new area and create boundary info from array.
int dig_find_area_poly(struct line_pnts *, double *)
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)
SF_FeatureType Vect__cache_feature_pg(const char *data, int skip_polygon, int force_type, struct Format_info_cache *cache, struct feat_parts *fparts)
Read geometry from HEX data.
int Vect__open_cursor_next_line_pg(struct Format_info_pg *pg_info, int fetch_all, int built_level)
Create select cursor for sequential access (internal use only)
plus_t area
Area it exists w/in, if any.
void * topo
Topology info.
Basic topology-related info.
struct P_line ** Line
Array of vector geometries.
struct P_area ** Area
Array of areas.
struct bound_box box
Bounding box of features.
struct P_isle ** Isle
Array of isles.
int built
Highest level of topology currently available.
Feature geometry info - coordinates.
double * y
Array of Y coordinates.
double * x
Array of X coordinates.
void add_part(SYMBOL *s, SYMBPART *p)