Gazebo Rendering

API Reference

3.7.2
gz/rendering/base/BaseArrowVisual.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef GZ_RENDERING_BASE_BASEARROWVISUAL_HH_
18 #define GZ_RENDERING_BASE_BASEARROWVISUAL_HH_
19 
21 #include "gz/rendering/Scene.hh"
22 
23 namespace ignition
24 {
25  namespace rendering
26  {
27  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
28  //
29  template <class T>
31  public virtual ArrowVisual,
32  public virtual T
33  {
34  protected: BaseArrowVisual();
35 
36  public: virtual ~BaseArrowVisual();
37 
38  public: virtual VisualPtr Head() const;
39 
40  public: virtual VisualPtr Shaft() const;
41 
42  protected: virtual void Init();
43  };
44 
46  template <class T>
48  {
49  }
50 
52  template <class T>
54  {
55  }
56 
58  template <class T>
60  {
61  return std::dynamic_pointer_cast<Visual>(this->ChildByIndex(0));
62  }
63 
65  template <class T>
67  {
68  return std::dynamic_pointer_cast<Visual>(this->ChildByIndex(1));
69  }
70 
72  template <class T>
74  {
75  T::Init();
76 
77  VisualPtr cone = this->Scene()->CreateVisual();
78  cone->AddGeometry(this->Scene()->CreateCone());
79  cone->SetOrigin(0, 0, -0.5);
80  cone->SetLocalPosition(0, 0, 0);
81  cone->SetLocalScale(0.1, 0.1, 0.25);
82  this->AddChild(cone);
83 
84  VisualPtr cylinder = this->Scene()->CreateVisual();
85  cylinder->AddGeometry(this->Scene()->CreateCylinder());
86  cylinder->SetOrigin(0, 0, 0.5);
87  cylinder->SetLocalPosition(0, 0, 0);
88  cylinder->SetLocalScale(0.05, 0.05, 0.5);
89  this->AddChild(cylinder);
90 
91  this->SetOrigin(0, 0, -0.5);
92  }
93  }
94  }
95 }
96 #endif
STL class.
BaseArrowVisual()
Definition: gz/rendering/base/BaseArrowVisual.hh:47
virtual VisualPtr CreateVisual()=0
Create new visual. A unique ID and name will automatically be assigned to the visual.
virtual VisualPtr Head() const
Get arrow-head visual.
Definition: gz/rendering/base/BaseArrowVisual.hh:59
Manages a single scene-graph. This class updates scene-wide properties and holds the root scene node....
Definition: gz/rendering/Scene.hh:48
virtual VisualPtr Shaft() const
Get arrow-shaft visual.
Definition: gz/rendering/base/BaseArrowVisual.hh:66
Definition: gz/rendering/base/BaseArrowVisual.hh:30
virtual void Init()
Definition: gz/rendering/base/BaseArrowVisual.hh:73
Represents a arrow composite visual.
Definition: gz/rendering/ArrowVisual.hh:31
virtual ~BaseArrowVisual()
Definition: gz/rendering/base/BaseArrowVisual.hh:53