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 
24 #include <QTimer>
25 
27 
31 
33 
34 #include <VisionX/gui-plugins/SemanticRelationViewer/ui_SemanticRelationViewerWidget.h>
35 #include <VisionX/interface/components/SemanticRelationAnalyzer.h>
36 #include <VisionX/interface/libraries/SemanticObjectRelations/GraphStorage.h>
37 
38 #include "SemanticGraphEdgeItem.h"
41 #include <SemanticObjectRelations/RelationGraph/json/AttributedGraph.h>
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  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
100  {
101  return "VisionX.SemanticRelationViewer";
102  }
103 
104  /**
105  * \see armarx::Component::onInitComponent()
106  */
107  void onInitComponent() override;
108 
109  /**
110  * \see armarx::Component::onConnectComponent()
111  */
112  void onConnectComponent() override;
113  void onDisconnectComponent() override;
114 
115 
116  public slots:
117  /* QT slot declarations */
118  void onUpdateGraphs();
119  void onAutoUpdateChanged();
120 
121  void onLeftClickVertex(SemanticGraphVertexItem* item);
122  void onLeftClickEdge(SemanticGraphEdgeItem* item);
123  void onLeftClickGlobal(SemanticGraphGlobalItem* item);
124 
125  signals:
126  /* QT signal declarations */
127 
128  private:
129  void drawGraph(QGraphicsScene* graphicsScene,
130  GraphvizLayoutedGraph const& layoutedGraph,
131  semrel::AttributedGraph const& graph);
132 
133  void setPropertyView(nlohmann::json const& attrs);
134 
135  void highlightSelected(QGraphicsItem* selected);
136 
137  void onZoomChanged(double newZoom);
138 
139  private:
140  Ui::SemanticRelationViewerWidget widget;
141  QTimer* timer = nullptr;
142  QGraphicsScene graphicsScene;
143  double graphicsSceneScale = 1.0;
144  QPointer<SimpleConfigDialog> configDialog;
145 
146  armarx::semantic::GraphStorageInterfacePrx storage;
147 
148  std::map<std::string, semrel::AttributedGraph> graphMap;
149  JSONTreeModel propertyModel;
150  };
151 } // namespace armarx
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:99
SemanticGraphEdgeItem.h
armarx::JSONTreeModel
Definition: JSONTreeModel.h:10
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:27
ImportExportComponent.h