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
Options.hpp
meshreduce::Options::Options
Options(int argc, char **argv)
Ctor. Parses the command parameters given to the main function of the program.
Definition: src/tools/lvr2_mesh_reducer/Options.cpp:46
meshreduce::Options::printUsage
bool printUsage() const
Definition: src/tools/lvr2_mesh_reducer/Options.cpp:70
meshreduce::Options::~Options
virtual ~Options()
Definition: src/tools/lvr2_mesh_reducer/Options.cpp:88
meshreduce::Options::getEdgeCollapseReductionRatio
float getEdgeCollapseReductionRatio() const
Reduction ratio for mesh reduction via edge collapse.
Definition: src/tools/lvr2_mesh_reducer/Options.cpp:65
lvr2::BaseOption::m_variables
variables_map m_variables
The internally used variable map.
Definition: BaseOption.hpp:104
meshreduce::Options::m_edgeCollapseReductionRatio
float m_edgeCollapseReductionRatio
Definition: src/tools/lvr2_mesh_reducer/Options.hpp:82
lvropenmp.hpp
meshreduce
Definition: src/tools/lvr2_mesh_reducer/Options.cpp:41
meshreduce::Options::getInputFileName
string getInputFileName() const
Returns the output file name.
Definition: src/tools/lvr2_mesh_reducer/Options.cpp:60
argc
int argc
Definition: tests_high_five_parallel.cpp:27
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
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