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 ScaleManipulator!
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 "OSGScaleManipulatorBase.h"
67 #include "OSGScaleManipulator.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
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",
98 ScaleManipulator::getClassType(),
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(),
116 "Uniform/Non-uniform scaling.\n",
117 UniformFieldId
, UniformFieldMask
,
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(),
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
)),
139 "<?xml version=\"1.0\"?>\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"
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"
154 " name=\"uniform\"\n"
156 " category=\"data\"\n"
157 " cardinality=\"single\"\n"
158 " visibility=\"external\"\n"
159 " access=\"public\"\n"
160 " defaultValue=\"false\"\n"
162 " Uniform/Non-uniform scaling.\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)
175 const FieldContainerType
&ScaleManipulatorBase::getType(void) const
180 UInt32
ScaleManipulatorBase::getContainerSize(void) const
182 return sizeof(ScaleManipulator
);
185 /*------------------------- decorator get ------------------------------*/
188 SFBool
*ScaleManipulatorBase::editSFUniform(void)
190 editSField(UniformFieldMask
);
195 const SFBool
*ScaleManipulatorBase::getSFUniform(void) const
205 /*------------------------------ access -----------------------------------*/
207 SizeT
ScaleManipulatorBase::getBinSize(ConstFieldMaskArg whichField
)
209 SizeT returnValue
= Inherited::getBinSize(whichField
);
211 if(FieldBits::NoField
!= (UniformFieldMask
& whichField
))
213 returnValue
+= _sfUniform
.getBinSize();
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
);
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
);
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
);
290 ScaleManipulator
*ScaleManipulatorBase::createEmptyLocal(BitVector bFlags
)
292 ScaleManipulator
*returnValue
;
294 newPtr
<ScaleManipulator
>(returnValue
, bFlags
);
296 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
343 FieldContainerTransitPtr
ScaleManipulatorBase::shallowCopy(void) const
345 ScaleManipulator
*tmpPtr
;
348 dynamic_cast<const ScaleManipulator
*>(this),
349 Thread::getCurrentLocalFlags());
351 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
353 FieldContainerTransitPtr
returnValue(tmpPtr
);
361 /*------------------------- constructors ----------------------------------*/
363 ScaleManipulatorBase::ScaleManipulatorBase(void) :
365 _sfUniform (bool(false))
369 ScaleManipulatorBase::ScaleManipulatorBase(const ScaleManipulatorBase
&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(
388 this->getType().getFieldDesc(UniformFieldId
),
389 const_cast<ScaleManipulatorBase
*>(this)));
394 EditFieldHandlePtr
ScaleManipulatorBase::editHandleUniform (void)
396 SFBool::EditHandlePtr
returnValue(
397 new SFBool::EditHandle(
399 this->getType().getFieldDesc(UniformFieldId
),
403 editSField(UniformFieldMask
);
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
),
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));
441 void ScaleManipulatorBase::resolveLinks(void)
443 Inherited::resolveLinks();