src/tools/lvr2_asciiconverter/Options.cpp
Go to the documentation of this file.
1 
28  /*
29  * Options.cpp
30  *
31  * Created on: Nov 21, 2010
32  * Author: Thomas Wiemann
33  */
34 
35 #include "Options.hpp"
36 
37 namespace ascii_convert
38 {
39 
40 Options::Options(int argc, char** argv) : m_descr("Supported options")
41 {
42 
43  // Create option descriptions
44 
45  m_descr.add_options()
46  ("help", "Produce help message")
47  ("inputFile", value< vector<string> >(), "An ASCII-File containing point cloud data.")
48  ("outputFile,o", value<string>()->default_value("out.txt"), "Name of the generated output file.")
49  ("xPos,x", value<int>()->default_value(0), "Position of the x-coordinates in the input data lines.")
50  ("yPos,y", value<int>()->default_value(1), "Position of the y-coordinates in the input data lines.")
51  ("zPos,z", value<int>()->default_value(2), "Position of the z-coordinates in the input data lines.")
52  ("sx", value<float>()->default_value(1.0), "Scaling factor for the x coordinates.")
53  ("sy", value<float>()->default_value(1.0), "Scaling factor for the y coordinates.")
54  ("sz", value<float>()->default_value(1.0), "Scaling factor for the z coordinates.")
55  ("rPos,r", value<int>()->default_value(-1), "Position of the red color component in the input data lines. (-1) means no color information")
56  ("gPos,g", value<int>()->default_value(-1), "Position of the green color component in the input data lines. (-1) means no color information")
57  ("bPos,b", value<int>()->default_value(-1), "Position of the blue color component in the input data lines. (-1) means no color information")
58  ("iPos,i", value<int>()->default_value(-1), "Position of the intensity information input data lines. (-1) means no intensity information")
59  ("convert,c", "Convert intensity into color")
60  ;
61 
62  m_pdescr.add("inputFile", -1);
63 
64  // Parse command line and generate variables map
65  store(command_line_parser(argc, argv).options(m_descr).positional(m_pdescr).run(), m_variables);
66  notify(m_variables);
67 
68  if(m_variables.count("help")) {
69  ::std::cout<< m_descr << ::std::endl;
70  exit(-1);
71  }
72 
73 
74 }
75 
77 {
78  return m_variables.count("convert");
79 }
80 
81 string Options::inputFile() const
82 {
83  return (m_variables["inputFile"].as< vector<string> >())[0];
84 }
85 
86 string Options::outputFile() const
87 {
88  return (m_variables["outputFile"].as< string>());
89 }
90 
91 bool Options::printUsage() const
92 {
93  if(!m_variables.count("inputFile"))
94  {
95  cout << "Error: You must specify an input file." << endl;
96  cout << endl;
97  cout << m_descr << endl;
98  return true;
99  }
100 
101  if(m_variables.count("help"))
102  {
103  cout << endl;
104  cout << m_descr << endl;
105  return true;
106  }
107  return false;
108 }
109 
111  // TODO Auto-generated destructor stub
112 }
113 
114 } // namespace reconstruct
const kaboom::Options * options
bool printUsage() const
Prints a usage message.
Options(int argc, char **argv)
Ctor. Parses the command parameters given to the main function of the program.
bool convertRemission() const
If true, intinesites will be converted to colors.
string outputFile() const
Retuns the input file.
string inputFile() const
Retuns the input file.
positional_options_description m_pdescr
The internally used positional option desription.
variables_map m_variables
The internally used variable map.
options_description m_descr
The internally used option description.
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