Visu.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
17  * @date 2021
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
22 #pragma once
23 
24 #include <optional>
25 
26 #include <SimoxUtility/color/Color.h>
27 
29 
31 
32 #include "GuiGraph.h"
33 
35 {
37 }
38 
40 {
41 
42  struct VertexVisu
43  {
45  {
47 
48  viz::Pose
49  draw(const std::string& name, const core::Pose& pose, const VertexData& attribs) const;
50  };
51 
52  std::optional<Pose> pose = Pose{};
53 
55  {
57 
59  draw(const std::string& name, const core::Pose& pose, const VertexData& attribs) const;
60  };
61 
62  std::optional<ForwardArrow> forwardArrow = ForwardArrow{};
63 
64 
65  void draw(viz::Layer& layer,
66  GuiGraph::ConstVertex vertex,
68  void draw(viz::Layer& layer,
69  const std::string& name,
70  const core::Pose& pose,
71  const VertexData& attribs) const;
72  };
73 
74  struct EdgeVisu
75  {
77  {
79 
80  viz::Arrow draw(const EdgeData& edge,
81  const std::string& sourceName,
82  const std::string& targetName,
83  const core::Pose& source,
84  const core::Pose& target) const;
85  };
86 
87  std::optional<Arrow> arrow = Arrow{};
88 
89  void
90  draw(viz::Layer& layer, GuiGraph::ConstEdge edge, graph::visu::ObjectParserInfo info) const;
91  };
92 
93  struct GraphVisu
94  {
95  std::optional<VertexVisu> vertex = VertexVisu{std::nullopt};
96  std::optional<EdgeVisu> edge = EdgeVisu{std::nullopt};
97 
98 
99  void
100  draw(viz::Layer& layer, const GuiGraph& graph, graph::visu::ObjectParserInfo info) const;
101  };
102 
103  template <class VisuT, class RangeT>
104  void
106  const std::optional<VisuT>& visu,
107  RangeT&& range,
109  {
110  if (visu.has_value())
111  {
112  for (auto element : range)
113  {
114  visu->draw(layer, element, info);
115  }
116  }
117  }
118 
119 } // namespace armarx::navigation::qt_plugins::location_graph_editor
armarx::navigation::qt_plugins::location_graph_editor::EdgeVisu::Arrow::draw
viz::Arrow draw(const EdgeData &edge, const std::string &sourceName, const std::string &targetName, const core::Pose &source, const core::Pose &target) const
Definition: Visu.cpp:94
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu
Definition: Visu.h:42
armarx::navigation::qt_plugins::location_graph_editor::GraphVisu::draw
void draw(viz::Layer &layer, const GuiGraph &graph, graph::visu::ObjectParserInfo info) const
Definition: Visu.cpp:130
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::forwardArrow
std::optional< ForwardArrow > forwardArrow
Definition: Visu.h:62
armarx::navigation::core::Pose
Eigen::Isometry3f Pose
Definition: basic_types.h:31
boost::target
Vertex target(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:688
armarx::navigation::qt_plugins::location_graph_editor::EdgeVisu
Definition: Visu.h:74
armarx::viz::Arrow
Definition: Elements.h:198
armarx::navigation::graph::VertexVisu::ForwardArrow
Definition: Visu.h:63
armarx::navigation::qt_plugins::location_graph_editor::EdgeData
The EdgeData struct holds data required for the edge.
Definition: GuiGraph.h:59
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::Pose::draw
viz::Pose draw(const std::string &name, const core::Pose &pose, const VertexData &attribs) const
Definition: Visu.cpp:38
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::Pose::scaleFactorHighlighted
float scaleFactorHighlighted
Definition: Visu.h:46
armarx::navigation::qt_plugins::location_graph_editor::VertexData
The NodeData struct holds data required for the node.
Definition: GuiGraph.h:43
armarx::navigation::qt_plugins::location_graph_editor::EdgeVisu::Arrow::colorHighlighted
simox::Color colorHighlighted
Definition: Visu.h:78
Color
uint32_t Color
RGBA color.
Definition: color.h:8
armarx::navigation::qt_plugins::location_graph_editor::EdgeVisu::Arrow
Definition: Visu.h:76
Visu.h
ObjectPoseClient.h
armarx::viz::Pose
Definition: Elements.h:179
armarx::navigation::qt_plugins::location_graph_editor
Definition: GuiGraph.cpp:29
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::draw
void draw(viz::Layer &layer, GuiGraph::ConstVertex vertex, graph::visu::ObjectParserInfo info) const
Definition: Visu.cpp:66
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::Pose
Definition: Visu.h:44
armarx::navigation::qt_plugins::location_graph_editor::EdgeVisu::draw
void draw(viz::Layer &layer, GuiGraph::ConstEdge edge, graph::visu::ObjectParserInfo info) const
Definition: Visu.cpp:111
armarx::navigation::qt_plugins::location_graph_editor::visu
Definition: Visu.h:34
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::pose
std::optional< Pose > pose
Definition: Visu.h:52
armarx::navigation::qt_plugins::location_graph_editor::GraphVisu
Definition: Visu.h:93
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::ForwardArrow::draw
viz::Arrow draw(const std::string &name, const core::Pose &pose, const VertexData &attribs) const
Definition: Visu.cpp:51
armarx::navigation::qt_plugins::location_graph_editor::visu::defaultColorHighlighted
const simox::Color defaultColorHighlighted
Definition: Visu.cpp:35
armarx::navigation::graph::EdgeVisu::Arrow
Definition: Visu.h:82
GuiGraph.h
armarx::navigation::qt_plugins::location_graph_editor::GuiGraph
Definition: GuiGraph.h:77
armarx::navigation::graph::visu::ObjectParserInfo
Definition: Visu.h:44
armarx::navigation::qt_plugins::location_graph_editor::GraphVisu::edge
std::optional< EdgeVisu > edge
Definition: Visu.h:96
armarx::navigation::qt_plugins::location_graph_editor::GraphVisu::vertex
std::optional< VertexVisu > vertex
Definition: Visu.h:95
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::ForwardArrow::colorHighlighted
simox::Color colorHighlighted
Definition: Visu.h:56
armarx::viz::Layer
Definition: Layer.h:12
armarx::navigation::qt_plugins::location_graph_editor::EdgeVisu::arrow
std::optional< Arrow > arrow
Definition: Visu.h:87
armarx::navigation::qt_plugins::location_graph_editor::applyVisu
void applyVisu(viz::Layer &layer, const std::optional< VisuT > &visu, RangeT &&range, graph::visu::ObjectParserInfo info)
Definition: Visu.h:105
armarx::navigation::qt_plugins::location_graph_editor::VertexVisu::ForwardArrow
Definition: Visu.h:54
armarx::navigation::graph::VertexVisu::Pose
Definition: Visu.h:54