Ignition Gui

API Reference

5.0.0
ImageDisplay.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef IGNITION_GUI_PLUGINS_IMAGEDISPLAY_HH_
19 #define IGNITION_GUI_PLUGINS_IMAGEDISPLAY_HH_
20 
21 #include <memory>
22 #ifdef _MSC_VER
23 #pragma warning(push, 0)
24 #endif
25 #include <ignition/msgs/image.pb.h>
26 #ifdef _MSC_VER
27 #pragma warning(pop)
28 #endif
29 
30 #include "ignition/gui/Plugin.hh"
31 
32 namespace ignition
33 {
34 namespace gui
35 {
36 namespace plugins
37 {
38  class ImageDisplayPrivate;
39 
47  class ImageDisplay : public Plugin
48  {
49  Q_OBJECT
50 
52  Q_PROPERTY(
54  READ TopicList
55  WRITE SetTopicList
56  NOTIFY TopicListChanged
57  )
58 
59 
60  public: ImageDisplay();
61 
63  public: virtual ~ImageDisplay();
64 
65  // Documentation inherited
66  public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem);
67 
69  public slots: void OnRefresh();
70 
72  public slots: void OnTopic(const QString _topic);
73 
77  public: Q_INVOKABLE QStringList TopicList() const;
78 
82  public: Q_INVOKABLE void SetTopicList(const QStringList &_topicList);
83 
85  signals: void TopicListChanged();
86 
88  signals: void newImage();
89 
91  private slots: void ProcessImage();
92 
94  private: void UpdateFromRgbInt8();
95 
97  private: void UpdateFromFloat32();
98 
100  private: void UpdateFromLInt16();
101 
103  private: void UpdateFromLInt8();
104 
107  private: void OnImageMsg(const ignition::msgs::Image &_msg);
108 
111  private: std::unique_ptr<ImageDisplayPrivate> dataPtr;
112  };
113 }
114 }
115 }
116 
117 #endif
STL namespace.
Definition: Application.hh:35
virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem)
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
Base class for Ignition GUI plugins.
Definition: Plugin.hh:54
void OnTopic(const QString _topic)
Callback when a new topic is chosen on the combo box.
QStringList topicList
Topic list.
Definition: ImageDisplay.hh:57
Q_INVOKABLE QStringList TopicList() const
Get the topic list as a string, for example &#39;ignition.msgs.StringMsg&#39;.
Definition: Application.hh:40
Q_INVOKABLE void SetTopicList(const QStringList &_topicList)
Set the topic list from a string, for example &#39;ignition.msgs.StringMsg&#39;.