[Liblas-commits] r981 - branches/1.0/apps

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Dec 26 00:40:11 EST 2008


Author: hobu
Date: Fri Dec 26 00:40:11 2008
New Revision: 981
URL: http://liblas.org/changeset/981

Log:
add index parse option to las2txt #86 (backport of r980)

Modified:
   branches/1.0/apps/las2txt.c

Modified: branches/1.0/apps/las2txt.c
==============================================================================
--- branches/1.0/apps/las2txt.c	(original)
+++ branches/1.0/apps/las2txt.c	Fri Dec 26 00:40:11 2008
@@ -56,7 +56,8 @@
     fprintf(stderr,"   u - user data (does not currently work)\n");
     fprintf(stderr,"   p - point source ID\n");
     fprintf(stderr,"   e - edge of flight line\n");
-    fprintf(stderr,"   d - direction of scan flag\n\n");
+    fprintf(stderr,"   d - direction of scan flag\n");
+    fprintf(stderr,"   M - vertex index number\n\n");
 
     fprintf(stderr,"----------------------------------------------------------\n");
     fprintf(stderr," The '--sep space' flag specifies what separator to use. The\n");
@@ -106,7 +107,9 @@
     LASPointH p = NULL;
     FILE* file_out = NULL;
     int len;
-  
+    
+    uint32_t index = 0;
+    
     for (i = 1; i < argc; i++)
     {
         if (    strcmp(argv[i],"-h") == 0 ||
@@ -464,11 +467,13 @@
     p = LASReader_GetNextPoint(reader);
     while (p)
     {
+        
         if (skip_invalid && !LASPoint_IsValid(p)) {
             if (verbose) {
                 LASError_Print("Skipping writing invalid point...");
             }
             p = LASReader_GetNextPoint(reader);
+            index -=1;
             continue;
         }
         
@@ -517,6 +522,10 @@
             case 'n': 
                 fprintf(file_out, "%d", LASPoint_GetNumberOfReturns(p));
                 break;
+            
+            case 'M':
+                fprintf(file_out, "%d", index);
+                break;
 /*
       case 'p': // the point source ID
         fprintf(file_out, "%d", lasreader->point.point_source_ID);
@@ -545,6 +554,7 @@
         }
 
         p = LASReader_GetNextPoint(reader);
+        index +=1;
     }
 
 


More information about the Liblas-commits mailing list