The GraphicsItemFactory is used to create graphics items from their factory name or from a GraphicsItemCfg. More...
#include "GraphicsItemFactory.h"
Static Public Member Functions | |
static GraphicsItemFactory & | instance (void) |
static ot::GraphicsItem * | create (const ConstJsonObject &_configObject, bool _isRoot=false) |
Will create the configuration from the provided json object and then create the item using the created configuration. | |
static ot::GraphicsItem * | itemFromConfig (const ot::GraphicsItemCfg *_config, bool _isRoot=false) |
Creates a graphics item from the provided configuration. The graphics item will be created according to the graphics item cfg name. If the created item is the root item finalizeGraphicsItem() will be called. | |
Additional Inherited Members | |
Public Types inherited from ot::FactoryTemplate< GraphicsItem > | |
typedef std::function< GraphicsItem *()> | ConstructorFunctionType |
Constructor type definition. | |
Public Member Functions inherited from ot::FactoryTemplate< GraphicsItem > | |
void | registerConstructor (const std::string &_key, ConstructorFunctionType _constructor) |
Will register the prvided constructor under the given key. If a constructor for the given key already exists a warning log will be generated and the request will be ignored. | |
void | deregisterConstructor (const std::string &_key) |
Remove the constructor for the given key. | |
GraphicsItem * | createFromKey (const std::string &_key) |
Call the constructor for the given key and return the created instance. | |
GraphicsItem * | createFromJSON (const ConstJsonObject &_jsonObject, const char *_typeKey) |
Creates an instance according to the key in the provided JSON object. If the key is empty the request will be ignored. If the created instance inherits from Serializable the setFromJsonObject method will be called. | |
GraphicsItem * | createFromJSON (const ConstJsonObject &_jsonObject, const std::string &_typeKey) |
[/ref ValueType* createFromJSON(const ConstJsonObject& _jsonObject, const char* _typeKey) "x"]. | |
Protected Member Functions inherited from ot::FactoryTemplate< GraphicsItem > | |
FactoryTemplate () | |
Protected constructor. | |
~FactoryTemplate () | |
Protected destructor. | |
The GraphicsItemFactory is used to create graphics items from their factory name or from a GraphicsItemCfg.
|
static |
Will create the configuration from the provided json object and then create the item using the created configuration.
_configObject | The JSON object containing the GraphicsItemCfg. |
|
static |
|
static |
Creates a graphics item from the provided configuration. The graphics item will be created according to the graphics item cfg name. If the created item is the root item finalizeGraphicsItem() will be called.
_config | The graphics item configuration. |
_isRoot | If true, the item will be added to a stack with a highlight item on top. The highlight item will be set to the root item. |