Simox  2.3.74.0
VirtualRobot::CoinVisualizationNode Class Reference
Inheritance diagram for VirtualRobot::CoinVisualizationNode:
VirtualRobot::VisualizationNode

Public Member Functions

 CoinVisualizationNode (const TriMeshModelPtr &tri)
 
 CoinVisualizationNode (const TriMeshModel &tri)
 
 CoinVisualizationNode (SoNode *visualizationNode, float margin=0.0f)
 
 ~CoinVisualizationNode () override
 
TriMeshModelPtr getTriMeshModel () override
 
SoNode * getCoinVisualization ()
 
void setGlobalPose (const Eigen::Matrix4f &m) override
 
void print () override
 print information about this visualization object. More...
 
void scale (const Eigen::Vector3f &scaleFactor) override
 
void attachVisualization (const std::string &name, VisualizationNodePtr v) override
 
void detachVisualization (const std::string &name) override
 
void setupVisualization (bool showVisualization, bool showAttachedVisualizations) override
 
VisualizationNodePtr clone (bool deepCopy=true, float scaling=1.0f) override
 
std::string getType () override
 
bool saveModel (const std::string &modelPath, const std::string &filename) override
 
void shrinkFatten (float offset) override
 
void createTriMeshModel () override
 
- Public Member Functions inherited from VirtualRobot::VisualizationNode
 VisualizationNode (const TriMeshModelPtr &triMeshModel=nullptr)
 
 VisualizationNode (const TriMeshModel &triMeshModel)
 
virtual ~VisualizationNode ()
 
const Eigen::Matrix4f & getGlobalPose () const
 
virtual bool hasAttachedVisualization (const std::string &name)
 
virtual VisualizationNodePtr getAttachedVisualization (const std::string &name)
 
void setUpdateVisualization (bool enable)
 
bool getUpdateVisualizationStatus ()
 
virtual int getNumFaces ()
 get number of faces (i.e. triangles) of this object More...
 
std::string getFilename ()
 optional filename tag More...
 
bool usedBoundingBoxVisu ()
 
void setFilename (const std::string &filename, bool boundingBox)
 Just stores the filename, no loading is performed! More...
 
std::string toXML (const std::string &basePath, int tabs)
 
std::string toXML (const std::string &basePath, const std::string &filename, int tabs)
 
BoundingBox getBoundingBox ()
 
virtual void scale (float scaleFactor)
 

Protected Member Functions

void setVisualization (SoNode *newVisu)
 

Static Protected Member Functions

static void InventorTriangleCB (void *data, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3)
 

Protected Attributes

SoNode * visualization
 
SoSeparator * visualizationAtGlobalPose
 
SoSeparator * attachedVisualizationsSeparator
 
SoSeparator * scaledVisualization
 
std::map< std::string, SoNode *> attachedCoinVisualizations
 
SoMatrixTransform * globalPoseTransform
 
SoScale * scaling
 
float margin = 0.0f
 
- Protected Attributes inherited from VirtualRobot::VisualizationNode
bool boundingBox
 Indicates, if the bounding box model was used. More...
 
std::string filename
 if the visualization was build from a file, the filename is stored here More...
 
Eigen::Matrix4f globalPose
 
bool updateVisualization
 
bool showVisualization
 
bool showAttachedVisualizations
 
TriMeshModelPtr triMeshModel
 
std::map< std::string, VisualizationNodePtrattachedVisualizations
 

Friends

class CoinVisualizationFactory
 

Additional Inherited Members

- Static Public Member Functions inherited from VirtualRobot::VisualizationNode
static VisualizationNodePtr CreateUnitedVisualization (const std::vector< VisualizationNodePtr > &visualizations)
 
- Data Fields inherited from VirtualRobot::VisualizationNode
EIGEN_MAKE_ALIGNED_OPERATOR_NEW std::vector< Primitive::PrimitivePtrprimitives
 

Constructor & Destructor Documentation

◆ CoinVisualizationNode() [1/3]

VirtualRobot::CoinVisualizationNode::CoinVisualizationNode ( const TriMeshModelPtr tri)

◆ CoinVisualizationNode() [2/3]

VirtualRobot::CoinVisualizationNode::CoinVisualizationNode ( const TriMeshModel tri)

◆ CoinVisualizationNode() [3/3]

VirtualRobot::CoinVisualizationNode::CoinVisualizationNode ( SoNode *  visualizationNode,
float  margin = 0.0f 
)

Store a reference to visualizationNode in the member CoinVisualizationNode::visualization. If visualizationNode is a valid object call SoNode::ref() on it.

◆ ~CoinVisualizationNode()

VirtualRobot::CoinVisualizationNode::~CoinVisualizationNode ( )
override

If CoinVisualizationNode::visualization is a valid object call SoNode::unref() on it.

Member Function Documentation

◆ attachVisualization()

void VirtualRobot::CoinVisualizationNode::attachVisualization ( const std::string &  name,
VisualizationNodePtr  v 
)
overridevirtual

Attach an optional visualization to this VisualizationNode. The attached visualizations will not show up in the TriMeshModel. If there is already a visualization attached with the given name, it is quietly replaced.

Reimplemented from VirtualRobot::VisualizationNode.

◆ clone()

VirtualRobot::VisualizationNodePtr VirtualRobot::CoinVisualizationNode::clone ( bool  deepCopy = true,
float  scaling = 1.0f 
)
overridevirtual

Clone this visualization.

Parameters
deepCopyWhen true, the underlying visualization is copied, otherwise a reference to the existing visualization is passed.
scalingScale Can be set to create a scaled version of this visual data. Since the underlying implementation may be able to re-use the visualization data, a deep copy may not be necessary in some cases.

Reimplemented from VirtualRobot::VisualizationNode.

◆ createTriMeshModel()

void VirtualRobot::CoinVisualizationNode::createTriMeshModel ( )
overridevirtual

This method constructs an instance of TriMeshModel and stores it in CoinVisualizationNode::triMeshModel. If CoinVisualizationMode::visualization is invalid VirtualRobotException is thrown. Otherwise CoinVisualizationNode::InventorTriangleCB() is called on the Inventor graph stored in CoinVisualizationNode::visualization.

Reimplemented from VirtualRobot::VisualizationNode.

◆ detachVisualization()

void VirtualRobot::CoinVisualizationNode::detachVisualization ( const std::string &  name)
overridevirtual

Remove an attached visualization.

Reimplemented from VirtualRobot::VisualizationNode.

◆ getCoinVisualization()

SoNode * VirtualRobot::CoinVisualizationNode::getCoinVisualization ( )

This mehtod returns the internal CoinVisualizationNode::visualization.

◆ getTriMeshModel()

TriMeshModelPtr VirtualRobot::CoinVisualizationNode::getTriMeshModel ( )
overridevirtual

This method returns CoinVisualizationNode::triMeshModel. If the model doesn't exist construct it by calling CoinVisualizationNode::createTriMeshModel().

Reimplemented from VirtualRobot::VisualizationNode.

◆ getType()

std::string VirtualRobot::CoinVisualizationNode::getType ( )
inlineoverridevirtual

Reimplemented from VirtualRobot::VisualizationNode.

◆ InventorTriangleCB()

void VirtualRobot::CoinVisualizationNode::InventorTriangleCB ( void *  data,
SoCallbackAction *  action,
const SoPrimitiveVertex *  v1,
const SoPrimitiveVertex *  v2,
const SoPrimitiveVertex *  v3 
)
staticprotected

This method extracts the triangle given by v1, v2, v3 and stores it in the TriMeshModel instance passed in through data by calling TriMeshModel::addTriangleWithFace() with the extracted triangle.

◆ print()

void VirtualRobot::CoinVisualizationNode::print ( )
overridevirtual

print information about this visualization object.

Reimplemented from VirtualRobot::VisualizationNode.

◆ saveModel()

bool VirtualRobot::CoinVisualizationNode::saveModel ( const std::string &  modelPath,
const std::string &  filename 
)
overridevirtual

Saves model file to model path. By default VRML models are generated.

Parameters
modelPathThe directory.
filenameThe new filename. If filename extension is ".iv", the file is stored in Open Inventor format. Otherwise the file is stored in VRML2 format (.wrl).

Reimplemented from VirtualRobot::VisualizationNode.

◆ scale()

void VirtualRobot::CoinVisualizationNode::scale ( const Eigen::Vector3f &  scaleFactor)
overridevirtual

Reimplemented from VirtualRobot::VisualizationNode.

◆ setGlobalPose()

void VirtualRobot::CoinVisualizationNode::setGlobalPose ( const Eigen::Matrix4f &  m)
overridevirtual

Sets the position of the internal data structure.

Reimplemented from VirtualRobot::VisualizationNode.

◆ setupVisualization()

void VirtualRobot::CoinVisualizationNode::setupVisualization ( bool  showVisualization,
bool  showAttachedVisualizations 
)
overridevirtual

Setup the visualization of this object.

Parameters
showVisualizationIf false, the visualization is disabled.
showAttachedVisualizationsIf false, the visualization of any attached optional visualizations is disabled.

Reimplemented from VirtualRobot::VisualizationNode.

◆ setVisualization()

void VirtualRobot::CoinVisualizationNode::setVisualization ( SoNode *  newVisu)
protected

Replace current visualization of this node. Be careful: any former grabbed trimeshmodels do no longer represent the new datastructure!

◆ shrinkFatten()

void VirtualRobot::CoinVisualizationNode::shrinkFatten ( float  offset)
overridevirtual

Reimplemented from VirtualRobot::VisualizationNode.

Friends And Related Function Documentation

◆ CoinVisualizationFactory

friend class CoinVisualizationFactory
friend

Field Documentation

◆ attachedCoinVisualizations

std::map< std::string, SoNode* > VirtualRobot::CoinVisualizationNode::attachedCoinVisualizations
protected

◆ attachedVisualizationsSeparator

SoSeparator* VirtualRobot::CoinVisualizationNode::attachedVisualizationsSeparator
protected

◆ globalPoseTransform

SoMatrixTransform* VirtualRobot::CoinVisualizationNode::globalPoseTransform
protected

◆ margin

float VirtualRobot::CoinVisualizationNode::margin = 0.0f
protected

◆ scaledVisualization

SoSeparator* VirtualRobot::CoinVisualizationNode::scaledVisualization
protected

◆ scaling

SoScale* VirtualRobot::CoinVisualizationNode::scaling
protected

◆ visualization

SoNode* VirtualRobot::CoinVisualizationNode::visualization
protected

◆ visualizationAtGlobalPose

SoSeparator* VirtualRobot::CoinVisualizationNode::visualizationAtGlobalPose
protected