src/tools/lvr2_viewer/app/Options.cpp
Go to the documentation of this file.
1 #include "Options.hpp"
2 
3 #include <iostream>
5 
6 namespace viewer
7 {
8 
9 using boost::program_options::command_line_parser;
10 using boost::program_options::value;
11 using std::cout;
12 using std::endl;
13 
14 Options::Options(int argc, char** argv) : lvr2::BaseOption(argc, argv)
15 {
16  // Create option descriptions
17  m_descr.add_options()("help",
18  "Produce help message")
19  ("chunkedMesh", boost::program_options::bool_switch()->default_value(false), "Is a chunked Mesh")
20  ("inputFile", value< std::vector<string> >(), "Input file name. Supported formats are ASCII (.pts, .xyz) and .ply")
21  ("layers", value<std::vector<string>>()->multitoken(), "Input file names.")
22  ("cacheSize", value<int>()->default_value(200), "Multilayer chunked mesh the maximum number of high resolution chunks in RAM")
23  ("highResDistance", value<float>()->default_value(150.0f), "The distance of the far plane for the high resolution");
24 
25  // setup in baseoption
26  setup();
27 
28 }
29 
30 bool Options::printUsage() const
31 {
32  if (m_variables.count("help"))
33  {
34  cout << m_descr << endl;
35  return true;
36  }
37 
38  if (!m_variables.count("inputFile"))
39  {
40  cout << "Error: You must specify an input file." << endl;
41  cout << endl;
42  cout << m_descr << endl;
43  return true;
44  }
45 
46  return false;
47 }
48 
49 //std::vector<string> Options::getInputFiles() const
50 //{
51 // return m_variables["inputFiles"].as<std::vector<string>>();
52 //}
53 
54 std::string Options::getInputFileName() const
55 {
56  return (m_variables["inputFile"].as< std::vector<string> >())[0];
57 }
58 std::vector<string> Options::getLayers() const
59 {
60  if(m_variables.count("layers"))
61  {
62  return m_variables["layers"].as<std::vector<string>>();
63  }
64  else
65  {
66  return std::vector<std::string>({"mesh0, mesh1"});
67 
68  }
69 }
70 
72 {
73  int size = m_variables["cacheSize"].as<int>();
74  if(size > 0)
75  {
76  return size;
77  }
78  return 200;
79 }
80 
82 {
83  return m_variables["highResDistance"].as<float>();
84 }
85 
87 {
88  return m_variables["chunkedMesh"].as<bool>();
89 }
90 
92 {
93  // TODO Auto-generated destructor stub
94 }
95 
96 } // namespace chunking
virtual void setup()
Setup internal data structures.
Definition: BaseOption.cpp:84
std::string getInputFileName() const
Returns the input file.
options_description m_descr
The internally used option description.
Definition: BaseOption.hpp:107
Options(int argc, char **argv)
Ctor. Parses the command parameters given to the main function of the program.
variables_map m_variables
The internally used variable map.
Definition: BaseOption.hpp:104
std::vector< std::string > getLayers() const
Returns the layers used for LOD.
bool printUsage() const
Prints a usage message to stdout.
char ** argv


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 Mon Feb 28 2022 22:46:08