RobWorkProject  24.5.15-
Static Public Member Functions | List of all members
DrawableFactory Class Reference

Factory for construction of drawables based on their type. More...

#include <DrawableFactory.hpp>

Static Public Member Functions

static Drawable::Ptr getDrawable (const std::string &str, const std::string &name)
 Factory method for constructing a Drawable based on a string. More...
 
static Drawable::Ptr loadDrawableFile (const std::string &filename, const std::string &name)
 Factory method constructing a Drawable from a file. More...
 
static Drawable::Ptr constructFromGeometry (const std::string &str, const std::string &name, bool useCache=false)
 Factory method constructing a Drawable based on a Geometry ID string. More...
 

Detailed Description

Factory for construction of drawables based on their type.

Member Function Documentation

◆ constructFromGeometry()

static Drawable::Ptr constructFromGeometry ( const std::string &  str,
const std::string &  name,
bool  useCache = false 
)
static

Factory method constructing a Drawable based on a Geometry ID string.

The method constructs a Drawable representing the geometry described in the string

An exception is thrown if the string cannot be parsed correctly.

Parameters
str[in] Geometry ID string
name[in] the id/name of the drawable
useCache[in] True to use caching. Default false
Returns
Point to drawable object

◆ getDrawable()

static Drawable::Ptr getDrawable ( const std::string &  str,
const std::string &  name 
)
static

Factory method for constructing a Drawable based on a string.

The method probes the string to see it describes a geometric primitive or a file name. In case of a geometric primitive it forwards to call to DrawableFactory::ConstructDrawableFromGeometry. Otherwise it calls DrawableFactory::LoadDrawableFile otherwise

◆ loadDrawableFile()

static Drawable::Ptr loadDrawableFile ( const std::string &  filename,
const std::string &  name 
)
static

Factory method constructing a Drawable from a file.

Parameters
filename[in] path and name of file to load
name[in] the id/name of the drawable
Returns
drawable

The factory determines which type of Drawable to used based on the filename extension. In case no extension exists if test whether a file with the same name or a .stl, .stla, .stlb, .3ds, .ac or .ac3d exists.

An exception is thrown if the file can't be loaded.


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