Visual.hh
Go to the documentation of this file.
1/*
2 * Copyright 2018 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 SDF_VISUAL_HH_
18#define SDF_VISUAL_HH_
19
20#include <memory>
21#include <string>
22#include <gz/math/Pose3.hh>
23#include <gz/utils/ImplPtr.hh>
24#include "sdf/Box.hh"
25#include "sdf/Cylinder.hh"
26#include "sdf/Element.hh"
27#include "sdf/Material.hh"
28#include "sdf/Plane.hh"
29#include "sdf/Plugin.hh"
30#include "sdf/SemanticPose.hh"
31#include "sdf/Sphere.hh"
32#include "sdf/Types.hh"
33#include "sdf/sdf_config.h"
34#include "sdf/system_util.hh"
35
36namespace sdf
37{
38 // Inline bracket to help doxygen filtering.
39 inline namespace SDF_VERSION_NAMESPACE {
40 //
41
42 // Forward declarations.
43 class Geometry;
44 struct PoseRelativeToGraph;
45 template <typename T> class ScopedGraph;
46
48 {
50 public: Visual();
51
58 public: Errors Load(ElementPtr _sdf);
59
63 public: std::string Name() const;
64
68 public: void SetName(const std::string &_name);
69
72 public: bool CastShadows() const;
73
76 public: void SetCastShadows(bool _castShadows);
77
80 public: float Transparency() const;
81
84 public: void SetTransparency(float _transparency);
85
88 public: const Geometry *Geom() const;
89
92 public: void SetGeom(const Geometry &_geom);
93
98 public: const gz::math::Pose3d &RawPose() const;
99
103 public: void SetRawPose(const gz::math::Pose3d &_pose);
104
109 public: const std::string &PoseRelativeTo() const;
110
115 public: void SetPoseRelativeTo(const std::string &_frame);
116
121
126 public: sdf::ElementPtr Element() const;
127
132 public: const sdf::Material *Material() const;
133
136 public: void SetMaterial(const sdf::Material &_material);
137
140 public: uint32_t VisibilityFlags() const;
141
144 public: void SetVisibilityFlags(uint32_t _flags);
145
150 public: void SetHasLaserRetro(bool _laserRetro);
151
154 public: bool HasLaserRetro() const;
155
158 public: double LaserRetro() const;
159
162 public: void SetLaserRetro(double _laserRetro);
163
169 public: sdf::ElementPtr ToElement() const;
170
174 public: const sdf::Plugins &Plugins() const;
175
180
182 public: void ClearPlugins();
183
186 public: void AddPlugin(const Plugin &_plugin);
187
192 private: void SetXmlParentName(const std::string &_xmlParentName);
193
198 private: void SetPoseRelativeToGraph(
200
204 friend class Link;
205
207 IGN_UTILS_IMPL_PTR(dataPtr)
208 };
209 }
210}
211#endif
Geometry provides access to a shape, such as a Box.
Definition: Geometry.hh:84
This class contains visual material properties.
Definition: Material.hh:46
Definition: Plugin.hh:46
Definition: Collision.hh:39
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:55
Definition: Visual.hh:48
void SetLaserRetro(double _laserRetro)
Set the lidar reflective intensity.
bool CastShadows() const
Get whether the visual casts shadows.
std::string Name() const
Get the name of the visual.
void AddPlugin(const Plugin &_plugin)
Add a plugin to this object.
void SetName(const std::string &_name)
Set the name of the visual.
uint32_t VisibilityFlags() const
Get the visibility flags of a visual.
const Geometry * Geom() const
Get a pointer to the visual's geometry.
sdf::SemanticPose SemanticPose() const
Get SemanticPose object of this object to aid in resolving poses.
double LaserRetro() const
Get the flidar reflective intensity.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
void SetRawPose(const gz::math::Pose3d &_pose)
Set the pose of the visual object.
const gz::math::Pose3d & RawPose() const
Get the pose of the visual object.
void ClearPlugins()
Remove all plugins.
sdf::ElementPtr ToElement() const
Create and return an SDF element filled with data from this visual.
Visual()
Default constructor.
const sdf::Material * Material() const
Get a pointer to the visual's material properties.
sdf::Plugins & Plugins()
Get a mutable vector of plugins attached to this object.
void SetPoseRelativeTo(const std::string &_frame)
Set the name of the coordinate frame relative to which this object's pose is expressed.
const std::string & PoseRelativeTo() const
Get the name of the coordinate frame relative to which this object's pose is expressed.
void SetCastShadows(bool _castShadows)
Set whether the visual casts shadows.
Errors Load(ElementPtr _sdf)
Load the visual based on a element pointer.
void SetVisibilityFlags(uint32_t _flags)
Set the visibility flags of a visual.
void SetHasLaserRetro(bool _laserRetro)
Set whether the lidar reflective intensity has been specified.
void SetMaterial(const sdf::Material &_material)
Set the visual's material.
float Transparency() const
Get the transparency value of the visual.
void SetGeom(const Geometry &_geom)
Set the visual's geometry.
const sdf::Plugins & Plugins() const
Get the plugins attached to this object.
void SetTransparency(float _transparency)
Set the transparency value for the visual.
bool HasLaserRetro() const
Get whether the lidar reflective intensity was set was set.
std::vector< Plugin > Plugins
A vector of Plugin.
Definition: Plugin.hh:196
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54
namespace for Simulation Description Format parser
Definition: Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25