fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / ComplexSceneManager / OSGCSMTrackballBase.cpp
blob8d2f99d098167abc8dd1f935effc60ba5f1a6170
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 CSMTrackball!
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 "OSGCSMTrackballBase.h"
67 #include "OSGCSMTrackball.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::CSMTrackball
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt32 CSMTrackballBase::_sfModifierMask
89 /*! \var UInt32 CSMTrackballBase::_sfProcessing
93 /*! \var Real32 CSMTrackballBase::_sfTranslationScaleFactor
97 /*! \var Matrix CSMTrackballBase::_sfMatrixResult
101 /*! \var Matrix CSMTrackballBase::_sfRotationMatrixResult
105 /*! \var Pnt3f CSMTrackballBase::_sfReferencePosition
109 /*! \var Matrix CSMTrackballBase::_sfReferenceMatrix
113 /*! \var Pnt3f CSMTrackballBase::_sfTransformCenter
117 /*! \var Vec3f CSMTrackballBase::_sfWorldDiag
121 /*! \var MouseData CSMTrackballBase::_sfMouseData
125 /*! \var OSGAny CSMTrackballBase::_sfReset
130 /***************************************************************************\
131 * FieldType/FieldTrait Instantiation *
132 \***************************************************************************/
134 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
135 PointerType FieldTraits<CSMTrackball *, nsOSG>::_type(
136 "CSMTrackballPtr",
137 "AttachmentContainerPtr",
138 CSMTrackball::getClassType(),
139 nsOSG);
140 #endif
142 OSG_FIELDTRAITS_GETTYPE_NS(CSMTrackball *, nsOSG)
144 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
145 CSMTrackball *,
146 nsOSG)
148 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
149 CSMTrackball *,
150 nsOSG)
152 /***************************************************************************\
153 * Field Description *
154 \***************************************************************************/
156 void CSMTrackballBase::classDescInserter(TypeObject &oType)
158 FieldDescriptionBase *pDesc = NULL;
161 pDesc = new SFUInt32::Description(
162 SFUInt32::getClassType(),
163 "modifierMask",
165 ModifierMaskFieldId, ModifierMaskFieldMask,
166 false,
167 (Field::SFDefaultFlags | Field::FStdAccess),
168 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleModifierMask),
169 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleModifierMask));
171 oType.addInitialDesc(pDesc);
173 pDesc = new SFUInt32::Description(
174 SFUInt32::getClassType(),
175 "processing",
177 ProcessingFieldId, ProcessingFieldMask,
178 false,
179 (Field::SFDefaultFlags | Field::FStdAccess),
180 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleProcessing),
181 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleProcessing));
183 oType.addInitialDesc(pDesc);
185 pDesc = new SFReal32::Description(
186 SFReal32::getClassType(),
187 "translationScaleFactor",
189 TranslationScaleFactorFieldId, TranslationScaleFactorFieldMask,
190 false,
191 (Field::SFDefaultFlags | Field::FStdAccess),
192 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleTranslationScaleFactor),
193 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleTranslationScaleFactor));
195 oType.addInitialDesc(pDesc);
197 pDesc = new SFMatrix::Description(
198 SFMatrix::getClassType(),
199 "matrixResult",
201 MatrixResultFieldId, MatrixResultFieldMask,
202 false,
203 (Field::SFDefaultFlags | Field::FStdAccess),
204 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleMatrixResult),
205 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleMatrixResult));
207 oType.addInitialDesc(pDesc);
209 pDesc = new SFMatrix::Description(
210 SFMatrix::getClassType(),
211 "rotationMatrixResult",
213 RotationMatrixResultFieldId, RotationMatrixResultFieldMask,
214 false,
215 (Field::SFDefaultFlags | Field::FStdAccess),
216 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleRotationMatrixResult),
217 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleRotationMatrixResult));
219 oType.addInitialDesc(pDesc);
221 pDesc = new SFPnt3f::Description(
222 SFPnt3f::getClassType(),
223 "referencePosition",
225 ReferencePositionFieldId, ReferencePositionFieldMask,
226 false,
227 (Field::SFDefaultFlags | Field::FStdAccess),
228 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleReferencePosition),
229 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleReferencePosition));
231 oType.addInitialDesc(pDesc);
233 pDesc = new SFMatrix::Description(
234 SFMatrix::getClassType(),
235 "referenceMatrix",
237 ReferenceMatrixFieldId, ReferenceMatrixFieldMask,
238 false,
239 (Field::SFDefaultFlags | Field::FStdAccess),
240 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleReferenceMatrix),
241 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleReferenceMatrix));
243 oType.addInitialDesc(pDesc);
245 pDesc = new SFPnt3f::Description(
246 SFPnt3f::getClassType(),
247 "transformCenter",
249 TransformCenterFieldId, TransformCenterFieldMask,
250 false,
251 (Field::SFDefaultFlags | Field::FStdAccess),
252 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleTransformCenter),
253 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleTransformCenter));
255 oType.addInitialDesc(pDesc);
257 pDesc = new SFVec3f::Description(
258 SFVec3f::getClassType(),
259 "worldDiag",
261 WorldDiagFieldId, WorldDiagFieldMask,
262 false,
263 (Field::SFDefaultFlags | Field::FStdAccess),
264 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleWorldDiag),
265 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleWorldDiag));
267 oType.addInitialDesc(pDesc);
269 pDesc = new SFMouseData::Description(
270 SFMouseData::getClassType(),
271 "mouseData",
273 MouseDataFieldId, MouseDataFieldMask,
274 true,
275 (Field::SFDefaultFlags | Field::FStdAccess),
276 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleMouseData),
277 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleMouseData));
279 oType.addInitialDesc(pDesc);
281 pDesc = new SFOSGAny::Description(
282 SFOSGAny::getClassType(),
283 "reset",
285 ResetFieldId, ResetFieldMask,
286 true,
287 (Field::SFDefaultFlags | Field::FStdAccess),
288 static_cast<FieldEditMethodSig>(&CSMTrackball::editHandleReset),
289 static_cast<FieldGetMethodSig >(&CSMTrackball::getHandleReset));
291 oType.addInitialDesc(pDesc);
295 CSMTrackballBase::TypeObject CSMTrackballBase::_type(
296 CSMTrackballBase::getClassname(),
297 Inherited::getClassname(),
298 "NULL",
299 nsOSG, //Namespace
300 reinterpret_cast<PrototypeCreateF>(&CSMTrackballBase::createEmptyLocal),
301 reinterpret_cast<InitContainerF>(&CSMTrackball::initMethod),
302 reinterpret_cast<ExitContainerF>(&CSMTrackball::exitMethod),
303 reinterpret_cast<InitalInsertDescFunc>(
304 reinterpret_cast<void *>(&CSMTrackball::classDescInserter)),
305 false,
307 "<?xml version=\"1.0\"?>\n"
308 "\n"
309 "<FieldContainer\n"
310 " name=\"CSMTrackball\"\n"
311 " parent=\"AttachmentContainer\"\n"
312 " library=\"ContribCSM\"\n"
313 " pointerfieldtypes=\"both\"\n"
314 " structure=\"concrete\"\n"
315 " systemcomponent=\"true\"\n"
316 " parentsystemcomponent=\"true\"\n"
317 " decoratable=\"false\"\n"
318 " useLocalIncludes=\"false\"\n"
319 " isNodeCore=\"false\"\n"
320 " isBundle=\"true\"\n"
321 ">\n"
322 "\t<Field\n"
323 "\t\tname=\"modifierMask\"\n"
324 "\t\ttype=\"UInt32\"\n"
325 "\t\tcardinality=\"single\"\n"
326 "\t\tvisibility=\"external\"\n"
327 " defaultValue=\"0x0000\"\n"
328 "\t>\n"
329 "\t</Field>\n"
330 "\t<Field\n"
331 "\t\tname=\"processing\"\n"
332 "\t\ttype=\"UInt32\"\n"
333 "\t\tcardinality=\"single\"\n"
334 "\t\tvisibility=\"external\"\n"
335 " defaultValue=\"false\"\n"
336 " access=\"protected\"\n"
337 "\t>\n"
338 "\t</Field>\n"
339 "\t<Field\n"
340 "\t\tname=\"translationScaleFactor\"\n"
341 "\t\ttype=\"Real32\"\n"
342 "\t\tcardinality=\"single\"\n"
343 "\t\tvisibility=\"external\"\n"
344 " defaultValue=\"1.f\"\n"
345 "\t>\n"
346 "\t</Field>\n"
347 "\t<Field\n"
348 "\t\tname=\"matrixResult\"\n"
349 "\t\ttype=\"Matrix\"\n"
350 "\t\tcardinality=\"single\"\n"
351 "\t\tvisibility=\"external\"\n"
352 " defaultValue=\"\"\n"
353 "\t>\n"
354 "\t</Field>\n"
355 "\t<Field\n"
356 "\t\tname=\"rotationMatrixResult\"\n"
357 "\t\ttype=\"Matrix\"\n"
358 "\t\tcardinality=\"single\"\n"
359 "\t\tvisibility=\"external\"\n"
360 " defaultValue=\"\"\n"
361 "\t>\n"
362 "\t</Field>\n"
363 "\t<Field\n"
364 "\t\tname=\"referencePosition\"\n"
365 "\t\ttype=\"Pnt3f\"\n"
366 "\t\tcardinality=\"single\"\n"
367 "\t\tvisibility=\"external\"\n"
368 " defaultValue=\"\"\n"
369 "\t>\n"
370 "\t</Field>\n"
371 "\t<Field\n"
372 "\t\tname=\"referenceMatrix\"\n"
373 "\t\ttype=\"Matrix\"\n"
374 "\t\tcardinality=\"single\"\n"
375 "\t\tvisibility=\"external\"\n"
376 " defaultValue=\"\"\n"
377 "\t>\n"
378 "\t</Field>\n"
379 "\t<Field\n"
380 "\t\tname=\"transformCenter\"\n"
381 "\t\ttype=\"Pnt3f\"\n"
382 "\t\tcardinality=\"single\"\n"
383 "\t\tvisibility=\"external\"\n"
384 " defaultValue=\"\"\n"
385 "\t>\n"
386 "\t</Field>\n"
387 "\t<Field\n"
388 "\t\tname=\"worldDiag\"\n"
389 "\t\ttype=\"Vec3f\"\n"
390 "\t\tcardinality=\"single\"\n"
391 "\t\tvisibility=\"external\"\n"
392 " defaultValue=\"\"\n"
393 "\t>\n"
394 "\t</Field>\n"
395 "\t<Field\n"
396 "\t\tname=\"mouseData\"\n"
397 "\t\ttype=\"MouseData\"\n"
398 "\t\tcardinality=\"single\"\n"
399 "\t\tvisibility=\"internal\"\n"
400 "\t\taccess=\"public\"\n"
401 "\t>\n"
402 "\t</Field>\n"
403 "\n"
404 "\t<Field\n"
405 "\t\tname=\"reset\"\n"
406 "\t\ttype=\"OSGAny\"\n"
407 "\t\tcardinality=\"single\"\n"
408 "\t\tvisibility=\"internal\"\n"
409 " defaultValue=\"\"\n"
410 "\t>\n"
411 "\t</Field>\n"
412 "</FieldContainer>\n",
416 /*------------------------------ get -----------------------------------*/
418 FieldContainerType &CSMTrackballBase::getType(void)
420 return _type;
423 const FieldContainerType &CSMTrackballBase::getType(void) const
425 return _type;
428 UInt32 CSMTrackballBase::getContainerSize(void) const
430 return sizeof(CSMTrackball);
433 /*------------------------- decorator get ------------------------------*/
436 SFUInt32 *CSMTrackballBase::editSFModifierMask(void)
438 editSField(ModifierMaskFieldMask);
440 return &_sfModifierMask;
443 const SFUInt32 *CSMTrackballBase::getSFModifierMask(void) const
445 return &_sfModifierMask;
449 SFUInt32 *CSMTrackballBase::editSFProcessing(void)
451 editSField(ProcessingFieldMask);
453 return &_sfProcessing;
456 const SFUInt32 *CSMTrackballBase::getSFProcessing(void) const
458 return &_sfProcessing;
462 SFReal32 *CSMTrackballBase::editSFTranslationScaleFactor(void)
464 editSField(TranslationScaleFactorFieldMask);
466 return &_sfTranslationScaleFactor;
469 const SFReal32 *CSMTrackballBase::getSFTranslationScaleFactor(void) const
471 return &_sfTranslationScaleFactor;
475 SFMatrix *CSMTrackballBase::editSFMatrixResult(void)
477 editSField(MatrixResultFieldMask);
479 return &_sfMatrixResult;
482 const SFMatrix *CSMTrackballBase::getSFMatrixResult(void) const
484 return &_sfMatrixResult;
488 SFMatrix *CSMTrackballBase::editSFRotationMatrixResult(void)
490 editSField(RotationMatrixResultFieldMask);
492 return &_sfRotationMatrixResult;
495 const SFMatrix *CSMTrackballBase::getSFRotationMatrixResult(void) const
497 return &_sfRotationMatrixResult;
501 SFPnt3f *CSMTrackballBase::editSFReferencePosition(void)
503 editSField(ReferencePositionFieldMask);
505 return &_sfReferencePosition;
508 const SFPnt3f *CSMTrackballBase::getSFReferencePosition(void) const
510 return &_sfReferencePosition;
514 SFMatrix *CSMTrackballBase::editSFReferenceMatrix(void)
516 editSField(ReferenceMatrixFieldMask);
518 return &_sfReferenceMatrix;
521 const SFMatrix *CSMTrackballBase::getSFReferenceMatrix(void) const
523 return &_sfReferenceMatrix;
527 SFPnt3f *CSMTrackballBase::editSFTransformCenter(void)
529 editSField(TransformCenterFieldMask);
531 return &_sfTransformCenter;
534 const SFPnt3f *CSMTrackballBase::getSFTransformCenter(void) const
536 return &_sfTransformCenter;
540 SFVec3f *CSMTrackballBase::editSFWorldDiag(void)
542 editSField(WorldDiagFieldMask);
544 return &_sfWorldDiag;
547 const SFVec3f *CSMTrackballBase::getSFWorldDiag(void) const
549 return &_sfWorldDiag;
553 SFMouseData *CSMTrackballBase::editSFMouseData(void)
555 editSField(MouseDataFieldMask);
557 return &_sfMouseData;
560 const SFMouseData *CSMTrackballBase::getSFMouseData(void) const
562 return &_sfMouseData;
566 SFOSGAny *CSMTrackballBase::editSFReset(void)
568 editSField(ResetFieldMask);
570 return &_sfReset;
573 const SFOSGAny *CSMTrackballBase::getSFReset(void) const
575 return &_sfReset;
583 /*------------------------------ access -----------------------------------*/
585 SizeT CSMTrackballBase::getBinSize(ConstFieldMaskArg whichField)
587 SizeT returnValue = Inherited::getBinSize(whichField);
589 if(FieldBits::NoField != (ModifierMaskFieldMask & whichField))
591 returnValue += _sfModifierMask.getBinSize();
593 if(FieldBits::NoField != (ProcessingFieldMask & whichField))
595 returnValue += _sfProcessing.getBinSize();
597 if(FieldBits::NoField != (TranslationScaleFactorFieldMask & whichField))
599 returnValue += _sfTranslationScaleFactor.getBinSize();
601 if(FieldBits::NoField != (MatrixResultFieldMask & whichField))
603 returnValue += _sfMatrixResult.getBinSize();
605 if(FieldBits::NoField != (RotationMatrixResultFieldMask & whichField))
607 returnValue += _sfRotationMatrixResult.getBinSize();
609 if(FieldBits::NoField != (ReferencePositionFieldMask & whichField))
611 returnValue += _sfReferencePosition.getBinSize();
613 if(FieldBits::NoField != (ReferenceMatrixFieldMask & whichField))
615 returnValue += _sfReferenceMatrix.getBinSize();
617 if(FieldBits::NoField != (TransformCenterFieldMask & whichField))
619 returnValue += _sfTransformCenter.getBinSize();
621 if(FieldBits::NoField != (WorldDiagFieldMask & whichField))
623 returnValue += _sfWorldDiag.getBinSize();
625 if(FieldBits::NoField != (MouseDataFieldMask & whichField))
627 returnValue += _sfMouseData.getBinSize();
629 if(FieldBits::NoField != (ResetFieldMask & whichField))
631 returnValue += _sfReset.getBinSize();
634 return returnValue;
637 void CSMTrackballBase::copyToBin(BinaryDataHandler &pMem,
638 ConstFieldMaskArg whichField)
640 Inherited::copyToBin(pMem, whichField);
642 if(FieldBits::NoField != (ModifierMaskFieldMask & whichField))
644 _sfModifierMask.copyToBin(pMem);
646 if(FieldBits::NoField != (ProcessingFieldMask & whichField))
648 _sfProcessing.copyToBin(pMem);
650 if(FieldBits::NoField != (TranslationScaleFactorFieldMask & whichField))
652 _sfTranslationScaleFactor.copyToBin(pMem);
654 if(FieldBits::NoField != (MatrixResultFieldMask & whichField))
656 _sfMatrixResult.copyToBin(pMem);
658 if(FieldBits::NoField != (RotationMatrixResultFieldMask & whichField))
660 _sfRotationMatrixResult.copyToBin(pMem);
662 if(FieldBits::NoField != (ReferencePositionFieldMask & whichField))
664 _sfReferencePosition.copyToBin(pMem);
666 if(FieldBits::NoField != (ReferenceMatrixFieldMask & whichField))
668 _sfReferenceMatrix.copyToBin(pMem);
670 if(FieldBits::NoField != (TransformCenterFieldMask & whichField))
672 _sfTransformCenter.copyToBin(pMem);
674 if(FieldBits::NoField != (WorldDiagFieldMask & whichField))
676 _sfWorldDiag.copyToBin(pMem);
678 if(FieldBits::NoField != (MouseDataFieldMask & whichField))
680 _sfMouseData.copyToBin(pMem);
682 if(FieldBits::NoField != (ResetFieldMask & whichField))
684 _sfReset.copyToBin(pMem);
688 void CSMTrackballBase::copyFromBin(BinaryDataHandler &pMem,
689 ConstFieldMaskArg whichField)
691 Inherited::copyFromBin(pMem, whichField);
693 if(FieldBits::NoField != (ModifierMaskFieldMask & whichField))
695 editSField(ModifierMaskFieldMask);
696 _sfModifierMask.copyFromBin(pMem);
698 if(FieldBits::NoField != (ProcessingFieldMask & whichField))
700 editSField(ProcessingFieldMask);
701 _sfProcessing.copyFromBin(pMem);
703 if(FieldBits::NoField != (TranslationScaleFactorFieldMask & whichField))
705 editSField(TranslationScaleFactorFieldMask);
706 _sfTranslationScaleFactor.copyFromBin(pMem);
708 if(FieldBits::NoField != (MatrixResultFieldMask & whichField))
710 editSField(MatrixResultFieldMask);
711 _sfMatrixResult.copyFromBin(pMem);
713 if(FieldBits::NoField != (RotationMatrixResultFieldMask & whichField))
715 editSField(RotationMatrixResultFieldMask);
716 _sfRotationMatrixResult.copyFromBin(pMem);
718 if(FieldBits::NoField != (ReferencePositionFieldMask & whichField))
720 editSField(ReferencePositionFieldMask);
721 _sfReferencePosition.copyFromBin(pMem);
723 if(FieldBits::NoField != (ReferenceMatrixFieldMask & whichField))
725 editSField(ReferenceMatrixFieldMask);
726 _sfReferenceMatrix.copyFromBin(pMem);
728 if(FieldBits::NoField != (TransformCenterFieldMask & whichField))
730 editSField(TransformCenterFieldMask);
731 _sfTransformCenter.copyFromBin(pMem);
733 if(FieldBits::NoField != (WorldDiagFieldMask & whichField))
735 editSField(WorldDiagFieldMask);
736 _sfWorldDiag.copyFromBin(pMem);
738 if(FieldBits::NoField != (MouseDataFieldMask & whichField))
740 editSField(MouseDataFieldMask);
741 _sfMouseData.copyFromBin(pMem);
743 if(FieldBits::NoField != (ResetFieldMask & whichField))
745 editSField(ResetFieldMask);
746 _sfReset.copyFromBin(pMem);
750 //! create a new instance of the class
751 CSMTrackballTransitPtr CSMTrackballBase::createLocal(BitVector bFlags)
753 CSMTrackballTransitPtr fc;
755 if(getClassType().getPrototype() != NULL)
757 FieldContainerTransitPtr tmpPtr =
758 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
760 fc = dynamic_pointer_cast<CSMTrackball>(tmpPtr);
763 return fc;
766 //! create a new instance of the class, copy the container flags
767 CSMTrackballTransitPtr CSMTrackballBase::createDependent(BitVector bFlags)
769 CSMTrackballTransitPtr fc;
771 if(getClassType().getPrototype() != NULL)
773 FieldContainerTransitPtr tmpPtr =
774 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
776 fc = dynamic_pointer_cast<CSMTrackball>(tmpPtr);
779 return fc;
782 //! create a new instance of the class
783 CSMTrackballTransitPtr CSMTrackballBase::create(void)
785 return createLocal();
788 CSMTrackball *CSMTrackballBase::createEmptyLocal(BitVector bFlags)
790 CSMTrackball *returnValue;
792 newPtr<CSMTrackball>(returnValue, bFlags);
794 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
796 return returnValue;
799 //! create an empty new instance of the class, do not copy the prototype
800 CSMTrackball *CSMTrackballBase::createEmpty(void)
802 return createEmptyLocal();
806 FieldContainerTransitPtr CSMTrackballBase::shallowCopyLocal(
807 BitVector bFlags) const
809 CSMTrackball *tmpPtr;
811 newPtr(tmpPtr, dynamic_cast<const CSMTrackball *>(this), bFlags);
813 FieldContainerTransitPtr returnValue(tmpPtr);
815 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
817 return returnValue;
820 FieldContainerTransitPtr CSMTrackballBase::shallowCopyDependent(
821 BitVector bFlags) const
823 CSMTrackball *tmpPtr;
825 newPtr(tmpPtr, dynamic_cast<const CSMTrackball *>(this), ~bFlags);
827 FieldContainerTransitPtr returnValue(tmpPtr);
829 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
831 return returnValue;
834 FieldContainerTransitPtr CSMTrackballBase::shallowCopy(void) const
836 return shallowCopyLocal();
842 /*------------------------- constructors ----------------------------------*/
844 CSMTrackballBase::CSMTrackballBase(void) :
845 Inherited(),
846 _sfModifierMask (UInt32(0x0000)),
847 _sfProcessing (UInt32(false)),
848 _sfTranslationScaleFactor (Real32(1.f)),
849 _sfMatrixResult (),
850 _sfRotationMatrixResult (),
851 _sfReferencePosition (),
852 _sfReferenceMatrix (),
853 _sfTransformCenter (),
854 _sfWorldDiag (),
855 _sfMouseData (),
856 _sfReset ()
860 CSMTrackballBase::CSMTrackballBase(const CSMTrackballBase &source) :
861 Inherited(source),
862 _sfModifierMask (source._sfModifierMask ),
863 _sfProcessing (source._sfProcessing ),
864 _sfTranslationScaleFactor (source._sfTranslationScaleFactor ),
865 _sfMatrixResult (source._sfMatrixResult ),
866 _sfRotationMatrixResult (source._sfRotationMatrixResult ),
867 _sfReferencePosition (source._sfReferencePosition ),
868 _sfReferenceMatrix (source._sfReferenceMatrix ),
869 _sfTransformCenter (source._sfTransformCenter ),
870 _sfWorldDiag (source._sfWorldDiag ),
871 _sfMouseData (source._sfMouseData ),
872 _sfReset (source._sfReset )
877 /*-------------------------- destructors ----------------------------------*/
879 CSMTrackballBase::~CSMTrackballBase(void)
884 GetFieldHandlePtr CSMTrackballBase::getHandleModifierMask (void) const
886 SFUInt32::GetHandlePtr returnValue(
887 new SFUInt32::GetHandle(
888 &_sfModifierMask,
889 this->getType().getFieldDesc(ModifierMaskFieldId),
890 const_cast<CSMTrackballBase *>(this)));
892 return returnValue;
895 EditFieldHandlePtr CSMTrackballBase::editHandleModifierMask (void)
897 SFUInt32::EditHandlePtr returnValue(
898 new SFUInt32::EditHandle(
899 &_sfModifierMask,
900 this->getType().getFieldDesc(ModifierMaskFieldId),
901 this));
904 editSField(ModifierMaskFieldMask);
906 return returnValue;
909 GetFieldHandlePtr CSMTrackballBase::getHandleProcessing (void) const
911 SFUInt32::GetHandlePtr returnValue(
912 new SFUInt32::GetHandle(
913 &_sfProcessing,
914 this->getType().getFieldDesc(ProcessingFieldId),
915 const_cast<CSMTrackballBase *>(this)));
917 return returnValue;
920 EditFieldHandlePtr CSMTrackballBase::editHandleProcessing (void)
922 SFUInt32::EditHandlePtr returnValue(
923 new SFUInt32::EditHandle(
924 &_sfProcessing,
925 this->getType().getFieldDesc(ProcessingFieldId),
926 this));
929 editSField(ProcessingFieldMask);
931 return returnValue;
934 GetFieldHandlePtr CSMTrackballBase::getHandleTranslationScaleFactor (void) const
936 SFReal32::GetHandlePtr returnValue(
937 new SFReal32::GetHandle(
938 &_sfTranslationScaleFactor,
939 this->getType().getFieldDesc(TranslationScaleFactorFieldId),
940 const_cast<CSMTrackballBase *>(this)));
942 return returnValue;
945 EditFieldHandlePtr CSMTrackballBase::editHandleTranslationScaleFactor(void)
947 SFReal32::EditHandlePtr returnValue(
948 new SFReal32::EditHandle(
949 &_sfTranslationScaleFactor,
950 this->getType().getFieldDesc(TranslationScaleFactorFieldId),
951 this));
954 editSField(TranslationScaleFactorFieldMask);
956 return returnValue;
959 GetFieldHandlePtr CSMTrackballBase::getHandleMatrixResult (void) const
961 SFMatrix::GetHandlePtr returnValue(
962 new SFMatrix::GetHandle(
963 &_sfMatrixResult,
964 this->getType().getFieldDesc(MatrixResultFieldId),
965 const_cast<CSMTrackballBase *>(this)));
967 return returnValue;
970 EditFieldHandlePtr CSMTrackballBase::editHandleMatrixResult (void)
972 SFMatrix::EditHandlePtr returnValue(
973 new SFMatrix::EditHandle(
974 &_sfMatrixResult,
975 this->getType().getFieldDesc(MatrixResultFieldId),
976 this));
979 editSField(MatrixResultFieldMask);
981 return returnValue;
984 GetFieldHandlePtr CSMTrackballBase::getHandleRotationMatrixResult (void) const
986 SFMatrix::GetHandlePtr returnValue(
987 new SFMatrix::GetHandle(
988 &_sfRotationMatrixResult,
989 this->getType().getFieldDesc(RotationMatrixResultFieldId),
990 const_cast<CSMTrackballBase *>(this)));
992 return returnValue;
995 EditFieldHandlePtr CSMTrackballBase::editHandleRotationMatrixResult(void)
997 SFMatrix::EditHandlePtr returnValue(
998 new SFMatrix::EditHandle(
999 &_sfRotationMatrixResult,
1000 this->getType().getFieldDesc(RotationMatrixResultFieldId),
1001 this));
1004 editSField(RotationMatrixResultFieldMask);
1006 return returnValue;
1009 GetFieldHandlePtr CSMTrackballBase::getHandleReferencePosition (void) const
1011 SFPnt3f::GetHandlePtr returnValue(
1012 new SFPnt3f::GetHandle(
1013 &_sfReferencePosition,
1014 this->getType().getFieldDesc(ReferencePositionFieldId),
1015 const_cast<CSMTrackballBase *>(this)));
1017 return returnValue;
1020 EditFieldHandlePtr CSMTrackballBase::editHandleReferencePosition(void)
1022 SFPnt3f::EditHandlePtr returnValue(
1023 new SFPnt3f::EditHandle(
1024 &_sfReferencePosition,
1025 this->getType().getFieldDesc(ReferencePositionFieldId),
1026 this));
1029 editSField(ReferencePositionFieldMask);
1031 return returnValue;
1034 GetFieldHandlePtr CSMTrackballBase::getHandleReferenceMatrix (void) const
1036 SFMatrix::GetHandlePtr returnValue(
1037 new SFMatrix::GetHandle(
1038 &_sfReferenceMatrix,
1039 this->getType().getFieldDesc(ReferenceMatrixFieldId),
1040 const_cast<CSMTrackballBase *>(this)));
1042 return returnValue;
1045 EditFieldHandlePtr CSMTrackballBase::editHandleReferenceMatrix(void)
1047 SFMatrix::EditHandlePtr returnValue(
1048 new SFMatrix::EditHandle(
1049 &_sfReferenceMatrix,
1050 this->getType().getFieldDesc(ReferenceMatrixFieldId),
1051 this));
1054 editSField(ReferenceMatrixFieldMask);
1056 return returnValue;
1059 GetFieldHandlePtr CSMTrackballBase::getHandleTransformCenter (void) const
1061 SFPnt3f::GetHandlePtr returnValue(
1062 new SFPnt3f::GetHandle(
1063 &_sfTransformCenter,
1064 this->getType().getFieldDesc(TransformCenterFieldId),
1065 const_cast<CSMTrackballBase *>(this)));
1067 return returnValue;
1070 EditFieldHandlePtr CSMTrackballBase::editHandleTransformCenter(void)
1072 SFPnt3f::EditHandlePtr returnValue(
1073 new SFPnt3f::EditHandle(
1074 &_sfTransformCenter,
1075 this->getType().getFieldDesc(TransformCenterFieldId),
1076 this));
1079 editSField(TransformCenterFieldMask);
1081 return returnValue;
1084 GetFieldHandlePtr CSMTrackballBase::getHandleWorldDiag (void) const
1086 SFVec3f::GetHandlePtr returnValue(
1087 new SFVec3f::GetHandle(
1088 &_sfWorldDiag,
1089 this->getType().getFieldDesc(WorldDiagFieldId),
1090 const_cast<CSMTrackballBase *>(this)));
1092 return returnValue;
1095 EditFieldHandlePtr CSMTrackballBase::editHandleWorldDiag (void)
1097 SFVec3f::EditHandlePtr returnValue(
1098 new SFVec3f::EditHandle(
1099 &_sfWorldDiag,
1100 this->getType().getFieldDesc(WorldDiagFieldId),
1101 this));
1104 editSField(WorldDiagFieldMask);
1106 return returnValue;
1109 GetFieldHandlePtr CSMTrackballBase::getHandleMouseData (void) const
1111 SFMouseData::GetHandlePtr returnValue(
1112 new SFMouseData::GetHandle(
1113 &_sfMouseData,
1114 this->getType().getFieldDesc(MouseDataFieldId),
1115 const_cast<CSMTrackballBase *>(this)));
1117 return returnValue;
1120 EditFieldHandlePtr CSMTrackballBase::editHandleMouseData (void)
1122 SFMouseData::EditHandlePtr returnValue(
1123 new SFMouseData::EditHandle(
1124 &_sfMouseData,
1125 this->getType().getFieldDesc(MouseDataFieldId),
1126 this));
1129 editSField(MouseDataFieldMask);
1131 return returnValue;
1134 GetFieldHandlePtr CSMTrackballBase::getHandleReset (void) const
1136 SFOSGAny::GetHandlePtr returnValue(
1137 new SFOSGAny::GetHandle(
1138 &_sfReset,
1139 this->getType().getFieldDesc(ResetFieldId),
1140 const_cast<CSMTrackballBase *>(this)));
1142 return returnValue;
1145 EditFieldHandlePtr CSMTrackballBase::editHandleReset (void)
1147 SFOSGAny::EditHandlePtr returnValue(
1148 new SFOSGAny::EditHandle(
1149 &_sfReset,
1150 this->getType().getFieldDesc(ResetFieldId),
1151 this));
1154 editSField(ResetFieldMask);
1156 return returnValue;
1160 #ifdef OSG_MT_CPTR_ASPECT
1161 void CSMTrackballBase::execSyncV( FieldContainer &oFrom,
1162 ConstFieldMaskArg whichField,
1163 AspectOffsetStore &oOffsets,
1164 ConstFieldMaskArg syncMode,
1165 const UInt32 uiSyncInfo)
1167 CSMTrackball *pThis = static_cast<CSMTrackball *>(this);
1169 pThis->execSync(static_cast<CSMTrackball *>(&oFrom),
1170 whichField,
1171 oOffsets,
1172 syncMode,
1173 uiSyncInfo);
1175 #endif
1178 #ifdef OSG_MT_CPTR_ASPECT
1179 FieldContainer *CSMTrackballBase::createAspectCopy(
1180 const FieldContainer *pRefAspect) const
1182 CSMTrackball *returnValue;
1184 newAspectCopy(returnValue,
1185 dynamic_cast<const CSMTrackball *>(pRefAspect),
1186 dynamic_cast<const CSMTrackball *>(this));
1188 return returnValue;
1190 #endif
1192 void CSMTrackballBase::resolveLinks(void)
1194 Inherited::resolveLinks();
1200 OSG_END_NAMESPACE