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 MoveManipulator!
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 "OSGMoveManipulatorBase.h"
67 #include "OSGMoveManipulator.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::MoveManipulator
78 The MoveHandle is used for moving objects. It consist of three axis which can be picked and translated and one center box to translate freely in 3D.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Pnt3f MoveManipulatorBase::_sfAxisBase
86 Axis being manipulated on, in world space.
89 /*! \var Vec3f MoveManipulatorBase::_sfAxisDirection
90 Axis being manipulated on, in world space.
93 /*! \var Vec3f MoveManipulatorBase::_sfBaseTranslation
94 Translation value at the beginning of manipulation.
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits
<MoveManipulator
*, nsOSG
>::_type(
104 "MoveManipulatorPtr",
106 MoveManipulator::getClassType(),
110 OSG_FIELDTRAITS_GETTYPE_NS(MoveManipulator
*, nsOSG
)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void MoveManipulatorBase::classDescInserter(TypeObject
&oType
)
118 FieldDescriptionBase
*pDesc
= NULL
;
121 pDesc
= new SFPnt3f::Description(
122 SFPnt3f::getClassType(),
124 "Axis being manipulated on, in world space.\n",
125 AxisBaseFieldId
, AxisBaseFieldMask
,
127 (Field::SFDefaultFlags
| Field::FStdAccess
),
128 static_cast<FieldEditMethodSig
>(&MoveManipulator::editHandleAxisBase
),
129 static_cast<FieldGetMethodSig
>(&MoveManipulator::getHandleAxisBase
));
131 oType
.addInitialDesc(pDesc
);
133 pDesc
= new SFVec3f::Description(
134 SFVec3f::getClassType(),
136 "Axis being manipulated on, in world space.\n",
137 AxisDirectionFieldId
, AxisDirectionFieldMask
,
139 (Field::SFDefaultFlags
| Field::FStdAccess
),
140 static_cast<FieldEditMethodSig
>(&MoveManipulator::editHandleAxisDirection
),
141 static_cast<FieldGetMethodSig
>(&MoveManipulator::getHandleAxisDirection
));
143 oType
.addInitialDesc(pDesc
);
145 pDesc
= new SFVec3f::Description(
146 SFVec3f::getClassType(),
148 "Translation value at the beginning of manipulation.\n",
149 BaseTranslationFieldId
, BaseTranslationFieldMask
,
151 (Field::SFDefaultFlags
| Field::FStdAccess
),
152 static_cast<FieldEditMethodSig
>(&MoveManipulator::editHandleBaseTranslation
),
153 static_cast<FieldGetMethodSig
>(&MoveManipulator::getHandleBaseTranslation
));
155 oType
.addInitialDesc(pDesc
);
159 MoveManipulatorBase::TypeObject
MoveManipulatorBase::_type(
160 MoveManipulatorBase::getClassname(),
161 Inherited::getClassname(),
164 reinterpret_cast<PrototypeCreateF
>(&MoveManipulatorBase::createEmptyLocal
),
165 reinterpret_cast<InitContainerF
>(&MoveManipulator::initMethod
),
166 reinterpret_cast<ExitContainerF
>(&MoveManipulator::exitMethod
),
167 reinterpret_cast<InitalInsertDescFunc
>(
168 reinterpret_cast<void *>(&MoveManipulator::classDescInserter
)),
171 "<?xml version=\"1.0\"?>\n"
174 "\tname=\"MoveManipulator\"\n"
175 "\tparent=\"Manipulator\"\n"
176 "\tlibrary=\"ContribGUI\"\n"
177 "\tpointerfieldtypes=\"none\"\n"
178 "\tstructure=\"concrete\"\n"
179 "\tsystemcomponent=\"true\"\n"
180 "\tparentsystemcomponent=\"true\"\n"
181 "\tdecoratable=\"false\"\n"
182 "\tuseLocalIncludes=\"true\"\n"
185 "\t\tname=\"axisBase\"\n"
186 "\t\ttype=\"Pnt3f\"\n"
187 "\t\tcardinality=\"single\"\n"
188 "\t\tvisibility=\"external\"\n"
189 "\t\taccess=\"protected\"\n"
191 "\tAxis being manipulated on, in world space.\n"
194 "\t\tname=\"axisDirection\"\n"
195 "\t\ttype=\"Vec3f\"\n"
196 "\t\tcardinality=\"single\"\n"
197 "\t\tvisibility=\"external\"\n"
198 "\t\taccess=\"protected\"\n"
200 "\tAxis being manipulated on, in world space.\n"
203 "\t\tname=\"baseTranslation\"\n"
204 "\t\ttype=\"Vec3f\"\n"
205 "\t\tcardinality=\"single\"\n"
206 "\t\tvisibility=\"external\"\n"
207 "\t\taccess=\"protected\"\n"
209 "\tTranslation value at the beginning of manipulation.\n"
211 "The MoveHandle is used for moving objects. It consist of three axis which can be picked and translated and one center box to translate freely in 3D.\n"
212 "</FieldContainer>\n",
213 "The MoveHandle is used for moving objects. It consist of three axis which can be picked and translated and one center box to translate freely in 3D.\n"
216 /*------------------------------ get -----------------------------------*/
218 FieldContainerType
&MoveManipulatorBase::getType(void)
223 const FieldContainerType
&MoveManipulatorBase::getType(void) const
228 UInt32
MoveManipulatorBase::getContainerSize(void) const
230 return sizeof(MoveManipulator
);
233 /*------------------------- decorator get ------------------------------*/
236 SFPnt3f
*MoveManipulatorBase::editSFAxisBase(void)
238 editSField(AxisBaseFieldMask
);
243 const SFPnt3f
*MoveManipulatorBase::getSFAxisBase(void) const
249 SFVec3f
*MoveManipulatorBase::editSFAxisDirection(void)
251 editSField(AxisDirectionFieldMask
);
253 return &_sfAxisDirection
;
256 const SFVec3f
*MoveManipulatorBase::getSFAxisDirection(void) const
258 return &_sfAxisDirection
;
262 SFVec3f
*MoveManipulatorBase::editSFBaseTranslation(void)
264 editSField(BaseTranslationFieldMask
);
266 return &_sfBaseTranslation
;
269 const SFVec3f
*MoveManipulatorBase::getSFBaseTranslation(void) const
271 return &_sfBaseTranslation
;
279 /*------------------------------ access -----------------------------------*/
281 SizeT
MoveManipulatorBase::getBinSize(ConstFieldMaskArg whichField
)
283 SizeT returnValue
= Inherited::getBinSize(whichField
);
285 if(FieldBits::NoField
!= (AxisBaseFieldMask
& whichField
))
287 returnValue
+= _sfAxisBase
.getBinSize();
289 if(FieldBits::NoField
!= (AxisDirectionFieldMask
& whichField
))
291 returnValue
+= _sfAxisDirection
.getBinSize();
293 if(FieldBits::NoField
!= (BaseTranslationFieldMask
& whichField
))
295 returnValue
+= _sfBaseTranslation
.getBinSize();
301 void MoveManipulatorBase::copyToBin(BinaryDataHandler
&pMem
,
302 ConstFieldMaskArg whichField
)
304 Inherited::copyToBin(pMem
, whichField
);
306 if(FieldBits::NoField
!= (AxisBaseFieldMask
& whichField
))
308 _sfAxisBase
.copyToBin(pMem
);
310 if(FieldBits::NoField
!= (AxisDirectionFieldMask
& whichField
))
312 _sfAxisDirection
.copyToBin(pMem
);
314 if(FieldBits::NoField
!= (BaseTranslationFieldMask
& whichField
))
316 _sfBaseTranslation
.copyToBin(pMem
);
320 void MoveManipulatorBase::copyFromBin(BinaryDataHandler
&pMem
,
321 ConstFieldMaskArg whichField
)
323 Inherited::copyFromBin(pMem
, whichField
);
325 if(FieldBits::NoField
!= (AxisBaseFieldMask
& whichField
))
327 editSField(AxisBaseFieldMask
);
328 _sfAxisBase
.copyFromBin(pMem
);
330 if(FieldBits::NoField
!= (AxisDirectionFieldMask
& whichField
))
332 editSField(AxisDirectionFieldMask
);
333 _sfAxisDirection
.copyFromBin(pMem
);
335 if(FieldBits::NoField
!= (BaseTranslationFieldMask
& whichField
))
337 editSField(BaseTranslationFieldMask
);
338 _sfBaseTranslation
.copyFromBin(pMem
);
342 //! create a new instance of the class
343 MoveManipulatorTransitPtr
MoveManipulatorBase::createLocal(BitVector bFlags
)
345 MoveManipulatorTransitPtr fc
;
347 if(getClassType().getPrototype() != NULL
)
349 FieldContainerTransitPtr tmpPtr
=
350 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
352 fc
= dynamic_pointer_cast
<MoveManipulator
>(tmpPtr
);
358 //! create a new instance of the class, copy the container flags
359 MoveManipulatorTransitPtr
MoveManipulatorBase::createDependent(BitVector bFlags
)
361 MoveManipulatorTransitPtr fc
;
363 if(getClassType().getPrototype() != NULL
)
365 FieldContainerTransitPtr tmpPtr
=
366 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
368 fc
= dynamic_pointer_cast
<MoveManipulator
>(tmpPtr
);
374 //! create a new instance of the class
375 MoveManipulatorTransitPtr
MoveManipulatorBase::create(void)
377 MoveManipulatorTransitPtr fc
;
379 if(getClassType().getPrototype() != NULL
)
381 FieldContainerTransitPtr tmpPtr
=
382 getClassType().getPrototype()-> shallowCopy();
384 fc
= dynamic_pointer_cast
<MoveManipulator
>(tmpPtr
);
390 MoveManipulator
*MoveManipulatorBase::createEmptyLocal(BitVector bFlags
)
392 MoveManipulator
*returnValue
;
394 newPtr
<MoveManipulator
>(returnValue
, bFlags
);
396 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
401 //! create an empty new instance of the class, do not copy the prototype
402 MoveManipulator
*MoveManipulatorBase::createEmpty(void)
404 MoveManipulator
*returnValue
;
406 newPtr
<MoveManipulator
>(returnValue
, Thread::getCurrentLocalFlags());
408 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
409 ~Thread::getCurrentLocalFlags();
415 FieldContainerTransitPtr
MoveManipulatorBase::shallowCopyLocal(
416 BitVector bFlags
) const
418 MoveManipulator
*tmpPtr
;
420 newPtr(tmpPtr
, dynamic_cast<const MoveManipulator
*>(this), bFlags
);
422 FieldContainerTransitPtr
returnValue(tmpPtr
);
424 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
429 FieldContainerTransitPtr
MoveManipulatorBase::shallowCopyDependent(
430 BitVector bFlags
) const
432 MoveManipulator
*tmpPtr
;
434 newPtr(tmpPtr
, dynamic_cast<const MoveManipulator
*>(this), ~bFlags
);
436 FieldContainerTransitPtr
returnValue(tmpPtr
);
438 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
443 FieldContainerTransitPtr
MoveManipulatorBase::shallowCopy(void) const
445 MoveManipulator
*tmpPtr
;
448 dynamic_cast<const MoveManipulator
*>(this),
449 Thread::getCurrentLocalFlags());
451 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
453 FieldContainerTransitPtr
returnValue(tmpPtr
);
461 /*------------------------- constructors ----------------------------------*/
463 MoveManipulatorBase::MoveManipulatorBase(void) :
467 _sfBaseTranslation ()
471 MoveManipulatorBase::MoveManipulatorBase(const MoveManipulatorBase
&source
) :
473 _sfAxisBase (source
._sfAxisBase
),
474 _sfAxisDirection (source
._sfAxisDirection
),
475 _sfBaseTranslation (source
._sfBaseTranslation
)
480 /*-------------------------- destructors ----------------------------------*/
482 MoveManipulatorBase::~MoveManipulatorBase(void)
487 GetFieldHandlePtr
MoveManipulatorBase::getHandleAxisBase (void) const
489 SFPnt3f::GetHandlePtr
returnValue(
490 new SFPnt3f::GetHandle(
492 this->getType().getFieldDesc(AxisBaseFieldId
),
493 const_cast<MoveManipulatorBase
*>(this)));
498 EditFieldHandlePtr
MoveManipulatorBase::editHandleAxisBase (void)
500 SFPnt3f::EditHandlePtr
returnValue(
501 new SFPnt3f::EditHandle(
503 this->getType().getFieldDesc(AxisBaseFieldId
),
507 editSField(AxisBaseFieldMask
);
512 GetFieldHandlePtr
MoveManipulatorBase::getHandleAxisDirection (void) const
514 SFVec3f::GetHandlePtr
returnValue(
515 new SFVec3f::GetHandle(
517 this->getType().getFieldDesc(AxisDirectionFieldId
),
518 const_cast<MoveManipulatorBase
*>(this)));
523 EditFieldHandlePtr
MoveManipulatorBase::editHandleAxisDirection (void)
525 SFVec3f::EditHandlePtr
returnValue(
526 new SFVec3f::EditHandle(
528 this->getType().getFieldDesc(AxisDirectionFieldId
),
532 editSField(AxisDirectionFieldMask
);
537 GetFieldHandlePtr
MoveManipulatorBase::getHandleBaseTranslation (void) const
539 SFVec3f::GetHandlePtr
returnValue(
540 new SFVec3f::GetHandle(
542 this->getType().getFieldDesc(BaseTranslationFieldId
),
543 const_cast<MoveManipulatorBase
*>(this)));
548 EditFieldHandlePtr
MoveManipulatorBase::editHandleBaseTranslation(void)
550 SFVec3f::EditHandlePtr
returnValue(
551 new SFVec3f::EditHandle(
553 this->getType().getFieldDesc(BaseTranslationFieldId
),
557 editSField(BaseTranslationFieldMask
);
563 #ifdef OSG_MT_CPTR_ASPECT
564 void MoveManipulatorBase::execSyncV( FieldContainer
&oFrom
,
565 ConstFieldMaskArg whichField
,
566 AspectOffsetStore
&oOffsets
,
567 ConstFieldMaskArg syncMode
,
568 const UInt32 uiSyncInfo
)
570 MoveManipulator
*pThis
= static_cast<MoveManipulator
*>(this);
572 pThis
->execSync(static_cast<MoveManipulator
*>(&oFrom
),
581 #ifdef OSG_MT_CPTR_ASPECT
582 FieldContainer
*MoveManipulatorBase::createAspectCopy(
583 const FieldContainer
*pRefAspect
) const
585 MoveManipulator
*returnValue
;
587 newAspectCopy(returnValue
,
588 dynamic_cast<const MoveManipulator
*>(pRefAspect
),
589 dynamic_cast<const MoveManipulator
*>(this));
595 void MoveManipulatorBase::resolveLinks(void)
597 Inherited::resolveLinks();