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

VRML Viewpoint Desc. More...

#include <OSGVRMLNodeDescs.h>

Inheritance diagram for osg::VRMLViewpointDesc:

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


 VRMLViewpointDesc (void)
Destructor


virtual ~VRMLViewpointDesc (void)
Helper


virtual void init (const Char8 *szName)
virtual void reset (void)
virtual ComponentTransformPtr getDefaultBeacon (void)
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 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

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


Detailed Description

VRML Viewpoint description

Definition at line 1751 of file OSGVRMLNodeDescs.h.


Member Typedef Documentation

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

VRMLViewpointDesc::VRMLViewpointDesc ( void   ) 

Definition at line 5177 of file OSGVRMLNodeDescs.cpp.

05177                                          :
05178     Inherited()
05179 {
05180 }

VRMLViewpointDesc::~VRMLViewpointDesc ( void   )  [virtual]

Definition at line 5185 of file OSGVRMLNodeDescs.cpp.

05186 {
05187 }

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


Member Function Documentation

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 5192 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pGenAtt, osg::VRMLNodeDesc::_pNodeCoreProto, osg::VRMLNodeDesc::_pNodeProto, osg::DynFieldAttachment< AttachmentDescT >::create(), osg::ComponentTransformBase::create(), osg::Node::create(), osg::SField< FieldTypeT, fieldNameSpace >::getClassType(), osg::DynFieldAttachment< AttachmentDescT >::getDynamicField(), and PINFO.

05193 {
05194 #ifdef OSG_DEBUG_VRML
05195     PINFO << "Viewpoint init : " << szName << std::endl;
05196 #endif
05197 
05198     _pNodeProto     = Node::create();
05199     _pNodeCoreProto = ComponentTransform::create();
05200     _pGenAtt        = GenericAtt::create();
05201     _pGenAtt->setInternal(true);
05202 
05203     FieldDescription *pDesc =
05204         new FieldDescription(SFBool::getClassType(),
05205                              "isViewpoint",
05206                              0, 0,
05207                              false,
05208                              (FieldIndexAccessMethod)
05209                              &GenericAtt::getDynamicField);
05210 
05211 
05212     _pGenAtt->addField(*pDesc);
05213 }

void VRMLViewpointDesc::reset ( void   )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 5215 of file OSGVRMLNodeDescs.cpp.

05216 {
05217  //   _pCamera = PerspectiveCamera::NullFC;
05218 
05219 //    _beaconNode = NullNode;
05221 //    _viewpointAttachment = ViewpointAttachmentPtr::NullPtr;
05222 //
05223 //    _defaultOrientation.setValue(_orientation);
05224 //    _defaultPosition   .setValue(_position);
05225 }

ComponentTransformPtr VRMLViewpointDesc::getDefaultBeacon ( void   )  [virtual]

Definition at line 5227 of file OSGVRMLNodeDescs.cpp.

References osg::NullFC.

05228 {
05229     return NullFC;
05230 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 5242 of file OSGVRMLNodeDescs.cpp.

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

05245 {
05246     bool bFound = false;
05247 
05248     _pCurrField = NULL;
05249 
05250     if(stringcasecmp("orientation", szFieldname) == 0)
05251     {
05252         _pCurrField = _pNodeCoreProto->getField("rotation");
05253 
05254         bFound = true;
05255     }
05256     else if(stringcasecmp("position", szFieldname) == 0)
05257     {
05258         _pCurrField = _pNodeCoreProto->getField("translation");
05259 
05260         bFound = true;
05261     }
05262 
05263     if(bFound == true)
05264     {
05265         return true;
05266     }
05267     else
05268     {
05269         return Inherited::prototypeAddField(szFieldType,
05270                                             uiFieldTypeId,
05271                                             szFieldname);
05272     }
05273 }

void VRMLViewpointDesc::endProtoInterface ( void   )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 5275 of file OSGVRMLNodeDescs.cpp.

05276 {
05277 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 5279 of file OSGVRMLNodeDescs.cpp.

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

05284 {
05285 #ifdef OSG_DEBUG_VRML
05286     indentLog(getIndent(), PINFO);
05287     PINFO << "ViewpointDesc::getFieldAndDesc : request "
05288           << szFieldname
05289           << std::endl;
05290 #endif
05291 
05292     if(szFieldname == NULL)
05293         return;
05294 
05295     if(pFC == NullFC)
05296         return;
05297 
05298     NodePtr pNode = NodePtr::dcast(pFC);
05299 
05300     if(pNode == NullFC)
05301     {
05302         PWARNING << "ViewpointDesc::getFieldAndDesc : No Node" << std::endl;
05303         return;
05304     }
05305 
05306     NodeCorePtr pNodeCore = pNode->getCore();
05307 
05308     ComponentTransformPtr pTransform = ComponentTransformPtr::dcast(pNodeCore);
05309 
05310     if(pTransform == NullFC)
05311     {
05312         PWARNING << "ViewpointDesc::getFieldAndDesc : No Geo" << std::endl;
05313         return;
05314     }
05315 
05316     if(stringcasecmp("orientation", szFieldname) == 0)
05317     {
05318 #ifdef OSG_DEBUG_VRML
05319         indentLog(getIndent(), PINFO);
05320         PINFO << "ViewpointDesc::getFieldAndDesc : internal "
05321               << szFieldname << std::endl;
05322 #endif
05323 
05324         pField = pTransform->getField("rotation");
05325 
05326         if(pField != NULL)
05327             pDesc = pTransform->getType().findFieldDescription("rotation");
05328     }
05329     else if(stringcasecmp("position", szFieldname) == 0)
05330     {
05331 #ifdef OSG_DEBUG_VRML
05332         indentLog(getIndent(), PINFO);
05333         PINFO << "ViewpointDesc::getFieldAndDesc : internal "
05334               << szFieldname << std::endl;
05335 #endif
05336 
05337         pField = pTransform->getField("translation");
05338 
05339         if(pField != NULL)
05340             pDesc = pTransform->getType().findFieldDescription("translation");
05341     }
05342     else
05343     {
05344         VRMLNodeDesc::getFieldAndDesc(pTransform,
05345                                       szFieldname,
05346                                       pField,
05347                                       pDesc);
05348     }
05349 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 5354 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.

05358 {
05359     FieldContainerPtr pFC         = NullFC;
05360     NodePtr           pNode       = NullFC;
05361     NodeCorePtr       pNodeCore   = NullFC;
05362     GenericAttPtr     pAtt        = NullFC;
05363 
05364     if(_pNodeProto != NullFC)
05365     {
05366         FieldContainerPtr pAttClone = _pGenAtt->clone();
05367 
05368         pAtt = GenericAttPtr::dcast(pAttClone);
05369 
05370         if(pAtt != NullFC)
05371         {
05372             pAtt->setInternal(true);
05373         }
05374 
05375         pFC = _pNodeProto->shallowCopy();
05376 
05377         pNode = NodePtr::dcast(pFC);
05378 
05379         pFC = _pNodeCoreProto->shallowCopy();
05380 
05381         pNodeCore = NodeCorePtr::dcast(pFC);
05382 
05383         beginEditCP(pNode);
05384         {
05385             pNode    ->setCore      (pNodeCore);
05386             pNodeCore->addAttachment(pAtt);
05387         }
05388         endEditCP  (pNode);
05389     }
05390 
05391 #ifdef OSG_DEBUG_VRML
05392     indentLog(getIndent(), PINFO);
05393     PINFO << "Begin Viewpoint " << &(*pNode) << std::endl;
05394 
05395     incIndent();
05396 #endif
05397 
05398     return pNode;
05399 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 5401 of file OSGVRMLNodeDescs.cpp.

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

05402 {
05403 #ifdef OSG_DEBUG_VRML
05404     decIndent();
05405 
05406     indentLog(getIndent(), PINFO);
05407     PINFO << "End Viewpoint " << &(*pFC) << std::endl;
05408 #endif
05409 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 5414 of file OSGVRMLNodeDescs.cpp.

05415 {
05416 }

void osg::VRMLViewpointDesc::operator= ( const VRMLViewpointDesc 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(), beginNode(), osg::VRMLInlineDesc::beginNode(), osg::VRMLGroupDesc::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(), endNode(), osg::VRMLInlineDesc::endNode(), osg::VRMLExtrusionDesc::endNode(), osg::VRMLGroupDesc::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(), getFieldAndDesc(), osg::VRMLInlineDesc::getFieldAndDesc(), osg::VRMLExtrusionDesc::getFieldAndDesc(), osg::VRMLGroupDesc::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(), osg::VRMLGroupDesc::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::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 11:12:21 2008 for OpenSG by  doxygen 1.5.5