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
BaseOption.hpp
viewer::Options::isChunkedMesh
bool isChunkedMesh() const
Definition: src/tools/lvr2_viewer/app/Options.cpp:86
viewer
Definition: src/tools/lvr2_viewer/app/Options.cpp:6
Options.hpp
viewer::Options::getCacheSize
int getCacheSize() const
Definition: src/tools/lvr2_viewer/app/Options.cpp:71
viewer::Options::getInputFileName
std::string getInputFileName() const
Returns the input file.
Definition: src/tools/lvr2_viewer/app/Options.cpp:54
lvr2::BaseOption::m_variables
variables_map m_variables
The internally used variable map.
Definition: BaseOption.hpp:104
viewer::Options::Options
Options(int argc, char **argv)
Ctor. Parses the command parameters given to the main function of the program.
Definition: src/tools/lvr2_viewer/app/Options.cpp:14
viewer::Options::~Options
virtual ~Options()
Definition: src/tools/lvr2_viewer/app/Options.cpp:91
argc
int argc
Definition: tests_high_five_parallel.cpp:27
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::BaseOption::setup
virtual void setup()
Setup internal data structures.
Definition: BaseOption.cpp:84
lvr2::BaseOption::m_descr
options_description m_descr
The internally used option description.
Definition: BaseOption.hpp:107
viewer::Options::getHighResDistance
float getHighResDistance() const
Definition: src/tools/lvr2_viewer/app/Options.cpp:81
viewer::Options::printUsage
bool printUsage() const
Prints a usage message to stdout.
Definition: src/tools/lvr2_viewer/app/Options.cpp:30
viewer::Options::getLayers
std::vector< std::string > getLayers() const
Returns the layers used for LOD.
Definition: src/tools/lvr2_viewer/app/Options.cpp:58
argv
char ** argv
Definition: tests_high_five_parallel.cpp:28


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 Wed Mar 2 2022 00:37:24