47 if (*((
unsigned char*)&i) == 1)
58 char* field = (
char*)value;
73 char* field = (
char*)value;
88 char* field = (
char*)value;
110 fprintf(stderr,
"ERROR: fine name pointer is zero\n");
120 fprintf(stderr,
"ERROR: cannot open file '%s'\n", file_name);
126 for (i = 0; i < 32; i++)
137 WIN32_FILE_ATTRIBUTE_DATA attr;
139 GetFileAttributesEx(file_name, GetFileExInfoStandard, &attr);
140 FileTimeToSystemTime(&attr.ftCreationTime, &creation);
141 int startday[13] = {-1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
161 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
163 if (int_input != 9994)
165 fprintf(stderr,
"ERROR: wrong shapefile code %d != 9994\n", int_input);
168 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
169 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
170 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
171 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
172 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
173 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
175 int file_length = int_input;
176 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
178 if (int_input != 1000)
180 fprintf(stderr,
"ERROR: wrong shapefile version %d != 1000\n", int_input);
183 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return false;
188 fprintf(stderr,
"ERROR: wrong shape type %d != 1,11,21,8,18,28\n",
shape_type);
192 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return false;
195 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return false;
198 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return false;
201 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return false;
204 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return false;
207 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return false;
210 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return false;
212 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return false;
219 npoints = (file_length-50)/(14);
223 npoints = (file_length-50)/(22);
227 npoints = (file_length-50)/(18);
231 npoints = (file_length-50-20)/(8);
235 npoints = (file_length-50-36)/(16);
239 npoints = (file_length-50-28)/(12);
261 if (this->scale_factor == 0) this->scale_factor =
new F64[3];
262 this->scale_factor[0] = scale_factor[0];
263 this->scale_factor[1] = scale_factor[1];
264 this->scale_factor[2] = scale_factor[2];
266 else if (this->scale_factor)
269 this->scale_factor = 0;
277 if (this->offset == 0) this->offset =
new F64[3];
278 this->offset[0] = offset[0];
279 this->offset[1] = offset[1];
280 this->offset[2] = offset[2];
282 else if (this->offset)
305 fprintf(stderr,
"WARNING: wrong shape type %d != %d in record\n", int_input,
shape_type);
423 fprintf(stderr,
"ERROR: fine name pointer is zero\n");
430 fprintf(stderr,
"ERROR: cannot reopen file '%s'\n", file_name);
437 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
438 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
439 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
440 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
441 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
442 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
443 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
444 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
445 if (fread(&int_input,
sizeof(
int), 1,
file) != 1)
return FALSE;
447 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return FALSE;
448 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return FALSE;
449 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return FALSE;
450 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return FALSE;
451 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return FALSE;
452 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return FALSE;
453 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return FALSE;
454 if (fread(&double_input,
sizeof(
double), 1,
file) != 1)
return FALSE;
571 fprintf(stderr,
"WARNING: quantization sign flip for min_x from %g to %g.\n",
header.
min_x, dequant_min_x);
572 fprintf(stderr,
" set scale factor for x coarser than %g with '-scale'\n",
header.
x_scale_factor);
580 fprintf(stderr,
"WARNING: quantization sign flip for max_x from %g to %g.\n",
header.
max_x, dequant_max_x);
581 fprintf(stderr,
" set scale factor for x coarser than %g with '-scale'\n",
header.
x_scale_factor);
589 fprintf(stderr,
"WARNING: quantization sign flip for min_y from %g to %g.\n",
header.
min_y, dequant_min_y);
590 fprintf(stderr,
" set scale factor for y coarser than %g with '-scale'\n",
header.
y_scale_factor);
598 fprintf(stderr,
"WARNING: quantization sign flip for max_y from %g to %g.\n",
header.
max_y, dequant_max_y);
599 fprintf(stderr,
" set scale factor for y coarser than %g with '-scale'\n",
header.
y_scale_factor);
607 fprintf(stderr,
"WARNING: quantization sign flip for min_z from %g to %g.\n",
header.
min_z, dequant_min_z);
608 fprintf(stderr,
" set scale factor for z coarser than %g with '-scale'\n",
header.
z_scale_factor);
616 fprintf(stderr,
"WARNING: quantization sign flip for max_z from %g to %g.\n",
header.
max_z, dequant_max_z);
617 fprintf(stderr,
" set scale factor for z coarser than %g with '-scale'\n",
header.
z_scale_factor);
653 this->
offset[0] = x_offset;
654 this->
offset[1] = y_offset;
655 this->
offset[2] = z_offset;
677 LASreaderSHPrescalereoffset::LASreaderSHPrescalereoffset(
F64 x_scale_factor,
F64 y_scale_factor,
F64 z_scale_factor,
F64 x_offset,
F64 y_offset,
F64 z_offset) :
LASreaderSHPrescale(x_scale_factor, y_scale_factor, z_scale_factor),
LASreaderSHPreoffset(x_offset, y_offset, z_offset)
static bool is_little_endian
BOOL read_point_default()
BOOL seek(const I64 p_index)
void set_scale_factor(const F64 *scale_factor)
void populate_scale_and_offset()
static void from_little_endian(int *value)
static void initialize_endianness()
BOOL init(const LASquantizer *quantizer, const U8 point_type, const U16 point_size, const LASattributer *attributer=0)
void populate_bounding_box()
FILE * fopen_compressed(const char *filename, const char *mode, bool *piped)
LASreaderSHPrescale(F64 x_scale_factor, F64 y_scale_factor, F64 z_scale_factor)
LASreaderSHPrescalereoffset(F64 x_scale_factor, F64 y_scale_factor, F64 z_scale_factor, F64 x_offset, F64 y_offset, F64 z_offset)
BOOL open(const char *file_name)
F64 get_y(const I32 y) const
static void from_big_endian(int *value)
virtual BOOL open(const char *file_name)
virtual BOOL open(const char *file_name)
virtual BOOL open(const char *file_name)
F64 get_z(const I32 z) const
BOOL reopen(const char *file_name)
LASreaderSHPreoffset(F64 x_offset, F64 y_offset, F64 z_offset)
#define LAS_TOOLS_VERSION
void set_offset(const F64 *offset)
ByteStreamIn * get_stream() const
F64 get_x(const I32 x) const
void close(BOOL close_stream=TRUE)