changed: gcc8 base update
[opensg.git] / Source / Contrib / Manipulators / OSGScaleManipulatorBase.cpp
blob2bdf27c8a0a41bd315fe1b7f48e2a8386952ac98
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 ScaleManipulator!
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 "OSGScaleManipulatorBase.h"
67 #include "OSGScaleManipulator.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::ScaleManipulator
78 The ScaleHandle is used for scaling objects. It consist of three axis which can be picked and scaled and one center box to scale freely in 3D.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var bool ScaleManipulatorBase::_sfUniform
86 Uniform/Non-uniform scaling.
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits<ScaleManipulator *, nsOSG>::_type(
96 "ScaleManipulatorPtr",
97 "ManipulatorPtr",
98 ScaleManipulator::getClassType(),
99 nsOSG);
100 #endif
102 OSG_FIELDTRAITS_GETTYPE_NS(ScaleManipulator *, nsOSG)
104 /***************************************************************************\
105 * Field Description *
106 \***************************************************************************/
108 void ScaleManipulatorBase::classDescInserter(TypeObject &oType)
110 FieldDescriptionBase *pDesc = NULL;
113 pDesc = new SFBool::Description(
114 SFBool::getClassType(),
115 "uniform",
116 "Uniform/Non-uniform scaling.\n",
117 UniformFieldId, UniformFieldMask,
118 false,
119 (Field::SFDefaultFlags | Field::FStdAccess),
120 static_cast<FieldEditMethodSig>(&ScaleManipulator::editHandleUniform),
121 static_cast<FieldGetMethodSig >(&ScaleManipulator::getHandleUniform));
123 oType.addInitialDesc(pDesc);
127 ScaleManipulatorBase::TypeObject ScaleManipulatorBase::_type(
128 ScaleManipulatorBase::getClassname(),
129 Inherited::getClassname(),
130 "NULL",
131 nsOSG, //Namespace
132 reinterpret_cast<PrototypeCreateF>(&ScaleManipulatorBase::createEmptyLocal),
133 reinterpret_cast<InitContainerF>(&ScaleManipulator::initMethod),
134 reinterpret_cast<ExitContainerF>(&ScaleManipulator::exitMethod),
135 reinterpret_cast<InitalInsertDescFunc>(
136 reinterpret_cast<void *>(&ScaleManipulator::classDescInserter)),
137 false,
139 "<?xml version=\"1.0\"?>\n"
140 "\n"
141 "<FieldContainer\n"
142 "\tname=\"ScaleManipulator\"\n"
143 "\tparent=\"Manipulator\"\n"
144 "\tlibrary=\"ContribGUI\"\n"
145 "\tpointerfieldtypes=\"none\"\n"
146 "\tstructure=\"concrete\"\n"
147 "\tsystemcomponent=\"true\"\n"
148 "\tparentsystemcomponent=\"true\"\n"
149 "\tdecoratable=\"false\"\n"
150 "\tuseLocalIncludes=\"true\"\n"
151 ">\n"
152 "The ScaleHandle is used for scaling objects. It consist of three axis which can be picked and scaled and one center box to scale freely in 3D.\n"
153 " <Field\n"
154 " name=\"uniform\"\n"
155 " type=\"bool\"\n"
156 " category=\"data\"\n"
157 " cardinality=\"single\"\n"
158 " visibility=\"external\"\n"
159 " access=\"public\"\n"
160 " defaultValue=\"false\"\n"
161 " >\n"
162 " Uniform/Non-uniform scaling.\n"
163 " </Field>\n"
164 "</FieldContainer>\n",
165 "The ScaleHandle is used for scaling objects. It consist of three axis which can be picked and scaled and one center box to scale freely in 3D.\n"
168 /*------------------------------ get -----------------------------------*/
170 FieldContainerType &ScaleManipulatorBase::getType(void)
172 return _type;
175 const FieldContainerType &ScaleManipulatorBase::getType(void) const
177 return _type;
180 UInt32 ScaleManipulatorBase::getContainerSize(void) const
182 return sizeof(ScaleManipulator);
185 /*------------------------- decorator get ------------------------------*/
188 SFBool *ScaleManipulatorBase::editSFUniform(void)
190 editSField(UniformFieldMask);
192 return &_sfUniform;
195 const SFBool *ScaleManipulatorBase::getSFUniform(void) const
197 return &_sfUniform;
205 /*------------------------------ access -----------------------------------*/
207 SizeT ScaleManipulatorBase::getBinSize(ConstFieldMaskArg whichField)
209 SizeT returnValue = Inherited::getBinSize(whichField);
211 if(FieldBits::NoField != (UniformFieldMask & whichField))
213 returnValue += _sfUniform.getBinSize();
216 return returnValue;
219 void ScaleManipulatorBase::copyToBin(BinaryDataHandler &pMem,
220 ConstFieldMaskArg whichField)
222 Inherited::copyToBin(pMem, whichField);
224 if(FieldBits::NoField != (UniformFieldMask & whichField))
226 _sfUniform.copyToBin(pMem);
230 void ScaleManipulatorBase::copyFromBin(BinaryDataHandler &pMem,
231 ConstFieldMaskArg whichField)
233 Inherited::copyFromBin(pMem, whichField);
235 if(FieldBits::NoField != (UniformFieldMask & whichField))
237 editSField(UniformFieldMask);
238 _sfUniform.copyFromBin(pMem);
242 //! create a new instance of the class
243 ScaleManipulatorTransitPtr ScaleManipulatorBase::createLocal(BitVector bFlags)
245 ScaleManipulatorTransitPtr fc;
247 if(getClassType().getPrototype() != NULL)
249 FieldContainerTransitPtr tmpPtr =
250 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
252 fc = dynamic_pointer_cast<ScaleManipulator>(tmpPtr);
255 return fc;
258 //! create a new instance of the class, copy the container flags
259 ScaleManipulatorTransitPtr ScaleManipulatorBase::createDependent(BitVector bFlags)
261 ScaleManipulatorTransitPtr fc;
263 if(getClassType().getPrototype() != NULL)
265 FieldContainerTransitPtr tmpPtr =
266 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
268 fc = dynamic_pointer_cast<ScaleManipulator>(tmpPtr);
271 return fc;
274 //! create a new instance of the class
275 ScaleManipulatorTransitPtr ScaleManipulatorBase::create(void)
277 ScaleManipulatorTransitPtr fc;
279 if(getClassType().getPrototype() != NULL)
281 FieldContainerTransitPtr tmpPtr =
282 getClassType().getPrototype()-> shallowCopy();
284 fc = dynamic_pointer_cast<ScaleManipulator>(tmpPtr);
287 return fc;
290 ScaleManipulator *ScaleManipulatorBase::createEmptyLocal(BitVector bFlags)
292 ScaleManipulator *returnValue;
294 newPtr<ScaleManipulator>(returnValue, bFlags);
296 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
298 return returnValue;
301 //! create an empty new instance of the class, do not copy the prototype
302 ScaleManipulator *ScaleManipulatorBase::createEmpty(void)
304 ScaleManipulator *returnValue;
306 newPtr<ScaleManipulator>(returnValue, Thread::getCurrentLocalFlags());
308 returnValue->_pFieldFlags->_bNamespaceMask &=
309 ~Thread::getCurrentLocalFlags();
311 return returnValue;
315 FieldContainerTransitPtr ScaleManipulatorBase::shallowCopyLocal(
316 BitVector bFlags) const
318 ScaleManipulator *tmpPtr;
320 newPtr(tmpPtr, dynamic_cast<const ScaleManipulator *>(this), bFlags);
322 FieldContainerTransitPtr returnValue(tmpPtr);
324 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
326 return returnValue;
329 FieldContainerTransitPtr ScaleManipulatorBase::shallowCopyDependent(
330 BitVector bFlags) const
332 ScaleManipulator *tmpPtr;
334 newPtr(tmpPtr, dynamic_cast<const ScaleManipulator *>(this), ~bFlags);
336 FieldContainerTransitPtr returnValue(tmpPtr);
338 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
340 return returnValue;
343 FieldContainerTransitPtr ScaleManipulatorBase::shallowCopy(void) const
345 ScaleManipulator *tmpPtr;
347 newPtr(tmpPtr,
348 dynamic_cast<const ScaleManipulator *>(this),
349 Thread::getCurrentLocalFlags());
351 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
353 FieldContainerTransitPtr returnValue(tmpPtr);
355 return returnValue;
361 /*------------------------- constructors ----------------------------------*/
363 ScaleManipulatorBase::ScaleManipulatorBase(void) :
364 Inherited(),
365 _sfUniform (bool(false))
369 ScaleManipulatorBase::ScaleManipulatorBase(const ScaleManipulatorBase &source) :
370 Inherited(source),
371 _sfUniform (source._sfUniform )
376 /*-------------------------- destructors ----------------------------------*/
378 ScaleManipulatorBase::~ScaleManipulatorBase(void)
383 GetFieldHandlePtr ScaleManipulatorBase::getHandleUniform (void) const
385 SFBool::GetHandlePtr returnValue(
386 new SFBool::GetHandle(
387 &_sfUniform,
388 this->getType().getFieldDesc(UniformFieldId),
389 const_cast<ScaleManipulatorBase *>(this)));
391 return returnValue;
394 EditFieldHandlePtr ScaleManipulatorBase::editHandleUniform (void)
396 SFBool::EditHandlePtr returnValue(
397 new SFBool::EditHandle(
398 &_sfUniform,
399 this->getType().getFieldDesc(UniformFieldId),
400 this));
403 editSField(UniformFieldMask);
405 return returnValue;
409 #ifdef OSG_MT_CPTR_ASPECT
410 void ScaleManipulatorBase::execSyncV( FieldContainer &oFrom,
411 ConstFieldMaskArg whichField,
412 AspectOffsetStore &oOffsets,
413 ConstFieldMaskArg syncMode,
414 const UInt32 uiSyncInfo)
416 ScaleManipulator *pThis = static_cast<ScaleManipulator *>(this);
418 pThis->execSync(static_cast<ScaleManipulator *>(&oFrom),
419 whichField,
420 oOffsets,
421 syncMode,
422 uiSyncInfo);
424 #endif
427 #ifdef OSG_MT_CPTR_ASPECT
428 FieldContainer *ScaleManipulatorBase::createAspectCopy(
429 const FieldContainer *pRefAspect) const
431 ScaleManipulator *returnValue;
433 newAspectCopy(returnValue,
434 dynamic_cast<const ScaleManipulator *>(pRefAspect),
435 dynamic_cast<const ScaleManipulator *>(this));
437 return returnValue;
439 #endif
441 void ScaleManipulatorBase::resolveLinks(void)
443 Inherited::resolveLinks();
449 OSG_END_NAMESPACE