dxf_to_graph_node.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, <copyright holder> <email>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the <organization> nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY <copyright holder> <email> ''AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  * DISCLAIMED. IN NO EVENT SHALL <copyright holder> <email> BE LIABLE FOR ANY
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
30 #include <boost/program_options.hpp>
31 
32 namespace po = boost::program_options;
33 
34 int main(int argc, char** argv)
35 {
36  po::options_description description("usage");
37  description.add_options()
38  ("help,h", "Display help message")
39  ("input,i", po::value<std::string>()->default_value("./segments.dxf"), "The path to the file")
40  ("output,o", po::value<std::string>()->default_value("./graphs/segments"), "The output directory")
41  ("width,w", po::value<float>()->default_value(0.6), "The width of a segments in meters")
42  ("length,l", po::value<float>()->default_value(1.0), "The length of a segment in meters");
43 
44  po::variables_map vm;
45  po::store(po::command_line_parser(argc, argv).options(description).run(), vm);
46  po::notify(vm);
47 
48  if(vm.count("help")){
49  std::cout << description << std::endl;
50  }
51  else
52  {
53  std::string inpath = vm["input"].as<std::string>();
54  std::string outpath = vm["output"].as<std::string>();
55  if(outpath.back() != '/')
56  outpath += "/";
57 
58  float length = vm["length"].as<float>();
59  float width = vm["width"].as<float>();
60 
61 
62  std::cout << "\tGenerating Graph from \"" << inpath << "\" with line_width: " << width << " and minimum line_length: " << length << std::endl;
63 
64  tuw_graph::DxfToGraph dxf2graph;
65  dxf2graph.parseGraph(inpath, length, width);
66  dxf2graph.serializeGraph(outpath);
67 
68  std::cout << "\tSaving graph to \"" << outpath << "\"" << std::endl;
69  }
70 
71 
72 
73  return 0;
74 }
75 
void serializeGraph(const std::string &_graphPath) const
serializes the graph and saves it to memory
int main(int argc, char **argv)
options
bool parseGraph(const std::string &_dxfPath, const float _segLength, const float _segWidth)
reads the graph from the dx file
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)


tuw_voronoi_graph
Author(s): Benjamin Binder
autogenerated on Mon Jun 10 2019 15:42:44