osg::VRMLGroupDesc Class Reference
[VRML-specific File Input/Output]

VRML Group Desc. More...

#include <OSGVRMLNodeDescs.h>

Inheritance diagram for osg::VRMLGroupDesc:

osg::VRMLNodeDesc

List of all members.

Member



FieldNameTypeHash _mFieldTypes
GenericAttPtr _pGenAtt
FieldContainerPtr _pNodeProto
FieldContainerPtr _pNodeCoreProto
Field_pCurrField
std::string _szCurrentName
bool _bSaveOnEnd
static UInt32 _uiIndent = 0
FieldgetField (FieldContainerPtr pFC1, FieldContainerPtr pFC2, GenericAttPtr pGenAtt, const Char8 *szFieldname)

Public Member Functions

Constructors


 VRMLGroupDesc (void)
Destructor


virtual ~VRMLGroupDesc (void)
Helper


virtual void init (const Char8 *szName)
Field


virtual bool prototypeAddField (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName)
virtual void endProtoInterface (void)
virtual void getFieldAndDesc (FieldContainerPtr pFC, const Char8 *szFieldname, Field *&pField, const FieldDescription *&pDesc)
Node


virtual FieldContainerPtr beginNode (const Char8 *szTypename, const Char8 *szName, FieldContainerPtr pCurrentFC)
virtual void endNode (FieldContainerPtr)
Dump


virtual void dump (const Char8 *szNodeName)
Helper


virtual void reset (void)
virtual void setOnEndSave (const Char8 *szName)
virtual void clearOnEndSave (void)
virtual bool getOnEndSave (void)
virtual const Char8getSavename (void)
virtual FieldContainerPtr getSaveFieldContainer (void)
Field


virtual FieldgetField (const Char8 *szFieldname)
Prototypes


virtual void prototypeAddFieldValue (const Char8 *szFieldVal)
FieldValue


virtual void addFieldValue (Field *pField, const Char8 *szFieldVal)
virtual bool use (FieldContainerPtr)

Static Public Member Functions

Class Get


static UInt32 getIndent (void)
static void incIndent (void)
static void decIndent (void)
static void resetIndent (void)

Protected Types

typedef std::map< const Char8
*, UInt32, LTString
FieldNameTypeHash

Protected Attributes

Member


SFVec3f _defaultBoxCenter
SFVec3f _defaultBoxSize
SFVec3f _boxCenter
SFVec3f _boxSize

Private Types

typedef VRMLNodeDesc Inherited

Private Member Functions

 VRMLGroupDesc (const VRMLGroupDesc &source)
 prohibit default function (move to 'public' if needed)
void operator= (const VRMLGroupDesc &source)
 prohibit default function (move to 'public' if needed)


Detailed Description

VRML Group description

Definition at line 1479 of file OSGVRMLNodeDescs.h.


Member Typedef Documentation

Definition at line 1556 of file OSGVRMLNodeDescs.h.

typedef std::map< const Char8 *, UInt32, LTString> osg::VRMLNodeDesc::FieldNameTypeHash [protected, inherited]

Definition at line 298 of file OSGVRMLNodeDescs.h.


Constructor & Destructor Documentation

VRMLGroupDesc::VRMLGroupDesc ( void   ) 

Definition at line 4322 of file OSGVRMLNodeDescs.cpp.

04322                                  :
04323     Inherited(),
04324 
04325     _defaultBoxCenter(),
04326     _defaultBoxSize  (),
04327 
04328     _boxCenter       (),
04329     _boxSize         ()
04330 {
04331 }

VRMLGroupDesc::~VRMLGroupDesc ( void   )  [virtual]

Definition at line 4336 of file OSGVRMLNodeDescs.cpp.

04337 {
04338 }

osg::VRMLGroupDesc::VRMLGroupDesc ( const VRMLGroupDesc source  )  [private]


Member Function Documentation

void VRMLGroupDesc::init ( const Char8 szName  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4343 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pGenAtt, osg::VRMLNodeDesc::_pNodeCoreProto, osg::VRMLNodeDesc::_pNodeProto, osg::DynFieldAttachment< AttachmentDescT >::create(), osg::GroupBase::create(), osg::Node::create(), osg::VRMLNodeDesc::getIndent(), osg::indentLog(), and PINFO.

04344 {
04345 #ifdef OSG_DEBUG_VRML
04346     indentLog(getIndent(), PINFO);
04347     PINFO << "GroupDesc::init : " << szName << std::endl;
04348 #endif
04349 
04350     _pNodeProto     = Node::create();
04351     _pNodeCoreProto = Group::create();
04352 
04353     _pGenAtt        = GenericAtt::create();
04354     _pGenAtt->setInternal(true);
04355 }

bool VRMLGroupDesc::prototypeAddField ( const Char8 szFieldType,
const UInt32  uiFieldTypeId,
const Char8 szFieldName 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4360 of file OSGVRMLNodeDescs.cpp.

References _defaultBoxCenter, _defaultBoxSize, osg::VRMLNodeDesc::_pCurrField, osg::VRMLNodeDesc::prototypeAddField(), and osg::stringcasecmp().

04363 {
04364     bool bFound = false;
04365 
04366     _pCurrField = NULL;
04367 
04368     if(stringcasecmp("bboxCenter", szFieldname) == 0)
04369     {
04370         _pCurrField = &_defaultBoxCenter;
04371         bFound = true;
04372     }
04373     else if(stringcasecmp("bboxSize", szFieldname) == 0)
04374     {
04375         _pCurrField = &_defaultBoxSize;
04376         bFound = true;
04377     }
04378     else if(stringcasecmp("children", szFieldname) == 0)
04379     {
04380         bFound = true;
04381     }
04382 
04383     if(bFound == true)
04384     {
04385         return true;
04386     }
04387     else
04388     {
04389         return Inherited::prototypeAddField(szFieldType,
04390                                             uiFieldTypeId,
04391                                             szFieldname);
04392     }
04393 }

void VRMLGroupDesc::endProtoInterface ( void   )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4395 of file OSGVRMLNodeDescs.cpp.

04396 {
04397 }

void VRMLGroupDesc::getFieldAndDesc ( FieldContainerPtr  pFC,
const Char8 szFieldname,
Field *&  pField,
const FieldDescription *&  pDesc 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4399 of file OSGVRMLNodeDescs.cpp.

References _boxCenter, _boxSize, osg::AttachmentContainerPtr::dcast(), osg::NodePtr::dcast(), osg::VRMLNodeDesc::decIndent(), osg::NodePtr::getCore(), osg::VRMLNodeDesc::getFieldAndDesc(), osg::VRMLNodeDesc::getIndent(), osg::VRMLNodeDesc::incIndent(), osg::indentLog(), osg::NullFC, PINFO, PWARNING, and osg::stringcasecmp().

04404 {
04405     if(szFieldname == NULL)
04406         return;
04407 
04408     if(pFC == NullFC)
04409         return;
04410 
04411     NodePtr pNode = NodePtr::dcast(pFC);
04412 
04413 #ifdef OSG_DEBUG_VRML
04414     indentLog(getIndent(), PINFO);
04415     PINFO << "VRMLGroupDesc::getFieldAndDesc : looking for "
04416           << szFieldname
04417           << std::endl;
04418 #endif
04419 
04420     if(pNode == NullFC)
04421     {
04422         PWARNING << "VRMLGroupDesc::getFieldAndDesc : No Node" << std::endl;
04423         return;
04424     }
04425 
04426     NodeCorePtr pNodeCore = pNode->getCore();
04427 
04428     GroupPtr pGroup       = GroupPtr::dcast(pNodeCore);
04429 
04430     if(pGroup == NullFC)
04431     {
04432         PWARNING << "VRMLGroupDesc::getFieldAndDesc : No Group" << std::endl;
04433         return;
04434     }
04435 
04436     incIndent();
04437 
04438     if(stringcasecmp("bboxCenter", szFieldname) == 0)
04439     {
04440 #ifdef OSG_DEBUG_VRML
04441         indentLog(getIndent(), PINFO);
04442         PINFO << "VRMLGroupDesc::getFieldAndDesc :  : request internal "
04443               << szFieldname
04444               << std::endl;
04445 #endif
04446 
04447         pField = &_boxCenter;
04448         pDesc  = NULL;
04449     }
04450     else if(stringcasecmp("bboxSize", szFieldname) == 0)
04451     {
04452 #ifdef OSG_DEBUG_VRML
04453         indentLog(getIndent(), PINFO);
04454         PINFO << "VRMLGroupDesc::getFieldAndDesc :  : request internal "
04455               << szFieldname
04456               << std::endl;
04457 #endif
04458 
04459         pField = &_boxSize;
04460         pDesc  = NULL;
04461     }
04462     else if(stringcasecmp("children", szFieldname) == 0)
04463     {
04464 #ifdef OSG_DEBUG_VRML
04465         indentLog(getIndent(), PINFO);
04466         PINFO << "VRMLGroupDesc::getFieldAndDesc :  : request internal "
04467               << szFieldname
04468               << std::endl;
04469 #endif
04470 
04471         pField = pNode->getField("children");
04472 
04473         if(pField != NULL)
04474             pDesc = pNode->getType().findFieldDescription("children");
04475     }
04476     else
04477     {
04478         VRMLNodeDesc::getFieldAndDesc(pGroup,
04479                                       szFieldname,
04480                                       pField,
04481                                       pDesc);
04482     }
04483 
04484 #ifdef OSG_DEBUG_VRML
04485     decIndent();
04486 #endif
04487 }

FieldContainerPtr VRMLGroupDesc::beginNode ( const Char8 szTypename,
const Char8 szName,
FieldContainerPtr  pCurrentFC 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4492 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pGenAtt, osg::VRMLNodeDesc::_pNodeCoreProto, osg::VRMLNodeDesc::_pNodeProto, osg::beginEditCP(), osg::AttachmentContainerPtr::dcast(), osg::NodePtr::dcast(), osg::FCPtr< BasePtrTypeT, FieldContainerTypeT >::dcast(), osg::endEditCP(), osg::VRMLNodeDesc::getIndent(), osg::VRMLNodeDesc::incIndent(), osg::indentLog(), osg::NullFC, and PINFO.

04496 {
04497     FieldContainerPtr pFC         = NullFC;
04498     NodePtr           pNode       = NullFC;
04499     NodeCorePtr       pNodeCore   = NullFC;
04500     GenericAttPtr     pAtt        = NullFC;
04501 
04502     if(_pNodeProto != NullFC)
04503     {
04504         FieldContainerPtr pAttClone = _pGenAtt->emptyCopy();
04505 
04506         pAtt = GenericAttPtr::dcast(pAttClone);
04507 
04508         if(pAtt != NullFC)
04509         {
04510             pAtt->setInternal(true);
04511         }
04512 
04513         pFC = _pNodeProto->shallowCopy();
04514 
04515         pNode = NodePtr::dcast(pFC);
04516 
04517         pFC = _pNodeCoreProto->shallowCopy();
04518 
04519         pNodeCore = NodeCorePtr::dcast(pFC);
04520 
04521         beginEditCP(pNode);
04522         {
04523             pNode    ->setCore      (pNodeCore);
04524             pNodeCore->addAttachment(pAtt);
04525         }
04526         endEditCP   (pNode);
04527     }
04528 
04529 #ifdef OSG_DEBUG_VRML
04530     indentLog(getIndent(), PINFO);
04531     PINFO << "Begin Group " << &(*pNode) << std::endl;
04532 
04533     incIndent();
04534 #endif
04535 
04536     return pNode;
04537 }

void VRMLGroupDesc::endNode ( FieldContainerPtr  pFC  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4539 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::decIndent(), osg::VRMLNodeDesc::getIndent(), osg::indentLog(), and PINFO.

04540 {
04541 #ifdef OSG_DEBUG_VRML
04542     decIndent();
04543 
04544     indentLog(getIndent(), PINFO);
04545     PINFO << "End Group "
04546           << &(*pFC) << std::endl;
04547 #endif
04548 }

void VRMLGroupDesc::dump ( const Char8 szNodeName  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4553 of file OSGVRMLNodeDescs.cpp.

04554 {
04555 }

void osg::VRMLGroupDesc::operator= ( const VRMLGroupDesc source  )  [private]

UInt32 VRMLNodeDesc::getIndent ( void   )  [static, inherited]

Definition at line 128 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_uiIndent.

Referenced by osg::VRMLNodeFactory< BaseT >::addFieldValue(), osg::VRMLNodeFactory< BaseT >::beginEventInDecl(), osg::VRMLNodeFactory< BaseT >::beginEventOutDecl(), osg::VRMLViewpointDesc::beginNode(), osg::VRMLInlineDesc::beginNode(), beginNode(), osg::VRMLSwitchDesc::beginNode(), osg::VRMLLODDesc::beginNode(), osg::VRMLPixelTextureDesc::beginNode(), osg::VRMLImageTextureDesc::beginNode(), osg::VRMLTextureTransformDesc::beginNode(), osg::VRMLAppearanceDesc::beginNode(), osg::VRMLGeometryPointSetDesc::beginNode(), osg::VRMLGeometryDesc::beginNode(), osg::VRMLShapeDesc::beginNode(), osg::VRMLFile::beginNode(), osg::VRMLNodeFactory< BaseT >::beginProto(), osg::VRMLFile::endField(), osg::VRMLViewpointDesc::endNode(), osg::VRMLInlineDesc::endNode(), osg::VRMLExtrusionDesc::endNode(), endNode(), osg::VRMLSwitchDesc::endNode(), osg::VRMLLODDesc::endNode(), osg::VRMLPixelTextureDesc::endNode(), osg::VRMLImageTextureDesc::endNode(), osg::VRMLTextureTransformDesc::endNode(), osg::VRMLAppearanceDesc::endNode(), osg::VRMLGeometryObjectDesc::endNode(), osg::VRMLGeometryPointSetDesc::endNode(), osg::VRMLGeometryDesc::endNode(), osg::VRMLShapeDesc::endNode(), osg::VRMLFile::endNode(), osg::VRMLNodeFactory< BaseT >::findNodeDesc(), osg::VRMLNodeDesc::getField(), osg::VRMLViewpointDesc::getFieldAndDesc(), osg::VRMLInlineDesc::getFieldAndDesc(), osg::VRMLExtrusionDesc::getFieldAndDesc(), getFieldAndDesc(), osg::VRMLSwitchDesc::getFieldAndDesc(), osg::VRMLLODDesc::getFieldAndDesc(), osg::VRMLAppearanceDesc::getFieldAndDesc(), osg::VRMLGeometryObjectDesc::getFieldAndDesc(), osg::VRMLGeometryPartDesc::getFieldAndDesc(), osg::VRMLGeometryPointSetDesc::getFieldAndDesc(), osg::VRMLGeometryDesc::getFieldAndDesc(), osg::VRMLShapeDesc::getFieldAndDesc(), osg::VRMLNodeDesc::getFieldAndDesc(), osg::VRMLFile::getFieldType(), osg::VRMLInlineDesc::init(), osg::VRMLExtrusionDesc::init(), init(), osg::VRMLSwitchDesc::init(), osg::VRMLLODDesc::init(), osg::VRMLPixelTextureDesc::init(), osg::VRMLImageTextureDesc::init(), osg::VRMLTextureTransformDesc::init(), osg::VRMLMaterialDesc::init(), osg::VRMLAppearanceDesc::init(), osg::VRMLGeometryObjectDesc::init(), osg::VRMLGeometryPartDesc::init(), osg::VRMLGeometryPointSetDesc::init(), osg::VRMLGeometryDesc::init(), osg::VRMLShapeDesc::init(), osg::VRMLPixelTextureDesc::prototypeAddField(), osg::VRMLImageTextureDesc::prototypeAddField(), osg::VRMLTextureTransformDesc::prototypeAddField(), osg::VRMLMaterialDesc::prototypeAddField(), osg::VRMLGeometryPartDesc::prototypeAddField(), osg::VRMLGeometryPointSetDesc::prototypeAddField(), osg::VRMLGeometryDesc::prototypeAddField(), osg::VRMLShapeDesc::prototypeAddField(), osg::VRMLNodeDesc::prototypeAddField(), osg::VRMLFile::setContainerFieldValue(), and osg::VRMLFile::use().

00129 {
00130     return _uiIndent;
00131 }

void VRMLNodeDesc::incIndent ( void   )  [static, inherited]

void VRMLNodeDesc::decIndent ( void   )  [static, inherited]

void VRMLNodeDesc::resetIndent ( void   )  [static, inherited]

void VRMLNodeDesc::reset ( void   )  [virtual, inherited]

void VRMLNodeDesc::setOnEndSave ( const Char8 szName  )  [virtual, inherited]

Definition at line 209 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd, and osg::VRMLNodeDesc::_szCurrentName.

Referenced by osg::VRMLFile::beginNode().

00210 {
00211     _szCurrentName = szName; // does that make a copy? I expect it to...
00212     _bSaveOnEnd = true;
00213 }

void VRMLNodeDesc::clearOnEndSave ( void   )  [virtual, inherited]

Definition at line 215 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd.

Referenced by osg::VRMLFile::endNode().

00216 {
00217     _bSaveOnEnd = false;
00218 }

bool VRMLNodeDesc::getOnEndSave ( void   )  [virtual, inherited]

Definition at line 220 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd.

Referenced by osg::VRMLFile::endNode().

00221 {
00222     return _bSaveOnEnd;
00223 }

const Char8 * VRMLNodeDesc::getSavename ( void   )  [virtual, inherited]

Definition at line 225 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_szCurrentName.

Referenced by osg::VRMLFile::endNode().

00226 {
00227     return _szCurrentName.c_str();
00228 }

FieldContainerPtr VRMLNodeDesc::getSaveFieldContainer ( void   )  [virtual, inherited]

Reimplemented in osg::VRMLAppearanceDesc.

Definition at line 230 of file OSGVRMLNodeDescs.cpp.

References osg::NullFC.

Referenced by osg::VRMLFile::endNode().

00231 {
00232     return NullFC;
00233 }

Field * VRMLNodeDesc::getField ( const Char8 szFieldname  )  [virtual, inherited]

Field * VRMLNodeDesc::getField ( FieldContainerPtr  pFC1,
FieldContainerPtr  pFC2,
GenericAttPtr  pGenAtt,
const Char8 szFieldname 
) [protected, inherited]

Definition at line 607 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::decIndent(), osg::VRMLNodeDesc::getIndent(), osg::VRMLNodeDesc::incIndent(), osg::indentLog(), osg::NullFC, and PINFO.

00611 {
00612     Field *returnValue = NULL;
00613 
00614     if(szFieldname == NULL)
00615     {
00616         return returnValue;
00617     }
00618 
00619 #ifdef OSG_DEBUG_VRML
00620     indentLog(getIndent(), PINFO);
00621     PINFO << "VRMLNodeDesc::getField " << std::endl;
00622 
00623     incIndent();
00624 
00625     indentLog(getIndent(), PINFO);
00626     PINFO << "Trying to find field : " << szFieldname << std::endl;
00627 #endif
00628 
00629     if(pFC1 != NullFC)
00630     {
00631         returnValue = pFC1->getField(szFieldname);
00632     }
00633 
00634 #ifdef OSG_DEBUG_VRML
00635     incIndent();
00636 
00637     indentLog(getIndent(), PINFO);
00638     PINFO << "Got this from node : " << returnValue << std::endl;
00639 #endif
00640 
00641     if(returnValue != NULL)
00642         return returnValue;
00643 
00644     if(pFC2 != NullFC)
00645     {
00646         returnValue = pFC2->getField(szFieldname);
00647 
00648 #ifdef OSG_DEBUG_VRML
00649         indentLog(getIndent(), PINFO);
00650         PINFO << "Got this from nodecore : " << returnValue << std::endl;
00651 #endif
00652     }
00653     else
00654     {
00655 #ifdef OSG_DEBUG_VRML
00656         indentLog(getIndent(), PINFO);
00657         PINFO << "No core to check" << std::endl;
00658 #endif
00659     }
00660 
00661 
00662     if(returnValue != NULL)
00663         return returnValue;
00664 
00665     if(pGenAtt != NullFC)
00666     {
00667         returnValue = pGenAtt->getField(szFieldname);
00668     }
00669 
00670 #ifdef OSG_DEBUG_VRML
00671     indentLog(getIndent(), PINFO);
00672     PINFO << "Got this from attachment : " << returnValue << std::endl;
00673 
00674     decIndent();
00675     decIndent();
00676 #endif
00677 
00678     return returnValue;
00679 }

void VRMLNodeDesc::prototypeAddFieldValue ( const Char8 szFieldVal  )  [virtual, inherited]

Definition at line 477 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pCurrField, and osg::Field::pushValueByStr().

Referenced by osg::VRMLNodeFactory< BaseT >::addFieldValue().

00478 {
00479     if(_pCurrField       != NULL)
00480     {
00481         _pCurrField->pushValueByStr(szFieldVal);
00482     }
00483 }

void VRMLNodeDesc::addFieldValue ( Field pField,
const Char8 szFieldVal 
) [virtual, inherited]

Reimplemented in osg::VRMLGeometryDesc, osg::VRMLGeometryPointSetDesc, and osg::VRMLPixelTextureDesc.

Definition at line 551 of file OSGVRMLNodeDescs.cpp.

References osg::Field::pushValueByStr().

Referenced by osg::VRMLFile::addFieldValue().

00553 {
00554     if(pField != NULL)
00555     {
00556         pField->pushValueByStr(szFieldVal);
00557     }
00558 }

bool VRMLNodeDesc::use ( FieldContainerPtr   )  [virtual, inherited]

Reimplemented in osg::VRMLAppearanceDesc.

Definition at line 560 of file OSGVRMLNodeDescs.cpp.

Referenced by osg::VRMLFile::use().

00561 {
00562     return false;
00563 }


Member Data Documentation

Definition at line 1546 of file OSGVRMLNodeDescs.h.

Referenced by prototypeAddField().

Definition at line 1547 of file OSGVRMLNodeDescs.h.

Referenced by prototypeAddField().

Definition at line 1549 of file OSGVRMLNodeDescs.h.

Referenced by getFieldAndDesc().

Definition at line 1550 of file OSGVRMLNodeDescs.h.

Referenced by getFieldAndDesc().

UInt32 VRMLNodeDesc::_uiIndent = 0 [static, protected, inherited]

Definition at line 307 of file OSGVRMLNodeDescs.h.

Field* osg::VRMLNodeDesc::_pCurrField [protected, inherited]

std::string osg::VRMLNodeDesc::_szCurrentName [protected, inherited]

bool osg::VRMLNodeDesc::_bSaveOnEnd [protected, inherited]


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

Generated on Mon Mar 17 12:05:22 2008 for OpenSG by  doxygen 1.5.5