MCPcopy Create free account
hub / github.com/LAStools/LAStools / demzip_I32 demzip_write_point

Function demzip_I32 demzip_write_point

LASlib/src/demzip_dll.cpp:3040–3166  ·  view source on GitHub ↗

---------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

3038
3039/*---------------------------------------------------------------------------*/
3040DEMZIP_API demzip_I32
3041demzip_write_point(
3042 demzip_POINTER pointer
3043)
3044{
3045 if (pointer == 0) return 1;
3046 demzip_dll_struct* demzip_dll = (demzip_dll_struct*)pointer;
3047
3048 try
3049 {
3050 // temporary fix to avoid corrupt LAZ files
3051
3052 if (demzip_dll->point.extended_point_type)
3053 {
3054 // make sure legacy flags and extended flags are identical
3055 if ((demzip_dll->point.extended_classification_flags & 0x7) != ((((U8*)&(demzip_dll->point.intensity))[3]) >> 5))
3056 {
3057 sprintf(demzip_dll->error, "legacy flags and extended flags are not identical");
3058 return 1;
3059 }
3060
3061 // make sure legacy classification is zero or identical to extended classification
3062 if (demzip_dll->point.classification != 0)
3063 {
3064 if (demzip_dll->point.classification != demzip_dll->point.extended_classification)
3065 {
3066 sprintf(demzip_dll->error, "legacy classification %d and extended classification %d are not consistent", demzip_dll->point.classification, demzip_dll->point.extended_classification);
3067 return 1;
3068 }
3069 }
3070 }
3071
3072 // special recoding of points (in compatibility mode only)
3073
3074 if (demzip_dll->compatibility_mode)
3075 {
3076 I32 scan_angle_remainder;
3077 I32 number_of_returns_increment;
3078 I32 return_number_increment;
3079 I32 return_count_difference;
3080 I32 overlap_bit;
3081 I32 scanner_channel;
3082
3083 // distill extended attributes
3084 struct demzip_point* point = &demzip_dll->point;
3085
3086 point->scan_angle_rank = I8_CLAMP(I16_QUANTIZE(0.006f*point->extended_scan_angle));
3087 scan_angle_remainder = point->extended_scan_angle - I16_QUANTIZE(((F32)point->scan_angle_rank)/0.006f);
3088 if (point->extended_number_of_returns <= 7)
3089 {
3090 point->number_of_returns = point->extended_number_of_returns;
3091 if (point->extended_return_number <= 7)
3092 {
3093 point->return_number = point->extended_return_number;
3094 }
3095 else
3096 {
3097 point->return_number = 7;

Callers

nothing calls this directly

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected