Blue Brain BioExplorer
core::ModelDescriptor Class Reference

The ModelDescriptor struct defines the metadata attached to a model.Model descriptor are exposed via the HTTP/WS interface. Enabling a model means that the model is part of scene. If disabled, the model still exists in Core, but is removed from the rendered scene. The visible attribute defines if the model should be visible or not. If invisible, the model is removed from the BVH. If set to true, the bounding box attribute displays a bounding box for the current model. More...

#include <Model.h>

Inheritance diagram for core::ModelDescriptor:
Collaboration diagram for core::ModelDescriptor:

Public Types

using RemovedCallback = std::function< void(const ModelDescriptor &)>
 
- Public Types inherited from core::BaseObject
using ModifiedCallback = std::function< void(const BaseObject &)>
 

Public Member Functions

 ModelDescriptor ()=default
 
 ModelDescriptor (ModelDescriptor &&rhs)=default
 
ModelDescriptoroperator= (ModelDescriptor &&rhs)=default
 
 ModelDescriptor (ModelPtr model, const std::string &path)
 
 ModelDescriptor (ModelPtr model, const std::string &path, const ModelMetadata &metadata)
 
 ModelDescriptor (ModelPtr model, const std::string &name, const std::string &path, const ModelMetadata &metadata)
 
ModelDescriptoroperator= (const ModelParams &rhs)
 
bool getEnabled () const
 
void setMetadata (const ModelMetadata &metadata)
 
const ModelMetadatagetMetadata () const
 
const ModelgetModel () const
 
ModelgetModel ()
 
void addInstance (const ModelInstance &instance)
 
void removeInstance (const size_t id)
 
void clearInstances ()
 
ModelInstancegetInstance (const size_t id)
 
const ModelInstancesgetInstances () const
 
Boxd getBounds () const
 
void computeBounds ()
 
void setProperties (const PropertyMap &properties)
 
const PropertyMapgetProperties () const
 
void onRemoved (const RemovedCallback &callback)
 
void callOnRemoved ()
 
void markForRemoval ()
 
bool isMarkedForRemoval () const
 
ModelDescriptorPtr clone (ModelPtr model) const
 
- Public Member Functions inherited from core::ModelParams
PLATFORM_API ModelParams ()=default
 
PLATFORM_API ModelParams (const std::string &path)
 Constructor to create ModelParams object from a given path. More...
 
PLATFORM_API ModelParams (const std::string &name, const std::string &path)
 Constructor to create ModelParams object with a given name and path. More...
 
PLATFORM_API ModelParams (const std::string &name, const std::string &path, const PropertyMap &loaderProperties)
 Constructor to create ModelParams object with a given name, path and loader properties. More...
 
PLATFORM_API ModelParams (ModelParams &&rhs)=default
 
PLATFORM_API ModelParamsoperator= (ModelParams &&rhs)=default
 
PLATFORM_API ModelParams (const ModelParams &rhs)=default
 
PLATFORM_API ModelParamsoperator= (const ModelParams &rhs)=default
 
PLATFORM_API void setName (const std::string &name)
 setName sets the name of the model More...
 
PLATFORM_API const std::string & getName () const
 getName gets the name of the model More...
 
PLATFORM_API void setPath (const std::string &path)
 setPath sets the path of the model More...
 
PLATFORM_API const std::string & getPath () const
 getPath gets the path of the model More...
 
PLATFORM_API void setLoaderName (const std::string &loaderName)
 setLoaderName sets the loader name of the model More...
 
PLATFORM_API const std::string & getLoaderName () const
 getLoaderName gets the loader name of the model More...
 
PLATFORM_API const PropertyMapgetLoaderProperties () const
 getLoaderProperties gets the loader properties of the model More...
 
PLATFORM_API void setLoaderProperties (const PropertyMap &pm)
 setLoaderProperties sets the loader properties of the model More...
 
- Public Member Functions inherited from core::ModelInstance
PLATFORM_API ModelInstance ()=default
 Default constructor. More...
 
PLATFORM_API ModelInstance (const bool visible, const bool boundingBox, const Transformation &transformation)
 Constructor with parameters. More...
 
PLATFORM_API bool getVisible () const
 Get the value of _visible. More...
 
PLATFORM_API void setVisible (const bool visible)
 Set the value of _visible. More...
 
PLATFORM_API bool getBoundingBox () const
 Get the value of _boundingBox. More...
 
PLATFORM_API void setBoundingBox (const bool enabled)
 Set the value of _boundingBox. More...
 
PLATFORM_API const TransformationgetTransformation () const
 Get the value of _transformation. More...
 
PLATFORM_API void setTransformation (const Transformation &transformation)
 Set the value of _transformation. More...
 
PLATFORM_API void setModelID (const size_t id)
 Set the value of _modelID. More...
 
PLATFORM_API size_t getModelID () const
 Get the value of _modelID. More...
 
PLATFORM_API void setInstanceID (const size_t id)
 Set the value of _instanceID. More...
 
PLATFORM_API size_t getInstanceID () const
 Get the value of _instanceID. More...
 
- Public Member Functions inherited from core::BaseObject
 BaseObject ()=default
 
virtual ~BaseObject ()=default
 
 BaseObject (const BaseObject &)
 
BaseObjectoperator= (const BaseObject &rhs)
 
bool isModified () const
 
void resetModified ()
 
void markModified (const bool triggerCallback=true)
 
void onModified (const ModifiedCallback &callback)
 
void clearModifiedCallback ()
 

Additional Inherited Members

- Protected Member Functions inherited from core::BaseObject
template<typename T >
void _updateValue (T &member, const T &newValue, const bool triggerCallback=true)
 
template<class T >
bool _isEqual (const T &a, const T &b, typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<class T >
bool _isEqual (const T &a, const T &b, typename std::enable_if<!std::is_floating_point< T >::value >::type *=0)
 
- Protected Attributes inherited from core::ModelParams
std::string _name
 
std::string _path
 
std::string _loaderName
 
PropertyMap _loaderProperties
 
- Protected Attributes inherited from core::ModelInstance
size_t _modelID {0}
 
size_t _instanceID {0}
 
bool _visible {true}
 
bool _boundingBox {false}
 
Transformation _transformation
 

Detailed Description

The ModelDescriptor struct defines the metadata attached to a model.

Model descriptor are exposed via the HTTP/WS interface. Enabling a model means that the model is part of scene. If disabled, the model still exists in Core, but is removed from the rendered scene. The visible attribute defines if the model should be visible or not. If invisible, the model is removed from the BVH. If set to true, the bounding box attribute displays a bounding box for the current model.

Definition at line 284 of file Model.h.

Member Typedef Documentation

◆ RemovedCallback

using core::ModelDescriptor::RemovedCallback = std::function<void(const ModelDescriptor&)>

Set a function that is called when this model is about to be removed.

Parameters
callbackThe callback function.

Definition at line 429 of file Model.h.

Constructor & Destructor Documentation

◆ ModelDescriptor() [1/5]

core::ModelDescriptor::ModelDescriptor ( )
default

◆ ModelDescriptor() [2/5]

core::ModelDescriptor::ModelDescriptor ( ModelDescriptor &&  rhs)
default

Default move constructor for a ModelDescriptor.

Parameters
rhsThe r-value reference of the ModelDescriptor.

◆ ModelDescriptor() [3/5]

core::ModelDescriptor::ModelDescriptor ( ModelPtr  model,
const std::string &  path 
)

Constructor for a ModelDescriptor with a given model and path.

Parameters
modelThe model pointer.
pathThe path of the model.

Definition at line 78 of file Model.cpp.

◆ ModelDescriptor() [4/5]

core::ModelDescriptor::ModelDescriptor ( ModelPtr  model,
const std::string &  path,
const ModelMetadata metadata 
)

Constructor for a ModelDescriptor with a given model, path and metadata.

Parameters
modelThe model pointer.
pathThe path of the model.
metadataThe metadata of the model.

Definition at line 86 of file Model.cpp.

◆ ModelDescriptor() [5/5]

core::ModelDescriptor::ModelDescriptor ( ModelPtr  model,
const std::string &  name,
const std::string &  path,
const ModelMetadata metadata 
)

Constructor for a ModelDescriptor with a given model, name, path and metadata.

Parameters
modelThe model pointer.
nameThe name of the model.
pathThe path of the model.
metadataThe metadata of the model.

Definition at line 95 of file Model.cpp.

Member Function Documentation

◆ addInstance()

void core::ModelDescriptor::addInstance ( const ModelInstance instance)

Adds an instance of the model.

Parameters
instanceThe instance to add.

Definition at line 131 of file Model.cpp.

◆ callOnRemoved()

void core::ModelDescriptor::callOnRemoved ( )
inline

Definition at line 433 of file Model.h.

◆ clearInstances()

void core::ModelDescriptor::clearInstances ( )

Removes all instances of the model.

Definition at line 152 of file Model.cpp.

◆ clone()

ModelDescriptorPtr core::ModelDescriptor::clone ( ModelPtr  model) const

Definition at line 184 of file Model.cpp.

◆ computeBounds()

void core::ModelDescriptor::computeBounds ( )

Computes the bounding box of the model.

Definition at line 167 of file Model.cpp.

◆ getBounds()

Boxd core::ModelDescriptor::getBounds ( ) const
inline

Gets the bounding box of the model.

Returns
The bounding box of the model.

Definition at line 402 of file Model.h.

◆ getEnabled()

bool core::ModelDescriptor::getEnabled ( ) const
inline

Checks if the model is enabled.

Returns
True if the model is visible or has a bounding box.

Definition at line 338 of file Model.h.

◆ getInstance()

ModelInstance * core::ModelDescriptor::getInstance ( const size_t  id)

Gets the instance of the model with the given id.

Parameters
idThe id of the instance to get.
Returns
The instance of the model with the given id.

Definition at line 160 of file Model.cpp.

◆ getInstances()

const ModelInstances& core::ModelDescriptor::getInstances ( ) const
inline

Gets all instances of the model.

Returns
All instances of the model.

Definition at line 396 of file Model.h.

◆ getMetadata()

const ModelMetadata& core::ModelDescriptor::getMetadata ( ) const
inline

Gets the metadata of this model.

Returns
The metadata of the model.

Definition at line 354 of file Model.h.

◆ getModel() [1/2]

Model& core::ModelDescriptor::getModel ( )
inline

Gets the reference to the model.

Returns
The model reference.

Definition at line 366 of file Model.h.

◆ getModel() [2/2]

const Model& core::ModelDescriptor::getModel ( ) const
inline

Gets the const reference to the model.

Returns
The model reference.

Definition at line 360 of file Model.h.

◆ getProperties()

const PropertyMap& core::ModelDescriptor::getProperties ( ) const
inline

Gets the properties of this model.

Returns
The properties of the model.

Definition at line 423 of file Model.h.

◆ isMarkedForRemoval()

bool core::ModelDescriptor::isMarkedForRemoval ( ) const
inline

Definition at line 443 of file Model.h.

◆ markForRemoval()

void core::ModelDescriptor::markForRemoval ( )
inline

Definition at line 440 of file Model.h.

◆ onRemoved()

void core::ModelDescriptor::onRemoved ( const RemovedCallback callback)
inline

Definition at line 430 of file Model.h.

◆ operator=() [1/2]

ModelDescriptor & core::ModelDescriptor::operator= ( const ModelParams rhs)

Copy assignment operator for a ModelParams.

Parameters
rhsThe ModelParams to copy from.
Returns
A reference to this ModelDescriptor.

Definition at line 105 of file Model.cpp.

◆ operator=() [2/2]

ModelDescriptor& core::ModelDescriptor::operator= ( ModelDescriptor &&  rhs)
default

Default move operator for a ModelDescriptor.

Parameters
rhsThe r-value reference of the ModelDescriptor.
Returns
A reference to this ModelDescriptor.

◆ removeInstance()

void core::ModelDescriptor::removeInstance ( const size_t  id)

Removes an instance of the model.

Parameters
idThe id of the instance to remove.

Definition at line 139 of file Model.cpp.

◆ setMetadata()

void core::ModelDescriptor::setMetadata ( const ModelMetadata metadata)
inline

Sets the metadata of this model.

Parameters
metadataThe metadata of the model.

Definition at line 344 of file Model.h.

◆ setProperties()

void core::ModelDescriptor::setProperties ( const PropertyMap properties)
inline

Sets the properties of this model.

Parameters
propertiesThe properties of the model.

Definition at line 413 of file Model.h.


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