[GRASS-SVN] r68472 - in grass/trunk/vector: v.in.lidar v.in.pdal v.out.lidar
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu May 19 15:51:52 PDT 2016
Author: wenzeslaus
Date: 2016-05-19 15:51:51 -0700 (Thu, 19 May 2016)
New Revision: 68472
Modified:
grass/trunk/vector/v.in.lidar/main.c
grass/trunk/vector/v.in.pdal/main.cpp
grass/trunk/vector/v.out.lidar/main.c
Log:
v.in.lidar, v.out.lidar, v.in.pdal: do not use category 0
Merge class 0 into class 1
and add 1 to the RGB number before saving
(and subtract 1 before reading).
Modified: grass/trunk/vector/v.in.lidar/main.c
===================================================================
--- grass/trunk/vector/v.in.lidar/main.c 2016-05-19 22:36:56 UTC (rev 68471)
+++ grass/trunk/vector/v.in.lidar/main.c 2016-05-19 22:51:51 UTC (rev 68472)
@@ -595,8 +595,14 @@
int return_c = return_to_cat(return_n, n_returns);
Vect_cat_set(Cats, return_layer, return_c);
}
- if (class_layer)
- Vect_cat_set(Cats, class_layer, point_class);
+ if (class_layer) {
+ /* 0 is not a valid category and
+ * classes 0 and 1 as practically the same */
+ if (point_class == 0)
+ Vect_cat_set(Cats, class_layer, 1);
+ else
+ Vect_cat_set(Cats, class_layer, point_class);
+ }
if (have_color && rgb_layer) {
/* TODO: if attr table, acquired again, performance difference? */
LASColorH LAS_color = LASPoint_GetColor(LAS_point);
@@ -607,6 +613,7 @@
int rgb = red;
rgb = (rgb << 8) + green;
rgb = (rgb << 8) + blue;
+ rgb++; /* cat 0 is not valid, add one */
Vect_cat_set(Cats, rgb_layer, rgb);
}
}
Modified: grass/trunk/vector/v.in.pdal/main.cpp
===================================================================
--- grass/trunk/vector/v.in.pdal/main.cpp 2016-05-19 22:36:56 UTC (rev 68471)
+++ grass/trunk/vector/v.in.pdal/main.cpp 2016-05-19 22:51:51 UTC (rev 68472)
@@ -64,6 +64,7 @@
int rgb = red;
rgb = (rgb << 8) + green;
rgb = (rgb << 8) + blue;
+ rgb++; /* cat 0 is not valid, add one */
Vect_cat_set(cats, layers->rgb_layer, rgb);
}
Modified: grass/trunk/vector/v.out.lidar/main.c
===================================================================
--- grass/trunk/vector/v.out.lidar/main.c 2016-05-19 22:36:56 UTC (rev 68471)
+++ grass/trunk/vector/v.out.lidar/main.c 2016-05-19 22:51:51 UTC (rev 68472)
@@ -416,9 +416,12 @@
if (context->rgb_layer) {
if (!Vect_cat_get(cats, context->rgb_layer, &cat))
return; /* TODO: is this an error? */
- int red = (cat >> 16) & 0xFF;
- int green = (cat >> 8) & 0xFF;
- int blue = cat & 0xFF;
+ /* cat 0 is not valid, so we are adding 1 when storing
+ * now we need to subtract 1 */
+ int rgb = cat - 1;
+ int red = (rgb >> 16) & 0xFF;
+ int green = (rgb >> 8) & 0xFF;
+ int blue = rgb & 0xFF;
LASColor_SetRed(las_color, red);
LASColor_SetGreen(las_color, green);
More information about the grass-commit
mailing list