Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
BIAS::OpenSceneGraphHelper Class Reference

Utility class for using OpenSceneGraph. More...

#include <GLviewer/OpenSceneGraphHelper.hh>

Public Member Functions

 OpenSceneGraphHelper ()
 
 ~OpenSceneGraphHelper ()
 

Static Public Member Functions

static bool AddOrSetInfo (osg::ref_ptr< osg::Node > node, const std::string &key, const std::string &value)
 Adds or sets information to the node. More...
 
static bool AdjustImageSizeToGPULimit (BIAS::Image< unsigned char > &tex)
 checks max texture size and adjusts More...
 
static bool BIAS2OSGMatrix (const BIAS::Matrix4x4< double > &BiasMat, osg::Matrixd &OsgMat)
 
static bool BIASimageToOSGimage (const BIAS::Image< unsigned char > &in, osg::Image *out, bool copydata)
 conversion function More...
 
static osg::Node * CreateBranchIndexedFaceSets (const BIAS::TriangleMesh &mesh, const std::string &name)
 
this is the new method which takes a triangle mesh and creates

an osg branch avoiding the copying into ThreeDOut. More...

 
static void DumpInfo (const osg::ref_ptr< osg::Node > node)
 Prints the content of the info associated with node to cout. More...
 
static std::vector
< osg::ref_ptr< osg::Node > > 
FindNodesWithInfo (const osg::ref_ptr< osg::Node > node, const std::string &key)
 Returns a vector of all nodes containing an info characterised by key. More...
 
static osg::ref_ptr< osg::Node > FindNodeWithInfo (const osg::ref_ptr< osg::Node > node, const std::string &key, const std::string &value)
 Finds a node downwards of node who has a matching key value pair. More...
 
static void GetInfo (const osg::ref_ptr< osg::Node > node, std::map< std::string, std::string > &key_val)
 returns the associated info as key_value pairs More...
 
static bool HasInfo (const osg::ref_ptr< osg::Node > node, const std::string &key, std::string &value)
 Checks if the node contains additional information in form of a key value pair. More...
 
static bool OSG2BIASMatrix (const osg::Matrixd &OsgMat, BIAS::Matrix4x4< double > &BiasMat)
 
static bool OSGimageToBIASimage (const osg::Image *in, BIAS::Image< unsigned char > &out)
 
static bool RemoveInfo (osg::ref_ptr< osg::Node > node, const std::string &key)
 Removes key value pair from node. More...
 

Static Protected Member Functions

static void FindNodesWithInfoHelper_ (const osg::ref_ptr< osg::Node > CurrentNode, const std::string &key, std::vector< osg::ref_ptr< osg::Node > > &result)
 helper function for FindNodesWithInfo More...
 

Detailed Description

Utility class for using OpenSceneGraph.

Author
MIP

Definition at line 41 of file OpenSceneGraphHelper.hh.

Constructor & Destructor Documentation

BIAS::OpenSceneGraphHelper::OpenSceneGraphHelper ( )
inline

Definition at line 43 of file OpenSceneGraphHelper.hh.

BIAS::OpenSceneGraphHelper::~OpenSceneGraphHelper ( )
inline

Definition at line 44 of file OpenSceneGraphHelper.hh.

Member Function Documentation

bool OpenSceneGraphHelper::AddOrSetInfo ( osg::ref_ptr< osg::Node >  node,
const std::string &  key,
const std::string &  value 
)
static
bool OpenSceneGraphHelper::AdjustImageSizeToGPULimit ( BIAS::Image< unsigned char > &  tex)
static
bool OpenSceneGraphHelper::BIAS2OSGMatrix ( const BIAS::Matrix4x4< double > &  BiasMat,
osg::Matrixd &  OsgMat 
)
static

Definition at line 282 of file OpenSceneGraphHelper.cpp.

References BIAS::Matrix< T >::GetData().

bool OpenSceneGraphHelper::BIASimageToOSGimage ( const BIAS::Image< unsigned char > &  in,
osg::Image *  out,
bool  copydata 
)
static
osg::Node * OpenSceneGraphHelper::CreateBranchIndexedFaceSets ( const BIAS::TriangleMesh mesh,
const std::string &  name 
)
static

this is the new method which takes a triangle mesh and creates

an osg branch avoiding the copying into ThreeDOut.

Definition at line 157 of file OpenSceneGraphHelper.cpp.

References BIAS::TriangleMesh::GetTexCoordsRef(), BIAS::TriangleMesh::GetTextureRef(), BIAS::TriangleMesh::GetTriangleIndicesRef(), and BIAS::TriangleMesh::GetVerticesRef().

void OpenSceneGraphHelper::DumpInfo ( const osg::ref_ptr< osg::Node >  node)
static

Prints the content of the info associated with node to cout.

Definition at line 508 of file OpenSceneGraphHelper.cpp.

std::vector< osg::ref_ptr< osg::Node > > OpenSceneGraphHelper::FindNodesWithInfo ( const osg::ref_ptr< osg::Node >  node,
const std::string &  key 
)
static

Returns a vector of all nodes containing an info characterised by key.

The search is conducted starting by node and proceeding downwards of node.

Author
woelk 11/2009

Definition at line 476 of file OpenSceneGraphHelper.cpp.

void OpenSceneGraphHelper::FindNodesWithInfoHelper_ ( const osg::ref_ptr< osg::Node >  CurrentNode,
const std::string &  key,
std::vector< osg::ref_ptr< osg::Node > > &  result 
)
staticprotected

helper function for FindNodesWithInfo

Definition at line 486 of file OpenSceneGraphHelper.cpp.

osg::ref_ptr< osg::Node > OpenSceneGraphHelper::FindNodeWithInfo ( const osg::ref_ptr< osg::Node >  node,
const std::string &  key,
const std::string &  value 
)
static

Finds a node downwards of node who has a matching key value pair.

Returns NULL if no node with a matching key value pair is found. Throws an exception when node is NULL.

Author
woelk 11/2009

Definition at line 451 of file OpenSceneGraphHelper.cpp.

void OpenSceneGraphHelper::GetInfo ( const osg::ref_ptr< osg::Node >  node,
std::map< std::string, std::string > &  key_val 
)
static

returns the associated info as key_value pairs

Definition at line 431 of file OpenSceneGraphHelper.cpp.

bool OpenSceneGraphHelper::HasInfo ( const osg::ref_ptr< osg::Node >  node,
const std::string &  key,
std::string &  value 
)
static

Checks if the node contains additional information in form of a key value pair.

Throws an exception when node is NULL.

Author
woelk 11/2009

Definition at line 374 of file OpenSceneGraphHelper.cpp.

Referenced by BIAS::GetNodeType(), and BIAS::SceneOpenSceneGraph::IsEditableNode().

bool OpenSceneGraphHelper::OSG2BIASMatrix ( const osg::Matrixd &  OsgMat,
BIAS::Matrix4x4< double > &  BiasMat 
)
static

Definition at line 266 of file OpenSceneGraphHelper.cpp.

References BIAS::Matrix< T >::GetData().

bool OpenSceneGraphHelper::OSGimageToBIASimage ( const osg::Image *  in,
BIAS::Image< unsigned char > &  out 
)
static
bool OpenSceneGraphHelper::RemoveInfo ( osg::ref_ptr< osg::Node >  node,
const std::string &  key 
)
static

Removes key value pair from node.

Returns false if info was not contained in the node. Throws an exception when node is NULL.

Author
woelk 11/2009

Definition at line 392 of file OpenSceneGraphHelper.cpp.


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