39 #include <OgreVector3.h> 40 #include <OgreQuaternion.h> 41 #include <OgreSceneNode.h> 47 Ogre::SceneNode* parent_node)
48 :
MarkerBase(owner, context, parent_node), lines_(nullptr)
60 ROS_ASSERT(new_message->type == visualization_msgs::Marker::LINE_STRIP);
67 Ogre::Vector3 pos, scale;
68 Ogre::Quaternion orient;
69 transform(new_message, pos, orient, scale);
74 lines_->
setColor(new_message->color.r, new_message->color.g, new_message->color.b,
75 new_message->color.a);
78 if (new_message->points.empty())
86 bool has_per_point_color = new_message->colors.size() == new_message->points.size();
89 std::vector<geometry_msgs::Point>::const_iterator it = new_message->points.begin();
90 std::vector<geometry_msgs::Point>::const_iterator end = new_message->points.end();
91 for (; it != end; ++it, ++i)
93 const geometry_msgs::Point& p = *it;
95 Ogre::Vector3 v(p.x, p.y, p.z);
98 ROS_WARN(
"Marker '%s/%d': invalid point[%zu] (%.2f, %.2f, %.2f)", new_message->ns.c_str(),
99 new_message->id, i, p.x, p.y, p.z);
104 if (has_per_point_color)
106 const std_msgs::ColorRGBA& color = new_message->colors[i];
109 ROS_WARN(
"Marker '%s/%d': invalid color[%zu] (%.2f, %.2f, %.2f, %.2f)", new_message->ns.c_str(),
110 new_message->id, i, color.r, color.g, color.b, color.a);
120 c.r = new_message->color.r;
121 c.g = new_message->color.g;
122 c.b = new_message->color.b;
123 c.a = new_message->color.a;
Ogre::SceneNode * scene_node_
bool transform(const MarkerConstPtr &message, Ogre::Vector3 &pos, Ogre::Quaternion &orient, Ogre::Vector3 &scale)
~LineStripMarker() override
void addPoint(const Ogre::Vector3 &point)
An object that displays a multi-segment line strip rendered as billboards.
void onNewMessage(const MarkerConstPtr &old_message, const MarkerConstPtr &new_message) override
Ogre::MaterialPtr getMaterial()
virtual void setPosition(const Ogre::Vector3 &position)
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this object.
std::pair< std::string, int32_t > MarkerID
Pure-virtual base class for objects which give Display subclasses context in which to work...
bool validateFloats(const sensor_msgs::CameraInfo &msg)
boost::shared_ptr< MarkerSelectionHandler > handler_
DisplayContext * context_
void setColor(float r, float g, float b, float a) override
Set the color of the object. Values are in the range [0, 1].
void setMaxPointsPerLine(uint32_t max)
LineStripMarker(MarkerDisplay *owner, DisplayContext *context, Ogre::SceneNode *parent_node)
visualization_msgs::Marker::ConstPtr MarkerConstPtr
virtual Ogre::SceneManager * getSceneManager() const =0
Returns the Ogre::SceneManager used for the main RenderPanel.
std::set< Ogre::MaterialPtr > S_MaterialPtr
virtual void setOrientation(const Ogre::Quaternion &orientation)
S_MaterialPtr getMaterials() override
void setScale(const Ogre::Vector3 &scale) override
Set the scale of the object. Always relative to the identity orientation of the object.
Displays "markers" sent in by other ROS nodes on the "visualization_marker" topic.
void setLineWidth(float width)