11
11
****************************************************************************/
12
12
13
13
#include < iostream>
14
+ #include < fstream>
14
15
#include < filesystem>
15
16
#include < thread>
16
17
namespace fs = std::filesystem;
@@ -25,7 +26,6 @@ namespace fs = std::filesystem;
25
26
#include " nlohmann/json.hpp"
26
27
27
28
28
-
29
29
using json = nlohmann::json;
30
30
31
31
using namespace pdal ;
@@ -368,8 +368,18 @@ std::string dateTimeStringFromYearAndDay(int year, int dayOfYear)
368
368
{
369
369
bool leapYear = isLeapYear (year);
370
370
371
- if (year < 0 ) return " " ; // Year is negative
372
- if ((dayOfYear < 1 ) || (dayOfYear > (leapYear ? 366 : 365 ))) return " " ; // Day of year is out of range
371
+ if (year < 0 ) // Year is negative
372
+ {
373
+ std::cerr << " Warning: year(" << year <<
374
+ " ) is not valid. Defualting to 1970." << std::endl;
375
+ year = 1970 ;
376
+ }
377
+ if ((dayOfYear < 1 ) || (dayOfYear > (leapYear ? 366 : 365 )))
378
+ {
379
+ std::cerr << " Warning: DayOfYear(" << year <<
380
+ " ) is out of range. Defualting to 1." << std::endl;
381
+ dayOfYear = 1 ;
382
+ }
373
383
374
384
// Figure out month and day of month, from day of year.
375
385
int daysInMonth[] = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 };
@@ -395,16 +405,20 @@ std::string dateTimeStringFromYearAndDay(int year, int dayOfYear)
395
405
void buildVpc (std::vector<std::string> args)
396
406
{
397
407
std::string outputFile;
408
+ std::string inputFileList;
398
409
std::vector<std::string> inputFiles;
399
410
bool boundaries = false ;
400
411
bool stats = false ;
401
412
bool overview = false ;
402
413
int max_threads = -1 ;
403
414
bool verbose = false ;
415
+ bool help = false ;
404
416
405
417
ProgramArgs programArgs;
418
+ programArgs.add (" help,h" , " Output command help." , help);
406
419
programArgs.add (" output,o" , " Output virtual point cloud file" , outputFile);
407
420
programArgs.add (" files,f" , " input files" , inputFiles).setPositional ();
421
+ programArgs.add (" input-file-list" , " Read input files from a txt file, one file per line." , inputFileList);
408
422
programArgs.add (" boundary" , " Calculate boundary polygons from data" , boundaries);
409
423
programArgs.add (" stats" , " Calculate statistics from data" , stats);
410
424
programArgs.add (" overview" , " Create overview point cloud from source data" , overview);
@@ -422,6 +436,32 @@ void buildVpc(std::vector<std::string> args)
422
436
return ;
423
437
}
424
438
439
+ if (help)
440
+ {
441
+
442
+ std::cout << " usage: pdal_wrench build_vpc [<args>]" << std::endl;
443
+ programArgs.dump (std::cerr, 2 , Utils::screenWidth ());
444
+ return ;
445
+ }
446
+
447
+ if (!inputFileList.empty ())
448
+ {
449
+ std::ifstream inputFile (inputFileList);
450
+ std::string line;
451
+
452
+ if (!inputFile)
453
+ {
454
+ std::cerr << " failed to open input file list: " << inputFileList << std::endl;
455
+ return ;
456
+ }
457
+
458
+ while (std::getline (inputFile, line))
459
+ {
460
+ inputFiles.push_back (line);
461
+ }
462
+
463
+ }
464
+
425
465
// std::cout << "input " << inputFiles.size() << std::endl;
426
466
// std::cout << "output " << outputFile << std::endl;
427
467
0 commit comments