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

VRML Level Of Detail Desc. More...

#include <OSGVRMLNodeDescs.h>

Inheritance diagram for osg::VRMLLODDesc:

osg::VRMLNodeDesc

List of all members.

Member



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

Public Member Functions

Constructors


 VRMLLODDesc (void)
Destructor


virtual ~VRMLLODDesc (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

Private Types

typedef VRMLNodeDesc Inherited

Private Member Functions

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


Detailed Description

VRML Level Of Detail description

Definition at line 1315 of file OSGVRMLNodeDescs.h.


Member Typedef Documentation

Definition at line 1381 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

VRMLLODDesc::VRMLLODDesc ( void   ) 

Definition at line 3850 of file OSGVRMLNodeDescs.cpp.

03850                              :
03851     Inherited()
03852 {
03853 }

VRMLLODDesc::~VRMLLODDesc ( void   )  [virtual]

Definition at line 3858 of file OSGVRMLNodeDescs.cpp.

03859 {
03860 }

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


Member Function Documentation

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3865 of file OSGVRMLNodeDescs.cpp.

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

03866 {
03867 #ifdef OSG_DEBUG_VRML
03868     indentLog(getIndent(), PINFO);
03869     PINFO << "LODDesc::init : " << szName << std::endl;
03870 #endif
03871 
03872     _pNodeProto     = Node::create();
03873     _pNodeCoreProto = DistanceLOD::create();
03874 
03875     _pGenAtt        = GenericAtt::create();
03876     _pGenAtt->setInternal(true);
03877 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3882 of file OSGVRMLNodeDescs.cpp.

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

03885 {
03886     bool bFound = false;
03887 
03888     _pCurrField = NULL;
03889 
03890     if(stringcasecmp("level", szFieldname) == 0)
03891     {
03892         bFound = true;
03893     }
03894     else if(stringcasecmp("center", szFieldname) == 0)
03895     {
03896         bFound = true;
03897     }
03898     else if(stringcasecmp("range", szFieldname) == 0)
03899     {
03900         bFound = true;
03901     }
03902 
03903     if(bFound == true)
03904     {
03905         return true;
03906     }
03907     else
03908     {
03909         return Inherited::prototypeAddField(szFieldType,
03910                                             uiFieldTypeId,
03911                                             szFieldname);
03912     }
03913 }

void VRMLLODDesc::endProtoInterface ( void   )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3915 of file OSGVRMLNodeDescs.cpp.

03916 {
03917 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 3919 of file OSGVRMLNodeDescs.cpp.

References 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().

03924 {
03925     if(szFieldname == NULL)
03926         return;
03927 
03928     if(pFC == NullFC)
03929         return;
03930 
03931     NodePtr pNode = NodePtr::dcast(pFC);
03932 
03933 #ifdef OSG_DEBUG_VRML
03934     indentLog(getIndent(), PINFO);
03935     PINFO << "VRMLLODDesc::getFieldAndDesc : looking for "
03936           << szFieldname
03937           << std::endl;
03938 #endif
03939 
03940     if(pNode == NullFC)
03941     {
03942         PWARNING <<  "VRMLLODDesc::getFieldAndDesc : No Node" << std::endl;
03943         return;
03944     }
03945 
03946     NodeCorePtr pNodeCore = pNode->getCore();
03947 
03948     DistanceLODPtr pLOD      = DistanceLODPtr::dcast(pNodeCore);
03949 
03950     if(pLOD == NullFC)
03951     {
03952         PWARNING <<  "VRMLLODDesc::getFieldAndDesc : No LOD" << std::endl;
03953         return;
03954     }
03955 
03956     incIndent();
03957 
03958     if(stringcasecmp("level", szFieldname) == 0)
03959     {
03960 #ifdef OSG_DEBUG_VRML
03961         indentLog(getIndent(), PINFO);
03962         PINFO << "VRMLLODDesc::getFieldAndDesc :  : request internal "
03963               << szFieldname
03964               << std::endl;
03965 #endif
03966 
03967         pField = pNode->getField("children");
03968 
03969         if(pField != NULL)
03970             pDesc = pNode->getType().findFieldDescription("children");
03971     }
03972     else if(stringcasecmp("center", szFieldname) == 0)
03973     {
03974 #ifdef OSG_DEBUG_VRML
03975         indentLog(getIndent(), PINFO);
03976         PINFO << "VRMLLODDesc::getFieldAndDesc :  : request internal "
03977               << szFieldname
03978               << std::endl;
03979 #endif
03980 
03981         pField = pLOD->getField("center");
03982 
03983         if(pField != NULL)
03984             pDesc = pLOD->getType().findFieldDescription("children");
03985     }
03986     else if(stringcasecmp("range", szFieldname) == 0)
03987     {
03988 #ifdef OSG_DEBUG_VRML
03989         indentLog(getIndent(), PINFO);
03990         PINFO << "VRMLLODDesc::getFieldAndDesc :  : request internal "
03991               << szFieldname
03992               << std::endl;
03993 #endif
03994 
03995         pField = pLOD->getField("range");
03996 
03997         if(pField != NULL)
03998             pDesc = pLOD->getType().findFieldDescription("range");
03999     }
04000     else
04001     {
04002         VRMLNodeDesc::getFieldAndDesc(pLOD,
04003                                       szFieldname,
04004                                       pField,
04005                                       pDesc);
04006     }
04007 
04008 #ifdef OSG_DEBUG_VRML
04009     decIndent();
04010 #endif
04011 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4016 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pGenAtt, osg::VRMLNodeDesc::_pNodeCoreProto, osg::VRMLNodeDesc::_pNodeProto, osg::beginEditCP(), osg::Node::CoreFieldMask, 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.

04020 {
04021     FieldContainerPtr pFC         = NullFC;
04022     NodePtr           pNode       = NullFC;
04023     NodeCorePtr       pNodeCore   = NullFC;
04024     GenericAttPtr     pAtt        = NullFC;
04025 
04026     if(_pNodeProto != NullFC)
04027     {
04028         FieldContainerPtr pAttClone = _pGenAtt->emptyCopy();
04029 
04030         pAtt = GenericAttPtr::dcast(pAttClone);
04031 
04032         if(pAtt != NullFC)
04033         {
04034             pAtt->setInternal(true);
04035         }
04036 
04037         pFC = _pNodeProto->shallowCopy();
04038 
04039         pNode = NodePtr::dcast(pFC);
04040 
04041         pFC = _pNodeCoreProto->shallowCopy();
04042 
04043         pNodeCore = NodeCorePtr::dcast(pFC);
04044 
04045         beginEditCP(pNode);
04046         {
04047             pNode    ->setCore      (pNodeCore);
04048             pNodeCore->addAttachment(pAtt);
04049         }
04050         endEditCP  (pNode, Node::CoreFieldMask);
04051     }
04052 
04053 #ifdef OSG_DEBUG_VRML
04054     indentLog(getIndent(), PINFO);
04055     PINFO << "Begin LOD " << &(*pNode) << std::endl;
04056 
04057     incIndent();
04058 #endif
04059 
04060     return pNode;
04061 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4063 of file OSGVRMLNodeDescs.cpp.

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

04064 {
04065 #ifdef OSG_DEBUG_VRML
04066     decIndent();
04067 
04068     indentLog(getIndent(), PINFO);
04069     PINFO << "End LOD "
04070           << &(*pFC) << std::endl;
04071 #endif
04072 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4077 of file OSGVRMLNodeDescs.cpp.

04078 {
04079 }

void osg::VRMLLODDesc::operator= ( const VRMLLODDesc 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(), osg::VRMLGroupDesc::beginNode(), osg::VRMLSwitchDesc::beginNode(), 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(), osg::VRMLGroupDesc::endNode(), osg::VRMLSwitchDesc::endNode(), 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(), osg::VRMLGroupDesc::getFieldAndDesc(), osg::VRMLSwitchDesc::getFieldAndDesc(), 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(), osg::VRMLGroupDesc::init(), osg::VRMLSwitchDesc::init(), 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

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:21 2008 for OpenSG by  doxygen 1.5.5