SOFA API  7b3729f1
Open source framework for multi-physics simuation
SofaComponentNodeModel Class Reference

#include <SofaComponentNodeModel.h>

Inheritance diagram for SofaComponentNodeModel:

Detailed Description

This Class is a NodeDataModel specialisation to represent a Sofa component on the QtNodes graph. It will take a SOFA BaseObject as target and parse all Data, storing Data, Links and connections with parents components.

Protected Attributes

QString m_caption
 caption to be display on the Graph More...
 
QString m_uniqName
 unique name to refer to this node More...
 
bool debugNodeGraph
 parameter to activate graph logs. False by default. More...
 
std::vector< std::pair< QString, QString > > m_data
 Vector of Data/port hold by this component/Node. vector of pair{DataName, DataType}. More...
 
std::vector< std::shared_ptr< SofaComponentNodeData > > m_Nodedata
 vector of SofaComponentNodeData class holding pointer to the Data. To replace More...
 
std::map< QString, std::pair< QString, QString > > m_dataConnections
 Map to store all connection between this node and other. map.key = this data name, map.value = pair{ComponentName, DataName}. More...
 
sofa::core::objectmodel::BaseObjectm_SofaObject
 Pointer to the sofa object. More...
 

Public Member Functions

 SofaComponentNodeModel (std::string name="EmptyNode")
 Default empty Object constructor with 0 Data. More...
 
 SofaComponentNodeModel (sofa::core::objectmodel::BaseObject *_sofaObject, bool debugMode=false)
 constructor with a Sofa BaseObject as target More...
 
virtual ~SofaComponentNodeModel ()
 
QString caption () const override
 Interface for caption. More...
 
void setCaption (std::string str)
 
QString name () const override
 Interface for name. More...
 
size_t getNbrData ()
 Return the number of Data. More...
 
size_t getNbrConnections ()
 Return the number of connection with other Node components. More...
 
const std::map< QString, std::pair< QString, QString > > & getDataConnections ()
 return the list of connections More...
 
QtNodes::PortIndex getDataInputId (const QString &dataName)
 Return the PortIndex of a Data given its Name. More...
 
unsigned int nPorts (PortType portType) const override
 
NodeDataType dataType (PortType portType, PortIndex portIndex) const override
 Override method to give the type of Data per Port. More...
 
std::shared_ptr< NodeData > outData (PortIndex port) override
 Override method to return the NodeData given a port. More...
 
void setInData (std::shared_ptr< NodeData > data, int port) override
 Override method to set input Data. More...
 
QWidgetembeddedWidget () override
 Override method for more advance node gui. Not yet used. More...
 

Protected Member Functions

void parseSofaObjectData ()
 } More...
 

Attribute details

◆ debugNodeGraph

bool SofaComponentNodeModel::debugNodeGraph
protected

parameter to activate graph logs. False by default.

◆ m_caption

QString SofaComponentNodeModel::m_caption
protected

caption to be display on the Graph

◆ m_data

std::vector< std::pair < QString, QString> > SofaComponentNodeModel::m_data
protected

Vector of Data/port hold by this component/Node. vector of pair{DataName, DataType}.

◆ m_dataConnections

std::map<QString, std::pair < QString, QString> > SofaComponentNodeModel::m_dataConnections
protected

Map to store all connection between this node and other. map.key = this data name, map.value = pair{ComponentName, DataName}.

◆ m_Nodedata

std::vector< std::shared_ptr<SofaComponentNodeData> > SofaComponentNodeModel::m_Nodedata
protected

vector of SofaComponentNodeData class holding pointer to the Data. To replace

See also
m_data when api is validated.

◆ m_SofaObject

sofa::core::objectmodel::BaseObject* SofaComponentNodeModel::m_SofaObject
protected

Pointer to the sofa object.

◆ m_uniqName

QString SofaComponentNodeModel::m_uniqName
protected

unique name to refer to this node

Constructor details

◆ SofaComponentNodeModel() [1/2]

SofaComponentNodeModel::SofaComponentNodeModel ( std::string  name = "EmptyNode")

Default empty Object constructor with 0 Data.

◆ SofaComponentNodeModel() [2/2]

SofaComponentNodeModel::SofaComponentNodeModel ( sofa::core::objectmodel::BaseObject _sofaObject,
bool  debugMode = false 
)

constructor with a Sofa BaseObject as target

◆ ~SofaComponentNodeModel()

virtual SofaComponentNodeModel::~SofaComponentNodeModel ( )
inlinevirtual

Function details

◆ caption()

QString SofaComponentNodeModel::caption ( ) const
inlineoverride

Interface for caption.

◆ dataType()

NodeDataType SofaComponentNodeModel::dataType ( PortType  portType,
PortIndex  portIndex 
) const
override

Override method to give the type of Data per Port.

◆ embeddedWidget()

QWidget* SofaComponentNodeModel::embeddedWidget ( )
inlineoverride

Override method for more advance node gui. Not yet used.

◆ getDataConnections()

const std::map<QString, std::pair < QString, QString> >& SofaComponentNodeModel::getDataConnections ( )
inline

return the list of connections

See also
m_dataConnections

◆ getDataInputId()

QtNodes::PortIndex SofaComponentNodeModel::getDataInputId ( const QString &  dataName)

Return the PortIndex of a Data given its Name.

◆ getNbrConnections()

size_t SofaComponentNodeModel::getNbrConnections ( )
inline

Return the number of connection with other Node components.

◆ getNbrData()

size_t SofaComponentNodeModel::getNbrData ( )
inline

Return the number of Data.

◆ name()

QString SofaComponentNodeModel::name ( ) const
inlineoverride

Interface for name.

◆ nPorts()

unsigned int SofaComponentNodeModel::nPorts ( PortType  portType) const
override

Interface for QtNodes { Override method to return the number of ports

◆ outData()

std::shared_ptr< NodeData > SofaComponentNodeModel::outData ( PortIndex  port)
override

Override method to return the NodeData given a port.

◆ parseSofaObjectData()

void SofaComponentNodeModel::parseSofaObjectData ( )
protected

}

Internal method to parse all Data of a Sofa component and create the corresponding ports

◆ setCaption()

void SofaComponentNodeModel::setCaption ( std::string  str)
inline

◆ setInData()

void SofaComponentNodeModel::setInData ( std::shared_ptr< NodeData >  data,
int  port 
)
override

Override method to set input Data.