[GRASS-SVN] r56547 - sandbox/martinl/v.ten

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jun 2 01:23:57 PDT 2013


Author: martinl
Date: 2013-06-02 01:23:57 -0700 (Sun, 02 Jun 2013)
New Revision: 56547

Modified:
   sandbox/martinl/v.ten/write.cpp
Log:
v.ten: write unique categories


Modified: sandbox/martinl/v.ten/write.cpp
===================================================================
--- sandbox/martinl/v.ten/write.cpp	2013-06-02 07:51:10 UTC (rev 56546)
+++ sandbox/martinl/v.ten/write.cpp	2013-06-02 08:23:57 UTC (rev 56547)
@@ -7,10 +7,14 @@
 
 void write_lines(struct Map_info *Out, int type, const Triangulation &T)
 {
+    int line;
     struct line_pnts *Points;
+    struct line_cats *Cats;
     
     Points = Vect_new_line_struct();
+    Cats = Vect_new_cats_struct();
     
+    line = 1;
     if (type == GV_LINE) {
         Triangulation::Finite_edges_iterator eit;
         Point pt1, pt2;
@@ -26,7 +30,10 @@
             Vect_append_point(Points, pt1.x(), pt1.y(), pt1.z());
             Vect_append_point(Points, pt2.x(), pt2.y(), pt2.z());
             
-            Vect_write_line(Out, type, Points, NULL);
+            Vect_reset_cats(Cats);
+            Vect_cat_set(Cats, 1, line++);
+            
+            Vect_write_line(Out, type, Points, Cats);
         }
     }
     else {
@@ -48,10 +55,14 @@
             Vect_append_point(Points, pt1.x(), pt1.y(), pt1.z());
             Vect_append_point(Points, pt2.x(), pt2.y(), pt2.z());
             Vect_append_point(Points, pt3.x(), pt3.y(), pt3.z());
+
+            Vect_reset_cats(Cats);
+            Vect_cat_set(Cats, 1, line++);
             
-            Vect_write_line(Out, type, Points, NULL);
+            Vect_write_line(Out, type, Points, Cats);
         }
     }
     
     Vect_destroy_line_struct(Points);
+    Vect_destroy_cats_struct(Cats);
 }



More information about the grass-commit mailing list