changed: gcc8 base update
[opensg.git] / Source / Contrib / Manipulators / OSGMoveManipulatorBase.cpp
blob21b6bbfd3a8593f618e28869d2a75c3eb34c2cd0
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class MoveManipulator!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGMoveManipulatorBase.h"
67 #include "OSGMoveManipulator.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
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",
105 "ManipulatorPtr",
106 MoveManipulator::getClassType(),
107 nsOSG);
108 #endif
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(),
123 "axisBase",
124 "Axis being manipulated on, in world space.\n",
125 AxisBaseFieldId, AxisBaseFieldMask,
126 false,
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(),
135 "axisDirection",
136 "Axis being manipulated on, in world space.\n",
137 AxisDirectionFieldId, AxisDirectionFieldMask,
138 false,
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(),
147 "baseTranslation",
148 "Translation value at the beginning of manipulation.\n",
149 BaseTranslationFieldId, BaseTranslationFieldMask,
150 false,
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(),
162 "NULL",
163 nsOSG, //Namespace
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)),
169 false,
171 "<?xml version=\"1.0\"?>\n"
172 "\n"
173 "<FieldContainer\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"
183 ">\n"
184 "\t<Field\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"
190 "\t>\n"
191 "\tAxis being manipulated on, in world space.\n"
192 "\t</Field>\n"
193 "\t<Field\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"
199 "\t>\n"
200 "\tAxis being manipulated on, in world space.\n"
201 "\t</Field>\n"
202 "\t<Field\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"
208 "\t>\n"
209 "\tTranslation value at the beginning of manipulation.\n"
210 "\t</Field>\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)
220 return _type;
223 const FieldContainerType &MoveManipulatorBase::getType(void) const
225 return _type;
228 UInt32 MoveManipulatorBase::getContainerSize(void) const
230 return sizeof(MoveManipulator);
233 /*------------------------- decorator get ------------------------------*/
236 SFPnt3f *MoveManipulatorBase::editSFAxisBase(void)
238 editSField(AxisBaseFieldMask);
240 return &_sfAxisBase;
243 const SFPnt3f *MoveManipulatorBase::getSFAxisBase(void) const
245 return &_sfAxisBase;
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();
298 return returnValue;
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);
355 return fc;
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);
371 return fc;
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);
387 return fc;
390 MoveManipulator *MoveManipulatorBase::createEmptyLocal(BitVector bFlags)
392 MoveManipulator *returnValue;
394 newPtr<MoveManipulator>(returnValue, bFlags);
396 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
398 return returnValue;
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();
411 return returnValue;
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;
426 return returnValue;
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;
440 return returnValue;
443 FieldContainerTransitPtr MoveManipulatorBase::shallowCopy(void) const
445 MoveManipulator *tmpPtr;
447 newPtr(tmpPtr,
448 dynamic_cast<const MoveManipulator *>(this),
449 Thread::getCurrentLocalFlags());
451 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
453 FieldContainerTransitPtr returnValue(tmpPtr);
455 return returnValue;
461 /*------------------------- constructors ----------------------------------*/
463 MoveManipulatorBase::MoveManipulatorBase(void) :
464 Inherited(),
465 _sfAxisBase (),
466 _sfAxisDirection (),
467 _sfBaseTranslation ()
471 MoveManipulatorBase::MoveManipulatorBase(const MoveManipulatorBase &source) :
472 Inherited(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(
491 &_sfAxisBase,
492 this->getType().getFieldDesc(AxisBaseFieldId),
493 const_cast<MoveManipulatorBase *>(this)));
495 return returnValue;
498 EditFieldHandlePtr MoveManipulatorBase::editHandleAxisBase (void)
500 SFPnt3f::EditHandlePtr returnValue(
501 new SFPnt3f::EditHandle(
502 &_sfAxisBase,
503 this->getType().getFieldDesc(AxisBaseFieldId),
504 this));
507 editSField(AxisBaseFieldMask);
509 return returnValue;
512 GetFieldHandlePtr MoveManipulatorBase::getHandleAxisDirection (void) const
514 SFVec3f::GetHandlePtr returnValue(
515 new SFVec3f::GetHandle(
516 &_sfAxisDirection,
517 this->getType().getFieldDesc(AxisDirectionFieldId),
518 const_cast<MoveManipulatorBase *>(this)));
520 return returnValue;
523 EditFieldHandlePtr MoveManipulatorBase::editHandleAxisDirection (void)
525 SFVec3f::EditHandlePtr returnValue(
526 new SFVec3f::EditHandle(
527 &_sfAxisDirection,
528 this->getType().getFieldDesc(AxisDirectionFieldId),
529 this));
532 editSField(AxisDirectionFieldMask);
534 return returnValue;
537 GetFieldHandlePtr MoveManipulatorBase::getHandleBaseTranslation (void) const
539 SFVec3f::GetHandlePtr returnValue(
540 new SFVec3f::GetHandle(
541 &_sfBaseTranslation,
542 this->getType().getFieldDesc(BaseTranslationFieldId),
543 const_cast<MoveManipulatorBase *>(this)));
545 return returnValue;
548 EditFieldHandlePtr MoveManipulatorBase::editHandleBaseTranslation(void)
550 SFVec3f::EditHandlePtr returnValue(
551 new SFVec3f::EditHandle(
552 &_sfBaseTranslation,
553 this->getType().getFieldDesc(BaseTranslationFieldId),
554 this));
557 editSField(BaseTranslationFieldMask);
559 return returnValue;
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),
573 whichField,
574 oOffsets,
575 syncMode,
576 uiSyncInfo);
578 #endif
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));
591 return returnValue;
593 #endif
595 void MoveManipulatorBase::resolveLinks(void)
597 Inherited::resolveLinks();
603 OSG_END_NAMESPACE