Computer Assited Medical Intervention Tool Kit  version 4.1
Public Types | Public Member Functions | Protected Attributes | List of all members
StructuralComponent Class Reference

A structural component is composed either by cell or by atoms. More...

#include <StructuralComponent.h>

Inherits Component.

Inherited by Cell.

Public Types

enum  ComposedBy { NOTHING, CELLS, ATOMS }
 What this structural component is made of. More...
 

Public Member Functions

void addStructure (Structure *s, bool check=true)
 Add a Structure in the list (and tells the structure to add this structural component in its list). More...
 
bool addStructureIfNotIn (Structure *s)
 Add a Structure in the list, only if it is not already in (and in this case tells the structure to add this structural component to its list). More...
 
virtual ComposedBy composedBy ()
 return the type of structure composing the structural component: a structural component is either a list of cells or atoms, or of nothing if it is empty (see enum ComposedBy). More...
 
virtual void deleteAllStructures ()
 this method free all the sub-components (i.e. More...
 
StructuralComponentgetAtoms ()
 Return a StructuralComponent with all the atoms of this structural component. More...
 
CellgetCell (unsigned int) const override
 get cell by order number (not cell index) More...
 
double * getColor () const
 Get the color. More...
 
void getColor (double *r, double *g, double *b, double *a) const
 Get the color by its 4 componants r,g,b and a. More...
 
RenderingMode::Mode getMode () const
 get the rendering mode More...
 
unsigned int getNumberOfCells () const override
 get the total nr of cell of the component More...
 
unsigned int getNumberOfStructures () const
 get the number of structures More...
 
StructuralComponentPropertiesgetProperties ()
 get the structural component properties of this SC More...
 
StructuralComponentProperties::Color getStructuralComponentPropertiesColor () const
 Return the color as a code (see StructuralComponentProperties::Color enum) More...
 
StructuregetStructure (const unsigned int) const
 get a structure by its index (fisrt structure is at index 0) More...
 
StructuregetStructureByIndex (const unsigned int)
 get a structure by its unique index More...
 
StructuregetStructureByName (const std::string)
 get a structure by its name More...
 
bool isCompatible (Structure *)
 return true if the given structure is compatible with what composes this structural component. More...
 
bool isInstanceOf (const char *) const override
 return true only if the parameter is equal to "StructuralComponent" More...
 
bool isStructureIn (Structure *s)
 Check if a given structure is present in the list. More...
 
bool isVisible (const RenderingMode::Mode mode) const override
 tell if a specific rendering mode is visible or not More...
 
void plannedNumberOfStructures (const unsigned int)
 optimize the I/O of the std:vector structures. More...
 
virtual void removeStructure (Structure *s)
 Remove a structure from the list (and tells the structure to remove this structural component from its list). More...
 
void setColor (const StructuralComponentProperties::Color c)
 Set the new color (using a StructuralComponentProperties::Color enum) More...
 
void setColor (const double r, const double b, const double g, const double a)
 Set the new RGBA color. More...
 
void setColor (const double r, const double b, const double g)
 Set the new RGB color. More...
 
void setMode (const RenderingMode::Mode)
 set the rendering mode More...
 
void setPhysicalModel (PhysicalModel *) override
 set the physical model (recursively to all cells or to all atoms) More...
 
void setVisible (const RenderingMode::Mode mode, const bool b) override
 set the visibility of a specific rendering mode More...
 
 StructuralComponent (PhysicalModel *)
 Default Constructor. More...
 
 StructuralComponent (PhysicalModel *p, physicalModel::StructuralComponent xmlSC)
 constructor from xml node: try to read and get the parmaters from xml More...
 
 StructuralComponent (PhysicalModel *, std::string)
 constructor that allows one to name the structure. More...
 
void xmlPrint (std::ostream &) const override
 print to an output stream in "pseudo" XML format (do nothing if there are no sub structures). More...
 
 ~StructuralComponent () override
 delete all the structures (call the deleteAllStructures method) More...
 
- Public Member Functions inherited from Component
 Component (PhysicalModel *, std::string n="")
 Default constructor, a component needs to know the PM it is in. More...
 
const std::string getName () const
 get the name of the component More...
 
PhysicalModelgetPhysicalModel () const
 get the physical model More...
 
PropertiesgetProperties ()
 get the component structural properties (guarantied to be non NULL) More...
 
bool isExclusive () const
 tell if this component is exclusive or not More...
 
void setExclusive (const bool)
 set the exclusive flag More...
 
void setName (const std::string)
 set the name of the component More...
 
virtual ~Component ()
 Virtual destructor needed here as this is an abstract class (pure virtual) More...
 
std::vector< MultiComponent * > getAllParentMultiComponents ()
 get the list of all the Multi Component that are using this Component More...
 
unsigned int getNumberOfParentMultiComponents () const
 get the number of MultiComponent that are using this Component (= nr of parent component) More...
 
MultiComponentgetParentMultiComponent (unsigned int)
 get a particular MultiComponent that is using this Component (a particular parent component) More...
 
void addParentMultiComponent (MultiComponent *)
 add a particular parent MultiComponent in the list More...
 
void removeParentMultiComponent (MultiComponent *)
 remove a particular parent MultiComponent More...
 

Protected Attributes

StructuralComponentatomList
 List of all the atoms of this structural component, build the first time. More...
 
std::vector< Structure * > structures
 List of the structure representing this component, all the structure in this list are either all Atom or all Cell (no mix!) More...
 
- Protected Attributes inherited from Component
Propertiesproperties
 

Additional Inherited Members

- Protected Member Functions inherited from Component
void deleteProperties ()
 delete the "properties" pointer and set it to NULL More...
 
void removeFromParents ()
 this tell the parent components that this component is removed from memory. More...
 

Detailed Description

A structural component is composed either by cell or by atoms.

Member Enumeration Documentation

◆ ComposedBy

What this structural component is made of.

Enumerator
NOTHING 

there are no structure yet, so everything is possible

CELLS 

the structural component is made of cells

ATOMS 

the structural component is made of atoms

Constructor & Destructor Documentation

◆ StructuralComponent() [1/3]

StructuralComponent::StructuralComponent ( PhysicalModel p)

◆ StructuralComponent() [2/3]

StructuralComponent::StructuralComponent ( PhysicalModel p,
physicalModel::StructuralComponent  xmlSC 
)

constructor from xml node: try to read and get the parmaters from xml

References atomList, Component::deleteProperties(), plannedNumberOfStructures(), and Component::properties.

◆ StructuralComponent() [3/3]

StructuralComponent::StructuralComponent ( PhysicalModel p,
std::string  n 
)

constructor that allows one to name the structure.

References atomList, Component::deleteProperties(), and Component::properties.

◆ ~StructuralComponent()

StructuralComponent::~StructuralComponent ( )
override

delete all the structures (call the deleteAllStructures method)

References atomList, deleteAllStructures(), Component::deleteProperties(), and Component::removeFromParents().

Member Function Documentation

◆ addStructure()

void StructuralComponent::addStructure ( Structure s,
bool  check = true 
)
inline

◆ addStructureIfNotIn()

bool StructuralComponent::addStructureIfNotIn ( Structure s)

Add a Structure in the list, only if it is not already in (and in this case tells the structure to add this structural component to its list).

Parameters
sthe structure to add
Returns
a boolean telling if s was added or not

References addStructure(), and isStructureIn().

Referenced by getAtoms(), and Facet::getCell().

◆ composedBy()

StructuralComponent::ComposedBy StructuralComponent::composedBy ( )
virtual

return the type of structure composing the structural component: a structural component is either a list of cells or atoms, or of nothing if it is empty (see enum ComposedBy).

Reimplemented in Cell.

References ATOMS, CELLS, getNumberOfStructures(), getStructure(), isInstanceOf(), and NOTHING.

Referenced by PMLExplorerWidget::createSCPropertyList(), isCompatible(), PMLComponent::selectSC(), and PhysicalModel::setAtoms().

◆ deleteAllStructures()

void StructuralComponent::deleteAllStructures ( )
virtual

this method free all the sub-components (i.e.

delete all the sub component and clear the list). After this methode getNumberOfSubStructures() should return 0

Reimplemented in Cell.

References structures.

Referenced by ~StructuralComponent().

◆ getAtoms()

StructuralComponent * StructuralComponent::getAtoms ( )

Return a StructuralComponent with all the atoms of this structural component.

If this structural component is already a composed of atoms, return this. If it is composed of cells or mixed atoms and cells, return all the atoms used. Each atom is present only once in the resulting SC.

References addStructureIfNotIn(), atomList, getNumberOfStructures(), Properties::getPhysicalModel(), getStructure(), Structure::isInstanceOf(), Component::properties, and StructuralComponent().

Referenced by SofaSimulator::SofaSimulator().

◆ getCell()

Cell * StructuralComponent::getCell ( unsigned int  cellOrderNr) const
overridevirtual

◆ getColor() [1/2]

double * StructuralComponent::getColor ( ) const

Get the color.

Returns
an array of 4 doubles (red, blue, green and alpha values)

References Component::properties.

Referenced by PMLComponent::createCellSelectionVTKPipeline(), PMLExplorerWidget::createSCPropertyList(), Cell::xmlPrint(), and xmlPrint().

◆ getColor() [2/2]

void StructuralComponent::getColor ( double *  r,
double *  g,
double *  b,
double *  a 
) const

Get the color by its 4 componants r,g,b and a.

References Component::properties.

◆ getMode()

RenderingMode::Mode StructuralComponent::getMode ( ) const

get the rendering mode

References Component::properties.

◆ getNumberOfCells()

unsigned int StructuralComponent::getNumberOfCells ( ) const
overridevirtual

◆ getNumberOfStructures()

unsigned int StructuralComponent::getNumberOfStructures ( ) const
inline

◆ getProperties()

StructuralComponentProperties * StructuralComponent::getProperties ( )
inline

get the structural component properties of this SC

Referenced by PMLExplorerWidget::createSCPropertyList().

◆ getStructuralComponentPropertiesColor()

StructuralComponentProperties::Color StructuralComponent::getStructuralComponentPropertiesColor ( ) const

Return the color as a code (see StructuralComponentProperties::Color enum)

References Component::properties.

◆ getStructure()

Structure * StructuralComponent::getStructure ( const unsigned int  i) const
inline

◆ getStructureByIndex()

Structure * StructuralComponent::getStructureByIndex ( const unsigned int  i)
inline

get a structure by its unique index

◆ getStructureByName()

Structure * StructuralComponent::getStructureByName ( const std::string  n)
inline

get a structure by its name

◆ isCompatible()

bool StructuralComponent::isCompatible ( Structure s)

return true if the given structure is compatible with what composes this structural component.

E.g. if the structural is made of cell, and the structure is a cell.

References ATOMS, CELLS, composedBy(), Structure::isInstanceOf(), and NOTHING.

◆ isInstanceOf()

bool StructuralComponent::isInstanceOf ( const char *  className) const
inlineoverridevirtual

return true only if the parameter is equal to "StructuralComponent"

Implements Component.

Referenced by composedBy(), and getCell().

◆ isStructureIn()

bool StructuralComponent::isStructureIn ( Structure s)

Check if a given structure is present in the list.

Parameters
sthe structure to check
Returns
true if and only if the structure is already in the list

References structures.

Referenced by addStructureIfNotIn().

◆ isVisible()

bool StructuralComponent::isVisible ( const RenderingMode::Mode  mode) const
overridevirtual

tell if a specific rendering mode is visible or not

Implements Component.

References Component::properties.

◆ plannedNumberOfStructures()

void StructuralComponent::plannedNumberOfStructures ( const unsigned int  size)
inline

optimize the I/O of the std:vector structures.

If you know the nr of structures to be in the SC, please give it here, it will greatly speed the building of the structure

Referenced by Cell::Cell(), PhysicalModel::parseAtoms(), and StructuralComponent().

◆ removeStructure()

void StructuralComponent::removeStructure ( Structure s)
inlinevirtual

Remove a structure from the list (and tells the structure to remove this structural component from its list).

Becareful: this method DOES NOT delete the object and/or free the memory.

Parameters
sthe ptr to the structure to remove

References Structure::removeStructuralComponent().

◆ setColor() [1/3]

void StructuralComponent::setColor ( const StructuralComponentProperties::Color  c)

Set the new color (using a StructuralComponentProperties::Color enum)

References Component::properties.

Referenced by Cell::Cell().

◆ setColor() [2/3]

void StructuralComponent::setColor ( const double  r,
const double  b,
const double  g,
const double  a 
)

Set the new RGBA color.

References Component::properties.

◆ setColor() [3/3]

void StructuralComponent::setColor ( const double  r,
const double  b,
const double  g 
)

Set the new RGB color.

References Component::properties.

◆ setMode()

void StructuralComponent::setMode ( const RenderingMode::Mode  m)

set the rendering mode

References Component::properties.

Referenced by SofaSimulator::createPml().

◆ setPhysicalModel()

void StructuralComponent::setPhysicalModel ( PhysicalModel pm)
overridevirtual

set the physical model (recursively to all cells or to all atoms)

Reimplemented from Component.

References getNumberOfStructures(), getStructure(), Structure::setPhysicalModel(), and Component::setPhysicalModel().

◆ setVisible()

void StructuralComponent::setVisible ( const RenderingMode::Mode  mode,
const bool  b 
)
overridevirtual

set the visibility of a specific rendering mode

Implements Component.

References Component::properties.

◆ xmlPrint()

void StructuralComponent::xmlPrint ( std::ostream &  o) const
overridevirtual

print to an output stream in "pseudo" XML format (do nothing if there are no sub structures).

Implements Component.

References StructuralComponentProperties::DEFAULT, getColor(), getNumberOfStructures(), Component::properties, and structures.

Referenced by PhysicalModel::xmlPrint().

Member Data Documentation

◆ atomList

StructuralComponent* StructuralComponent::atomList
protected

List of all the atoms of this structural component, build the first time.

Return a StructuralComponent is called.

Referenced by getAtoms(), StructuralComponent(), Cell::~Cell(), and ~StructuralComponent().

◆ structures

std::vector<Structure*> StructuralComponent::structures
protected

List of the structure representing this component, all the structure in this list are either all Atom or all Cell (no mix!)

Referenced by Cell::deleteAllStructures(), deleteAllStructures(), getCell(), getNumberOfCells(), isStructureIn(), Cell::xmlPrint(), and xmlPrint().


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