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
rqt_image_view
Definition: image_view.h:58
rqt_image_view::ImageView::ROTATE_STATE_COUNT
@ ROTATE_STATE_COUNT
Definition: image_view.h:142
rqt_image_view::ImageView::widget_
QWidget * widget_
Definition: image_view.h:128
rqt_image_view::ImageView
Definition: image_view.h:60
rqt_image_view::ImageView::initPlugin
virtual void initPlugin(qt_gui_cpp::PluginContext &context)
Definition: image_view.cpp:57
ros::Publisher
rqt_image_view::ImageView::ROTATE_0
@ ROTATE_0
Definition: image_view.h:137
rqt_image_view::ImageView::getTopicList
virtual ROS_DEPRECATED QList< QString > getTopicList(const QSet< QString > &message_types, const QList< QString > &transports)
Definition: image_view.cpp:258
rqt_image_view::ImageView::getTopics
virtual QSet< QString > getTopics(const QSet< QString > &message_types, const QSet< QString > &message_sub_types, const QList< QString > &transports)
Definition: image_view.cpp:264
rqt_image_view::ImageView::subscriber_
image_transport::Subscriber subscriber_
Definition: image_view.h:130
rqt_image_view::ImageView::callbackImage
virtual void callbackImage(const sensor_msgs::Image::ConstPtr &msg)
Definition: image_view.cpp:564
qt_gui_cpp::PluginContext
rqt_image_view::ImageView::pub_mouse_left_
ros::Publisher pub_mouse_left_
Definition: image_view.h:148
rqt_image_view::ImageView::onMousePublish
virtual void onMousePublish(bool checked)
Definition: image_view.cpp:395
rqt_image_view::ImageView::arg_topic_name
QString arg_topic_name
Definition: image_view.h:147
rqt_image_view::ImageView::ui_
Ui::ImageViewWidget ui_
Definition: image_view.h:126
rqt_image_view::ImageView::onDynamicRange
virtual void onDynamicRange(bool checked)
Definition: image_view.cpp:371
ROS_DEPRECATED
#define ROS_DEPRECATED
rqt_image_view::ImageView::ROTATE_180
@ ROTATE_180
Definition: image_view.h:139
rqt_image_view::ImageView::saveImage
virtual void saveImage()
Definition: image_view.cpp:381
qt_gui_cpp::Settings
image_transport::Subscriber
rqt_image_view::ImageView::onZoom1
virtual void onZoom1(bool checked)
Definition: image_view.cpp:354
rqt_image_view::ImageView::syncRotateLabel
void syncRotateLabel()
Definition: image_view.cpp:480
rqt_gui_cpp::Plugin
rqt_image_view::ImageView::ROTATE_90
@ ROTATE_90
Definition: image_view.h:138
rqt_image_view::ImageView::conversion_mat_
cv::Mat conversion_mat_
Definition: image_view.h:132
rqt_image_view::ImageView::onRotateRight
virtual void onRotateRight()
Definition: image_view.cpp:474
rqt_image_view::ImageView::num_gridlines_
int num_gridlines_
Definition: image_view.h:154
rqt_image_view::ImageView::onRotateLeft
virtual void onRotateLeft()
Definition: image_view.cpp:464
rqt_image_view::ImageView::onTopicChanged
virtual void onTopicChanged(int index)
Definition: image_view.cpp:326
rqt_image_view::ImageView::shutdownPlugin
virtual void shutdownPlugin()
Definition: image_view.cpp:120
package.h
rqt_image_view::ImageView::rotate_state_
RotateState rotate_state_
Definition: image_view.h:156
rqt_image_view::ImageView::updateTopicList
virtual void updateTopicList()
Definition: image_view.cpp:215
image_transport.h
rqt_image_view::ImageView::selectTopic
virtual void selectTopic(const QString &topic)
Definition: image_view.cpp:312
rqt_image_view::ImageView::overlayGrid
virtual void overlayGrid()
Definition: image_view.cpp:541
plugin.h
rqt_image_view::ImageView::restoreSettings
virtual void restoreSettings(const qt_gui_cpp::Settings &plugin_settings, const qt_gui_cpp::Settings &instance_settings)
Definition: image_view.cpp:143
rqt_image_view::ImageView::saveSettings
virtual void saveSettings(qt_gui_cpp::Settings &plugin_settings, qt_gui_cpp::Settings &instance_settings) const
Definition: image_view.cpp:126
rqt_image_view::ImageView::invertPixels
virtual void invertPixels(int x, int y)
Definition: image_view.cpp:492
rqt_image_view::ImageView::RotateState
RotateState
Definition: image_view.h:136
rqt_image_view::ImageView::getGridIndices
QList< int > getGridIndices(int size) const
Definition: image_view.cpp:502
rqt_image_view::ImageView::ImageView
ImageView()
Definition: image_view.cpp:48
rqt_image_view::ImageView::onHideToolbarChanged
virtual void onHideToolbarChanged(bool hide)
Definition: image_view.cpp:459
rqt_image_view::ImageView::updateNumGridlines
virtual void updateNumGridlines()
Definition: image_view.cpp:376
macros.h
rqt_image_view::ImageView::ROTATE_270
@ ROTATE_270
Definition: image_view.h:140
rqt_image_view::ImageView::pub_topic_custom_
bool pub_topic_custom_
Definition: image_view.h:150
rqt_image_view::ImageView::onMouseLeft
virtual void onMouseLeft(int x, int y)
Definition: image_view.cpp:419
rqt_image_view::ImageView::onPubTopicChanged
virtual void onPubTopicChanged()
Definition: image_view.cpp:453
rqt_image_view::ImageView::hide_toolbar_action_
QAction * hide_toolbar_action_
Definition: image_view.h:152
rqt_image_view::ImageView::setColorSchemeList
virtual void setColorSchemeList()
Definition: image_view.cpp:190


rqt_image_view
Author(s): Dirk Thomas , Mabel Zhang
autogenerated on Fri May 26 2023 02:31:55