38static void init_parts(
struct geom_parts *);
39static void reset_parts(
struct geom_parts *);
40static void free_parts(
struct geom_parts *);
41static void add_part(
struct geom_parts *,
int);
42static void del_part(
struct geom_parts *);
46 struct line_pnts *,
int,
struct geom_parts *);
49#include "pg_local_proto.h"
54static void build_pg(
struct Map_info *,
int);
60static void build_ogr(
struct Map_info *,
int);
65void init_parts(
struct geom_parts *
parts)
73void reset_parts(
struct geom_parts *
parts)
81void free_parts(
struct geom_parts *
parts)
104void del_part(
struct geom_parts *
parts)
113 struct geom_parts *
parts)
123 for (i = 0; i <
parts->n_parts; i++) {
136 struct geom_parts *
parts)
155 G_debug(4,
"Line registered with line = %d", line);
172 add_parts_to_offset(offset,
parts);
183 struct geom_parts *
parts)
239 lines[0] = -lines[0];
269 G_warning(
_(
"Unable to calculate centroid for area %d"),
283 Line = plus->
Line[line];
289 Area->centroid = line;
313 struct geom_parts
parts;
353 G_warning(
_(
"Feature %d without geometry skipped"), fid);
374 G_message(
n_(
"One primitive registered",
"%d primitives registered",
377 G_message(
n_(
"One vertex registered",
"%d vertices registered", npoints),
395 struct geom_parts *
parts)
397 int i,
ret, npoints, line;
409 G_debug(4,
"add_geometry_ogr() FID = %d",
FID);
421 ogr_info->cache.lines_types[0] = -1;
437 npoints +=
ogr_info->cache.lines[0]->n_points;
446 for (i = 0; i <
nPoints; i++) {
451 npoints +=
ogr_info->cache.lines[0]->n_points;
468 ogr_info->cache.lines_alloc *
sizeof(
int));
471 i <
ogr_info->cache.lines_alloc; i++) {
473 ogr_info->cache.lines_types[i] = -1;
485 for (i = 0; i <
nPoints; i++) {
513 lines[0] = -lines[0];
540 G_warning(
_(
"Unable to calculate centroid for area %d"),
547 G_debug(4,
" Centroid: %f, %f", x, y);
553 Line = plus->
Line[line];
559 Area->centroid = line;
569 G_debug(4,
"%d geoms -> next level", nParts);
572 if (nParts >
ogr_info->cache.lines_alloc) {
573 ogr_info->cache.lines_alloc += nParts;
579 ogr_info->cache.lines_alloc *
sizeof(
int));
581 for (i =
ogr_info->cache.lines_alloc - nParts;
582 i <
ogr_info->cache.lines_alloc; i++) {
584 ogr_info->cache.lines_types[i] = -1;
589 for (i = 0; i < nParts; i++) {
615 struct geom_parts
parts;
660 G_message(
n_(
"One primitive registered",
"%d primitives registered",
663 G_message(
n_(
"One vertex registered",
"%d vertices registered", npoints),
667 G_warning(
n_(
"One feature without geometry skipped",
668 "%d features without geometry skipped",
nskipped),
717 G_fatal_error(
_(
"GRASS is not compiled with PostgreSQL support"));
722 "Vect__build_sfa()");
746 G_warning(
_(
"Feature index is built only for non-native formats. "
747 "Nothing to dump."));
752 offset = &(
Map->fInfo.ogr.offset);
754 offset = &(
Map->fInfo.pg.offset);
756 fprintf(
out,
"---------- FEATURE INDEX DUMP ----------\n");
765 "number of features: %d\n\noffset : value (fid or part idx):\n",
767 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)