Robowflex  v0.1
Making MoveIt Easy
robowflex::Geometry::ShapeType Class Reference

Supported shape types. More...

#include <geometry.h>

Public Types

enum  Type {
  BOX = 0 ,
  SPHERE = 1 ,
  CYLINDER = 2 ,
  CONE = 3 ,
  MESH = 4
}
 

Static Public Member Functions

static Type toType (const std::string &str)
 Converts a string into a ShapeType. More...
 
static const std::stringtoString (Type type)
 Converts a ShapeType to its string. More...
 

Static Public Attributes

static const unsigned int MAX = (unsigned int)Geometry::ShapeType::MESH + 1
 Maximum value of ShapeType. More...
 
static const std::vector< std::stringSTRINGS
 Mapping of ShapeType to string. More...
 

Detailed Description

Supported shape types.

Definition at line 40 of file geometry.h.

Member Enumeration Documentation

◆ Type

Enumerator
BOX 

Solid primitive box. Uses three dimensions (x, y, z).

SPHERE 

Solid primitive sphere. Uses one dimension (radius).

CYLINDER 

Solid primitive cylinder. Uses two dimensions (height, radius).

CONE 

Solid primitive cone. Uses two dimensions (height, radius).

MESH 

Mesh. Dimensions scale along x, y, z.

Definition at line 43 of file geometry.h.

44  {
45  BOX = 0, ///< Solid primitive box. Uses three dimensions (x, y, z).
46  SPHERE = 1, ///< Solid primitive sphere. Uses one dimension (radius).
47  CYLINDER = 2, ///< Solid primitive cylinder. Uses two dimensions (height, radius).
48  CONE = 3, ///< Solid primitive cone. Uses two dimensions (height, radius).
49  MESH = 4 ///< Mesh. Dimensions scale along x, y, z.
50  };
@ CYLINDER
Solid primitive cylinder. Uses two dimensions (height, radius).
Definition: geometry.h:47
@ MESH
Mesh. Dimensions scale along x, y, z.
Definition: geometry.h:49
@ CONE
Solid primitive cone. Uses two dimensions (height, radius).
Definition: geometry.h:48
@ BOX
Solid primitive box. Uses three dimensions (x, y, z).
Definition: geometry.h:45
@ SPHERE
Solid primitive sphere. Uses one dimension (radius).
Definition: geometry.h:46

Member Function Documentation

◆ toString()

const std::string & Geometry::ShapeType::toString ( Type  type)
static

Converts a ShapeType to its string.

Definition at line 35 of file geometry.cpp.

36 {
37  if (type > MAX)
38  throw Exception(1, "Invalid type for geometry.");
39 
40  return STRINGS[type];
41 }
Exception that contains a message and an error code.
Definition: util.h:15
static const std::vector< std::string > STRINGS
Mapping of ShapeType to string.
Definition: geometry.h:53
static const unsigned int MAX
Maximum value of ShapeType.
Definition: geometry.h:52

◆ toType()

Geometry::ShapeType::Type Geometry::ShapeType::toType ( const std::string str)
static

Converts a string into a ShapeType.

Definition at line 14 of file geometry.cpp.

15 {
16  std::string lower(str);
17  std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
18 
19  Type type;
20 
21  unsigned int i = 0;
22  for (; i < MAX; ++i)
23  if (STRINGS[i].compare(lower) == 0)
24  {
25  type = (Type)i;
26  break;
27  }
28 
29  if (i == MAX)
30  throw Exception(1, "Invalid type for geometry.");
31 
32  return type;
33 }
Type
T transform(T... args)

Member Data Documentation

◆ MAX

const unsigned int Geometry::ShapeType::MAX = (unsigned int)Geometry::ShapeType::MESH + 1
static

Maximum value of ShapeType.

Definition at line 52 of file geometry.h.

◆ STRINGS

const std::vector< std::string > Geometry::ShapeType::STRINGS
static

Mapping of ShapeType to string.

Definition at line 53 of file geometry.h.


The documentation for this class was generated from the following files: