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 <QSet>
53 #include <QSize>
54 #include <QWidget>
55 
56 #include <vector>
57 
58 namespace rqt_image_view {
59 
60 class ImageView
61  : public rqt_gui_cpp::Plugin
62 {
63 
64  Q_OBJECT
65 
66 public:
67 
68  ImageView();
69 
70  virtual void initPlugin(qt_gui_cpp::PluginContext& context);
71 
72  virtual void shutdownPlugin();
73 
74  virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const;
75 
76  virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings);
77 
78 protected slots:
79 
80  virtual void setColorSchemeList();
81 
82  virtual void updateTopicList();
83 
84 protected:
85 
86  // deprecated function for backward compatibility only, use getTopics() instead
87  ROS_DEPRECATED virtual QList<QString> getTopicList(const QSet<QString>& message_types, const QList<QString>& transports);
88 
89  virtual QSet<QString> getTopics(const QSet<QString>& message_types, const QSet<QString>& message_sub_types, const QList<QString>& transports);
90 
91  virtual void selectTopic(const QString& topic);
92 
93 protected slots:
94 
95  virtual void onTopicChanged(int index);
96 
97  virtual void onZoom1(bool checked);
98 
99  virtual void onDynamicRange(bool checked);
100 
101  virtual void saveImage();
102 
103  virtual void updateNumGridlines();
104 
105  virtual void onMousePublish(bool checked);
106 
107  virtual void onMouseLeft(int x, int y);
108 
109  virtual void onPubTopicChanged();
110 
111  virtual void onHideToolbarChanged(bool hide);
112 
113  virtual void onRotateLeft();
114  virtual void onRotateRight();
115 
116 protected:
117 
118  virtual void callbackImage(const sensor_msgs::Image::ConstPtr& msg);
119 
120  virtual void invertPixels(int x, int y);
121 
122  QList<int> getGridIndices(int size) const;
123 
124  virtual void overlayGrid();
125 
126  Ui::ImageViewWidget ui_;
127 
128  QWidget* widget_;
129 
131 
133 
134 private:
135 
136  enum RotateState {
137  ROTATE_0 = 0,
141 
143  };
144 
145  void syncRotateLabel();
146 
147  QString arg_topic_name;
149 
151 
153 
155 
157 };
158 
159 }
160 
161 #endif // rqt_image_view__ImageView_H
virtual void onMouseLeft(int x, int y)
Definition: image_view.cpp:415
virtual void onPubTopicChanged()
Definition: image_view.cpp:449
virtual void initPlugin(qt_gui_cpp::PluginContext &context)
Definition: image_view.cpp:57
QAction * hide_toolbar_action_
Definition: image_view.h:152
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:560
ros::Publisher pub_mouse_left_
Definition: image_view.h:148
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:130
virtual void onMousePublish(bool checked)
Definition: image_view.cpp:391
Ui::ImageViewWidget ui_
Definition: image_view.h:126
virtual void onDynamicRange(bool checked)
Definition: image_view.cpp:367
virtual void onZoom1(bool checked)
Definition: image_view.cpp:350
virtual void saveImage()
Definition: image_view.cpp:377
virtual void onRotateLeft()
Definition: image_view.cpp:460
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:470
#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:537
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:455
QList< int > getGridIndices(int size) const
Definition: image_view.cpp:498
virtual void invertPixels(int x, int y)
Definition: image_view.cpp:488
virtual void updateNumGridlines()
Definition: image_view.cpp:372
virtual void setColorSchemeList()
Definition: image_view.cpp:186


rqt_image_view
Author(s): Dirk Thomas
autogenerated on Sun Dec 13 2020 03:36:07