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#include <string>
26
27#include <SimoxUtility/color/Color.h>
28
31
32#include "GuiGraph.h"
33
38
40{
41
43 {
45 {
47
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
Eigen::Isometry3f Pose
Definition basic_types.h:31
This file is part of ArmarX.
Definition Visu.h:48
void applyVisu(viz::Layer &layer, const std::optional< VisuT > &visu, RangeT &&range, graph::visu::ObjectParserInfo info)
Definition Visu.h:105
The EdgeData struct holds data required for the edge.
Definition GuiGraph.h:61
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:98
void draw(viz::Layer &layer, GuiGraph::ConstEdge edge, graph::visu::ObjectParserInfo info) const
Definition Visu.cpp:115
void draw(viz::Layer &layer, const GuiGraph &graph, graph::visu::ObjectParserInfo info) const
Definition Visu.cpp:134
The NodeData struct holds data required for the node.
Definition GuiGraph.h:45
viz::Arrow draw(const std::string &name, const core::Pose &pose, const VertexData &attribs) const
Definition Visu.cpp:55
viz::Pose draw(const std::string &name, const core::Pose &pose, const VertexData &attribs) const
Definition Visu.cpp:42
void draw(viz::Layer &layer, GuiGraph::ConstVertex vertex, graph::visu::ObjectParserInfo info) const
Definition Visu.cpp:70