GuiGraph.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 <map>
25#include <optional>
26
29
30#include <SemanticObjectRelations/RelationGraph/RelationGraph.h>
31
32
33class QGraphicsEllipseItem;
34class QGraphicsLineItem;
35class QTableWidgetItem;
36
38{
39
40 /**
41 * @brief The NodeData struct holds data required for the node.
42 * The name is stored in the key used in the map vertices.
43 */
45 {
46 /// The item in the table tableWidgetVertices.
47 QTableWidgetItem* tableWidgetItem = nullptr;
48
49 /// Whether the node is highlighted.
50 bool highlighted = false;
51
52 /// Whether the vertex was changed since loading or committing.
53 bool changed = false;
54 };
55
56 /**
57 * @brief The EdgeData struct holds data required for the edge.
58 * The name is stored in the key used in the map edges.
59 */
61 {
62 /// The line in the scene.
63 QGraphicsLineItem* graphicsItem = nullptr;
64
65 /// The item in the table tableWidgetEdges.
66 QTableWidgetItem* tableWidgetItem = nullptr;
67
68 /// Whether the edge is highlighted.
69 bool highlighted = false;
70 };
71
73 {
74 /// Whether the graph structure was changed since loading or committing.
75 bool edgesChanged = false;
76 };
77
78 class GuiGraph : public semrel::RelationGraph<VertexData, EdgeData, GraphData>
79 {
80 public:
81 using RelationGraph::RelationGraph;
82
83
84 bool hasChanged() const;
85
86 std::optional<Vertex> getVertexFromTableItem(QTableWidgetItem* item);
87
88 std::map<QTableWidgetItem*, Vertex> getTableItemToVertexMap();
89 std::map<QTableWidgetItem*, Edge> getTableItemToEdgeMap();
90 };
91
94
95
96 float getYawAngleDegree(const core::Pose& pose);
97 double getYawAngleDegree(const core::Pose_d& pose);
98
99} // namespace armarx::navigation::qt_plugins::location_graph_editor
std::map< QTableWidgetItem *, Edge > getTableItemToEdgeMap()
Definition GuiGraph.cpp:84
std::optional< Vertex > getVertexFromTableItem(QTableWidgetItem *item)
Definition GuiGraph.cpp:55
std::map< QTableWidgetItem *, Vertex > getTableItemToVertexMap()
Definition GuiGraph.cpp:68
Eigen::Isometry3f Pose
Definition basic_types.h:31
Eigen::Isometry3d Pose_d
Definition basic_types.h:32
This file is part of ArmarX.
Definition Visu.h:48
auto toGuiGraph(const core::Graph &nav) -> GuiGraph
Definition GuiGraph.cpp:112
navigation::core::Graph fromGuiGraph(const GuiGraph &gui)
Definition GuiGraph.cpp:127
The EdgeData struct holds data required for the edge.
Definition GuiGraph.h:61
QGraphicsLineItem * graphicsItem
The line in the scene.
Definition GuiGraph.h:63
QTableWidgetItem * tableWidgetItem
The item in the table tableWidgetEdges.
Definition GuiGraph.h:66
bool edgesChanged
Whether the graph structure was changed since loading or committing.
Definition GuiGraph.h:75
The NodeData struct holds data required for the node.
Definition GuiGraph.h:45
bool changed
Whether the vertex was changed since loading or committing.
Definition GuiGraph.h:53
QTableWidgetItem * tableWidgetItem
The item in the table tableWidgetVertices.
Definition GuiGraph.h:47