image_view.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, Dirk Thomas, TU Darmstadt
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  * * Neither the name of the TU Darmstadt nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef rqt_image_view__ImageView_H
34 #define rqt_image_view__ImageView_H
35 
36 #include <rqt_gui_cpp/plugin.h>
37 
38 #include <ui_image_view.h>
39 
41 #include <ros/package.h>
42 #include <ros/macros.h>
43 #include <sensor_msgs/Image.h>
44 #include <geometry_msgs/Point.h>
45 
46 #include <opencv2/core/core.hpp>
47 
48 #include <QAction>
49 #include <QImage>
50 #include <QList>
51 #include <QString>
52 #include <QSize>
53 #include <QWidget>
54 
55 #include <vector>
56 
57 namespace rqt_image_view {
58 
59 class ImageView
60  : public rqt_gui_cpp::Plugin
61 {
62 
63  Q_OBJECT
64 
65 public:
66 
67  ImageView();
68 
69  virtual void initPlugin(qt_gui_cpp::PluginContext& context);
70 
71  virtual void shutdownPlugin();
72 
73  virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const;
74 
75  virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings);
76 
77 protected slots:
78 
79  virtual void setColorSchemeList();
80 
81  virtual void updateTopicList();
82 
83 protected:
84 
85  // deprecated function for backward compatibility only, use getTopics() instead
86  ROS_DEPRECATED virtual QList<QString> getTopicList(const QSet<QString>& message_types, const QList<QString>& transports);
87 
88  virtual QSet<QString> getTopics(const QSet<QString>& message_types, const QSet<QString>& message_sub_types, const QList<QString>& transports);
89 
90  virtual void selectTopic(const QString& topic);
91 
92 protected slots:
93 
94  virtual void onTopicChanged(int index);
95 
96  virtual void onZoom1(bool checked);
97 
98  virtual void onDynamicRange(bool checked);
99 
100  virtual void saveImage();
101 
102  virtual void updateNumGridlines();
103 
104  virtual void onMousePublish(bool checked);
105 
106  virtual void onMouseLeft(int x, int y);
107 
108  virtual void onPubTopicChanged();
109 
110  virtual void onHideToolbarChanged(bool hide);
111 
112  virtual void onRotateLeft();
113  virtual void onRotateRight();
114 
115 protected:
116 
117  virtual void callbackImage(const sensor_msgs::Image::ConstPtr& msg);
118 
119  virtual void invertPixels(int x, int y);
120 
121  QList<int> getGridIndices(int size) const;
122 
123  virtual void overlayGrid();
124 
125  Ui::ImageViewWidget ui_;
126 
127  QWidget* widget_;
128 
130 
132 
133 private:
134 
135  enum RotateState {
136  ROTATE_0 = 0,
140 
142  };
143 
144  void syncRotateLabel();
145 
146  QString arg_topic_name;
148 
150 
152 
154 
156 };
157 
158 }
159 
160 #endif // rqt_image_view__ImageView_H
virtual void onMouseLeft(int x, int y)
Definition: image_view.cpp:413
virtual void onPubTopicChanged()
Definition: image_view.cpp:447
virtual void initPlugin(qt_gui_cpp::PluginContext &context)
Definition: image_view.cpp:57
QAction * hide_toolbar_action_
Definition: image_view.h:151
virtual QSet< QString > getTopics(const QSet< QString > &message_types, const QSet< QString > &message_sub_types, const QList< QString > &transports)
Definition: image_view.cpp:260
virtual void callbackImage(const sensor_msgs::Image::ConstPtr &msg)
Definition: image_view.cpp:558
ros::Publisher pub_mouse_left_
Definition: image_view.h:147
virtual ROS_DEPRECATED QList< QString > getTopicList(const QSet< QString > &message_types, const QList< QString > &transports)
Definition: image_view.cpp:254
image_transport::Subscriber subscriber_
Definition: image_view.h:129
virtual void onMousePublish(bool checked)
Definition: image_view.cpp:389
Ui::ImageViewWidget ui_
Definition: image_view.h:125
virtual void onDynamicRange(bool checked)
Definition: image_view.cpp:365
virtual void onZoom1(bool checked)
Definition: image_view.cpp:348
virtual void saveImage()
Definition: image_view.cpp:375
virtual void onRotateLeft()
Definition: image_view.cpp:458
virtual void onTopicChanged(int index)
Definition: image_view.cpp:322
virtual void shutdownPlugin()
Definition: image_view.cpp:120
virtual void onRotateRight()
Definition: image_view.cpp:468
#define ROS_DEPRECATED
virtual void updateTopicList()
Definition: image_view.cpp:211
virtual void saveSettings(qt_gui_cpp::Settings &plugin_settings, qt_gui_cpp::Settings &instance_settings) const
Definition: image_view.cpp:126
virtual void selectTopic(const QString &topic)
Definition: image_view.cpp:308
virtual void overlayGrid()
Definition: image_view.cpp:535
virtual void restoreSettings(const qt_gui_cpp::Settings &plugin_settings, const qt_gui_cpp::Settings &instance_settings)
Definition: image_view.cpp:142
virtual void onHideToolbarChanged(bool hide)
Definition: image_view.cpp:453
QList< int > getGridIndices(int size) const
Definition: image_view.cpp:496
virtual void invertPixels(int x, int y)
Definition: image_view.cpp:486
virtual void updateNumGridlines()
Definition: image_view.cpp:370
virtual void setColorSchemeList()
Definition: image_view.cpp:186


rqt_image_view
Author(s): Dirk Thomas
autogenerated on Mon Mar 18 2019 02:53:45