libtin/src/tool/grd2tin.cpp

52 lines
1.9 KiB
C++
Raw Normal View History

2021-10-16 21:37:51 +08:00
#include "../lib/tin.h"
#include "iostream"
#include "fstream"
#include "sstream"
#include "string"
#ifdef _WINDOWS
#include "getopt_win.h"
#else
#include "getopt.h"
#endif
void display_help(std::string exe_name)
{
std::clog << exe_name << " - Generating the Triangular Irregular Networks (TIN) from regular DEM grids\n\n";
std::clog << "Usage: -z<xyz-file> -r<xmin>/<xmax>/<ymin>/<ymax> -i<dx>/<dy> -m<mesh-file> [-p<poly-file>] [-t<threshold>] [-l<log-file>] [-n<neighbor-file>]\n\n";
std::clog << "Options:\n";
std::clog << " -z --xyz-file\tinput DEM grid file.\n";
std::clog << " -r --range\tinput DEM grid's range.\n";
std::clog << " -i --interval\tinput DEM grid's interval.\n";
std::clog << " -m --mesh-file\toutput a Gmsh's .msh file of the generated TIN.\n";
std::clog << " -p --poly-file\tinput a polygon file to control the outline shape of the generated TIN.\n";
std::clog << " -t --threshold\tthreshold of the maximal error of the generated TIN with respect to the input DEM grid.\n";
std::clog << " -l --log-file\toutput a .log file of the maximal error of the generated TIN.\n";
std::clog << " -n --neighbor-file\toutput a .neigh file of the maximal error of the generated TIN.\n";
return;
}
int main(int argc, char const *argv[])
{
static struct option long_opts[] =
{
{"xyz-file", required_argument, NULL, 'z'},
{"range", required_argument, NULL, 'r'},
{"interval", required_argument, NULL, 'i'},
{"mesh-file", required_argument, NULL, 'm'},
{"poly-file", required_argument, NULL, 'p'},
{"threshold", required_argument, NULL, 't'},
{"log-file", required_argument, NULL, 'l'},
{"neighbor-file", required_argument, NULL, 'n'},
{0, 0, 0, 0},
};
if (argc == 1)
{
display_help(argv[0]);
return 0;
}
return 0;
}