33 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
37 #include <MemoryX/interface/gui/GraphVisualizerInterface.h>
40 #include <QMainWindow>
42 #include <QGraphicsScene>
43 #include <QGraphicsLineItem>
44 #include <QGraphicsEllipseItem>
45 #include <QMouseEvent>
46 #include <MemoryX/interface/components/GraphNodePoseResolverInterface.h>
57 #include <MemoryX/gui-plugins/GraphVisualizerPlugin/ui_GraphVisualizerGuiPlugin.h>
62 class GraphVisualizerGraphicsEllipseItem;
63 class GraphVisualizerGraphicsLineItem;
65 class GraphVisualizerConfigDialog;
66 class GraphVisualizerWidget;
68 class MouseEventProcessor;
80 Q_PLUGIN_METADATA(IID
"ArmarXGuiInterface/1.00")
85 return "GraphVisualizerGuiPlugin";
216 public GraphVisualizerInterface
230 using EdgeId =
const std::pair<const std::string, const std::string>;
244 return "MemoryX.GraphVisualizerGUI";
248 return QIcon {
"://icons/graph_visu.svg"};
262 bool hasEdge(
const std::string& node1,
const std::string& node2,
const Ice::Current& = Ice::emptyCurrent)
override
264 return (edges.find(toEdge(node1, node2)) != edges.end());
267 bool hasNode(
const std::string&
id,
const Ice::Current& = Ice::emptyCurrent)
override
269 return (nodes.find(
id) != nodes.end());
274 void addEdge(
const std::string& node1Id,
const std::string& node2Id,
const Ice::Current& = Ice::emptyCurrent)
override;
275 void addNode(
const GraphNodeBasePtr& node,
const Ice::Current& = Ice::emptyCurrent)
override;
277 void highlightEdge(
const std::string& node1Id,
const std::string& node2Id,
bool highlighted =
true,
const Ice::Current& = Ice::emptyCurrent)
override;
278 void highlightNode(
const std::string& nodeId,
bool highlighted =
true,
const Ice::Current& = Ice::emptyCurrent)
override;
280 void clearEdges(
const Ice::Current& = Ice::emptyCurrent)
override;
281 void clearGraph(
const Ice::Current& = Ice::emptyCurrent)
override;
283 void resetHighlight(
const Ice::Current& = Ice::emptyCurrent)
override;
285 void redraw(
const Ice::Current& = Ice::emptyCurrent)
override;
295 Ui::GraphVisualizerGuiPlugin
ui;
301 void addKitchenGraph();
303 void selectedSceneChanged(
int i);
304 void updateSceneList();
312 void nodeTableDoubleClicked(
int row,
int);
317 void edgeTableDoubleClicked(
int row,
int);
323 void nodeDoubleClicked(
NodeId id);
329 void edgeDoubleClicked(
EdgeId id);
336 void viewRotatedClock();
343 void viewRotatedCounterClock();
348 void transformView();
355 bool addNewEdge(
const std::string& from,
const std::string& to);
356 void addNewEdgeBoth();
357 void addNewEdgeStartEnd();
358 void addNewEdgeEndStart();
360 void addNewGraphNode();
361 void editGraphNode();
373 GraphNodeBasePtr node;
383 QGraphicsEllipseItem* graphicsItem;
388 int tableWidgetNodesIndex;
405 QGraphicsLineItem* graphicsItem;
409 int tableWidgetEdgesIndex;
424 static EdgeId toEdge(
const std::string& node1,
const std::string& node2)
426 return EdgeId {node1, node2};
433 void updateEdge(
const EdgeId&
id);
439 void updateNode(
const NodeId&
id);
441 void setEditFields(
const NodeData& node);
446 std::string debugDrawerTopicName;
456 QPointer<GraphVisualizerConfigDialog> dialog;
458 float getYawAngle(
const armarx::PoseBasePtr& pose)
const;
467 QPointer<QGraphicsScene> scene;
472 std::map<std::string, NodeData> nodes;
477 std::map<EdgeId, EdgeData> edges;
487 std::string debugDrawerLayerName;
489 bool editStartNodeNext;
491 std::string priorKnowledgeProxyName;
492 memoryx::PriorKnowledgeInterfacePrx priorKnowledgePrx;
493 memoryx::GraphNodePoseResolverInterfacePrx gnpr;
494 memoryx::GraphMemorySegmentBasePrx graphSeg;
496 QString lastSelectedSceneName;
507 void loadScene(
const std::string& xmlFile);
528 QGraphicsEllipseItem {x, y, width, height, parent},
530 parentVisuWidget(visuWidget)
540 parentVisuWidget.nodeDoubleClicked(
id);
563 QGraphicsLineItem {x1, y1, x2, y2, parent},
565 parentVisuWidget(visuWidget)
576 parentVisuWidget.edgeDoubleClicked(
id);
597 bool eventFilter(QObject* obj, QEvent* event)
override;