38 #include <OGRE/OgreMaterialManager.h> 39 #include <OGRE/OgreTextureManager.h> 40 #include <OGRE/OgreTexture.h> 41 #include <OGRE/OgreTechnique.h> 42 #include <OGRE/OgreHardwarePixelBuffer.h> 51 :
rviz::
Display(), update_required_(false), first_time_(true), data_(0.0)
55 ros::message_traits::datatype<std_msgs::Float32>(),
56 "std_msgs::Float32 topic to subscribe to.",
59 "size of the plotter window",
62 "left of the plotter window",
65 "top of the plotter window",
73 "alpha belnding value for foreground",
77 "alpha belnding value for foreground for indicator",
85 "alpha belnding value for background",
97 "max value of pie chart",
101 "min value of pie chart",
106 "change the color automatically",
111 "only used if auto color change is set to True.",
117 "only used if auto color change is set to True.",
122 "change the max color at threshold",
127 "change the med color at threshold ",
133 "change the rotate direction",
161 static int count = 0;
163 ss <<
"PieChartDisplayObject" << count++;
222 double r2 = (r - 0.6) / 0.4;
247 QColor fg_color2(fg_color);
257 QPainter painter( &Hud );
258 painter.setRenderHint(QPainter::Antialiasing,
true);
260 const int outer_line_width = 5;
261 const int value_line_width = 10;
262 const int value_indicator_line_width = 2;
263 const int value_padding = 5;
265 const int value_aabb_offset
266 = outer_line_width + value_padding + value_line_width / 2;
268 painter.setPen(QPen(fg_color, outer_line_width, Qt::SolidLine));
270 painter.drawEllipse(outer_line_width / 2, outer_line_width / 2,
271 width - outer_line_width ,
274 painter.setPen(QPen(fg_color2, value_indicator_line_width, Qt::SolidLine));
275 painter.drawEllipse(value_aabb_offset, value_aabb_offset,
276 width - value_aabb_offset * 2,
281 const double ratio_angle = ratio * 360.0 * rotate_direction;
282 const double start_angle_offset = -90;
283 painter.setPen(QPen(fg_color, value_line_width, Qt::SolidLine));
284 painter.drawArc(QRectF(value_aabb_offset, value_aabb_offset,
285 width - value_aabb_offset * 2,
287 start_angle_offset * 16 ,
289 QFont
font = painter.font();
292 painter.setFont(font);
293 painter.setPen(QPen(fg_color, value_line_width, Qt::SolidLine));
294 std::ostringstream
s;
295 s << std::fixed << std::setprecision(2) << val;
297 Qt::AlignCenter | Qt::AlignVCenter,
303 Qt::AlignCenter | Qt::AlignVCenter,
317 if (topic_name.length() > 0 && topic_name !=
"/") {
490 return (top_ < y && top_ + texture_size_ > y &&
491 left_ < x && left_ + texture_size_ > x);
rviz::BoolProperty * auto_color_change_property_
virtual void drawPlot(double val)
double max_color_threshold_
virtual QImage getQImage(unsigned int width, unsigned int height)
rviz::ColorProperty * fg_color_property_
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
PLUGINLIB_EXPORT_CLASS(jsk_rviz_plugins::PictogramArrayDisplay, rviz::Display)
virtual QColor getColor() const
rviz::FloatProperty * bg_alpha_property_
rviz::ColorProperty * bg_color_property_
void updateClockwiseRotate()
OverlayObject::Ptr overlay_
virtual bool isInRegion(int x, int y)
virtual void onInitialize()
rviz::FloatProperty * med_color_threshold_property_
rviz::ColorProperty * max_color_property_
std::string getTopicStd() const
rviz::FloatProperty * fg_alpha_property_
rviz::FloatProperty * min_value_property_
virtual void processMessage(const std_msgs::Float32::ConstPtr &msg)
virtual void setPosition(int x, int y)
rviz::ColorProperty * med_color_property_
virtual void movePosition(int x, int y)
virtual QString getName() const
double med_color_threshold_
void updateMedColorThreshold()
rviz::FloatProperty * max_value_property_
rviz::BoolProperty * clockwise_rotate_property_
virtual int getInt() const
virtual ~PieChartDisplay()
rviz::RosTopicProperty * update_topic_property_
bool setValue(const QVariant &new_value) override
rviz::BoolProperty * show_caption_property_
virtual float getFloat() const
void updateMaxColorThreshold()
rviz::FloatProperty * fg_alpha2_property_
virtual void update(float wall_dt, float ros_dt)
rviz::IntProperty * left_property_
rviz::IntProperty * top_property_
virtual bool getBool() const
virtual void unsubscribe()
rviz::FloatProperty * max_color_threshold_property_
rviz::IntProperty * size_property_
rviz::IntProperty * text_size_property_
void updateAutoColorChange()