dxf_to_graph.h
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  * DISCLAIMED. IN NO EVENT SHALL <copyright holder> <email> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
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 
29 #ifndef DXF_TO_GRAPH_H
30 #define DXF_TO_GRAPH_H
31 
32 #include <string>
34 #include <dxflib/dl_dxf.h>
35 
36 namespace tuw_graph
37 {
38  struct Line
39  {
40  Eigen::Vector2d start;
41  Eigen::Vector2d end;
42  Line(Eigen::Vector2d _start, Eigen::Vector2d _end) : start(_start), end(_end) {}
43  Line() {}
44  };
45 
46  class DxfToGraph
47  {
48  public:
56  bool parseGraph(const std::string &_dxfPath, const float _segLength, const float _segWidth);
61  void serializeGraph(const std::string &_graphPath) const;
62  private:
63  std::vector<Line> splitLine(const DL_LineData &_line, const float _segLength) const;
64  std::vector<Line> splitCircle(const DL_CircleData &_circle, const float _segLength) const;
65  std::vector<Line> splitArc(const DL_ArcData&_arc, const float _segLength) const;
66  bool getGraphData(const DL_ImageData& _image, float &_scale, Eigen::Vector2d &_offset) const;
67  std::vector<Segment> generateGraph(const std::vector<Line> &_lines, const float _segWidth, const float &_scale, const Eigen::Vector2d &_offset) const;
68 
69  std::vector<Segment> graphData_;
70  float scale_;
71  Eigen::Vector2d offset_;
72  };
73 }
74 #endif // PLANNER_NODE_H
Line(Eigen::Vector2d _start, Eigen::Vector2d _end)
Definition: dxf_to_graph.h:42
Eigen::Vector2d end
Definition: dxf_to_graph.h:41
std::vector< Segment > graphData_
Definition: dxf_to_graph.h:69
Eigen::Vector2d start
Definition: dxf_to_graph.h:40
Eigen::Vector2d offset_
Definition: dxf_to_graph.h:71


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