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 Light;
39  class Model;
40  class Physics;
41  class WorldPrivate;
42 
44  {
46  public: World();
47 
50  public: World(const World &_world);
51 
54  public: World(World &&_world) noexcept;
55 
59  public: World &operator=(World &&_world);
60 
64  public: World &operator=(const World &_world);
65 
67  public: ~World();
68 
75  public: Errors Load(ElementPtr _sdf);
76 
79  public: std::string Name() const;
80 
83  public: void SetName(const std::string &_name) const;
84 
89  public: std::string AudioDevice() const;
90 
95  public: void SetAudioDevice(const std::string &_device);
96 
101  public: ignition::math::Vector3d WindLinearVelocity() const;
102 
107  public: void SetWindLinearVelocity(const ignition::math::Vector3d &_wind);
108 
114  public: ignition::math::Vector3d Gravity() const;
115 
119  public: void SetGravity(const ignition::math::Vector3d &_gravity);
120 
127  public: ignition::math::Vector3d MagneticField() const;
128 
135  public: void SetMagneticField(const ignition::math::Vector3d &_mag);
136 
139  public: uint64_t ModelCount() const;
140 
146  public: const Model *ModelByIndex(const uint64_t _index) const;
147 
151  public: bool ModelNameExists(const std::string &_name) const;
152 
155  public: uint64_t LightCount() const;
156 
162  public: const Light *LightByIndex(const uint64_t _index) const;
163 
167  public: bool LightNameExists(const std::string &_name) const;
168 
173  public: const sdf::Atmosphere *Atmosphere() const;
174 
177  public: void SetAtmosphere(const sdf::Atmosphere &_atmosphere) const;
178 
183  public: sdf::Gui *Gui() const;
184 
187  public: void SetGui(const sdf::Gui &_gui);
188 
193  public: const sdf::Scene *Scene() const;
194 
197  public: void SetScene(const sdf::Scene &_scene);
198 
203  public: sdf::ElementPtr Element() const;
204 
207  public: uint64_t PhysicsCount() const;
208 
215  public: const Physics *PhysicsByIndex(const uint64_t _index) const;
216 
219  public: const Physics *PhysicsDefault() const;
220 
224  public: bool PhysicsNameExists(const std::string &_name) const;
225 
227  private: WorldPrivate *dataPtr = nullptr;
228  };
229  }
230 }
231 #endif
Provides a description of a light source.
Definition: Light.hh:59
class SDFORMAT_VISIBLE Element
Definition: Element.hh:47
Definition: World.hh:43
Definition: Gui.hh:34
The Atmosphere class contains information about an atmospheric model and related parameters such as t...
Definition: Atmosphere.hh:46
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:51
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
The physics element specifies the type and properties of a dynamics engine.
Definition: Physics.hh:38
namespace for Simulation Description Format parser
Definition: AirPressure.hh:25
Definition: Scene.hh:36
Definition: Model.hh:38