[Liblas-devel] GetClassification() et al.

Mateusz Łoskot mateusz at loskot.net
Tue Oct 25 09:30:13 EDT 2011


2011/10/25 Peder Axensten <Peder.Axensten at slu.se>:
> I ran the following:
>
>        liblas::Point p;
>        liblas::Classification c1( 7, true /*synthetic*/, false /*keypoint*/, true /*withheld*/ ); // set all bits of classification
>        p.SetClassification( c1 ); // set point with classification
>        liblas::Classification          c2;
>        c2 = p.GetClassification();
>        std::cout       << "TEST:\n"
>                                << "1 Synthetic: " << c1.IsSynthetic() << "\n"
>                                << "1 Keypoint:  " << c1.IsKeyPoint() << "\n"
>                                << "1 Withheld:  " << c1.IsWithheld() << "\n"
>                                << "2 Synthetic: " << c2.IsSynthetic() << "\n"
>                                << "2 Keypoint:  " << c2.IsKeyPoint() << "\n"
>                                << "2 Withheld:  " << c2.IsWithheld() << "\n"
>                                ;
>
>
> And I got:
> TEST:
> 1 Synthetic: 1
> 1 Keypoint:  0
> 1 Withheld:  1
> 2 Synthetic: 0
> 2 Keypoint:  0
> 2 Withheld:  0
>
> My conclusion is that SetClassification() filters the Classification, so that only the lower 5 bits remain.

The thing is that LAS spec uses classification with dual meaning:
1) as name of all classification bits (0:7)
2) as name of bits 0:4 which refer to index in classification table.

The GetClassification gives you *only* the index in the classification
table, it is value in 0:4 bits.

> I'd be happy if someone could correct me, but to me it seems that there is no way to set the higher bits of a Point's Classification.

The three remaining bits are available through IsSynthetic(),
IsKeypoint() and IsWithheld()
accessors in Classification class.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org


More information about the Liblas-devel mailing list