arrow.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #include "object.h"
31 
32 #ifndef OGRE_TOOLS_ARROW_H
33 #define OGRE_TOOLS_ARROW_H
34 
35 #include <OgrePrerequisites.h>
36 
37 namespace Ogre
38 {
39 class Any;
40 } // namespace Ogre
41 
42 
43 namespace rviz
44 {
45 class Shape;
46 
57 class Arrow : public Object
58 {
59 public:
71  Arrow(Ogre::SceneManager* scene_manager,
72  Ogre::SceneNode* parent_node = nullptr,
73  float shaft_length = 1.0f,
74  float shaft_diameter = 0.1f,
75  float head_length = 0.3f,
76  float head_diameter = 0.2f);
77  ~Arrow() override;
78 
87  void set(float shaft_length, float shaft_diameter, float head_length, float head_diameter);
88 
97  void setColor(float r, float g, float b, float a) override;
98  void setColor(const Ogre::ColourValue& color);
99 
107  void setHeadColor(float r, float g, float b, float a = 1.0f);
108  void setHeadColor(const Ogre::ColourValue& color);
116  void setShaftColor(float r, float g, float b, float a = 1.0f);
117  void setShaftColor(const Ogre::ColourValue& color);
118 
124  void setOrientation(const Ogre::Quaternion& orientation) override;
125 
127  void setPosition(const Ogre::Vector3& position) override;
128 
137  void setDirection(const Ogre::Vector3& direction);
138 
139  void setScale(const Ogre::Vector3& scale) override;
140  const Ogre::Vector3& getPosition() override;
141  const Ogre::Quaternion& getOrientation() override;
142 
147  Ogre::SceneNode* getSceneNode()
148  {
149  return scene_node_;
150  }
151 
155  void setUserData(const Ogre::Any& data) override;
156 
158  {
159  return shaft_;
160  }
162  {
163  return head_;
164  }
165 
166 private:
167  Ogre::SceneNode* scene_node_;
168 
171 };
172 
173 } // namespace rviz
174 
175 #endif /* OGRE_TOOLS_ARROW_H */
rviz::Arrow::set
void set(float shaft_length, float shaft_diameter, float head_length, float head_diameter)
Set the parameters for this arrow.
Definition: arrow.cpp:74
Ogre
Definition: axes_display.h:35
rviz::Arrow::scene_node_
Ogre::SceneNode * scene_node_
Definition: arrow.h:167
rviz::Arrow::shaft_
Shape * shaft_
Cylinder used for the shaft of the arrow.
Definition: arrow.h:169
rviz::Arrow
An arrow consisting of a cylinder and a cone.
Definition: arrow.h:57
rviz::Arrow::getOrientation
const Ogre::Quaternion & getOrientation() override
Get the local orientation of this object.
Definition: arrow.cpp:145
rviz::Arrow::setOrientation
void setOrientation(const Ogre::Quaternion &orientation) override
Set the orientation.
Definition: arrow.cpp:119
rviz::Arrow::setUserData
void setUserData(const Ogre::Any &data) override
Sets user data on all ogre objects we own.
Definition: arrow.cpp:150
rviz::Arrow::getShaft
Shape * getShaft()
Definition: arrow.h:157
f
f
rviz::Arrow::setHeadColor
void setHeadColor(float r, float g, float b, float a=1.0f)
Set the color of the arrow's head. Values are in the range [0, 1].
Definition: arrow.cpp:109
rviz
Definition: add_display_dialog.cpp:54
rviz::Arrow::getHead
Shape * getHead()
Definition: arrow.h:161
rviz::Arrow::setDirection
void setDirection(const Ogre::Vector3 &direction)
Set the direction of the arrow.
Definition: arrow.cpp:126
rviz::Arrow::~Arrow
~Arrow() override
Definition: arrow.cpp:66
rviz::Arrow::setShaftColor
void setShaftColor(float r, float g, float b, float a=1.0f)
Set the color of the arrow's shaft. Values are in the range [0, 1].
Definition: arrow.cpp:104
rviz::Shape
Definition: shape.h:51
rviz::Object
Base class for visible objects, providing a minimal generic interface.
Definition: object.h:47
rviz::Arrow::setPosition
void setPosition(const Ogre::Vector3 &position) override
Set the position of the base of the arrow.
Definition: arrow.cpp:114
rviz::Arrow::Arrow
Arrow(Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node=nullptr, float shaft_length=1.0f, float shaft_diameter=0.1f, float head_length=0.3f, float head_diameter=0.2f)
Constructor.
Definition: arrow.cpp:42
rviz::Arrow::getSceneNode
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this arrow.
Definition: arrow.h:147
rviz::Arrow::head_
Shape * head_
Cone used for the head of the arrow.
Definition: arrow.h:170
rviz::Arrow::setColor
void setColor(float r, float g, float b, float a) override
Set the color of this arrow. Sets both the head and shaft color to the same value....
Definition: arrow.cpp:89
rviz::Arrow::getPosition
const Ogre::Vector3 & getPosition() override
Get the local position of this object.
Definition: arrow.cpp:140
object.h
rviz::Arrow::setScale
void setScale(const Ogre::Vector3 &scale) override
Set the scale of the object. Always relative to the identity orientation of the object.
Definition: arrow.cpp:134


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Thu May 16 2024 02:30:48