[GRASS-SVN] r55814 - grass/trunk/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 15 03:12:14 PDT 2013
Author: martinl
Date: 2013-04-15 03:12:13 -0700 (Mon, 15 Apr 2013)
New Revision: 55814
Modified:
grass/trunk/lib/vector/Vlib/build_pg.c
Log:
vlib(pg): comments cosmetics
Modified: grass/trunk/lib/vector/Vlib/build_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build_pg.c 2013-04-15 09:58:59 UTC (rev 55813)
+++ grass/trunk/lib/vector/Vlib/build_pg.c 2013-04-15 10:12:13 UTC (rev 55814)
@@ -5,11 +5,11 @@
Higher level functions for reading/writing/manipulating vectors.
- Line offset is
+ Line offset (simple features only) is
- centroids : FID
- other types : index of the first record (which is FID) in offset array.
- (C) 2012 by the GRASS Development Team
+ (C) 2012-2013 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
@@ -161,7 +161,11 @@
/* update faces from GRASS Topology */
if (build >= GV_BUILD_AREAS) {
- /* reset centroids to '0' (universal face) */
+ /* do clean up (1-3)
+ insert new faces (4)
+ update edges (5)
+ */
+ /* 1) reset centroids to '0' (universal face) */
sprintf(stmt, "UPDATE \"%s\".node SET containing_face = 0 WHERE "
"containing_face IS NOT NULL", pg_info->toposchema_name);
G_debug(2, "SQL: %s", stmt);
@@ -170,7 +174,7 @@
return 0;
}
- /* reset left|right edges */
+ /* 2) reset left|right edges */
sprintf(stmt, "UPDATE \"%s\".edge_data SET left_face = 0, right_face = 0",
pg_info->toposchema_name);
G_debug(2, "SQL: %s", stmt);
@@ -179,7 +183,7 @@
return 0;
}
- /* delete faces */
+ /* 3) delete faces */
sprintf(stmt, "DELETE FROM \"%s\".face WHERE "
"face_id != 0", pg_info->toposchema_name);
G_debug(2, "SQL: %s", stmt);
@@ -188,7 +192,7 @@
return 0;
}
- /* insert faces & update nodes (containing_face) based on
+ /* 4) insert faces & update nodes (containing_face) based on
* GRASS topology */
nareas = Vect_get_num_areas(Map);
for (area = 1; area <= nareas; area++) {
@@ -200,7 +204,7 @@
if (build < GV_BUILD_CENTROIDS)
continue;
- /* update centroids */
+ /* update centroids (node -> containing_face) */
Area = plus->Area[area];
if (Area->centroid < 1) {
G_debug(3, "Area %d without centroid, skipped", area);
@@ -209,8 +213,8 @@
Line = plus->Line[Area->centroid];
sprintf(stmt, "UPDATE \"%s\".node SET "
- "containing_face = %d WHERE node_id = %lu",
- pg_info->toposchema_name, area, Line->offset);
+ "containing_face = %d WHERE node_id = %d",
+ pg_info->toposchema_name, area, (int)Line->offset);
G_debug(2, "SQL: %s", stmt);
if(Vect__execute_pg(pg_info->conn, stmt) == -1) {
@@ -219,7 +223,7 @@
}
}
- /* update edges (left and right face) */
+ /* 5) update edges (left and right face) */
for (line = 1; line <= plus->n_lines; line++) {
type = Vect_read_line(Map, NULL, NULL, line);
if (type != GV_BOUNDARY)
@@ -264,7 +268,7 @@
Isle = plus->Isle[isle];
Vect__insert_face_pg(Map, -isle);
}
- }
+ } /* build >= GV_BUILD_ISLES */
if (pg_info->feature_type == SF_POLYGON) {
int centroid;
@@ -276,6 +280,7 @@
if (centroid < 1)
continue;
+ /* update topogeometry object: centroid -> face */
if (build_topogeom_stmt(pg_info, GV_CENTROID, area, centroid, stmt) &&
Vect__execute_pg(pg_info->conn, stmt) == -1) {
Vect__execute_pg(pg_info->conn, "ROLLBACK");
More information about the grass-commit
mailing list