1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class CameraDecorator!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
65 #include "OSGNode.h" // Beacon Class
67 #include "OSGCameraDecoratorBase.h"
68 #include "OSGCameraDecorator.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::CameraDecorator
79 The Camera base class, see \ref PageSystemWindowCamera for a description.
81 The only common fields are _sfNear and _sfFar.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var CameraPtr CameraDecoratorBase::_sfDecoratee
89 The object being decorated
92 /***************************************************************************\
93 * FieldType/FieldTrait Instantiation *
94 \***************************************************************************/
96 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
97 PointerType FieldTraits
<CameraDecorator
*, nsOSG
>::_type(
100 CameraDecorator::getClassType(),
104 OSG_FIELDTRAITS_GETTYPE_NS(CameraDecorator
*, nsOSG
)
106 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
110 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
114 /***************************************************************************\
115 * Field Description *
116 \***************************************************************************/
118 void CameraDecoratorBase::classDescInserter(TypeObject
&oType
)
120 FieldDescriptionBase
*pDesc
= NULL
;
122 pDesc
= new SFUnrecCameraPtr::Description(
123 SFUnrecCameraPtr::getClassType(),
125 "undocumented decoratee",
126 DecorateeFieldId
, DecorateeFieldMask
,
128 (Field::SFDefaultFlags
| Field::FStdAccess
),
129 static_cast<FieldEditMethodSig
>(&CameraDecorator::editHandleDecoratee
),
130 static_cast<FieldGetMethodSig
>(&CameraDecorator::getHandleDecoratee
));
132 oType
.addInitialDesc(pDesc
);
136 CameraDecoratorBase::TypeObject
CameraDecoratorBase::_type(
137 CameraDecoratorBase::getClassname(),
138 Inherited::getClassname(),
142 reinterpret_cast<InitContainerF
>(&CameraDecorator::initMethod
),
143 reinterpret_cast<ExitContainerF
>(&CameraDecorator::exitMethod
),
144 reinterpret_cast<InitalInsertDescFunc
>(
145 reinterpret_cast<void *>(&CameraDecorator::classDescInserter
)),
148 "<?xml version=\"1.0\" ?>\n"
152 " parent=\"AttachmentContainer\"\n"
153 " library=\"System\"\n"
154 " structure=\"abstract\"\n"
155 " pointerfieldtypes=\"both\"\n"
156 " systemcomponent=\"true\"\n"
157 " parentsystemcomponent=\"true\"\n"
158 " decoratable=\"true\"\n"
159 " decorateeFieldFlags=\"SFDefaultFlags | Field::FStdAccess\"\n"
160 " docGroupBase=\"GrpSystemWindow\"\n"
163 " The Camera base class, see \\ref PageSystemWindowCamera for a description.\n"
165 " The only common fields are _sfNear and _sfFar.\n"
168 "\t name=\"beacon\"\n"
170 " category=\"weakpointer\"\n"
171 "\t cardinality=\"single\"\n"
172 "\t visibility=\"external\"\n"
174 "\tThe object that define's the camera's coordinate system. The camera is\n"
175 "\t positioned at the origin of the system and looks down the negative z-axis\n"
176 "\t (OpenGL-style). \n"
180 "\t type=\"Real32\"\n"
181 "\t cardinality=\"single\"\n"
182 "\t visibility=\"external\"\n"
184 "\tThe near distance of the camera.\n"
188 "\t type=\"Real32\"\n"
189 "\t cardinality=\"single\"\n"
190 "\t visibility=\"external\"\n"
192 "\tThe far distance of the camera.\n"
194 "</FieldContainer>\n",
195 "The Camera base class, see \\ref PageSystemWindowCamera for a description.\n"
197 "The only common fields are _sfNear and _sfFar.\n"
200 /*------------------------------ get -----------------------------------*/
202 FieldContainerType
&CameraDecoratorBase::getType(void)
207 const FieldContainerType
&CameraDecoratorBase::getType(void) const
212 UInt32
CameraDecoratorBase::getContainerSize(void) const
214 return sizeof(CameraDecorator
);
217 /*------------------------- decorator get ------------------------------*/
219 const SFUnrecCameraPtr
*CameraDecoratorBase::getSFDecoratee(void) const
221 return &_sfDecoratee
;
224 //! Get the CameraDecorator::_sfBeacon field.
225 const SFWeakNodePtr
*CameraDecoratorBase::getSFBeacon(void) const
227 if(_sfDecoratee
.getValue() != NULL
)
229 return getDecoratee()->getSFBeacon();
236 //! Get the CameraDecorator::_sfBeacon field.
237 SFWeakNodePtr
*CameraDecoratorBase::editSFBeacon(void)
239 if(_sfDecoratee
.getValue() != NULL
)
241 return getDecoratee()->editSFBeacon();
249 SFReal32
*CameraDecoratorBase::editSFNear(void)
251 if(_sfDecoratee
.getValue() != NULL
)
253 return getDecoratee()->editSFNear();
261 const SFReal32
*CameraDecoratorBase::getSFNear(void) const
263 if(_sfDecoratee
.getValue() != NULL
)
265 return getDecoratee()->getSFNear();
273 SFReal32
*CameraDecoratorBase::editSFFar(void)
275 if(_sfDecoratee
.getValue() != NULL
)
277 return getDecoratee()->editSFFar();
285 const SFReal32
*CameraDecoratorBase::getSFFar(void) const
287 if(_sfDecoratee
.getValue() != NULL
)
289 return getDecoratee()->getSFFar();
302 /*------------------------------ access -----------------------------------*/
304 SizeT
CameraDecoratorBase::getBinSize(ConstFieldMaskArg whichField
)
306 SizeT returnValue
= Inherited::getBinSize(whichField
);
308 if(FieldBits::NoField
!= (DecorateeFieldMask
& whichField
))
310 returnValue
+= _sfDecoratee
.getBinSize();
316 void CameraDecoratorBase::copyToBin(BinaryDataHandler
&pMem
,
317 ConstFieldMaskArg whichField
)
319 Inherited::copyToBin(pMem
, whichField
);
321 if(FieldBits::NoField
!= (DecorateeFieldMask
& whichField
))
323 _sfDecoratee
.copyToBin(pMem
);
327 void CameraDecoratorBase::copyFromBin(BinaryDataHandler
&pMem
,
328 ConstFieldMaskArg whichField
)
330 Inherited::copyFromBin(pMem
, whichField
);
332 if(FieldBits::NoField
!= (DecorateeFieldMask
& whichField
))
334 editSField(DecorateeFieldMask
);
335 _sfDecoratee
.copyFromBin(pMem
);
342 /*------------------------- constructors ----------------------------------*/
344 CameraDecoratorBase::CameraDecoratorBase(void) :
350 CameraDecoratorBase::CameraDecoratorBase(const CameraDecoratorBase
&source
) :
352 _sfDecoratee(source
._sfDecoratee
)
357 /*-------------------------- destructors ----------------------------------*/
359 CameraDecoratorBase::~CameraDecoratorBase(void)
363 void CameraDecoratorBase::onCreate(const CameraDecorator
*source
)
365 Inherited::onCreate(source
);
369 CameraDecorator
*pThis
= static_cast<CameraDecorator
*>(this);
371 pThis
->setBeacon(source
->getBeacon());
375 GetFieldHandlePtr
CameraDecoratorBase::getHandleDecoratee (void) const
377 SFUnrecCameraPtr::GetHandlePtr
returnValue(
378 new SFUnrecCameraPtr::GetHandle(
380 this->getType().getFieldDesc(DecorateeFieldId
),
381 const_cast<CameraDecoratorBase
*>(this)));
386 EditFieldHandlePtr
CameraDecoratorBase::editHandleDecoratee(void)
388 SFUnrecCameraPtr::EditHandlePtr
returnValue(
389 new SFUnrecCameraPtr::EditHandle(
391 this->getType().getFieldDesc(DecorateeFieldId
),
394 returnValue
->setSetMethod(boost::bind(&CameraDecorator::setDecoratee
,
395 static_cast<CameraDecorator
*>(this), _1
));
397 editSField(DecorateeFieldMask
);
402 GetFieldHandlePtr
CameraDecoratorBase::getHandleBeacon (void) const
404 SFWeakNodePtr::GetHandlePtr
returnValue(
405 new SFWeakNodePtr::GetHandle(
407 this->getType().getFieldDesc(BeaconFieldId
),
408 const_cast<CameraDecoratorBase
*>(this)));
413 EditFieldHandlePtr
CameraDecoratorBase::editHandleBeacon (void)
415 SFWeakNodePtr::EditHandlePtr
returnValue(
416 new SFWeakNodePtr::EditHandle(
418 this->getType().getFieldDesc(BeaconFieldId
),
421 returnValue
->setSetMethod(
422 boost::bind(&CameraDecorator::setBeacon
,
423 static_cast<CameraDecorator
*>(this), _1
));
425 editSField(BeaconFieldMask
);
430 GetFieldHandlePtr
CameraDecoratorBase::getHandleNear (void) const
432 SFReal32::GetHandlePtr
returnValue(
433 new SFReal32::GetHandle(
435 this->getType().getFieldDesc(NearFieldId
),
436 const_cast<CameraDecoratorBase
*>(this)));
441 EditFieldHandlePtr
CameraDecoratorBase::editHandleNear (void)
443 SFReal32::EditHandlePtr
returnValue(
444 new SFReal32::EditHandle(
446 this->getType().getFieldDesc(NearFieldId
),
450 editSField(NearFieldMask
);
455 GetFieldHandlePtr
CameraDecoratorBase::getHandleFar (void) const
457 SFReal32::GetHandlePtr
returnValue(
458 new SFReal32::GetHandle(
460 this->getType().getFieldDesc(FarFieldId
),
461 const_cast<CameraDecoratorBase
*>(this)));
466 EditFieldHandlePtr
CameraDecoratorBase::editHandleFar (void)
468 SFReal32::EditHandlePtr
returnValue(
469 new SFReal32::EditHandle(
471 this->getType().getFieldDesc(FarFieldId
),
475 editSField(FarFieldMask
);
481 #ifdef OSG_MT_CPTR_ASPECT
482 void CameraDecoratorBase::execSyncV( FieldContainer
&oFrom
,
483 ConstFieldMaskArg whichField
,
484 AspectOffsetStore
&oOffsets
,
485 ConstFieldMaskArg syncMode
,
486 const UInt32 uiSyncInfo
)
488 CameraDecorator
*pThis
= static_cast<CameraDecorator
*>(this);
490 pThis
->execSync(static_cast<CameraDecorator
*>(&oFrom
),
500 void CameraDecoratorBase::resolveLinks(void)
502 static_cast<CameraDecorator
*>(this)->setDecoratee(NULL
);
504 Inherited::resolveLinks();
506 static_cast<CameraDecorator
*>(this)->setBeacon(NULL
);
511 /*------------------------------ get -----------------------------------*/
514 //! Get the value of the CameraDecorator::_sfBeacon field.
515 Node
* CameraDecoratorBase::getBeacon(void) const
517 if(_sfDecoratee
.getValue() != NULL
)
519 return getDecoratee()->getBeacon();
523 return Inherited::getBeacon();
527 //! Set the value of the CameraDecorator::_sfBeacon field.
528 void CameraDecoratorBase::setBeacon(Node
* const value
)
530 if(_sfDecoratee
.getValue() != NULL
)
532 getDecoratee()->setBeacon(value
);
536 Inherited::setBeacon(value
);
540 //! Get the value of the CameraDecorator::_sfNear field.
541 Real32
&CameraDecoratorBase::editNear(void)
543 if(_sfDecoratee
.getValue() != NULL
)
545 return getDecoratee()->editNear();
549 return Inherited::editNear();
553 //! Get the value of the CameraDecorator::_sfNear field.
554 Real32
CameraDecoratorBase::getNear(void) const
556 if(_sfDecoratee
.getValue() != NULL
)
558 return getDecoratee()->getNear();
562 return Inherited::getNear();
567 //! Set the value of the CameraDecorator::_sfNear field.
568 void CameraDecoratorBase::setNear(const Real32 value
)
570 if(_sfDecoratee
.getValue() != NULL
)
572 getDecoratee()->setNear(value
);
576 Inherited::setNear(value
);
580 //! Get the value of the CameraDecorator::_sfFar field.
581 Real32
&CameraDecoratorBase::editFar(void)
583 if(_sfDecoratee
.getValue() != NULL
)
585 return getDecoratee()->editFar();
589 return Inherited::editFar();
593 //! Get the value of the CameraDecorator::_sfFar field.
594 Real32
CameraDecoratorBase::getFar(void) const
596 if(_sfDecoratee
.getValue() != NULL
)
598 return getDecoratee()->getFar();
602 return Inherited::getFar();
607 //! Set the value of the CameraDecorator::_sfFar field.
608 void CameraDecoratorBase::setFar(const Real32 value
)
610 if(_sfDecoratee
.getValue() != NULL
)
612 getDecoratee()->setFar(value
);
616 Inherited::setFar(value
);