[Liblas-commits] r1165 - branches/1.2/apps

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Apr 3 11:11:38 EDT 2009


Author: hobu
Date: Fri Apr  3 11:11:37 2009
New Revision: 1165
URL: http://liblas.org/changeset/1165

Log:
backport fix for #122


Modified:
   branches/1.2/apps/las2las.c

Modified: branches/1.2/apps/las2las.c
==============================================================================
--- branches/1.2/apps/las2las.c	(original)
+++ branches/1.2/apps/las2las.c	Fri Apr  3 11:11:37 2009
@@ -11,7 +11,7 @@
  * See LICENSE.txt in this source distribution for more information.
  **************************************************************************/
 
-
+#include <assert.h>
 #include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -97,6 +97,7 @@
     int elim_scan_angle_above = 0;
     int elim_intensity_below = 0;
     int elim_class = 0;
+    int clsidx = 0;
     int first_only = FALSE;
     int last_only = FALSE;
     int skip_invalid = FALSE;
@@ -370,12 +371,17 @@
             p = LASReader_GetNextPoint(reader);
             continue;
         }
-        if (elim_class && ( elim_class == LASPoint_GetClassification(p)))
+
+        clsidx = LASPoint_GetClassification(p);
+        clsidx = (clsidx & 31); // 31 is max index in classification lookup table
+        assert(clsidx <= 31);
+        if (elim_class && (elim_class == clsidx))
         {
             eliminated_class++;
             p = LASReader_GetNextPoint(reader);
             continue;
-        }        
+        }
+
         if (elim_intensity_below && LASPoint_GetIntensity(p) < elim_intensity_below)
         {
             eliminated_intensity++;
@@ -733,7 +739,11 @@
             p = LASReader_GetNextPoint(reader);
             continue;
         }
-        if (elim_class && ( elim_class == LASPoint_GetClassification(p)))
+
+        clsidx = LASPoint_GetClassification(p);
+        clsidx = (clsidx & 31); // 31 is max index in classification lookup table
+        assert(clsidx <= 31);
+        if (elim_class && (elim_class == clsidx))
         {
             p = LASReader_GetNextPoint(reader);
             continue;


More information about the Liblas-commits mailing list