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 TransformationInterfaceSensor!
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"
66 #include "OSGTransformationInterfaceSensorBase.h"
67 #include "OSGTransformationInterfaceSensor.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::TransformationInterfaceSensor
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Matrix TransformationInterfaceSensorBase::_sfTransformation
89 /*! \var Vec3f TransformationInterfaceSensorBase::_sfTranslation
93 /*! \var Quaternion TransformationInterfaceSensorBase::_sfRotation
97 /*! \var Real32 TransformationInterfaceSensorBase::_sfRotationScale
101 /*! \var Real32 TransformationInterfaceSensorBase::_sfTranslationScale
106 /***************************************************************************\
107 * FieldType/FieldTrait Instantiation *
108 \***************************************************************************/
110 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
111 PointerType FieldTraits
<TransformationInterfaceSensor
*, nsOSG
>::_type(
112 "TransformationInterfaceSensorPtr",
113 "DeviceInterfaceSensorPtr",
114 TransformationInterfaceSensor::getClassType(),
118 OSG_FIELDTRAITS_GETTYPE_NS(TransformationInterfaceSensor
*, nsOSG
)
120 /***************************************************************************\
121 * Field Description *
122 \***************************************************************************/
124 void TransformationInterfaceSensorBase::classDescInserter(TypeObject
&oType
)
126 FieldDescriptionBase
*pDesc
= NULL
;
129 pDesc
= new SFMatrix::Description(
130 SFMatrix::getClassType(),
133 TransformationFieldId
, TransformationFieldMask
,
135 (Field::FStdAccess
| Field::FThreadLocal
),
136 static_cast<FieldEditMethodSig
>(&TransformationInterfaceSensor::editHandleTransformation
),
137 static_cast<FieldGetMethodSig
>(&TransformationInterfaceSensor::getHandleTransformation
));
139 oType
.addInitialDesc(pDesc
);
141 pDesc
= new SFVec3f::Description(
142 SFVec3f::getClassType(),
145 TranslationFieldId
, TranslationFieldMask
,
147 (Field::FStdAccess
| Field::FThreadLocal
),
148 static_cast<FieldEditMethodSig
>(&TransformationInterfaceSensor::editHandleTranslation
),
149 static_cast<FieldGetMethodSig
>(&TransformationInterfaceSensor::getHandleTranslation
));
151 oType
.addInitialDesc(pDesc
);
153 pDesc
= new SFQuaternion::Description(
154 SFQuaternion::getClassType(),
157 RotationFieldId
, RotationFieldMask
,
159 (Field::FStdAccess
| Field::FThreadLocal
),
160 static_cast<FieldEditMethodSig
>(&TransformationInterfaceSensor::editHandleRotation
),
161 static_cast<FieldGetMethodSig
>(&TransformationInterfaceSensor::getHandleRotation
));
163 oType
.addInitialDesc(pDesc
);
165 pDesc
= new SFReal32::Description(
166 SFReal32::getClassType(),
169 RotationScaleFieldId
, RotationScaleFieldMask
,
171 (Field::FStdAccess
| Field::FThreadLocal
),
172 static_cast<FieldEditMethodSig
>(&TransformationInterfaceSensor::editHandleRotationScale
),
173 static_cast<FieldGetMethodSig
>(&TransformationInterfaceSensor::getHandleRotationScale
));
175 oType
.addInitialDesc(pDesc
);
177 pDesc
= new SFReal32::Description(
178 SFReal32::getClassType(),
181 TranslationScaleFieldId
, TranslationScaleFieldMask
,
183 (Field::FStdAccess
| Field::FThreadLocal
),
184 static_cast<FieldEditMethodSig
>(&TransformationInterfaceSensor::editHandleTranslationScale
),
185 static_cast<FieldGetMethodSig
>(&TransformationInterfaceSensor::getHandleTranslationScale
));
187 oType
.addInitialDesc(pDesc
);
191 TransformationInterfaceSensorBase::TypeObject
TransformationInterfaceSensorBase::_type(
192 TransformationInterfaceSensorBase::getClassname(),
193 Inherited::getClassname(),
196 reinterpret_cast<PrototypeCreateF
>(&TransformationInterfaceSensorBase::createEmptyLocal
),
197 reinterpret_cast<InitContainerF
>(&TransformationInterfaceSensor::initMethod
),
198 reinterpret_cast<ExitContainerF
>(&TransformationInterfaceSensor::exitMethod
),
199 reinterpret_cast<InitalInsertDescFunc
>(
200 reinterpret_cast<void *>(&TransformationInterfaceSensor::classDescInserter
)),
203 "<?xml version=\"1.0\"?>\n"
206 " name=\"TransformationInterfaceSensor\"\n"
207 " parent=\"DeviceInterfaceSensor\"\n"
208 " library=\"ContribCSM\"\n"
209 " pointerfieldtypes=\"none\"\n"
210 " structure=\"concrete\"\n"
211 " systemcomponent=\"true\"\n"
212 " parentsystemcomponent=\"true\"\n"
213 " decoratable=\"false\"\n"
214 " useLocalIncludes=\"false\"\n"
215 " isNodeCore=\"false\"\n"
216 " isBundle=\"false\"\n"
217 " parentFields=\"none\"\n"
220 " name=\"transformation\"\n"
222 " cardinality=\"single\"\n"
223 " visibility=\"internal\"\n"
224 " access=\"public\"\n"
225 " defaultValue=\"\"\n"
226 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
231 " name=\"translation\"\n"
233 " cardinality=\"single\"\n"
234 " visibility=\"internal\"\n"
235 " access=\"public\"\n"
236 " defaultValue=\"\"\n"
237 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
242 " name=\"rotation\"\n"
243 " type=\"Quaternion\"\n"
244 " cardinality=\"single\"\n"
245 " visibility=\"internal\"\n"
246 " access=\"public\"\n"
247 " defaultValue=\"\"\n"
248 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
253 " name=\"rotationScale\"\n"
255 " cardinality=\"single\"\n"
256 " visibility=\"internal\"\n"
257 " access=\"public\"\n"
258 " defaultValue=\"1.f\"\n"
259 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
264 " name=\"translationScale\"\n"
266 " cardinality=\"single\"\n"
267 " visibility=\"internal\"\n"
268 " access=\"protected\"\n"
269 " defaultValue=\"1.f\"\n"
270 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
273 "</FieldContainer>\n",
277 /*------------------------------ get -----------------------------------*/
279 FieldContainerType
&TransformationInterfaceSensorBase::getType(void)
284 const FieldContainerType
&TransformationInterfaceSensorBase::getType(void) const
289 UInt32
TransformationInterfaceSensorBase::getContainerSize(void) const
291 return sizeof(TransformationInterfaceSensor
);
294 /*------------------------- decorator get ------------------------------*/
297 SFMatrix
*TransformationInterfaceSensorBase::editSFTransformation(void)
299 editSField(TransformationFieldMask
);
301 return &_sfTransformation
;
304 const SFMatrix
*TransformationInterfaceSensorBase::getSFTransformation(void) const
306 return &_sfTransformation
;
310 SFVec3f
*TransformationInterfaceSensorBase::editSFTranslation(void)
312 editSField(TranslationFieldMask
);
314 return &_sfTranslation
;
317 const SFVec3f
*TransformationInterfaceSensorBase::getSFTranslation(void) const
319 return &_sfTranslation
;
323 SFQuaternion
*TransformationInterfaceSensorBase::editSFRotation(void)
325 editSField(RotationFieldMask
);
330 const SFQuaternion
*TransformationInterfaceSensorBase::getSFRotation(void) const
336 SFReal32
*TransformationInterfaceSensorBase::editSFRotationScale(void)
338 editSField(RotationScaleFieldMask
);
340 return &_sfRotationScale
;
343 const SFReal32
*TransformationInterfaceSensorBase::getSFRotationScale(void) const
345 return &_sfRotationScale
;
349 SFReal32
*TransformationInterfaceSensorBase::editSFTranslationScale(void)
351 editSField(TranslationScaleFieldMask
);
353 return &_sfTranslationScale
;
356 const SFReal32
*TransformationInterfaceSensorBase::getSFTranslationScale(void) const
358 return &_sfTranslationScale
;
366 /*------------------------------ access -----------------------------------*/
368 SizeT
TransformationInterfaceSensorBase::getBinSize(ConstFieldMaskArg whichField
)
370 SizeT returnValue
= Inherited::getBinSize(whichField
);
372 if(FieldBits::NoField
!= (TransformationFieldMask
& whichField
))
374 returnValue
+= _sfTransformation
.getBinSize();
376 if(FieldBits::NoField
!= (TranslationFieldMask
& whichField
))
378 returnValue
+= _sfTranslation
.getBinSize();
380 if(FieldBits::NoField
!= (RotationFieldMask
& whichField
))
382 returnValue
+= _sfRotation
.getBinSize();
384 if(FieldBits::NoField
!= (RotationScaleFieldMask
& whichField
))
386 returnValue
+= _sfRotationScale
.getBinSize();
388 if(FieldBits::NoField
!= (TranslationScaleFieldMask
& whichField
))
390 returnValue
+= _sfTranslationScale
.getBinSize();
396 void TransformationInterfaceSensorBase::copyToBin(BinaryDataHandler
&pMem
,
397 ConstFieldMaskArg whichField
)
399 Inherited::copyToBin(pMem
, whichField
);
401 if(FieldBits::NoField
!= (TransformationFieldMask
& whichField
))
403 _sfTransformation
.copyToBin(pMem
);
405 if(FieldBits::NoField
!= (TranslationFieldMask
& whichField
))
407 _sfTranslation
.copyToBin(pMem
);
409 if(FieldBits::NoField
!= (RotationFieldMask
& whichField
))
411 _sfRotation
.copyToBin(pMem
);
413 if(FieldBits::NoField
!= (RotationScaleFieldMask
& whichField
))
415 _sfRotationScale
.copyToBin(pMem
);
417 if(FieldBits::NoField
!= (TranslationScaleFieldMask
& whichField
))
419 _sfTranslationScale
.copyToBin(pMem
);
423 void TransformationInterfaceSensorBase::copyFromBin(BinaryDataHandler
&pMem
,
424 ConstFieldMaskArg whichField
)
426 Inherited::copyFromBin(pMem
, whichField
);
428 if(FieldBits::NoField
!= (TransformationFieldMask
& whichField
))
430 editSField(TransformationFieldMask
);
431 _sfTransformation
.copyFromBin(pMem
);
433 if(FieldBits::NoField
!= (TranslationFieldMask
& whichField
))
435 editSField(TranslationFieldMask
);
436 _sfTranslation
.copyFromBin(pMem
);
438 if(FieldBits::NoField
!= (RotationFieldMask
& whichField
))
440 editSField(RotationFieldMask
);
441 _sfRotation
.copyFromBin(pMem
);
443 if(FieldBits::NoField
!= (RotationScaleFieldMask
& whichField
))
445 editSField(RotationScaleFieldMask
);
446 _sfRotationScale
.copyFromBin(pMem
);
448 if(FieldBits::NoField
!= (TranslationScaleFieldMask
& whichField
))
450 editSField(TranslationScaleFieldMask
);
451 _sfTranslationScale
.copyFromBin(pMem
);
455 //! create a new instance of the class
456 TransformationInterfaceSensorTransitPtr
TransformationInterfaceSensorBase::createLocal(BitVector bFlags
)
458 TransformationInterfaceSensorTransitPtr fc
;
460 if(getClassType().getPrototype() != NULL
)
462 FieldContainerTransitPtr tmpPtr
=
463 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
465 fc
= dynamic_pointer_cast
<TransformationInterfaceSensor
>(tmpPtr
);
471 //! create a new instance of the class, copy the container flags
472 TransformationInterfaceSensorTransitPtr
TransformationInterfaceSensorBase::createDependent(BitVector bFlags
)
474 TransformationInterfaceSensorTransitPtr fc
;
476 if(getClassType().getPrototype() != NULL
)
478 FieldContainerTransitPtr tmpPtr
=
479 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
481 fc
= dynamic_pointer_cast
<TransformationInterfaceSensor
>(tmpPtr
);
487 //! create a new instance of the class
488 TransformationInterfaceSensorTransitPtr
TransformationInterfaceSensorBase::create(void)
490 TransformationInterfaceSensorTransitPtr fc
;
492 if(getClassType().getPrototype() != NULL
)
494 FieldContainerTransitPtr tmpPtr
=
495 getClassType().getPrototype()-> shallowCopy();
497 fc
= dynamic_pointer_cast
<TransformationInterfaceSensor
>(tmpPtr
);
503 TransformationInterfaceSensor
*TransformationInterfaceSensorBase::createEmptyLocal(BitVector bFlags
)
505 TransformationInterfaceSensor
*returnValue
;
507 newPtr
<TransformationInterfaceSensor
>(returnValue
, bFlags
);
509 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
514 //! create an empty new instance of the class, do not copy the prototype
515 TransformationInterfaceSensor
*TransformationInterfaceSensorBase::createEmpty(void)
517 TransformationInterfaceSensor
*returnValue
;
519 newPtr
<TransformationInterfaceSensor
>(returnValue
, Thread::getCurrentLocalFlags());
521 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
522 ~Thread::getCurrentLocalFlags();
528 FieldContainerTransitPtr
TransformationInterfaceSensorBase::shallowCopyLocal(
529 BitVector bFlags
) const
531 TransformationInterfaceSensor
*tmpPtr
;
533 newPtr(tmpPtr
, dynamic_cast<const TransformationInterfaceSensor
*>(this), bFlags
);
535 FieldContainerTransitPtr
returnValue(tmpPtr
);
537 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
542 FieldContainerTransitPtr
TransformationInterfaceSensorBase::shallowCopyDependent(
543 BitVector bFlags
) const
545 TransformationInterfaceSensor
*tmpPtr
;
547 newPtr(tmpPtr
, dynamic_cast<const TransformationInterfaceSensor
*>(this), ~bFlags
);
549 FieldContainerTransitPtr
returnValue(tmpPtr
);
551 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
556 FieldContainerTransitPtr
TransformationInterfaceSensorBase::shallowCopy(void) const
558 TransformationInterfaceSensor
*tmpPtr
;
561 dynamic_cast<const TransformationInterfaceSensor
*>(this),
562 Thread::getCurrentLocalFlags());
564 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
566 FieldContainerTransitPtr
returnValue(tmpPtr
);
574 /*------------------------- constructors ----------------------------------*/
576 TransformationInterfaceSensorBase::TransformationInterfaceSensorBase(void) :
578 _sfTransformation (),
581 _sfRotationScale (Real32(1.f
)),
582 _sfTranslationScale (Real32(1.f
))
586 TransformationInterfaceSensorBase::TransformationInterfaceSensorBase(const TransformationInterfaceSensorBase
&source
) :
588 _sfTransformation (source
._sfTransformation
),
589 _sfTranslation (source
._sfTranslation
),
590 _sfRotation (source
._sfRotation
),
591 _sfRotationScale (source
._sfRotationScale
),
592 _sfTranslationScale (source
._sfTranslationScale
)
597 /*-------------------------- destructors ----------------------------------*/
599 TransformationInterfaceSensorBase::~TransformationInterfaceSensorBase(void)
604 GetFieldHandlePtr
TransformationInterfaceSensorBase::getHandleTransformation (void) const
606 SFMatrix::GetHandlePtr
returnValue(
607 new SFMatrix::GetHandle(
609 this->getType().getFieldDesc(TransformationFieldId
),
610 const_cast<TransformationInterfaceSensorBase
*>(this)));
615 EditFieldHandlePtr
TransformationInterfaceSensorBase::editHandleTransformation (void)
617 SFMatrix::EditHandlePtr
returnValue(
618 new SFMatrix::EditHandle(
620 this->getType().getFieldDesc(TransformationFieldId
),
624 editSField(TransformationFieldMask
);
629 GetFieldHandlePtr
TransformationInterfaceSensorBase::getHandleTranslation (void) const
631 SFVec3f::GetHandlePtr
returnValue(
632 new SFVec3f::GetHandle(
634 this->getType().getFieldDesc(TranslationFieldId
),
635 const_cast<TransformationInterfaceSensorBase
*>(this)));
640 EditFieldHandlePtr
TransformationInterfaceSensorBase::editHandleTranslation (void)
642 SFVec3f::EditHandlePtr
returnValue(
643 new SFVec3f::EditHandle(
645 this->getType().getFieldDesc(TranslationFieldId
),
649 editSField(TranslationFieldMask
);
654 GetFieldHandlePtr
TransformationInterfaceSensorBase::getHandleRotation (void) const
656 SFQuaternion::GetHandlePtr
returnValue(
657 new SFQuaternion::GetHandle(
659 this->getType().getFieldDesc(RotationFieldId
),
660 const_cast<TransformationInterfaceSensorBase
*>(this)));
665 EditFieldHandlePtr
TransformationInterfaceSensorBase::editHandleRotation (void)
667 SFQuaternion::EditHandlePtr
returnValue(
668 new SFQuaternion::EditHandle(
670 this->getType().getFieldDesc(RotationFieldId
),
674 editSField(RotationFieldMask
);
679 GetFieldHandlePtr
TransformationInterfaceSensorBase::getHandleRotationScale (void) const
681 SFReal32::GetHandlePtr
returnValue(
682 new SFReal32::GetHandle(
684 this->getType().getFieldDesc(RotationScaleFieldId
),
685 const_cast<TransformationInterfaceSensorBase
*>(this)));
690 EditFieldHandlePtr
TransformationInterfaceSensorBase::editHandleRotationScale (void)
692 SFReal32::EditHandlePtr
returnValue(
693 new SFReal32::EditHandle(
695 this->getType().getFieldDesc(RotationScaleFieldId
),
699 editSField(RotationScaleFieldMask
);
704 GetFieldHandlePtr
TransformationInterfaceSensorBase::getHandleTranslationScale (void) const
706 SFReal32::GetHandlePtr
returnValue(
707 new SFReal32::GetHandle(
708 &_sfTranslationScale
,
709 this->getType().getFieldDesc(TranslationScaleFieldId
),
710 const_cast<TransformationInterfaceSensorBase
*>(this)));
715 EditFieldHandlePtr
TransformationInterfaceSensorBase::editHandleTranslationScale(void)
717 SFReal32::EditHandlePtr
returnValue(
718 new SFReal32::EditHandle(
719 &_sfTranslationScale
,
720 this->getType().getFieldDesc(TranslationScaleFieldId
),
724 editSField(TranslationScaleFieldMask
);
730 #ifdef OSG_MT_CPTR_ASPECT
731 void TransformationInterfaceSensorBase::execSyncV( FieldContainer
&oFrom
,
732 ConstFieldMaskArg whichField
,
733 AspectOffsetStore
&oOffsets
,
734 ConstFieldMaskArg syncMode
,
735 const UInt32 uiSyncInfo
)
737 TransformationInterfaceSensor
*pThis
= static_cast<TransformationInterfaceSensor
*>(this);
739 pThis
->execSync(static_cast<TransformationInterfaceSensor
*>(&oFrom
),
748 #ifdef OSG_MT_CPTR_ASPECT
749 FieldContainer
*TransformationInterfaceSensorBase::createAspectCopy(
750 const FieldContainer
*pRefAspect
) const
752 TransformationInterfaceSensor
*returnValue
;
754 newAspectCopy(returnValue
,
755 dynamic_cast<const TransformationInterfaceSensor
*>(pRefAspect
),
756 dynamic_cast<const TransformationInterfaceSensor
*>(this));
762 void TransformationInterfaceSensorBase::resolveLinks(void)
764 Inherited::resolveLinks();