SemanticRelationViewerWidgetController.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  * @package VisionX::gui-plugins::SemanticRelationViewerWidgetController
17  * @author Fabian Paus ( fabian dot paus at kit dot edu )
18  * @date 2019
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #pragma once
23 
25 #include "SemanticGraphEdgeItem.h"
27 
32 
34 
35 #include <VisionX/interface/components/SemanticRelationAnalyzer.h>
36 #include <VisionX/interface/libraries/SemanticObjectRelations/GraphStorage.h>
37 #include <VisionX/gui-plugins/SemanticRelationViewer/ui_SemanticRelationViewerWidget.h>
38 
39 #include <SemanticObjectRelations/RelationGraph/json/AttributedGraph.h>
40 
41 #include <QTimer>
42 
43 namespace armarx
44 {
45  struct GraphvizLayoutedGraph;
46 
47  /**
48  \page VisionX-GuiPlugins-SemanticRelationViewer SemanticRelationViewer
49  \brief The SemanticRelationViewer allows visualizing ...
50 
51  \image html SemanticRelationViewer.png
52  The user can
53 
54  API Documentation \ref SemanticRelationViewerWidgetController
55 
56  \see SemanticRelationViewerGuiPlugin
57  */
58 
59  /**
60  * \class SemanticRelationViewerWidgetController
61  * \brief SemanticRelationViewerWidgetController brief one line description
62  *
63  * Detailed description
64  */
67  public armarx::ArmarXComponentWidgetControllerTemplate < SemanticRelationViewerWidgetController >
68  {
69  Q_OBJECT
70 
71  public:
72  /**
73  * Controller Constructor
74  */
76 
77  /**
78  * Controller destructor
79  */
81 
82  /**
83  * @see ArmarXWidgetController::loadSettings()
84  */
85  void loadSettings(QSettings* settings) override;
86 
87  /**
88  * @see ArmarXWidgetController::saveSettings()
89  */
90  void saveSettings(QSettings* settings) override;
91 
92  QPointer<QDialog> getConfigDialog(QWidget* parent) override;
93 
94  /**
95  * Returns the Widget name displayed in the ArmarXGui to create an
96  * instance of this class.
97  */
98  static QString GetWidgetName()
99  {
100  return "VisionX.SemanticRelationViewer";
101  }
102 
103  /**
104  * \see armarx::Component::onInitComponent()
105  */
106  void onInitComponent() override;
107 
108  /**
109  * \see armarx::Component::onConnectComponent()
110  */
111  void onConnectComponent() override;
112  void onDisconnectComponent() override;
113 
114 
115  public slots:
116  /* QT slot declarations */
117  void onUpdateGraphs();
118  void onAutoUpdateChanged();
119 
120  void onLeftClickVertex(SemanticGraphVertexItem* item);
121  void onLeftClickEdge(SemanticGraphEdgeItem* item);
122  void onLeftClickGlobal(SemanticGraphGlobalItem* item);
123 
124  signals:
125  /* QT signal declarations */
126 
127  private:
128  void drawGraph(QGraphicsScene* graphicsScene,
129  GraphvizLayoutedGraph const& layoutedGraph,
130  semrel::AttributedGraph const& graph);
131 
132  void setPropertyView(nlohmann::json const& attrs);
133 
134  void highlightSelected(QGraphicsItem* selected);
135 
136  void onZoomChanged(double newZoom);
137 
138  private:
139  Ui::SemanticRelationViewerWidget widget;
140  QTimer* timer = nullptr;
141  QGraphicsScene graphicsScene;
142  double graphicsSceneScale = 1.0;
143  QPointer<SimpleConfigDialog> configDialog;
144 
145  armarx::semantic::GraphStorageInterfacePrx storage;
146 
147  std::map<std::string, semrel::AttributedGraph> graphMap;
148  JSONTreeModel propertyModel;
149  };
150 }
armarx::SemanticGraphGlobalItem
Definition: SemanticGraphGlobalItem.h:9
armarx::SemanticGraphEdgeItem
Definition: SemanticGraphEdgeItem.h:11
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
SimpleConfigDialog.h
ArmarXGuiPlugin.h
armarx::SemanticGraphVertexItem
Definition: SemanticGraphVertexItem.h:9
JSONTreeModel.h
ArmarXComponentWidgetController.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::SemanticRelationViewerWidgetController::GetWidgetName
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
Definition: SemanticRelationViewerWidgetController.h:98
SemanticGraphEdgeItem.h
armarx::JSONTreeModel
Definition: JSONTreeModel.h:9
SemanticGraphVertexItem.h
armarx::SemanticRelationViewerWidgetController
SemanticRelationViewerWidgetController brief one line description.
Definition: SemanticRelationViewerWidgetController.h:65
armarx::GraphvizLayoutedGraph
Definition: GraphvizLayout.h:34
SemanticGraphGlobalItem.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h