[GRASS-SVN] r51984 - in grass/trunk: include/defs lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 6 06:26:10 PDT 2012
Author: martinl
Date: 2012-06-06 06:26:09 -0700 (Wed, 06 Jun 2012)
New Revision: 51984
Modified:
grass/trunk/include/defs/vector.h
grass/trunk/lib/vector/Vlib/build.c
grass/trunk/lib/vector/Vlib/build_pg.c
grass/trunk/lib/vector/Vlib/close.c
grass/trunk/lib/vector/Vlib/close_pg.c
grass/trunk/lib/vector/Vlib/open.c
grass/trunk/lib/vector/Vlib/read.c
grass/trunk/lib/vector/Vlib/read_pg.c
Log:
partly revert r51975 - keep two level (level 3 is reserved for 3D topology)
Modified: grass/trunk/include/defs/vector.h
===================================================================
--- grass/trunk/include/defs/vector.h 2012-06-06 11:09:01 UTC (rev 51983)
+++ grass/trunk/include/defs/vector.h 2012-06-06 13:26:09 UTC (rev 51984)
@@ -503,7 +503,7 @@
struct line_cats *, int);
int V2_read_line_sfa(struct Map_info *, struct line_pnts *,
struct line_cats *, int);
-int V3_read_line_pg(struct Map_info *, struct line_pnts *,
+int V2_read_line_pg(struct Map_info *, struct line_pnts *,
struct line_cats *, int);
int V1_read_next_line_nat(struct Map_info *, struct line_pnts *,
struct line_cats *);
@@ -517,8 +517,6 @@
struct line_cats *);
int V2_read_next_line_pg(struct Map_info *, struct line_pnts *,
struct line_cats *);
-int V3_read_next_line_pg(struct Map_info *, struct line_pnts *,
- struct line_cats *);
int V1_delete_line_nat(struct Map_info *, off_t);
int V1_delete_line_ogr(struct Map_info *, off_t);
int V1_delete_line_pg(struct Map_info *, off_t);
Modified: grass/trunk/lib/vector/Vlib/build.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build.c 2012-06-06 11:09:01 UTC (rev 51983)
+++ grass/trunk/lib/vector/Vlib/build.c 2012-06-06 13:26:09 UTC (rev 51984)
@@ -793,8 +793,7 @@
G_verbose_message(_("Topology was built"));
}
- if (Map->level == 1)
- Map->level = LEVEL_2;
+ Map->level = LEVEL_2;
plus->mode = GV_MODE_WRITE;
if (build == GV_BUILD_ALL) {
Modified: grass/trunk/lib/vector/Vlib/build_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build_pg.c 2012-06-06 11:09:01 UTC (rev 51983)
+++ grass/trunk/lib/vector/Vlib/build_pg.c 2012-06-06 13:26:09 UTC (rev 51984)
@@ -145,7 +145,6 @@
}
plus->built = build;
- Map->level = 3;
return 1;
}
Modified: grass/trunk/lib/vector/Vlib/close.c
===================================================================
--- grass/trunk/lib/vector/Vlib/close.c 2012-06-06 11:09:01 UTC (rev 51983)
+++ grass/trunk/lib/vector/Vlib/close.c 2012-06-06 13:26:09 UTC (rev 51984)
@@ -122,8 +122,8 @@
/* write out fidx file */
if (Map->format == GV_FORMAT_OGR)
V2_close_ogr(Map);
- else if (Map->format == GV_FORMAT_POSTGIS && Map->level == 2)
- V2_close_pg(Map);
+ else if (Map->format == GV_FORMAT_POSTGIS)
+ V2_close_pg(Map);
}
else {
/* spatial index must also be closed when opened with topo but
Modified: grass/trunk/lib/vector/Vlib/close_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/close_pg.c 2012-06-06 11:09:01 UTC (rev 51983)
+++ grass/trunk/lib/vector/Vlib/close_pg.c 2012-06-06 13:26:09 UTC (rev 51984)
@@ -109,6 +109,9 @@
if (!VECT_OPEN(Map))
return -1;
+ if (Map->fInfo.pg.toposchema_name) /* no fidx file for PostGIS topology */
+ return 0;
+
/* write fidx for maps in the current mapset */
if (Vect_save_fidx(Map, &(Map->fInfo.pg.offset)) != 1)
G_warning(_("Unable to save feature index file for vector map <%s>"),
Modified: grass/trunk/lib/vector/Vlib/open.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open.c 2012-06-06 11:09:01 UTC (rev 51983)
+++ grass/trunk/lib/vector/Vlib/open.c 2012-06-06 13:26:09 UTC (rev 51984)
@@ -32,18 +32,13 @@
/*
\brief Number of levels
- Native format:
- 1 without topology
- - 2 with topology
- OGR-links:
- - 1 without topology
- - 2 with pseudo-topology (simple features access)
- PG-links:
- - 1 without topology
- - 2 with pseudo-topology (simple features access)
- - 3 with topology (PostGIS Topology access)
+ - 2 with 2D topology
+
+ \todo Implement
+ - 3 with 3D topology
*/
-#define MAX_OPEN_LEVEL 3
+#define MAX_OPEN_LEVEL 2
static int open_old_dummy()
{
@@ -320,9 +315,6 @@
Vect_get_full_name(Map));
}
}
- else {
- level = 3; /* PostGIS topology available */
- }
/* open spatial index */
if (level >= 2) {
@@ -528,8 +520,7 @@
if (access(file_path, F_OK) == 0) /* cidx file exists? */
unlink(file_path);
- if (format == GV_FORMAT_OGR ||
- (format == GV_FORMAT_POSTGIS && level == 2)) {
+ if (format == GV_FORMAT_OGR || format == GV_FORMAT_POSTGIS) {
G_file_name(file_path, buf, GV_FIDX_ELEMENT, G_mapset());
if (access(file_path, F_OK) == 0) /* fidx file exists? */
unlink(file_path);
Modified: grass/trunk/lib/vector/Vlib/read.c
===================================================================
--- grass/trunk/lib/vector/Vlib/read.c 2012-06-06 11:09:01 UTC (rev 51983)
+++ grass/trunk/lib/vector/Vlib/read.c 2012-06-06 13:26:09 UTC (rev 51984)
@@ -34,53 +34,46 @@
}
#endif
-static int (*Read_next_line_array[][4]) () = {
+static int (*Read_next_line_array[][3]) () = {
{
- read_dummy, V1_read_next_line_nat, V2_read_next_line_nat, read_dummy}
+ read_dummy, V1_read_next_line_nat, V2_read_next_line_nat}
#ifdef HAVE_OGR
, {
- read_dummy, V1_read_next_line_ogr, V2_read_next_line_ogr, read_dummy}
+ read_dummy, V1_read_next_line_ogr, V2_read_next_line_ogr}
, {
- read_dummy, V1_read_next_line_ogr, V2_read_next_line_ogr, read_dummy}
+ read_dummy, V1_read_next_line_ogr, V2_read_next_line_ogr}
#else
, {
- read_dummy, format, format, format}
+ read_dummy, format, format}
, {
- read_dummy, format, format, format}
+ read_dummy, format, format}
#endif
#ifdef HAVE_POSTGRES
, {
- read_dummy, V1_read_next_line_pg, V2_read_next_line_pg, V3_read_next_line_pg}
+ read_dummy, V1_read_next_line_pg, V2_read_next_line_pg}
#else
, {
read_dummy, format, format, format}
#endif
};
-static int (*Read_line_array[][2]) () = {
- {
- V2_read_line_nat, read_dummy}
+static int (*Read_line_array[]) () = {
+ V2_read_line_nat
#ifdef HAVE_OGR
- , {
- V2_read_line_sfa, read_dummy}
- , {
- V2_read_line_sfa, read_dummy}
+ , V2_read_line_sfa
+ , V2_read_line_sfa
#else
- , {
- format, format}
- , {
- format, format}
+ , format
+ , format
#endif
#ifdef HAVE_POSTGRES
- , {
- V2_read_line_sfa, V3_read_line_pg}
+ , V2_read_line_pg
#else
- , {
- format, format}
+ , format
#endif
};
-
+
/*!
\brief Get line id for sequential reading.
@@ -176,7 +169,7 @@
"(max features in vector map <%s>: %d)"),
line, Vect_get_full_name(Map), Map->plus.n_lines);
- ret = (*Read_line_array[Map->format][Map->level == 3 ? 1 : 0]) (Map, line_p, line_c, line);
+ ret = (*Read_line_array[Map->format]) (Map, line_p, line_c, line);
/*
if (ret == -1)
Modified: grass/trunk/lib/vector/Vlib/read_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/read_pg.c 2012-06-06 11:09:01 UTC (rev 51983)
+++ grass/trunk/lib/vector/Vlib/read_pg.c 2012-06-06 13:26:09 UTC (rev 51984)
@@ -201,28 +201,6 @@
}
/*!
- \brief Read next feature from PostGIS layer on topological level
- (PostGIS topology access).
-
- This function implements sequential access.
-
- \param Map pointer to Map_info structure
- \param[out] line_p container used to store line points within
- (pointer to line_pnts struct)
- \param[out] line_c container used to store line categories within
- (pointer to line_cats struct)
-
- \return feature type
- \return -2 no more features (EOF)
- \return -1 on failure
- */
-int V3_read_next_line_pg(struct Map_info *Map, struct line_pnts *line_p,
- struct line_cats *line_c)
-{
- return V2_read_next_line_pg(Map, line_p, line_c);
-}
-
-/*!
\brief Read feature from PostGIS layer at given offset (level 1 without topology)
This function implements random access on level 1.
@@ -305,7 +283,7 @@
#endif
}
-int V3_read_line_pg(struct Map_info *Map, struct line_pnts *line_p,
+int V2_read_line_pg(struct Map_info *Map, struct line_pnts *line_p,
struct line_cats *line_c, int line)
{
#ifdef HAVE_POSTGRES
@@ -322,7 +300,7 @@
return -1;
}
- G_debug(4, "V3_read_line_pg() line = %d type = %d offset = %lu",
+ G_debug(4, "V2_read_line_pg() line = %d type = %d offset = %lu",
line, Line->type, Line->offset);
if (!line_p && !line_c)
More information about the grass-commit
mailing list