00001 // -*- mode: c++; -*- 00002 00003 #ifndef POLYGON_ARRAY_DISPLAY_H 00004 #define POLYGON_ARRAY_DISPLAY_H 00005 00006 #include <jsk_pcl_ros/PolygonArray.h> 00007 #include <rviz/message_filter_display.h> 00008 #include <rviz/properties/float_property.h> 00009 #include <rviz/ogre_helpers/billboard_line.h> 00010 #include <rviz/ogre_helpers/shape.h> 00011 #include <OGRE/OgreSceneNode.h> 00012 #include <OGRE/OgreManualObject.h> 00013 #include <OGRE/OgreMaterialManager.h> 00014 #include <rviz/properties/color_property.h> 00015 #include <rviz/properties/bool_property.h> 00016 #include <rviz/ogre_helpers/billboard_line.h> 00017 00018 namespace jsk_rviz_plugin 00019 { 00020 class PolygonArrayDisplay : public rviz::MessageFilterDisplay<jsk_pcl_ros::PolygonArray> 00021 { 00022 Q_OBJECT 00023 public: 00024 PolygonArrayDisplay(); 00025 virtual ~PolygonArrayDisplay(); 00026 protected: 00027 virtual void onInitialize(); 00028 virtual void reset(); 00029 virtual void updateSceneNodes(const jsk_pcl_ros::PolygonArray::ConstPtr& msg); 00030 virtual void allocateMaterials(int num); 00031 virtual void updateLines(int num); 00032 private Q_SLOTS: 00033 void updateAutoColoring(); 00034 void updateOnlyBorder(); 00035 private: 00036 void processMessage(const jsk_pcl_ros::PolygonArray::ConstPtr& msg); 00037 rviz::ColorProperty* color_property_; 00038 rviz::FloatProperty* alpha_property_; 00039 rviz::BoolProperty* only_border_property_; 00040 rviz::BoolProperty* auto_coloring_property_; 00041 bool only_border_; 00042 bool auto_coloring_; 00043 std::vector<Ogre::ManualObject*> manual_objects_; 00044 std::vector<Ogre::SceneNode*> scene_nodes_; 00045 std::vector<Ogre::MaterialPtr> materials_; 00046 std::vector<rviz::BillboardLine*> lines_; 00047 }; 00048 } 00049 00050 #endif 00051