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 PlaneMoveManipulator!
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 "OSGPlaneMoveManipulatorBase.h"
67 #include "OSGPlaneMoveManipulator.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::PlaneMoveManipulator
78 The PlaneMoveHandle is used for moving objects in a plane and rotating them around one axis.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt16 PlaneMoveManipulatorBase::_sfAxis
86 Rotation axis to rotate around (0:X, 1:Y, 2:Z). Translation plane is defined by the other two axes. *** Not implemented yet ***
89 /*! \var Vec3f PlaneMoveManipulatorBase::_sfBaseTranslation
90 Translation value at the beginning of manipulation.
93 /*! \var Quaternion PlaneMoveManipulatorBase::_sfBaseRotation
94 Rotation value at the beginning of manipulation.
97 /*! \var Pnt3f PlaneMoveManipulatorBase::_sfClickPoint
98 Point clicked on to start manipulation.
102 /***************************************************************************\
103 * FieldType/FieldTrait Instantiation *
104 \***************************************************************************/
106 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
107 PointerType FieldTraits
<PlaneMoveManipulator
*, nsOSG
>::_type(
108 "PlaneMoveManipulatorPtr",
110 PlaneMoveManipulator::getClassType(),
114 OSG_FIELDTRAITS_GETTYPE_NS(PlaneMoveManipulator
*, nsOSG
)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void PlaneMoveManipulatorBase::classDescInserter(TypeObject
&oType
)
122 FieldDescriptionBase
*pDesc
= NULL
;
125 pDesc
= new SFUInt16::Description(
126 SFUInt16::getClassType(),
128 "Rotation axis to rotate around (0:X, 1:Y, 2:Z). Translation plane is defined by the other two axes. *** Not implemented yet ***\n",
129 AxisFieldId
, AxisFieldMask
,
131 (Field::SFDefaultFlags
| Field::FStdAccess
),
132 static_cast<FieldEditMethodSig
>(&PlaneMoveManipulator::editHandleAxis
),
133 static_cast<FieldGetMethodSig
>(&PlaneMoveManipulator::getHandleAxis
));
135 oType
.addInitialDesc(pDesc
);
137 pDesc
= new SFVec3f::Description(
138 SFVec3f::getClassType(),
140 "Translation value at the beginning of manipulation.\n",
141 BaseTranslationFieldId
, BaseTranslationFieldMask
,
143 (Field::SFDefaultFlags
| Field::FStdAccess
),
144 static_cast<FieldEditMethodSig
>(&PlaneMoveManipulator::editHandleBaseTranslation
),
145 static_cast<FieldGetMethodSig
>(&PlaneMoveManipulator::getHandleBaseTranslation
));
147 oType
.addInitialDesc(pDesc
);
149 pDesc
= new SFQuaternion::Description(
150 SFQuaternion::getClassType(),
152 "Rotation value at the beginning of manipulation.\n",
153 BaseRotationFieldId
, BaseRotationFieldMask
,
155 (Field::SFDefaultFlags
| Field::FStdAccess
),
156 static_cast<FieldEditMethodSig
>(&PlaneMoveManipulator::editHandleBaseRotation
),
157 static_cast<FieldGetMethodSig
>(&PlaneMoveManipulator::getHandleBaseRotation
));
159 oType
.addInitialDesc(pDesc
);
161 pDesc
= new SFPnt3f::Description(
162 SFPnt3f::getClassType(),
164 "Point clicked on to start manipulation.\n",
165 ClickPointFieldId
, ClickPointFieldMask
,
167 (Field::SFDefaultFlags
| Field::FStdAccess
),
168 static_cast<FieldEditMethodSig
>(&PlaneMoveManipulator::editHandleClickPoint
),
169 static_cast<FieldGetMethodSig
>(&PlaneMoveManipulator::getHandleClickPoint
));
171 oType
.addInitialDesc(pDesc
);
175 PlaneMoveManipulatorBase::TypeObject
PlaneMoveManipulatorBase::_type(
176 PlaneMoveManipulatorBase::getClassname(),
177 Inherited::getClassname(),
180 reinterpret_cast<PrototypeCreateF
>(&PlaneMoveManipulatorBase::createEmptyLocal
),
181 reinterpret_cast<InitContainerF
>(&PlaneMoveManipulator::initMethod
),
182 reinterpret_cast<ExitContainerF
>(&PlaneMoveManipulator::exitMethod
),
183 reinterpret_cast<InitalInsertDescFunc
>(
184 reinterpret_cast<void *>(&PlaneMoveManipulator::classDescInserter
)),
187 "<?xml version=\"1.0\"?>\n"
190 "\tname=\"PlaneMoveManipulator\"\n"
191 "\tparent=\"Manipulator\"\n"
192 "\tlibrary=\"ContribGUI\"\n"
193 "\tpointerfieldtypes=\"none\"\n"
194 "\tstructure=\"concrete\"\n"
195 "\tsystemcomponent=\"true\"\n"
196 "\tparentsystemcomponent=\"true\"\n"
197 "\tdecoratable=\"false\"\n"
198 "\tuseLocalIncludes=\"true\"\n"
201 "\t\tname=\"axis\"\n"
202 "\t\ttype=\"UInt16\"\n"
203 "\t\tcardinality=\"single\"\n"
204 "\t\tvisibility=\"external\"\n"
205 "\t\taccess=\"protected\"\n"
206 " defaultValue=\"1\"\n"
208 "\tRotation axis to rotate around (0:X, 1:Y, 2:Z). Translation plane is defined by the other two axes. *** Not implemented yet ***\n"
211 "\t\tname=\"baseTranslation\"\n"
212 "\t\ttype=\"Vec3f\"\n"
213 "\t\tcardinality=\"single\"\n"
214 "\t\tvisibility=\"external\"\n"
215 "\t\taccess=\"protected\"\n"
217 "\tTranslation value at the beginning of manipulation.\n"
220 "\t\tname=\"baseRotation\"\n"
221 "\t\ttype=\"Quaternion\"\n"
222 "\t\tcardinality=\"single\"\n"
223 "\t\tvisibility=\"external\"\n"
224 "\t\taccess=\"protected\"\n"
226 "\tRotation value at the beginning of manipulation.\n"
229 "\t\tname=\"clickPoint\"\n"
230 "\t\ttype=\"Pnt3f\"\n"
231 "\t\tcardinality=\"single\"\n"
232 "\t\tvisibility=\"external\"\n"
233 "\t\taccess=\"protected\"\n"
235 "\tPoint clicked on to start manipulation.\n"
237 "The PlaneMoveHandle is used for moving objects in a plane and rotating them around one axis.\n"
238 "</FieldContainer>\n",
239 "The PlaneMoveHandle is used for moving objects in a plane and rotating them around one axis.\n"
242 /*------------------------------ get -----------------------------------*/
244 FieldContainerType
&PlaneMoveManipulatorBase::getType(void)
249 const FieldContainerType
&PlaneMoveManipulatorBase::getType(void) const
254 UInt32
PlaneMoveManipulatorBase::getContainerSize(void) const
256 return sizeof(PlaneMoveManipulator
);
259 /*------------------------- decorator get ------------------------------*/
262 SFUInt16
*PlaneMoveManipulatorBase::editSFAxis(void)
264 editSField(AxisFieldMask
);
269 const SFUInt16
*PlaneMoveManipulatorBase::getSFAxis(void) const
275 SFVec3f
*PlaneMoveManipulatorBase::editSFBaseTranslation(void)
277 editSField(BaseTranslationFieldMask
);
279 return &_sfBaseTranslation
;
282 const SFVec3f
*PlaneMoveManipulatorBase::getSFBaseTranslation(void) const
284 return &_sfBaseTranslation
;
288 SFQuaternion
*PlaneMoveManipulatorBase::editSFBaseRotation(void)
290 editSField(BaseRotationFieldMask
);
292 return &_sfBaseRotation
;
295 const SFQuaternion
*PlaneMoveManipulatorBase::getSFBaseRotation(void) const
297 return &_sfBaseRotation
;
301 SFPnt3f
*PlaneMoveManipulatorBase::editSFClickPoint(void)
303 editSField(ClickPointFieldMask
);
305 return &_sfClickPoint
;
308 const SFPnt3f
*PlaneMoveManipulatorBase::getSFClickPoint(void) const
310 return &_sfClickPoint
;
318 /*------------------------------ access -----------------------------------*/
320 SizeT
PlaneMoveManipulatorBase::getBinSize(ConstFieldMaskArg whichField
)
322 SizeT returnValue
= Inherited::getBinSize(whichField
);
324 if(FieldBits::NoField
!= (AxisFieldMask
& whichField
))
326 returnValue
+= _sfAxis
.getBinSize();
328 if(FieldBits::NoField
!= (BaseTranslationFieldMask
& whichField
))
330 returnValue
+= _sfBaseTranslation
.getBinSize();
332 if(FieldBits::NoField
!= (BaseRotationFieldMask
& whichField
))
334 returnValue
+= _sfBaseRotation
.getBinSize();
336 if(FieldBits::NoField
!= (ClickPointFieldMask
& whichField
))
338 returnValue
+= _sfClickPoint
.getBinSize();
344 void PlaneMoveManipulatorBase::copyToBin(BinaryDataHandler
&pMem
,
345 ConstFieldMaskArg whichField
)
347 Inherited::copyToBin(pMem
, whichField
);
349 if(FieldBits::NoField
!= (AxisFieldMask
& whichField
))
351 _sfAxis
.copyToBin(pMem
);
353 if(FieldBits::NoField
!= (BaseTranslationFieldMask
& whichField
))
355 _sfBaseTranslation
.copyToBin(pMem
);
357 if(FieldBits::NoField
!= (BaseRotationFieldMask
& whichField
))
359 _sfBaseRotation
.copyToBin(pMem
);
361 if(FieldBits::NoField
!= (ClickPointFieldMask
& whichField
))
363 _sfClickPoint
.copyToBin(pMem
);
367 void PlaneMoveManipulatorBase::copyFromBin(BinaryDataHandler
&pMem
,
368 ConstFieldMaskArg whichField
)
370 Inherited::copyFromBin(pMem
, whichField
);
372 if(FieldBits::NoField
!= (AxisFieldMask
& whichField
))
374 editSField(AxisFieldMask
);
375 _sfAxis
.copyFromBin(pMem
);
377 if(FieldBits::NoField
!= (BaseTranslationFieldMask
& whichField
))
379 editSField(BaseTranslationFieldMask
);
380 _sfBaseTranslation
.copyFromBin(pMem
);
382 if(FieldBits::NoField
!= (BaseRotationFieldMask
& whichField
))
384 editSField(BaseRotationFieldMask
);
385 _sfBaseRotation
.copyFromBin(pMem
);
387 if(FieldBits::NoField
!= (ClickPointFieldMask
& whichField
))
389 editSField(ClickPointFieldMask
);
390 _sfClickPoint
.copyFromBin(pMem
);
394 //! create a new instance of the class
395 PlaneMoveManipulatorTransitPtr
PlaneMoveManipulatorBase::createLocal(BitVector bFlags
)
397 PlaneMoveManipulatorTransitPtr fc
;
399 if(getClassType().getPrototype() != NULL
)
401 FieldContainerTransitPtr tmpPtr
=
402 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
404 fc
= dynamic_pointer_cast
<PlaneMoveManipulator
>(tmpPtr
);
410 //! create a new instance of the class, copy the container flags
411 PlaneMoveManipulatorTransitPtr
PlaneMoveManipulatorBase::createDependent(BitVector bFlags
)
413 PlaneMoveManipulatorTransitPtr fc
;
415 if(getClassType().getPrototype() != NULL
)
417 FieldContainerTransitPtr tmpPtr
=
418 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
420 fc
= dynamic_pointer_cast
<PlaneMoveManipulator
>(tmpPtr
);
426 //! create a new instance of the class
427 PlaneMoveManipulatorTransitPtr
PlaneMoveManipulatorBase::create(void)
429 PlaneMoveManipulatorTransitPtr fc
;
431 if(getClassType().getPrototype() != NULL
)
433 FieldContainerTransitPtr tmpPtr
=
434 getClassType().getPrototype()-> shallowCopy();
436 fc
= dynamic_pointer_cast
<PlaneMoveManipulator
>(tmpPtr
);
442 PlaneMoveManipulator
*PlaneMoveManipulatorBase::createEmptyLocal(BitVector bFlags
)
444 PlaneMoveManipulator
*returnValue
;
446 newPtr
<PlaneMoveManipulator
>(returnValue
, bFlags
);
448 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
453 //! create an empty new instance of the class, do not copy the prototype
454 PlaneMoveManipulator
*PlaneMoveManipulatorBase::createEmpty(void)
456 PlaneMoveManipulator
*returnValue
;
458 newPtr
<PlaneMoveManipulator
>(returnValue
, Thread::getCurrentLocalFlags());
460 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
461 ~Thread::getCurrentLocalFlags();
467 FieldContainerTransitPtr
PlaneMoveManipulatorBase::shallowCopyLocal(
468 BitVector bFlags
) const
470 PlaneMoveManipulator
*tmpPtr
;
472 newPtr(tmpPtr
, dynamic_cast<const PlaneMoveManipulator
*>(this), bFlags
);
474 FieldContainerTransitPtr
returnValue(tmpPtr
);
476 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
481 FieldContainerTransitPtr
PlaneMoveManipulatorBase::shallowCopyDependent(
482 BitVector bFlags
) const
484 PlaneMoveManipulator
*tmpPtr
;
486 newPtr(tmpPtr
, dynamic_cast<const PlaneMoveManipulator
*>(this), ~bFlags
);
488 FieldContainerTransitPtr
returnValue(tmpPtr
);
490 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
495 FieldContainerTransitPtr
PlaneMoveManipulatorBase::shallowCopy(void) const
497 PlaneMoveManipulator
*tmpPtr
;
500 dynamic_cast<const PlaneMoveManipulator
*>(this),
501 Thread::getCurrentLocalFlags());
503 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
505 FieldContainerTransitPtr
returnValue(tmpPtr
);
513 /*------------------------- constructors ----------------------------------*/
515 PlaneMoveManipulatorBase::PlaneMoveManipulatorBase(void) :
518 _sfBaseTranslation (),
524 PlaneMoveManipulatorBase::PlaneMoveManipulatorBase(const PlaneMoveManipulatorBase
&source
) :
526 _sfAxis (source
._sfAxis
),
527 _sfBaseTranslation (source
._sfBaseTranslation
),
528 _sfBaseRotation (source
._sfBaseRotation
),
529 _sfClickPoint (source
._sfClickPoint
)
534 /*-------------------------- destructors ----------------------------------*/
536 PlaneMoveManipulatorBase::~PlaneMoveManipulatorBase(void)
541 GetFieldHandlePtr
PlaneMoveManipulatorBase::getHandleAxis (void) const
543 SFUInt16::GetHandlePtr
returnValue(
544 new SFUInt16::GetHandle(
546 this->getType().getFieldDesc(AxisFieldId
),
547 const_cast<PlaneMoveManipulatorBase
*>(this)));
552 EditFieldHandlePtr
PlaneMoveManipulatorBase::editHandleAxis (void)
554 SFUInt16::EditHandlePtr
returnValue(
555 new SFUInt16::EditHandle(
557 this->getType().getFieldDesc(AxisFieldId
),
561 editSField(AxisFieldMask
);
566 GetFieldHandlePtr
PlaneMoveManipulatorBase::getHandleBaseTranslation (void) const
568 SFVec3f::GetHandlePtr
returnValue(
569 new SFVec3f::GetHandle(
571 this->getType().getFieldDesc(BaseTranslationFieldId
),
572 const_cast<PlaneMoveManipulatorBase
*>(this)));
577 EditFieldHandlePtr
PlaneMoveManipulatorBase::editHandleBaseTranslation(void)
579 SFVec3f::EditHandlePtr
returnValue(
580 new SFVec3f::EditHandle(
582 this->getType().getFieldDesc(BaseTranslationFieldId
),
586 editSField(BaseTranslationFieldMask
);
591 GetFieldHandlePtr
PlaneMoveManipulatorBase::getHandleBaseRotation (void) const
593 SFQuaternion::GetHandlePtr
returnValue(
594 new SFQuaternion::GetHandle(
596 this->getType().getFieldDesc(BaseRotationFieldId
),
597 const_cast<PlaneMoveManipulatorBase
*>(this)));
602 EditFieldHandlePtr
PlaneMoveManipulatorBase::editHandleBaseRotation (void)
604 SFQuaternion::EditHandlePtr
returnValue(
605 new SFQuaternion::EditHandle(
607 this->getType().getFieldDesc(BaseRotationFieldId
),
611 editSField(BaseRotationFieldMask
);
616 GetFieldHandlePtr
PlaneMoveManipulatorBase::getHandleClickPoint (void) const
618 SFPnt3f::GetHandlePtr
returnValue(
619 new SFPnt3f::GetHandle(
621 this->getType().getFieldDesc(ClickPointFieldId
),
622 const_cast<PlaneMoveManipulatorBase
*>(this)));
627 EditFieldHandlePtr
PlaneMoveManipulatorBase::editHandleClickPoint (void)
629 SFPnt3f::EditHandlePtr
returnValue(
630 new SFPnt3f::EditHandle(
632 this->getType().getFieldDesc(ClickPointFieldId
),
636 editSField(ClickPointFieldMask
);
642 #ifdef OSG_MT_CPTR_ASPECT
643 void PlaneMoveManipulatorBase::execSyncV( FieldContainer
&oFrom
,
644 ConstFieldMaskArg whichField
,
645 AspectOffsetStore
&oOffsets
,
646 ConstFieldMaskArg syncMode
,
647 const UInt32 uiSyncInfo
)
649 PlaneMoveManipulator
*pThis
= static_cast<PlaneMoveManipulator
*>(this);
651 pThis
->execSync(static_cast<PlaneMoveManipulator
*>(&oFrom
),
660 #ifdef OSG_MT_CPTR_ASPECT
661 FieldContainer
*PlaneMoveManipulatorBase::createAspectCopy(
662 const FieldContainer
*pRefAspect
) const
664 PlaneMoveManipulator
*returnValue
;
666 newAspectCopy(returnValue
,
667 dynamic_cast<const PlaneMoveManipulator
*>(pRefAspect
),
668 dynamic_cast<const PlaneMoveManipulator
*>(this));
674 void PlaneMoveManipulatorBase::resolveLinks(void)
676 Inherited::resolveLinks();