Skip to content

Commit af0d120

Browse files
committed
minor cleanup and comments
1 parent 154a2b7 commit af0d120

File tree

4 files changed

+10
-23
lines changed

4 files changed

+10
-23
lines changed

rviz_common/include/rviz_common/properties/ros_topic_multi_property.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ namespace rviz_common
4242
namespace properties
4343
{
4444

45+
// Like RosTopicProperty but can accept multiple message types
4546
class RVIZ_COMMON_PUBLIC RosTopicMultiProperty : public RosTopicProperty
4647
{
4748
Q_OBJECT
@@ -53,9 +54,14 @@ class RVIZ_COMMON_PUBLIC RosTopicMultiProperty : public RosTopicProperty
5354
const QString & description = QString(),
5455
Property * parent = nullptr,
5556
const char * changed_slot = nullptr,
56-
QObject * receiver = nullptr);
57+
QObject * receiver = nullptr):
58+
RosTopicProperty(name, default_value, "", description, parent, changed_slot, receiver),
59+
message_types_(message_types)
60+
{}
61+
62+
void setMessageTypes(const std::vector<QString> & message_types)
63+
{message_types_ = message_types;}
5764

58-
void setMessageTypes(const std::vector<QString> & message_types);
5965

6066
std::vector<QString> getMessageTypes() const
6167
{return message_types_;}

rviz_common/src/rviz_common/properties/ros_topic_multi_property.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ namespace rviz_common
4242
namespace properties
4343
{
4444

45-
RosTopicMultiProperty::RosTopicMultiProperty(
46-
const QString & name,
47-
const QString & default_value,
48-
const std::vector<QString> & message_types,
49-
const QString & description,
50-
Property * parent,
51-
const char * changed_slot,
52-
QObject * receiver)
53-
: RosTopicProperty(name, default_value, "", description, parent, changed_slot, receiver),
54-
message_types_(message_types)
55-
{}
56-
57-
void RosTopicMultiProperty::setMessageTypes(const std::vector<QString> & message_types)
58-
{
59-
message_types_ = message_types;
60-
}
61-
6245
void RosTopicMultiProperty::fillTopicList()
6346
{
6447
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

rviz_default_plugins/include/rviz_default_plugins/displays/image/image_display.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
# include "rviz_default_plugins/displays/image/image_transport_display.hpp"
5656

5757
# include <sensor_msgs/msg/image.hpp>
58-
# include <sensor_msgs/msg/compressed_image.hpp>
59-
//# include <theora_image_transport/msg/packet.hpp>
6058
#endif
6159

6260

@@ -89,12 +87,10 @@ class RVIZ_DEFAULT_PLUGINS_PUBLIC ImageDisplay : public
8987
void update(float wall_dt, float ros_dt) override;
9088
void reset() override;
9189

92-
9390
public Q_SLOTS:
9491
virtual void updateNormalizeOptions();
9592

9693
protected:
97-
// overrides from Display
9894
void onEnable() override;
9995
void onDisable() override;
10096
void subscribe() override;

rviz_default_plugins/src/rviz_default_plugins/displays/image/image_display.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ ImageDisplay::ImageDisplay()
7676
ImageDisplay::ImageDisplay(std::unique_ptr<ROSImageTextureIface> texture)
7777
: texture_(std::move(texture))
7878
{
79+
// Remove the default single-type topic and replace with a multi-type topic property
80+
// This allows us to display image and compressed image topics in the topic list
7981
delete this->topic_property_;
8082
this->topic_property_ = new rviz_common::properties::RosTopicMultiProperty(
8183
"Topic",

0 commit comments

Comments
 (0)