src/tools/lvr2_mesh_reducer/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 
38 
39 #include <fstream>
40 
41 namespace meshreduce
42 {
43 
44 using namespace boost::program_options;
45 
46 Options::Options(int argc, char** argv) : BaseOption(argc, argv)
47 {
48  // Create option descriptions
49  m_descr.add_options()("help", "Produce help message")(
50  "inputFile",
51  value<vector<string>>(),
52  "Input file name. Supported formats are .obj and .ply")(
53  "reductionRatio,r",
54  value<float>(&m_edgeCollapseReductionRatio)->default_value(0.0),
55  "Percentage of faces to remove via edge-collapse (0.0 means no reduction, 1.0 means to "
56  "remove all faces which can be removed)");
57  setup();
58 }
59 
61 {
62  return (m_variables["inputFile"].as<vector<string>>())[0];
63 }
64 
66 {
67  return (m_variables["reductionRatio"].as<float>());
68 }
69 
70 bool Options::printUsage() const
71 {
72  if (m_variables.count("help"))
73  {
74  cout << endl;
75  cout << m_descr << endl;
76  return true;
77  }
78  else if (!m_variables.count("inputFile"))
79  {
80  cout << "Error: You must specify an input file." << endl;
81  cout << endl;
82  cout << m_descr << endl;
83  return true;
84  }
85  return false;
86 }
87 
89 {
90  // TODO Auto-generated destructor stub
91 }
92 
93 } // namespace meshreduce
string getInputFileName() const
Returns the output file name.
virtual void setup()
Setup internal data structures.
Definition: BaseOption.cpp:84
options_description m_descr
The internally used option description.
Definition: BaseOption.hpp:107
float getEdgeCollapseReductionRatio() const
Reduction ratio for mesh reduction via edge collapse.
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
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