32 #include <QApplication> 34 #include <QDockWidget> 36 #include <QMetaObject> 39 #include <OgreSceneManager.h> 40 #include <OgreSceneNode.h> 51 #include <boost/filesystem.hpp> 57 , scene_node_(nullptr)
60 , visibility_bits_(0xFFFFFFFF)
61 , associated_widget_(nullptr)
62 , associated_widget_panel_(nullptr)
65 qRegisterMetaType<ros::Time>();
110 case Qt::ForegroundRole:
124 return QColor(40, 120, 197);
129 return QApplication::palette().color(QPalette::Text);
143 case Qt::DecorationRole:
177 QMetaObject::invokeMethod(
this,
"setStatusInternal", Qt::QueuedConnection, Q_ARG(
int, level),
178 Q_ARG(QString, name), Q_ARG(QString, text));
199 QMetaObject::invokeMethod(
this,
"deleteStatusInternal", Qt::QueuedConnection, Q_ARG(QString, name));
212 QMetaObject::invokeMethod(
this,
"clearStatusesInternal", Qt::QueuedConnection);
295 associated_widgets_visibility[widget] = visible;
299 auto it = associated_widgets_visibility.find(widget);
300 return it != associated_widgets_visibility.end() && it->second;
305 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
346 QApplication::restoreOverrideCursor();
static std::map< PanelDockWidget *, bool > associated_widgets_visibility
virtual QIcon getIcon() const
PanelDockWidget * associated_widget_panel_
virtual void save(Config config) const
Write the value of this property and/or its children into the given Config reference.
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz...
void changed()
Emitted by setValue() just after the value has changed.
PropertyTreeModel * model_
Pointer to the PropertyTreeModel managing this property tree.
void setDisableChildrenIfFalse(bool disable)
virtual void load(const Config &config)
Load the value of this property and/or its children from the given Config reference.
void emitTimeSignal(ros::Time time)
Emit a time signal that other Displays can synchronize to.
virtual bool setValue(const QVariant &new_value)
Set the new value for this property. Returns true if the new value is different from the old value...
ros::NodeHandle update_nh_
A NodeHandle whose CallbackQueue is run from the main GUI thread (the "update" thread).
void timeSignal(ros::Time time, QPrivateSignal)
virtual void onEnableChanged()
virtual PanelDockWidget * addPane(const QString &name, QWidget *pane, Qt::DockWidgetArea area=Qt::LeftDockWidgetArea, bool floating=false)=0
virtual void setName(const QString &name)
Set the name.
void load(const Config &config) override
Load the settings for this display from the given Config node, which must be a map.
QIcon statusIcon(Level level) const
virtual ros::CallbackQueueInterface * getUpdateQueue()=0
Return the CallbackQueue using the main GUI thread.
bool mapGetString(const QString &key, QString *value_out) const
Convenience function for looking up a named string.
uint32_t visibility_bits_
Ogre::SceneNode * scene_node_
The Ogre::SceneNode to hold all 3D scene elements shown by this Display.
void unsetVisibilityBits(uint32_t bits)
void setVisible(PanelDockWidget *widget, bool visible)
void mapSetValue(const QString &key, QVariant value)
Set a named child to the given value.
Configuration data storage class.
QString fixed_frame_
A convenience variable equal to context_->getFixedFrame().
virtual Level getLevel() const
QVariant getViewData(int column, int role) const override
Return data appropriate for the given column (0 or 1) and role for this Display.
Pure-virtual base class for objects which give Display subclasses context in which to work...
virtual void clearStatuses()
Delete all status children. This is thread-safe.
void clearStatusesInternal()
virtual void reset()
Called to tell the display to clear its state.
virtual QVariant getViewData(int column, int role) const
Return data appropriate for the given column (0 or 1) and role for this Property. ...
QWidget * associated_widget_
virtual void onEnable()
Derived classes override this to do the actual work of enabling themselves.
virtual Qt::ItemFlags getViewFlags(int column) const
Return item flags appropriate for the given column (0 or 1) for this Property.
void setCallbackQueue(CallbackQueueInterface *queue)
void setAssociatedWidget(QWidget *widget)
Associate the given widget with this Display.
static QColor statusColor(Level level)
Return the color appropriate for the given status level.
void queueRender()
Convenience function which calls context_->queueRender().
virtual QString getName() const
Return the name of this Property as a QString.
Qt::ItemFlags getViewFlags(int column) const override
Return item flags appropriate for the given column (0 or 1) for this Display.
void setVisibilityBits(uint32_t bits)
void setFixedFrame(const QString &fixed_frame)
Set the fixed frame in this display.
Ogre::SceneManager * scene_manager_
A convenience variable equal to context_->getSceneManager().
virtual Ogre::SceneManager * getSceneManager() const =0
Returns the Ogre::SceneManager used for the main RenderPanel.
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
bool isEnabled() const
Return true if this Display is enabled, false if not.
bool mapGetBool(const QString &key, bool *value_out) const
Convenience function for looking up a named boolean.
virtual QString getFixedFrame() const =0
Return the fixed frame name.
ros::NodeHandle threaded_nh_
A NodeHandle whose CallbackQueue is run from a different thread than the GUI.
virtual void onDisable()
Derived classes override this to do the actual work of disabling themselves.
void setEnabled(bool enabled)
Enable or disable this Display.
void setStatus(Level level, const QString &name, const QString &text)
virtual void fixedFrameChanged()
Called by setFixedFrame(). Override to respond to changes to fixed_frame_.
virtual void addChild(Property *child, int index=-1)
Add a child property.
void save(Config config) const override
Write this display to the given Config node.
void setName(const QString &name) override
Overridden from Property to set associated widget title to the new name.
void emitDataChanged(Property *property)
bool isVisible(PanelDockWidget *widget)
virtual void onInitialize()
Override this function to do subclass-specific initialization.
void initialize(DisplayContext *context)
Main initialization, called after constructor, before load() or setEnabled().
virtual void deleteStatus(const QString &name)
Delete the status entry with the given name. This is thread-safe.
void associatedPanelVisibilityChange(bool visible)
virtual QString getClassId() const
Return the class identifier which was used to create this instance. This version just returns whateve...
virtual bool getBool() const
void applyVisibilityBits(uint32_t bits, Ogre::SceneNode *node)
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
Show status level and text. This is thread-safe.
void deleteStatusInternal(const QString &name)
virtual WindowManagerInterface * getWindowManager() const =0
Return the window manager, if any.
virtual ros::CallbackQueueInterface * getThreadedQueue()=0
Return a CallbackQueue using a different thread than the main GUI one.
void setIcon(const QIcon &icon) override
Set the Display's icon.
void deleteStatus(const QString &name)
void setStatusInternal(int level, const QString &name, const QString &text)