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

Public Member Functions

 CoinVisualizationNode (SoNode *visualizationNode, float margin=0.0f)
 
 ~CoinVisualizationNode ()
 
virtual TriMeshModelPtr getTriMeshModel ()
 
SoNode * getCoinVisualization ()
 
virtual void setGlobalPose (const Eigen::Matrix4f &m)
 
virtual void print ()
 print information about this visualization object. More...
 
virtual void scale (Eigen::Vector3f &scaleFactor)
 
virtual void attachVisualization (const std::string &name, VisualizationNodePtr v)
 
virtual void detachVisualization (const std::string &name)
 
virtual void setupVisualization (bool showVisualization, bool showAttachedVisualizations)
 
virtual VisualizationNodePtr clone (bool deepCopy=true, float scaling=1.0f)
 
virtual std::string getType ()
 
virtual bool saveModel (const std::string &modelPath, const std::string &filename)
 
virtual void shrinkFatten (float offset)
 
virtual void createTriMeshModel ()
 
- Public Member Functions inherited from VirtualRobot::VisualizationNode
 VisualizationNode ()
 
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 ()
 

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
 
TriMeshModelPtr triMeshModel
 
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
 
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

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.

VirtualRobot::CoinVisualizationNode::~CoinVisualizationNode ( )

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

Member Function Documentation

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

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.

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

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.

void VirtualRobot::CoinVisualizationNode::createTriMeshModel ( )
virtual

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.

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

Remove an attached visualization.

Reimplemented from VirtualRobot::VisualizationNode.

SoNode * VirtualRobot::CoinVisualizationNode::getCoinVisualization ( )

This mehtod returns the internal CoinVisualizationNode::visualization.

TriMeshModelPtr VirtualRobot::CoinVisualizationNode::getTriMeshModel ( )
virtual

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

Reimplemented from VirtualRobot::VisualizationNode.

virtual std::string VirtualRobot::CoinVisualizationNode::getType ( )
inlinevirtual

Reimplemented from VirtualRobot::VisualizationNode.

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.

void VirtualRobot::CoinVisualizationNode::print ( )
virtual

print information about this visualization object.

Reimplemented from VirtualRobot::VisualizationNode.

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

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.

void VirtualRobot::CoinVisualizationNode::scale ( Eigen::Vector3f &  scaleFactor)
virtual

Reimplemented from VirtualRobot::VisualizationNode.

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

Sets the position of the internal data structure.

Reimplemented from VirtualRobot::VisualizationNode.

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

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.

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!

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

Reimplemented from VirtualRobot::VisualizationNode.

Friends And Related Function Documentation

friend class CoinVisualizationFactory
friend

Field Documentation

std::map< std::string, SoNode* > VirtualRobot::CoinVisualizationNode::attachedCoinVisualizations
protected
SoSeparator* VirtualRobot::CoinVisualizationNode::attachedVisualizationsSeparator
protected
SoMatrixTransform* VirtualRobot::CoinVisualizationNode::globalPoseTransform
protected
float VirtualRobot::CoinVisualizationNode::margin = 0.0f
protected
SoSeparator* VirtualRobot::CoinVisualizationNode::scaledVisualization
protected
SoScale* VirtualRobot::CoinVisualizationNode::scaling
protected
TriMeshModelPtr VirtualRobot::CoinVisualizationNode::triMeshModel
protected
SoNode* VirtualRobot::CoinVisualizationNode::visualization
protected
SoSeparator* VirtualRobot::CoinVisualizationNode::visualizationAtGlobalPose
protected