Go to the documentation of this file.
48 fprintf(stderr,
"ERROR: fine name pointer is zero\n");
57 fprintf(stderr,
"ERROR: cannot open file '%s'\n", file_name);
74 for (
I32 d = 0; d < dim; d++)
79 for (
I32 d = 0; d < dim; d++)
93 for (i = 0; i < 32; i++)
104 WIN32_FILE_ATTRIBUTE_DATA attr;
106 GetFileAttributesEx(file_name, GetFileExInfoStandard, &attr);
107 FileTimeToSystemTime(&attr.ftCreationTime, &creation);
108 int startday[13] = {-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
177 parse_less = strdup(
"xyz");
184 if (parse_less[i] !=
'x' && parse_less[i] !=
'y' && parse_less[i] !=
'z' && parse_less[i] !=
'r' && (parse_less[i] <
'0' || parse_less[i] >
'0'))
191 parse_less[i] =
'\0';
193 }
while (parse_less[i] ==
's');
204 if (
parse(parse_less))
214 fprintf(stderr,
"WARNING: cannot parse '%s' with '%s'. skipping ...\n",
line, parse_less);
222 fprintf(stderr,
"ERROR: could not parse any lines with '%s'\n", parse_less);
254 if (
parse(parse_less))
280 fprintf(stderr,
"WARNING: cannot parse '%s' with '%s'. skipping ...\n",
line, parse_less);
307 fprintf(stderr,
"ERROR: could not open '%s' for second pass\n", file_name);
314 this->parse_string = strdup(
"xyz");
331 if (
parse(this->parse_string))
340 fprintf(stderr,
"WARNING: cannot parse '%s' with '%s'. skipping ...\n",
line, this->parse_string);
348 fprintf(stderr,
"ERROR: could not parse any lines with '%s'\n", this->parse_string);
351 free(this->parse_string);
352 this->parse_string = 0;
409 if (this->scale_factor == 0) this->scale_factor =
new F64[3];
414 else if (this->scale_factor)
417 this->scale_factor = 0;
425 if (this->offset == 0) this->offset =
new F64[3];
426 this->offset[0] =
offset[0];
427 this->offset[1] =
offset[1];
428 this->offset[2] =
offset[2];
430 else if (this->offset)
473 fseek(
file, 0, SEEK_SET);
491 fprintf(stderr,
"WARNING: cannot parse '%s' with '%s'. skipping ...\n",
line, this->
parse_string);
497 fprintf(stderr,
"ERROR: could not parse any lines with '%s'\n", this->
parse_string);
504 delta = (
U32)p_index;
530 fprintf(stderr,
"WARNING: cannot parse '%s' with '%s'. skipping ...\n",
line, this->
parse_string);
540 fprintf(stderr,
"WARNING: end-of-file after %I64d of %I64d points\n",
p_count,
npoints);
542 fprintf(stderr,
"WARNING: end-of-file after %lld of %lld points\n",
p_count,
npoints);
607 fprintf(stderr,
"ERROR: fine name pointer is zero\n");
614 fprintf(stderr,
"ERROR: cannot reopen file '%s'\n", file_name);
636 fprintf(stderr,
"WARNING: cannot parse '%s' with '%s'. skipping ...\n",
line,
parse_string);
644 fprintf(stderr,
"ERROR: could not parse any lines with '%s'\n",
parse_string);
713 if (sscanf(l,
"%lf", &temp_d) != 1)
return FALSE;
718 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
720 if (temp_i < U8_MIN || temp_i >
U8_MAX)
722 fprintf(stderr,
"WARNING: extra attribute %d of type U8 is %d. clamped to [%d %d] range.\n",
index, temp_i,
U8_MIN,
U8_MAX);
736 if (sscanf(l,
"%lf", &temp_d) != 1)
return FALSE;
741 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
743 if (temp_i < I8_MIN || temp_i >
I8_MAX)
745 fprintf(stderr,
"WARNING: extra attribute %d of type I8 is %d. clamped to [%d %d] range.\n",
index, temp_i,
I8_MIN,
I8_MAX);
759 if (sscanf(l,
"%lf", &temp_d) != 1)
return FALSE;
764 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
766 if (temp_i < U16_MIN || temp_i >
U16_MAX)
768 fprintf(stderr,
"WARNING: extra attribute %d of type U16 is %d. clamped to [%d %d] range.\n",
index, temp_i,
U16_MIN,
U16_MAX);
782 if (sscanf(l,
"%lf", &temp_d) != 1)
return FALSE;
787 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
789 if (temp_i < I16_MIN || temp_i >
I16_MAX)
791 fprintf(stderr,
"WARNING: extra attribute %d of type I16 is %d. clamped to [%d %d] range.\n",
index, temp_i,
I16_MIN,
I16_MAX);
805 if (sscanf(l,
"%lf", &temp_d) != 1)
return FALSE;
810 if (sscanf(l,
"%u", &temp_u) != 1)
return FALSE;
820 if (sscanf(l,
"%lf", &temp_d) != 1)
return FALSE;
825 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
827 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
833 if (sscanf(l,
"%f", &temp_f) != 1)
return FALSE;
839 if (sscanf(l,
"%lf", &temp_d) != 1)
return FALSE;
844 fprintf(stderr,
"WARNING: extra attribute %d not (yet) implemented.\n",
index);
855 const char* l =
line;
861 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
862 if (l[0] == 0)
return FALSE;
864 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
866 else if (
p[0] ==
'y')
868 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
869 if (l[0] == 0)
return FALSE;
871 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
873 else if (
p[0] ==
'z')
875 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
876 if (l[0] == 0)
return FALSE;
878 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
880 else if (
p[0] ==
't')
882 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
883 if (l[0] == 0)
return FALSE;
885 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
887 else if (
p[0] ==
'R')
889 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
890 if (l[0] == 0)
return FALSE;
891 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
893 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
895 else if (
p[0] ==
'G')
897 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
898 if (l[0] == 0)
return FALSE;
899 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
901 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
903 else if (
p[0] ==
'B')
905 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
906 if (l[0] == 0)
return FALSE;
907 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
909 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
911 else if (
p[0] ==
's')
913 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
914 if (l[0] == 0)
return FALSE;
915 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
917 else if (
p[0] ==
'i')
919 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
920 if (l[0] == 0)
return FALSE;
921 if (sscanf(l,
"%f", &temp_f) != 1)
return FALSE;
924 if (temp_f < 0.0f || temp_f >= 65535.5f) fprintf(stderr,
"WARNING: intensity %g is out of range of unsigned short\n", temp_f);
926 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
928 else if (
p[0] ==
'a')
930 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
931 if (l[0] == 0)
return FALSE;
932 if (sscanf(l,
"%f", &temp_f) != 1)
return FALSE;
935 if (temp_f < -128.0f || temp_f > 127.0f) fprintf(stderr,
"WARNING: scan angle %g is out of range of char\n", temp_f);
937 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
939 else if (
p[0] ==
'n')
941 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
942 if (l[0] == 0)
return FALSE;
943 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
944 if (temp_i < 0 || temp_i > 7) fprintf(stderr,
"WARNING: return number %d is out of range of three bits\n", temp_i);
946 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
948 else if (
p[0] ==
'r')
950 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
951 if (l[0] == 0)
return FALSE;
952 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
953 if (temp_i < 0 || temp_i > 7) fprintf(stderr,
"WARNING: return number %d is out of range of three bits\n", temp_i);
955 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
957 else if (
p[0] ==
'c')
959 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
960 if (l[0] == 0)
return FALSE;
961 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
962 if (temp_i < 0 || temp_i > 255) fprintf(stderr,
"WARNING: classification %d is out of range of unsigned char\n", temp_i);
964 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
966 else if (
p[0] ==
'u')
968 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
969 if (l[0] == 0)
return FALSE;
970 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
971 if (temp_i < 0 || temp_i > 255) fprintf(stderr,
"WARNING: user data %d is out of range of unsigned char\n", temp_i);
973 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
975 else if (
p[0] ==
'p')
977 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
978 if (l[0] == 0)
return FALSE;
979 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
980 if (temp_i < 0 || temp_i > 65535) fprintf(stderr,
"WARNING: point source ID %d is out of range of unsigned short\n", temp_i);
982 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
984 else if (
p[0] ==
'e')
986 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
987 if (l[0] == 0)
return FALSE;
988 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
989 if (temp_i < 0 || temp_i > 1) fprintf(stderr,
"WARNING: edge of flight line flag %d is out of range of boolean flag\n", temp_i);
991 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
993 else if (
p[0] ==
'd')
995 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
996 if (l[0] == 0)
return FALSE;
997 if (sscanf(l,
"%d", &temp_i) != 1)
return FALSE;
998 if (temp_i < 0 || temp_i > 1) fprintf(stderr,
"WARNING: direction of scan flag %d is out of range of boolean flag\n", temp_i);
1000 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
1002 else if (
p[0] >=
'0' &&
p[0] <=
'9')
1004 while (l[0] && (l[0] ==
' ' || l[0] ==
',' || l[0] ==
'\t')) l++;
1005 if (l[0] == 0)
return FALSE;
1008 while (l[0] && l[0] !=
' ' && l[0] !=
',' && l[0] !=
'\t') l++;
1012 fprintf(stderr,
"ERROR: unknown symbol '%c' in parse string\n",
p[0]);
1024 if ((
p[0] !=
'x') &&
1042 if (
p[0] >=
'0' &&
p[0] <=
'9')
1047 fprintf(stderr,
"ERROR: extra attribute '%d' was not described.\n",
index);
1054 fprintf(stderr,
"ERROR: unknown symbol '%c' in parse string. valid are\n",
p[0]);
1055 fprintf(stderr,
" 'x' : the x coordinate\n");
1056 fprintf(stderr,
" 'y' : the y coordinate\n");
1057 fprintf(stderr,
" 'z' : the x coordinate\n");
1058 fprintf(stderr,
" 't' : the gps time\n");
1059 fprintf(stderr,
" 'R' : the red channel of the RGB field\n");
1060 fprintf(stderr,
" 'G' : the green channel of the RGB field\n");
1061 fprintf(stderr,
" 'B' : the blue channel of the RGB field\n");
1062 fprintf(stderr,
" 's' : a string or a number that we don't care about\n");
1063 fprintf(stderr,
" 'i' : the intensity\n");
1064 fprintf(stderr,
" 'a' : the scan angle\n");
1065 fprintf(stderr,
" 'n' : the number of returns of that given pulse\n");
1066 fprintf(stderr,
" 'r' : the number of the return\n");
1067 fprintf(stderr,
" 'c' : the classification\n");
1068 fprintf(stderr,
" 'u' : the user data\n");
1069 fprintf(stderr,
" 'p' : the point source ID\n");
1070 fprintf(stderr,
" 'e' : the edge of flight line flag\n");
1071 fprintf(stderr,
" 'd' : the direction of scan flag\n");
1143 fprintf(stderr,
"WARNING: quantization sign flip for min_x from %g to %g.\n",
header.
min_x, dequant_min_x);
1144 fprintf(stderr,
" set scale factor for x coarser than %g with '-scale'\n",
header.
x_scale_factor);
1152 fprintf(stderr,
"WARNING: quantization sign flip for max_x from %g to %g.\n",
header.
max_x, dequant_max_x);
1153 fprintf(stderr,
" set scale factor for x coarser than %g with '-scale'\n",
header.
x_scale_factor);
1161 fprintf(stderr,
"WARNING: quantization sign flip for min_y from %g to %g.\n",
header.
min_y, dequant_min_y);
1162 fprintf(stderr,
" set scale factor for y coarser than %g with '-scale'\n",
header.
y_scale_factor);
1170 fprintf(stderr,
"WARNING: quantization sign flip for max_y from %g to %g.\n",
header.
max_y, dequant_max_y);
1171 fprintf(stderr,
" set scale factor for y coarser than %g with '-scale'\n",
header.
y_scale_factor);
1179 fprintf(stderr,
"WARNING: quantization sign flip for min_z from %g to %g.\n",
header.
min_z, dequant_min_z);
1180 fprintf(stderr,
" set scale factor for z coarser than %g with '-scale'\n",
header.
z_scale_factor);
1188 fprintf(stderr,
"WARNING: quantization sign flip for max_z from %g to %g.\n",
header.
max_z, dequant_max_z);
1189 fprintf(stderr,
" set scale factor for z coarser than %g with '-scale'\n",
header.
z_scale_factor);
1225 this->
offset[0] = x_offset;
1226 this->
offset[1] = y_offset;
1227 this->
offset[2] = z_offset;
1249 LASreaderTXTrescalereoffset::LASreaderTXTrescalereoffset(
F64 x_scale_factor,
F64 y_scale_factor,
F64 z_scale_factor,
F64 x_offset,
F64 y_offset,
F64 z_offset) :
LASreaderTXTrescale(x_scale_factor, y_scale_factor, z_scale_factor),
LASreaderTXTreoffset(x_offset, y_offset, z_offset)
void add_extra_attribute(I32 data_type, const char *name, const char *description=0, F64 scale=1.0, F64 offset=0.0)
ByteStreamIn * get_stream() const
virtual BOOL open(const char *file_name, const char *parse_string=0, I32 skip_lines=0, BOOL populate_header=FALSE)
F64 get_y(const I32 y) const
I32 number_extra_attributes
void set_translate_intensity(F32 translate_intensity)
BOOL reopen(const char *file_name)
void populate_bounding_box()
void update_min(U8 *min, I32 dim=0)
F64 extra_attribute_offsets[10]
void set_min(U8 *min, I32 dim=0)
BOOL set_offset(F64 offset, I32 dim=0)
I32 get_extra_attribute_array_offset(const char *name) const
F64 get_z(const I32 z) const
void update_max(U8 *max, I32 dim=0)
void set_scale_factor(const F64 *scale_factor)
BOOL parse(const char *parse_string)
I32 extra_attributes_data_types[10]
LASreaderTXTrescalereoffset(F64 x_scale_factor, F64 y_scale_factor, F64 z_scale_factor, F64 x_offset, F64 y_offset, F64 z_offset)
virtual BOOL open(const char *file_name, const char *parse_string=0, I32 skip_lines=0, BOOL populate_header=FALSE)
BOOL parse_extra_attribute(const char *l, I32 index)
I32 number_extra_attributes
void set_scale_scan_angle(F32 scale_scan_angle)
void set_scale_intensity(F32 scale_intensity)
void set_max(U8 *max, I32 dim=0)
LASreaderTXTrescale(F64 x_scale_factor, F64 y_scale_factor, F64 z_scale_factor)
I32 add_extra_attribute(const LASattribute extra_attribute)
void set_extra_attribute(I32 index, const U8 *data)
BOOL open(const char *file_name, const char *parse_string=0, I32 skip_lines=0, BOOL populate_header=FALSE)
LASreaderTXTreoffset(F64 x_offset, F64 y_offset, F64 z_offset)
const char * extra_attribute_descriptions[10]
BOOL seek(const I64 p_index)
BOOL set_scale(F64 scale, I32 dim=0)
void set_translate_scan_angle(F32 translate_scan_angle)
BOOL read_point_default()
I32 extra_attribute_array_offsets[10]
void close(BOOL close_stream=TRUE)
void set_offset(const F64 *offset)
#define LAS_TOOLS_VERSION
const char * extra_attribute_names[10]
U8 number_of_returns_of_given_pulse
BOOL init(const LASquantizer *quantizer, const U8 point_type, const U16 point_size, const LASattributer *attributer=0)
FILE * fopen_compressed(const char *filename, const char *mode, bool *piped)
virtual BOOL open(const char *file_name, const char *parse_string=0, I32 skip_lines=0, BOOL populate_header=FALSE)
I16 get_total_extra_attributes_size() const
F64 get_x(const I32 x) const
LASattribute * extra_attributes
F64 extra_attribute_scales[10]
void populate_scale_and_offset()
BOOL check_parse_string(const char *parse_string)
lvr2
Author(s): Thomas Wiemann
, Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23