Geometry.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_GEOMETRY_HH_
18 #define SDF_GEOMETRY_HH_
19 
20 #include <ignition/utils/ImplPtr.hh>
21 #include <sdf/Error.hh>
22 #include <sdf/Element.hh>
23 #include <sdf/sdf_config.h>
24 
25 namespace sdf
26 {
27  // Inline bracket to help doxygen filtering.
28  inline namespace SDF_VERSION_NAMESPACE {
29  //
30 
31  // Forward declare private data class.
32  class Box;
33  class Capsule;
34  class Cylinder;
35  class Ellipsoid;
36  class Heightmap;
37  class Mesh;
38  class Plane;
39  class Sphere;
40 
43  enum class GeometryType
44  {
46  EMPTY = 0,
47 
49  BOX = 1,
50 
52  CYLINDER = 2,
53 
55  PLANE = 3,
56 
58  SPHERE = 4,
59 
61  MESH = 5,
62 
64  HEIGHTMAP = 6,
65 
67  CAPSULE = 7,
68 
70  ELLIPSOID = 8,
71  };
72 
78  {
80  public: Geometry();
81 
88  public: Errors Load(ElementPtr _sdf);
89 
92  public: GeometryType Type() const;
93 
96  public: void SetType(const GeometryType _type);
97 
103  public: const Box *BoxShape() const;
104 
107  public: void SetBoxShape(const Box &_box);
108 
114  public: const Capsule *CapsuleShape() const;
115 
118  public: void SetCapsuleShape(const Capsule &_capsule);
119 
125  public: const Cylinder *CylinderShape() const;
126 
129  public: void SetCylinderShape(const Cylinder &_cylinder);
130 
136  public: const Ellipsoid *EllipsoidShape() const;
137 
140  public: void SetEllipsoidShape(const Ellipsoid &_ellipsoid);
141 
147  public: const Sphere *SphereShape() const;
148 
151  public: void SetSphereShape(const Sphere &_sphere);
152 
158  public: const Plane *PlaneShape() const;
159 
162  public: void SetPlaneShape(const Plane &_plane);
163 
169  public: const Mesh *MeshShape() const;
170 
173  public: void SetMeshShape(const Mesh &_mesh);
174 
180  public: const Heightmap *HeightmapShape() const;
181 
184  public: void SetHeightmapShape(const Heightmap &_heightmap);
185 
190  public: sdf::ElementPtr Element() const;
191 
193  IGN_UTILS_IMPL_PTR(dataPtr)
194  };
195  }
196 }
197 #endif
sdf::v11::Plane
Plane represents a plane shape, and is usually accessed through a Geometry.
Definition: Plane.hh:36
sdf::v11::GeometryType::MESH
@ MESH
A mesh geometry.
sdf::v11::GeometryType::CYLINDER
@ CYLINDER
A cylinder geometry.
Error.hh
sdf::v11::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v11::GeometryType::EMPTY
@ EMPTY
Empty geometry. This means no shape has been defined.
sdf::v11::Geometry
Geometry provides access to a shape, such as a Box.
Definition: Geometry.hh:77
sdf::v11::GeometryType
GeometryType
Definition: Geometry.hh:43
sdf::v11::GeometryType::BOX
@ BOX
A box geometry.
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:33
sdf::v11::Cylinder
Cylinder represents a cylinder shape, and is usually accessed through a Geometry.
Definition: Cylinder.hh:32
sdf::v11::Ellipsoid
Ellipsoid represents a ellipsoid shape, and is usually accessed through a Geometry.
Definition: Ellipsoid.hh:32
sdf::v11::GeometryType::SPHERE
@ SPHERE
A sphere geometry.
sdf::v11::GeometryType::ELLIPSOID
@ ELLIPSOID
An ellipsoid geometry.
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:41
sdf::v11::Box
Box represents a box shape, and is usually accessed through a Geometry.
Definition: Box.hh:33
sdf::v11::GeometryType::PLANE
@ PLANE
A plane geometry.
sdf::v11::Sphere
Sphere represents a sphere shape, and is usually accessed through a Geometry.
Definition: Sphere.hh:33
sdf::v11::Mesh
Mesh represents a mesh shape, and is usually accessed through a Geometry.
Definition: Mesh.hh:35
sdf::v11::Capsule
Capsule represents a capsule shape, and is usually accessed through a Geometry.
Definition: Capsule.hh:32
sdf::v11::GeometryType::CAPSULE
@ CAPSULE
A capsule geometry.
sdf::v11::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
sdf::v11::Heightmap
Heightmap represents a shape defined by a 2D field, and is usually accessed through a Geometry.
Definition: Heightmap.hh:119
sdf::v11::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
sdf::v11::GeometryType::HEIGHTMAP
@ HEIGHTMAP
A heightmap geometry.
Element.hh