53 fprintf(stderr,
"ERROR: cannot open laswriterlas to NULL\n");
66 fprintf(stderr,
"ERROR: cannot open laswriterlas with file name '%s'\n",
file_name);
77 fprintf(stderr,
"ERROR: cannot open laswritertxt with file name '%s'\n",
file_name);
88 fprintf(stderr,
"ERROR: cannot open laswriterbin with file name '%s'\n",
file_name);
99 fprintf(stderr,
"ERROR: cannot open laswriterqfit with file name '%s'\n",
file_name);
100 delete laswriterqfit;
103 return laswriterqfit;
107 fprintf(stderr,
"ERROR: unknown format %d\n",
format);
118 fprintf(stderr,
"ERROR: cannot open laswriterlas to stdout\n");
129 fprintf(stderr,
"ERROR: cannot open laswritertxt to stdout\n");
138 if (!laswriterbin->
open(stdout, header,
"ts8"))
140 fprintf(stderr,
"ERROR: cannot open laswriterbin to stdout\n");
149 if (!laswriterqfit->
open(stdout, header, 40))
151 fprintf(stderr,
"ERROR: cannot open laswriterbin to stdout\n");
152 delete laswriterqfit;
155 return laswriterqfit;
159 fprintf(stderr,
"ERROR: unknown format %d\n",
format);
165 fprintf(stderr,
"ERROR: no laswriter output specified\n");
178 return waveform13writer;
180 delete waveform13writer;
186 fprintf(stderr,
"Supported LAS Outputs\n");
187 fprintf(stderr,
" -o lidar.las\n");
188 fprintf(stderr,
" -o lidar.laz\n");
189 fprintf(stderr,
" -o xyzta.txt -oparse xyzta (on-the-fly to ASCII)\n");
190 fprintf(stderr,
" -o terrasolid.bin\n");
191 fprintf(stderr,
" -o nasa.qi\n");
192 fprintf(stderr,
" -olas -olaz -otxt -obin -oqfit (specify format)\n");
193 fprintf(stderr,
" -stdout (pipe to stdout)\n");
194 fprintf(stderr,
" -nil (pipe to NULL)\n");
200 for (i = 1; i <
argc; i++)
202 if (argv[i][0] ==
'\0')
206 else if (strcmp(argv[i],
"-h") == 0 || strcmp(argv[i],
"-help") == 0)
211 else if (strcmp(argv[i],
"-o") == 0)
215 fprintf(stderr,
"ERROR: '%s' needs 1 argument: file_name\n", argv[i]);
219 *argv[i]=
'\0'; *argv[i+1]=
'\0'; i+=1;
221 else if (strcmp(argv[i],
"-olas") == 0)
226 else if (strcmp(argv[i],
"-olaz") == 0)
231 else if (strcmp(argv[i],
"-otxt") == 0)
236 else if (strcmp(argv[i],
"-obin") == 0)
241 else if (strcmp(argv[i],
"-oqi") == 0 || strcmp(argv[i],
"-oqfit") == 0)
246 else if (strcmp(argv[i],
"-stdout") == 0)
252 else if (strcmp(argv[i],
"-nil") == 0)
258 else if (strcmp(argv[i],
"-v1") == 0)
264 else if (strcmp(argv[i],
"-v2") == 0)
270 else if (strcmp(argv[i],
"-no_chunk") == 0)
275 else if (strcmp(argv[i],
"-chunk") == 0)
280 else if (strcmp(argv[i],
"-chunk_size") == 0)
284 fprintf(stderr,
"ERROR: '%s' needs 1 argument: number_points\n", argv[i]);
289 *argv[i]=
'\0'; *argv[i+1]=
'\0'; i+=1;
291 else if (strcmp(argv[i],
"-oparse") == 0)
295 fprintf(stderr,
"ERROR: '%s' needs 1 argument: string\n", argv[i]);
299 *argv[i]=
'\0'; *argv[i+1]=
'\0'; i+=1;
301 else if (strcmp(argv[i],
"-sep") == 0)
305 fprintf(stderr,
"ERROR: '%s' needs 1 argument: separator\n", argv[i]);
309 *argv[i]=
'\0'; *argv[i+1]=
'\0'; i+=1;
317 if (this->file_name) free(this->file_name);
320 this->file_name = strdup(file_name);
321 if (strstr(file_name,
".laz") || strstr(file_name,
".LAZ"))
325 else if (strstr(file_name,
".las") || strstr(file_name,
".LAS"))
329 else if (strstr(file_name,
".bin") || strstr(file_name,
".BIN"))
333 else if (strstr(file_name,
".qi") || strstr(file_name,
".QI"))
352 if (strstr(format,
"laz") || strstr(format,
"LAZ"))
356 else if (strstr(format,
"las") || strstr(format,
"LAS"))
360 else if (strstr(format,
"bin") || strstr(format,
"BIN"))
364 else if (strstr(format,
"qi") || strstr(format,
"QI"))
382 if (file_number > -1)
386 if (this->file_name) free(this->file_name);
387 len = strlen(file_name);
388 this->file_name = (
char*)malloc(len+10);
389 strcpy(this->file_name, file_name);
393 len = strlen(this->file_name);
395 while (len > 0 && this->file_name[len] !=
'.') len--;
398 while (num > 0 && this->file_name[num] >=
'0' && this->file_name[num] <=
'9')
400 this->file_name[num] =
'0' + (file_number%10);
401 file_number = file_number/10;
407 if (this->file_name) free(this->file_name);
410 len = strlen(file_name);
411 this->file_name = (
char*)malloc(len+10);
412 strcpy(this->file_name, file_name);
413 while (len > 0 && this->file_name[len] !=
'.') len--;
414 if (file_number == -1)
416 this->file_name[len] =
'_';
417 this->file_name[len+1] =
'1';
418 this->file_name[len+2] =
'.';
429 this->file_name = strdup(
"output.xxx");
434 this->file_name[len] =
'l';
435 this->file_name[len+1] =
'a';
436 this->file_name[len+2] =
's';
440 this->file_name[len] =
'l';
441 this->file_name[len+1] =
'a';
442 this->file_name[len+2] =
'z';
446 this->file_name[len] =
'b';
447 this->file_name[len+1] =
'i';
448 this->file_name[len+2] =
'n';
452 this->file_name[len] =
't';
453 this->file_name[len+1] =
'x';
454 this->file_name[len+2] =
't';
456 this->file_name[len+3] =
'\0';
476 if (this->parse_string) free(this->parse_string);
477 this->parse_string = strdup(parse_string);
482 if (this->separator) free(this->separator);
483 this->separator = strdup(separator);
LASwaveform13writer * open_waveform13(const LASheader *lasheader)
#define LASZIP_CHUNK_SIZE_DEFAULT
BOOL open(const char *file_name, const LASheader *header, const char *version, U32 io_buffer_size=65536)
void set_file_name(const char *file_name)
LASwriter * open(LASheader *header)
BOOL open(const LASheader *header, U32 compressor=LASZIP_COMPRESSOR_NONE, I32 requested_version=0, I32 chunk_size=50000)
#define LAS_TOOLS_FORMAT_LAS
#define LAS_TOOLS_FORMAT_LAZ
BOOL format_was_specified() const
#define LAS_TOOLS_FORMAT_DEFAULT
const char * get_file_name() const
#define LASZIP_COMPRESSOR_NONE
#define LAS_TOOLS_FORMAT_BIN
void set_separator(const char *separator)
#define LAS_TOOLS_FORMAT_TXT
void make_file_name(const char *file_name, I32 file_number=-1)
BOOL open(const char *file_name, const LASheader *header, I32 version=48, U32 io_buffer_size=65536)
#define LASZIP_COMPRESSOR_NOT_CHUNKED
#define LAS_TOOLS_FORMAT_QFIT
void set_format(const char *format)
#define LASZIP_COMPRESSOR_CHUNKED
BOOL parse(int argc, char *argv[])
BOOL open(const char *file_name, const LASheader *header, const char *parse_string=0, const char *separator=0)
void set_parse_string(const char *parse_string)