瀏覽代碼

vlib(pg): fix updating topogeom data for faces

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56510 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 年之前
父節點
當前提交
b6739a9cc6
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      lib/vector/Vlib/build_pg.c

+ 7 - 1
lib/vector/Vlib/build_pg.c

@@ -314,6 +314,8 @@ int build_topo(struct Map_info *Map, int build)
     if (pg_info->feature_type == SF_POLYGON) {
         int centroid;
         
+        struct P_line *Line;
+        
         G_message(_("Updating TopoGeometry data..."));
         for (area = 1; area <= plus->n_areas; area++) {
             G_percent(area, plus->n_areas, 5);
@@ -321,8 +323,12 @@ int build_topo(struct Map_info *Map, int build)
             if (centroid < 1)
                 continue;
         
+            Line = plus->Line[centroid];
+            if (!Line)
+                continue;
+
             /* update topogeometry object: centroid -> face */
-            if (build_topogeom_stmt(pg_info, GV_CENTROID, area, centroid, stmt) &&
+            if (build_topogeom_stmt(pg_info, GV_CENTROID, area, (int) Line->offset, stmt) &&
                 Vect__execute_pg(pg_info->conn, stmt) == -1) {
                 Vect__execute_pg(pg_info->conn, "ROLLBACK");
                 return 0;