World.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2017 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_WORLD_HH_
18 #define SDF_WORLD_HH_
19 
20 #include <string>
21 #include <ignition/math/Vector3.hh>
22 
23 #include "sdf/Atmosphere.hh"
24 #include "sdf/Element.hh"
25 #include "sdf/Gui.hh"
26 #include "sdf/Scene.hh"
27 #include "sdf/Types.hh"
28 #include "sdf/sdf_config.h"
29 #include "sdf/system_util.hh"
30 
31 namespace sdf
32 {
33  // Inline bracket to help doxygen filtering.
34  inline namespace SDF_VERSION_NAMESPACE {
35  //
36 
37  // Forward declare private data class.
38  class Actor;
39  class Frame;
40  class Light;
41  class Model;
42  class Physics;
43  class WorldPrivate;
44 
46  {
48  public: World();
49 
52  public: World(const World &_world);
53 
56  public: World(World &&_world) noexcept;
57 
61  public: World &operator=(World &&_world);
62 
66  public: World &operator=(const World &_world);
67 
69  public: ~World();
70 
77  public: Errors Load(ElementPtr _sdf);
78 
81  public: std::string Name() const;
82 
85  public: void SetName(const std::string &_name) const;
86 
91  public: std::string AudioDevice() const;
92 
97  public: void SetAudioDevice(const std::string &_device);
98 
103  public: ignition::math::Vector3d WindLinearVelocity() const;
104 
109  public: void SetWindLinearVelocity(const ignition::math::Vector3d &_wind);
110 
116  public: ignition::math::Vector3d Gravity() const;
117 
121  public: void SetGravity(const ignition::math::Vector3d &_gravity);
122 
129  public: ignition::math::Vector3d MagneticField() const;
130 
137  public: void SetMagneticField(const ignition::math::Vector3d &_mag);
138 
141  public: uint64_t ModelCount() const;
142 
148  public: const Model *ModelByIndex(const uint64_t _index) const;
149 
153  public: const Model *ModelByName(const std::string &_name) const;
154 
158  public: bool ModelNameExists(const std::string &_name) const;
159 
162  public: uint64_t ActorCount() const;
163 
169  public: const Actor *ActorByIndex(const uint64_t _index) const;
170 
174  public: bool ActorNameExists(const std::string &_name) const;
175 
178  public: uint64_t FrameCount() const;
179 
186  public: const Frame *FrameByIndex(const uint64_t _index) const;
187 
192  public: const Frame *FrameByName(const std::string &_name) const;
193 
197  public: bool FrameNameExists(const std::string &_name) const;
198 
201  public: uint64_t LightCount() const;
202 
208  public: const Light *LightByIndex(const uint64_t _index) const;
209 
213  public: bool LightNameExists(const std::string &_name) const;
214 
219  public: const sdf::Atmosphere *Atmosphere() const;
220 
223  public: void SetAtmosphere(const sdf::Atmosphere &_atmosphere) const;
224 
229  public: sdf::Gui *Gui() const;
230 
233  public: void SetGui(const sdf::Gui &_gui);
234 
239  public: const sdf::Scene *Scene() const;
240 
243  public: void SetScene(const sdf::Scene &_scene);
244 
249  public: sdf::ElementPtr Element() const;
250 
253  public: uint64_t PhysicsCount() const;
254 
261  public: const Physics *PhysicsByIndex(const uint64_t _index) const;
262 
265  public: const Physics *PhysicsDefault() const;
266 
270  public: bool PhysicsNameExists(const std::string &_name) const;
271 
273  private: WorldPrivate *dataPtr = nullptr;
274  };
275  }
276 }
277 #endif
Definition: Model.hh:42
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
The physics element specifies the type and properties of a dynamics engine.
Definition: Physics.hh:38
Definition: World.hh:45
Definition: Gui.hh:34
The Atmosphere class contains information about an atmospheric model and related parameters such as t...
Definition: Atmosphere.hh:46
A Frame element descibes the properties associated with an explicit frame defined in a Model or World...
Definition: Frame.hh:41
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:74
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
Definition: Scene.hh:36
Provides a description of a light source.
Definition: Light.hh:62
namespace for Simulation Description Format parser
Definition: Actor.hh:32
Provides a description of an actor.
Definition: Actor.hh:277