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 SimpleStatisticsForeground!
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 "OSGSimpleStatisticsForegroundBase.h"
67 #include "OSGSimpleStatisticsForeground.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::SimpleStatisticsForeground
78 SimpleStatisticsForeground displays the Statistics info as simple lines of
81 OSG::SimpleStatisticsForeground displays the statistics info as simple text
82 lines. They are displayed using a compiled-in font that can use an arbitrary
83 color and that can be arbitrarily resized, with the size per line given in
86 The format of every element is given by a format string for every element that
87 is directly passed to OSG::StatElem::putToString(), so go there to see the
90 If no elementIDs are given all elements in the OSG::StatCollector are display,
91 using the default format.
93 The format string for the given elements are stored in the _mfFormats Field,
94 the size and color used for all lines in _sfSize and _sfColor.
96 See \ref PageSystemWindowForegroundStatisticsSimple
99 /***************************************************************************\
100 * Field Documentation *
101 \***************************************************************************/
103 /*! \var std::string SimpleStatisticsForegroundBase::_mfFormats
104 The format strings for the given StatElemDesc IDs. If not set, name and
108 /*! \var Real32 SimpleStatisticsForegroundBase::_sfSize
109 Height of a single line, in pixel.
112 /*! \var Color4f SimpleStatisticsForegroundBase::_sfColor
116 /*! \var Color4f SimpleStatisticsForegroundBase::_sfShadowColor
120 /*! \var Color4f SimpleStatisticsForegroundBase::_sfBgColor
121 Color of the background.
124 /*! \var std::string SimpleStatisticsForegroundBase::_sfFamily
125 The font family to be used, e.g. "SANS", default if unset.
128 /*! \var Vec2f SimpleStatisticsForegroundBase::_sfShadowOffset
129 Offset of the shadow, in pixels.
132 /*! \var UInt8 SimpleStatisticsForegroundBase::_sfHorizontalAlign
133 Simple form of layout management, 0 defaults to left.
136 /*! \var UInt8 SimpleStatisticsForegroundBase::_sfVerticalAlign
137 Simple form of layout management, 0 defaults to top.
140 /*! \var Color4f SimpleStatisticsForegroundBase::_sfBorderColor
144 /*! \var Vec2f SimpleStatisticsForegroundBase::_sfBorderOffset
145 Offset of the border in pixels.
148 /*! \var Vec2f SimpleStatisticsForegroundBase::_sfTextMargin
149 Text margin in pixels.
153 /***************************************************************************\
154 * FieldType/FieldTrait Instantiation *
155 \***************************************************************************/
157 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
158 PointerType FieldTraits
<SimpleStatisticsForeground
*, nsOSG
>::_type(
159 "SimpleStatisticsForegroundPtr",
160 "StatisticsForegroundPtr",
161 SimpleStatisticsForeground::getClassType(),
165 OSG_FIELDTRAITS_GETTYPE_NS(SimpleStatisticsForeground
*, nsOSG
)
167 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
168 SimpleStatisticsForeground
*,
171 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
172 SimpleStatisticsForeground
*,
175 /***************************************************************************\
176 * Field Description *
177 \***************************************************************************/
179 void SimpleStatisticsForegroundBase::classDescInserter(TypeObject
&oType
)
181 FieldDescriptionBase
*pDesc
= NULL
;
184 pDesc
= new MFString::Description(
185 MFString::getClassType(),
187 "The format strings for the given StatElemDesc IDs. If not set, name and\n"
188 "value are used. \n",
189 FormatsFieldId
, FormatsFieldMask
,
191 (Field::MFDefaultFlags
| Field::FStdAccess
),
192 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleFormats
),
193 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleFormats
));
195 oType
.addInitialDesc(pDesc
);
197 pDesc
= new SFReal32::Description(
198 SFReal32::getClassType(),
200 "Height of a single line, in pixel.\n",
201 SizeFieldId
, SizeFieldMask
,
203 (Field::SFDefaultFlags
| Field::FStdAccess
),
204 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleSize
),
205 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleSize
));
207 oType
.addInitialDesc(pDesc
);
209 pDesc
= new SFColor4f::Description(
210 SFColor4f::getClassType(),
212 "Color of the text.\n",
213 ColorFieldId
, ColorFieldMask
,
215 (Field::SFDefaultFlags
| Field::FStdAccess
),
216 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleColor
),
217 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleColor
));
219 oType
.addInitialDesc(pDesc
);
221 pDesc
= new SFColor4f::Description(
222 SFColor4f::getClassType(),
224 "Color of the shadow.\n",
225 ShadowColorFieldId
, ShadowColorFieldMask
,
227 (Field::SFDefaultFlags
| Field::FStdAccess
),
228 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleShadowColor
),
229 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleShadowColor
));
231 oType
.addInitialDesc(pDesc
);
233 pDesc
= new SFColor4f::Description(
234 SFColor4f::getClassType(),
236 "Color of the background.\n",
237 BgColorFieldId
, BgColorFieldMask
,
239 (Field::SFDefaultFlags
| Field::FStdAccess
),
240 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleBgColor
),
241 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleBgColor
));
243 oType
.addInitialDesc(pDesc
);
245 pDesc
= new SFString::Description(
246 SFString::getClassType(),
248 "The font family to be used, e.g. \"SANS\", default if unset.\n",
249 FamilyFieldId
, FamilyFieldMask
,
251 (Field::SFDefaultFlags
| Field::FStdAccess
),
252 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleFamily
),
253 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleFamily
));
255 oType
.addInitialDesc(pDesc
);
257 pDesc
= new SFVec2f::Description(
258 SFVec2f::getClassType(),
260 "Offset of the shadow, in pixels.\n",
261 ShadowOffsetFieldId
, ShadowOffsetFieldMask
,
263 (Field::SFDefaultFlags
| Field::FStdAccess
),
264 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleShadowOffset
),
265 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleShadowOffset
));
267 oType
.addInitialDesc(pDesc
);
269 pDesc
= new SFUInt8::Description(
270 SFUInt8::getClassType(),
272 "Simple form of layout management, 0 defaults to left.\n",
273 HorizontalAlignFieldId
, HorizontalAlignFieldMask
,
275 (Field::SFDefaultFlags
| Field::FStdAccess
),
276 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleHorizontalAlign
),
277 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleHorizontalAlign
));
279 oType
.addInitialDesc(pDesc
);
281 pDesc
= new SFUInt8::Description(
282 SFUInt8::getClassType(),
284 "Simple form of layout management, 0 defaults to top.\n",
285 VerticalAlignFieldId
, VerticalAlignFieldMask
,
287 (Field::SFDefaultFlags
| Field::FStdAccess
),
288 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleVerticalAlign
),
289 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleVerticalAlign
));
291 oType
.addInitialDesc(pDesc
);
293 pDesc
= new SFColor4f::Description(
294 SFColor4f::getClassType(),
296 "Color of the border.\n",
297 BorderColorFieldId
, BorderColorFieldMask
,
299 (Field::SFDefaultFlags
| Field::FStdAccess
),
300 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleBorderColor
),
301 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleBorderColor
));
303 oType
.addInitialDesc(pDesc
);
305 pDesc
= new SFVec2f::Description(
306 SFVec2f::getClassType(),
308 "Offset of the border in pixels.\n",
309 BorderOffsetFieldId
, BorderOffsetFieldMask
,
311 (Field::SFDefaultFlags
| Field::FStdAccess
),
312 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleBorderOffset
),
313 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleBorderOffset
));
315 oType
.addInitialDesc(pDesc
);
317 pDesc
= new SFVec2f::Description(
318 SFVec2f::getClassType(),
320 "Text margin in pixels.\n",
321 TextMarginFieldId
, TextMarginFieldMask
,
323 (Field::SFDefaultFlags
| Field::FStdAccess
),
324 static_cast<FieldEditMethodSig
>(&SimpleStatisticsForeground::editHandleTextMargin
),
325 static_cast<FieldGetMethodSig
>(&SimpleStatisticsForeground::getHandleTextMargin
));
327 oType
.addInitialDesc(pDesc
);
331 SimpleStatisticsForegroundBase::TypeObject
SimpleStatisticsForegroundBase::_type(
332 SimpleStatisticsForegroundBase::getClassname(),
333 Inherited::getClassname(),
336 reinterpret_cast<PrototypeCreateF
>(&SimpleStatisticsForegroundBase::createEmptyLocal
),
337 reinterpret_cast<InitContainerF
>(&SimpleStatisticsForeground::initMethod
),
338 reinterpret_cast<ExitContainerF
>(&SimpleStatisticsForeground::exitMethod
),
339 reinterpret_cast<InitalInsertDescFunc
>(
340 reinterpret_cast<void *>(&SimpleStatisticsForeground::classDescInserter
)),
343 "<?xml version=\"1.0\"?>\n"
346 " name=\"SimpleStatisticsForeground\"\n"
347 " parent=\"StatisticsForeground\"\n"
348 " library=\"Util\"\n"
349 " pointerfieldtypes=\"both\"\n"
350 " structure=\"concrete\"\n"
351 " systemcomponent=\"true\"\n"
352 " parentsystemcomponent=\"true\"\n"
353 " decoratable=\"false\"\n"
354 " docGroupBase=\"GrpUtilStatistics\"\n"
356 " SimpleStatisticsForeground displays the Statistics info as simple lines of\n"
359 " OSG::SimpleStatisticsForeground displays the statistics info as simple text\n"
360 " lines. They are displayed using a compiled-in font that can use an arbitrary\n"
361 " color and that can be arbitrarily resized, with the size per line given in\n"
364 " The format of every element is given by a format string for every element that\n"
365 " is directly passed to OSG::StatElem::putToString(), so go there to see the\n"
366 " possible options.\n"
368 " If no elementIDs are given all elements in the OSG::StatCollector are display,\n"
369 " using the default format.\n"
371 " The format string for the given elements are stored in the _mfFormats Field,\n"
372 " the size and color used for all lines in _sfSize and _sfColor.\n"
374 " See \\ref PageSystemWindowForegroundStatisticsSimple\n"
376 "\t name=\"formats\"\n"
377 "\t type=\"std::string\"\n"
378 "\t cardinality=\"multi\"\n"
379 "\t visibility=\"external\"\n"
380 "\t access=\"public\"\n"
382 "\tThe format strings for the given StatElemDesc IDs. If not set, name and\n"
383 "\tvalue are used. \n"
387 "\t type=\"Real32\"\n"
388 "\t cardinality=\"single\"\n"
389 "\t visibility=\"external\"\n"
390 "\t defaultValue=\"16\"\n"
391 "\t access=\"public\"\n"
393 "\tHeight of a single line, in pixel.\n"
396 "\t name=\"color\"\n"
397 "\t type=\"Color4f\"\n"
398 "\t cardinality=\"single\"\n"
399 "\t visibility=\"external\"\n"
400 "\t defaultValue=\"1,1,1,1\"\n"
401 "\t access=\"public\"\n"
403 "\tColor of the text.\n"
406 "\t name=\"shadowColor\"\n"
407 "\t type=\"Color4f\"\n"
408 "\t cardinality=\"single\"\n"
409 "\t visibility=\"external\"\n"
410 "\t defaultValue=\"0,0,0,1\"\n"
411 "\t access=\"public\"\n"
413 "\tColor of the shadow.\n"
416 "\t name=\"bgColor\"\n"
417 "\t type=\"Color4f\"\n"
418 "\t cardinality=\"single\"\n"
419 "\t visibility=\"external\"\n"
420 "\t defaultValue=\"0,0,0,0\"\n"
421 "\t access=\"public\"\n"
423 "\tColor of the background.\n"
426 "\t name=\"family\"\n"
427 "\t type=\"std::string\"\n"
428 "\t cardinality=\"single\"\n"
429 "\t visibility=\"external\"\n"
430 "\t access=\"public\"\n"
432 "\tThe font family to be used, e.g. \"SANS\", default if unset.\n"
435 "\t name=\"shadowOffset\"\n"
436 "\t type=\"Vec2f\"\n"
437 "\t cardinality=\"single\"\n"
438 "\t visibility=\"external\"\n"
439 "\t defaultValue=\"1,-1\"\n"
440 "\t access=\"public\"\n"
442 "\tOffset of the shadow, in pixels.\n"
445 "\t name=\"horizontalAlign\"\n"
446 "\t type=\"UInt8\"\n"
447 "\t cardinality=\"single\"\n"
448 "\t visibility=\"external\"\n"
449 "\t defaultValue=\"0\"\n"
450 "\t access=\"public\"\n"
452 "\tSimple form of layout management, 0 defaults to left.\n"
455 "\t name=\"verticalAlign\"\n"
456 "\t type=\"UInt8\"\n"
457 "\t cardinality=\"single\"\n"
458 "\t visibility=\"external\"\n"
459 "\t defaultValue=\"0\"\n"
460 "\t access=\"public\"\n"
462 "\tSimple form of layout management, 0 defaults to top.\n"
465 "\t name=\"borderColor\"\n"
466 "\t type=\"Color4f\"\n"
467 "\t cardinality=\"single\"\n"
468 "\t visibility=\"external\"\n"
469 "\t defaultValue=\"0,0,0,0\"\n"
470 "\t access=\"public\"\n"
472 "\tColor of the border.\n"
475 "\t name=\"borderOffset\"\n"
476 "\t type=\"Vec2f\"\n"
477 "\t cardinality=\"single\"\n"
478 "\t visibility=\"external\"\n"
479 "\t defaultValue=\"4,4\"\n"
480 "\t access=\"public\"\n"
482 "\tOffset of the border in pixels.\n"
485 "\t name=\"textMargin\"\n"
486 "\t type=\"Vec2f\"\n"
487 "\t cardinality=\"single\"\n"
488 "\t visibility=\"external\"\n"
489 "\t defaultValue=\"0,0\"\n"
490 "\t access=\"public\"\n"
492 "\tText margin in pixels.\n"
494 "</FieldContainer>\n",
495 "SimpleStatisticsForeground displays the Statistics info as simple lines of\n"
498 "OSG::SimpleStatisticsForeground displays the statistics info as simple text\n"
499 "lines. They are displayed using a compiled-in font that can use an arbitrary\n"
500 "color and that can be arbitrarily resized, with the size per line given in\n"
503 "The format of every element is given by a format string for every element that\n"
504 "is directly passed to OSG::StatElem::putToString(), so go there to see the\n"
505 "possible options.\n"
507 "If no elementIDs are given all elements in the OSG::StatCollector are display,\n"
508 "using the default format.\n"
510 "The format string for the given elements are stored in the _mfFormats Field,\n"
511 "the size and color used for all lines in _sfSize and _sfColor.\n"
513 "See \\ref PageSystemWindowForegroundStatisticsSimple\n"
516 /*------------------------------ get -----------------------------------*/
518 FieldContainerType
&SimpleStatisticsForegroundBase::getType(void)
523 const FieldContainerType
&SimpleStatisticsForegroundBase::getType(void) const
528 UInt32
SimpleStatisticsForegroundBase::getContainerSize(void) const
530 return sizeof(SimpleStatisticsForeground
);
533 /*------------------------- decorator get ------------------------------*/
536 MFString
*SimpleStatisticsForegroundBase::editMFFormats(void)
538 editMField(FormatsFieldMask
, _mfFormats
);
543 const MFString
*SimpleStatisticsForegroundBase::getMFFormats(void) const
549 SFReal32
*SimpleStatisticsForegroundBase::editSFSize(void)
551 editSField(SizeFieldMask
);
556 const SFReal32
*SimpleStatisticsForegroundBase::getSFSize(void) const
562 SFColor4f
*SimpleStatisticsForegroundBase::editSFColor(void)
564 editSField(ColorFieldMask
);
569 const SFColor4f
*SimpleStatisticsForegroundBase::getSFColor(void) const
575 SFColor4f
*SimpleStatisticsForegroundBase::editSFShadowColor(void)
577 editSField(ShadowColorFieldMask
);
579 return &_sfShadowColor
;
582 const SFColor4f
*SimpleStatisticsForegroundBase::getSFShadowColor(void) const
584 return &_sfShadowColor
;
588 SFColor4f
*SimpleStatisticsForegroundBase::editSFBgColor(void)
590 editSField(BgColorFieldMask
);
595 const SFColor4f
*SimpleStatisticsForegroundBase::getSFBgColor(void) const
601 SFString
*SimpleStatisticsForegroundBase::editSFFamily(void)
603 editSField(FamilyFieldMask
);
608 const SFString
*SimpleStatisticsForegroundBase::getSFFamily(void) const
614 SFVec2f
*SimpleStatisticsForegroundBase::editSFShadowOffset(void)
616 editSField(ShadowOffsetFieldMask
);
618 return &_sfShadowOffset
;
621 const SFVec2f
*SimpleStatisticsForegroundBase::getSFShadowOffset(void) const
623 return &_sfShadowOffset
;
627 SFUInt8
*SimpleStatisticsForegroundBase::editSFHorizontalAlign(void)
629 editSField(HorizontalAlignFieldMask
);
631 return &_sfHorizontalAlign
;
634 const SFUInt8
*SimpleStatisticsForegroundBase::getSFHorizontalAlign(void) const
636 return &_sfHorizontalAlign
;
640 SFUInt8
*SimpleStatisticsForegroundBase::editSFVerticalAlign(void)
642 editSField(VerticalAlignFieldMask
);
644 return &_sfVerticalAlign
;
647 const SFUInt8
*SimpleStatisticsForegroundBase::getSFVerticalAlign(void) const
649 return &_sfVerticalAlign
;
653 SFColor4f
*SimpleStatisticsForegroundBase::editSFBorderColor(void)
655 editSField(BorderColorFieldMask
);
657 return &_sfBorderColor
;
660 const SFColor4f
*SimpleStatisticsForegroundBase::getSFBorderColor(void) const
662 return &_sfBorderColor
;
666 SFVec2f
*SimpleStatisticsForegroundBase::editSFBorderOffset(void)
668 editSField(BorderOffsetFieldMask
);
670 return &_sfBorderOffset
;
673 const SFVec2f
*SimpleStatisticsForegroundBase::getSFBorderOffset(void) const
675 return &_sfBorderOffset
;
679 SFVec2f
*SimpleStatisticsForegroundBase::editSFTextMargin(void)
681 editSField(TextMarginFieldMask
);
683 return &_sfTextMargin
;
686 const SFVec2f
*SimpleStatisticsForegroundBase::getSFTextMargin(void) const
688 return &_sfTextMargin
;
696 /*------------------------------ access -----------------------------------*/
698 SizeT
SimpleStatisticsForegroundBase::getBinSize(ConstFieldMaskArg whichField
)
700 SizeT returnValue
= Inherited::getBinSize(whichField
);
702 if(FieldBits::NoField
!= (FormatsFieldMask
& whichField
))
704 returnValue
+= _mfFormats
.getBinSize();
706 if(FieldBits::NoField
!= (SizeFieldMask
& whichField
))
708 returnValue
+= _sfSize
.getBinSize();
710 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
712 returnValue
+= _sfColor
.getBinSize();
714 if(FieldBits::NoField
!= (ShadowColorFieldMask
& whichField
))
716 returnValue
+= _sfShadowColor
.getBinSize();
718 if(FieldBits::NoField
!= (BgColorFieldMask
& whichField
))
720 returnValue
+= _sfBgColor
.getBinSize();
722 if(FieldBits::NoField
!= (FamilyFieldMask
& whichField
))
724 returnValue
+= _sfFamily
.getBinSize();
726 if(FieldBits::NoField
!= (ShadowOffsetFieldMask
& whichField
))
728 returnValue
+= _sfShadowOffset
.getBinSize();
730 if(FieldBits::NoField
!= (HorizontalAlignFieldMask
& whichField
))
732 returnValue
+= _sfHorizontalAlign
.getBinSize();
734 if(FieldBits::NoField
!= (VerticalAlignFieldMask
& whichField
))
736 returnValue
+= _sfVerticalAlign
.getBinSize();
738 if(FieldBits::NoField
!= (BorderColorFieldMask
& whichField
))
740 returnValue
+= _sfBorderColor
.getBinSize();
742 if(FieldBits::NoField
!= (BorderOffsetFieldMask
& whichField
))
744 returnValue
+= _sfBorderOffset
.getBinSize();
746 if(FieldBits::NoField
!= (TextMarginFieldMask
& whichField
))
748 returnValue
+= _sfTextMargin
.getBinSize();
754 void SimpleStatisticsForegroundBase::copyToBin(BinaryDataHandler
&pMem
,
755 ConstFieldMaskArg whichField
)
757 Inherited::copyToBin(pMem
, whichField
);
759 if(FieldBits::NoField
!= (FormatsFieldMask
& whichField
))
761 _mfFormats
.copyToBin(pMem
);
763 if(FieldBits::NoField
!= (SizeFieldMask
& whichField
))
765 _sfSize
.copyToBin(pMem
);
767 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
769 _sfColor
.copyToBin(pMem
);
771 if(FieldBits::NoField
!= (ShadowColorFieldMask
& whichField
))
773 _sfShadowColor
.copyToBin(pMem
);
775 if(FieldBits::NoField
!= (BgColorFieldMask
& whichField
))
777 _sfBgColor
.copyToBin(pMem
);
779 if(FieldBits::NoField
!= (FamilyFieldMask
& whichField
))
781 _sfFamily
.copyToBin(pMem
);
783 if(FieldBits::NoField
!= (ShadowOffsetFieldMask
& whichField
))
785 _sfShadowOffset
.copyToBin(pMem
);
787 if(FieldBits::NoField
!= (HorizontalAlignFieldMask
& whichField
))
789 _sfHorizontalAlign
.copyToBin(pMem
);
791 if(FieldBits::NoField
!= (VerticalAlignFieldMask
& whichField
))
793 _sfVerticalAlign
.copyToBin(pMem
);
795 if(FieldBits::NoField
!= (BorderColorFieldMask
& whichField
))
797 _sfBorderColor
.copyToBin(pMem
);
799 if(FieldBits::NoField
!= (BorderOffsetFieldMask
& whichField
))
801 _sfBorderOffset
.copyToBin(pMem
);
803 if(FieldBits::NoField
!= (TextMarginFieldMask
& whichField
))
805 _sfTextMargin
.copyToBin(pMem
);
809 void SimpleStatisticsForegroundBase::copyFromBin(BinaryDataHandler
&pMem
,
810 ConstFieldMaskArg whichField
)
812 Inherited::copyFromBin(pMem
, whichField
);
814 if(FieldBits::NoField
!= (FormatsFieldMask
& whichField
))
816 editMField(FormatsFieldMask
, _mfFormats
);
817 _mfFormats
.copyFromBin(pMem
);
819 if(FieldBits::NoField
!= (SizeFieldMask
& whichField
))
821 editSField(SizeFieldMask
);
822 _sfSize
.copyFromBin(pMem
);
824 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
826 editSField(ColorFieldMask
);
827 _sfColor
.copyFromBin(pMem
);
829 if(FieldBits::NoField
!= (ShadowColorFieldMask
& whichField
))
831 editSField(ShadowColorFieldMask
);
832 _sfShadowColor
.copyFromBin(pMem
);
834 if(FieldBits::NoField
!= (BgColorFieldMask
& whichField
))
836 editSField(BgColorFieldMask
);
837 _sfBgColor
.copyFromBin(pMem
);
839 if(FieldBits::NoField
!= (FamilyFieldMask
& whichField
))
841 editSField(FamilyFieldMask
);
842 _sfFamily
.copyFromBin(pMem
);
844 if(FieldBits::NoField
!= (ShadowOffsetFieldMask
& whichField
))
846 editSField(ShadowOffsetFieldMask
);
847 _sfShadowOffset
.copyFromBin(pMem
);
849 if(FieldBits::NoField
!= (HorizontalAlignFieldMask
& whichField
))
851 editSField(HorizontalAlignFieldMask
);
852 _sfHorizontalAlign
.copyFromBin(pMem
);
854 if(FieldBits::NoField
!= (VerticalAlignFieldMask
& whichField
))
856 editSField(VerticalAlignFieldMask
);
857 _sfVerticalAlign
.copyFromBin(pMem
);
859 if(FieldBits::NoField
!= (BorderColorFieldMask
& whichField
))
861 editSField(BorderColorFieldMask
);
862 _sfBorderColor
.copyFromBin(pMem
);
864 if(FieldBits::NoField
!= (BorderOffsetFieldMask
& whichField
))
866 editSField(BorderOffsetFieldMask
);
867 _sfBorderOffset
.copyFromBin(pMem
);
869 if(FieldBits::NoField
!= (TextMarginFieldMask
& whichField
))
871 editSField(TextMarginFieldMask
);
872 _sfTextMargin
.copyFromBin(pMem
);
876 //! create a new instance of the class
877 SimpleStatisticsForegroundTransitPtr
SimpleStatisticsForegroundBase::createLocal(BitVector bFlags
)
879 SimpleStatisticsForegroundTransitPtr fc
;
881 if(getClassType().getPrototype() != NULL
)
883 FieldContainerTransitPtr tmpPtr
=
884 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
886 fc
= dynamic_pointer_cast
<SimpleStatisticsForeground
>(tmpPtr
);
892 //! create a new instance of the class, copy the container flags
893 SimpleStatisticsForegroundTransitPtr
SimpleStatisticsForegroundBase::createDependent(BitVector bFlags
)
895 SimpleStatisticsForegroundTransitPtr fc
;
897 if(getClassType().getPrototype() != NULL
)
899 FieldContainerTransitPtr tmpPtr
=
900 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
902 fc
= dynamic_pointer_cast
<SimpleStatisticsForeground
>(tmpPtr
);
908 //! create a new instance of the class
909 SimpleStatisticsForegroundTransitPtr
SimpleStatisticsForegroundBase::create(void)
911 SimpleStatisticsForegroundTransitPtr fc
;
913 if(getClassType().getPrototype() != NULL
)
915 FieldContainerTransitPtr tmpPtr
=
916 getClassType().getPrototype()-> shallowCopy();
918 fc
= dynamic_pointer_cast
<SimpleStatisticsForeground
>(tmpPtr
);
924 SimpleStatisticsForeground
*SimpleStatisticsForegroundBase::createEmptyLocal(BitVector bFlags
)
926 SimpleStatisticsForeground
*returnValue
;
928 newPtr
<SimpleStatisticsForeground
>(returnValue
, bFlags
);
930 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
935 //! create an empty new instance of the class, do not copy the prototype
936 SimpleStatisticsForeground
*SimpleStatisticsForegroundBase::createEmpty(void)
938 SimpleStatisticsForeground
*returnValue
;
940 newPtr
<SimpleStatisticsForeground
>(returnValue
, Thread::getCurrentLocalFlags());
942 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
943 ~Thread::getCurrentLocalFlags();
949 FieldContainerTransitPtr
SimpleStatisticsForegroundBase::shallowCopyLocal(
950 BitVector bFlags
) const
952 SimpleStatisticsForeground
*tmpPtr
;
954 newPtr(tmpPtr
, dynamic_cast<const SimpleStatisticsForeground
*>(this), bFlags
);
956 FieldContainerTransitPtr
returnValue(tmpPtr
);
958 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
963 FieldContainerTransitPtr
SimpleStatisticsForegroundBase::shallowCopyDependent(
964 BitVector bFlags
) const
966 SimpleStatisticsForeground
*tmpPtr
;
968 newPtr(tmpPtr
, dynamic_cast<const SimpleStatisticsForeground
*>(this), ~bFlags
);
970 FieldContainerTransitPtr
returnValue(tmpPtr
);
972 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
977 FieldContainerTransitPtr
SimpleStatisticsForegroundBase::shallowCopy(void) const
979 SimpleStatisticsForeground
*tmpPtr
;
982 dynamic_cast<const SimpleStatisticsForeground
*>(this),
983 Thread::getCurrentLocalFlags());
985 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
987 FieldContainerTransitPtr
returnValue(tmpPtr
);
995 /*------------------------- constructors ----------------------------------*/
997 SimpleStatisticsForegroundBase::SimpleStatisticsForegroundBase(void) :
1000 _sfSize (Real32(16)),
1001 _sfColor (Color4f(1,1,1,1)),
1002 _sfShadowColor (Color4f(0,0,0,1)),
1003 _sfBgColor (Color4f(0,0,0,0)),
1005 _sfShadowOffset (Vec2f(1,-1)),
1006 _sfHorizontalAlign (UInt8(0)),
1007 _sfVerticalAlign (UInt8(0)),
1008 _sfBorderColor (Color4f(0,0,0,0)),
1009 _sfBorderOffset (Vec2f(4,4)),
1010 _sfTextMargin (Vec2f(0,0))
1014 SimpleStatisticsForegroundBase::SimpleStatisticsForegroundBase(const SimpleStatisticsForegroundBase
&source
) :
1016 _mfFormats (source
._mfFormats
),
1017 _sfSize (source
._sfSize
),
1018 _sfColor (source
._sfColor
),
1019 _sfShadowColor (source
._sfShadowColor
),
1020 _sfBgColor (source
._sfBgColor
),
1021 _sfFamily (source
._sfFamily
),
1022 _sfShadowOffset (source
._sfShadowOffset
),
1023 _sfHorizontalAlign (source
._sfHorizontalAlign
),
1024 _sfVerticalAlign (source
._sfVerticalAlign
),
1025 _sfBorderColor (source
._sfBorderColor
),
1026 _sfBorderOffset (source
._sfBorderOffset
),
1027 _sfTextMargin (source
._sfTextMargin
)
1032 /*-------------------------- destructors ----------------------------------*/
1034 SimpleStatisticsForegroundBase::~SimpleStatisticsForegroundBase(void)
1039 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleFormats (void) const
1041 MFString::GetHandlePtr
returnValue(
1042 new MFString::GetHandle(
1044 this->getType().getFieldDesc(FormatsFieldId
),
1045 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1050 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleFormats (void)
1052 MFString::EditHandlePtr
returnValue(
1053 new MFString::EditHandle(
1055 this->getType().getFieldDesc(FormatsFieldId
),
1059 editMField(FormatsFieldMask
, _mfFormats
);
1064 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleSize (void) const
1066 SFReal32::GetHandlePtr
returnValue(
1067 new SFReal32::GetHandle(
1069 this->getType().getFieldDesc(SizeFieldId
),
1070 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1075 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleSize (void)
1077 SFReal32::EditHandlePtr
returnValue(
1078 new SFReal32::EditHandle(
1080 this->getType().getFieldDesc(SizeFieldId
),
1084 editSField(SizeFieldMask
);
1089 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleColor (void) const
1091 SFColor4f::GetHandlePtr
returnValue(
1092 new SFColor4f::GetHandle(
1094 this->getType().getFieldDesc(ColorFieldId
),
1095 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1100 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleColor (void)
1102 SFColor4f::EditHandlePtr
returnValue(
1103 new SFColor4f::EditHandle(
1105 this->getType().getFieldDesc(ColorFieldId
),
1109 editSField(ColorFieldMask
);
1114 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleShadowColor (void) const
1116 SFColor4f::GetHandlePtr
returnValue(
1117 new SFColor4f::GetHandle(
1119 this->getType().getFieldDesc(ShadowColorFieldId
),
1120 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1125 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleShadowColor (void)
1127 SFColor4f::EditHandlePtr
returnValue(
1128 new SFColor4f::EditHandle(
1130 this->getType().getFieldDesc(ShadowColorFieldId
),
1134 editSField(ShadowColorFieldMask
);
1139 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleBgColor (void) const
1141 SFColor4f::GetHandlePtr
returnValue(
1142 new SFColor4f::GetHandle(
1144 this->getType().getFieldDesc(BgColorFieldId
),
1145 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1150 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleBgColor (void)
1152 SFColor4f::EditHandlePtr
returnValue(
1153 new SFColor4f::EditHandle(
1155 this->getType().getFieldDesc(BgColorFieldId
),
1159 editSField(BgColorFieldMask
);
1164 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleFamily (void) const
1166 SFString::GetHandlePtr
returnValue(
1167 new SFString::GetHandle(
1169 this->getType().getFieldDesc(FamilyFieldId
),
1170 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1175 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleFamily (void)
1177 SFString::EditHandlePtr
returnValue(
1178 new SFString::EditHandle(
1180 this->getType().getFieldDesc(FamilyFieldId
),
1184 editSField(FamilyFieldMask
);
1189 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleShadowOffset (void) const
1191 SFVec2f::GetHandlePtr
returnValue(
1192 new SFVec2f::GetHandle(
1194 this->getType().getFieldDesc(ShadowOffsetFieldId
),
1195 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1200 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleShadowOffset (void)
1202 SFVec2f::EditHandlePtr
returnValue(
1203 new SFVec2f::EditHandle(
1205 this->getType().getFieldDesc(ShadowOffsetFieldId
),
1209 editSField(ShadowOffsetFieldMask
);
1214 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleHorizontalAlign (void) const
1216 SFUInt8::GetHandlePtr
returnValue(
1217 new SFUInt8::GetHandle(
1218 &_sfHorizontalAlign
,
1219 this->getType().getFieldDesc(HorizontalAlignFieldId
),
1220 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1225 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleHorizontalAlign(void)
1227 SFUInt8::EditHandlePtr
returnValue(
1228 new SFUInt8::EditHandle(
1229 &_sfHorizontalAlign
,
1230 this->getType().getFieldDesc(HorizontalAlignFieldId
),
1234 editSField(HorizontalAlignFieldMask
);
1239 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleVerticalAlign (void) const
1241 SFUInt8::GetHandlePtr
returnValue(
1242 new SFUInt8::GetHandle(
1244 this->getType().getFieldDesc(VerticalAlignFieldId
),
1245 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1250 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleVerticalAlign (void)
1252 SFUInt8::EditHandlePtr
returnValue(
1253 new SFUInt8::EditHandle(
1255 this->getType().getFieldDesc(VerticalAlignFieldId
),
1259 editSField(VerticalAlignFieldMask
);
1264 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleBorderColor (void) const
1266 SFColor4f::GetHandlePtr
returnValue(
1267 new SFColor4f::GetHandle(
1269 this->getType().getFieldDesc(BorderColorFieldId
),
1270 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1275 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleBorderColor (void)
1277 SFColor4f::EditHandlePtr
returnValue(
1278 new SFColor4f::EditHandle(
1280 this->getType().getFieldDesc(BorderColorFieldId
),
1284 editSField(BorderColorFieldMask
);
1289 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleBorderOffset (void) const
1291 SFVec2f::GetHandlePtr
returnValue(
1292 new SFVec2f::GetHandle(
1294 this->getType().getFieldDesc(BorderOffsetFieldId
),
1295 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1300 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleBorderOffset (void)
1302 SFVec2f::EditHandlePtr
returnValue(
1303 new SFVec2f::EditHandle(
1305 this->getType().getFieldDesc(BorderOffsetFieldId
),
1309 editSField(BorderOffsetFieldMask
);
1314 GetFieldHandlePtr
SimpleStatisticsForegroundBase::getHandleTextMargin (void) const
1316 SFVec2f::GetHandlePtr
returnValue(
1317 new SFVec2f::GetHandle(
1319 this->getType().getFieldDesc(TextMarginFieldId
),
1320 const_cast<SimpleStatisticsForegroundBase
*>(this)));
1325 EditFieldHandlePtr
SimpleStatisticsForegroundBase::editHandleTextMargin (void)
1327 SFVec2f::EditHandlePtr
returnValue(
1328 new SFVec2f::EditHandle(
1330 this->getType().getFieldDesc(TextMarginFieldId
),
1334 editSField(TextMarginFieldMask
);
1340 #ifdef OSG_MT_CPTR_ASPECT
1341 void SimpleStatisticsForegroundBase::execSyncV( FieldContainer
&oFrom
,
1342 ConstFieldMaskArg whichField
,
1343 AspectOffsetStore
&oOffsets
,
1344 ConstFieldMaskArg syncMode
,
1345 const UInt32 uiSyncInfo
)
1347 SimpleStatisticsForeground
*pThis
= static_cast<SimpleStatisticsForeground
*>(this);
1349 pThis
->execSync(static_cast<SimpleStatisticsForeground
*>(&oFrom
),
1358 #ifdef OSG_MT_CPTR_ASPECT
1359 FieldContainer
*SimpleStatisticsForegroundBase::createAspectCopy(
1360 const FieldContainer
*pRefAspect
) const
1362 SimpleStatisticsForeground
*returnValue
;
1364 newAspectCopy(returnValue
,
1365 dynamic_cast<const SimpleStatisticsForeground
*>(pRefAspect
),
1366 dynamic_cast<const SimpleStatisticsForeground
*>(this));
1372 void SimpleStatisticsForegroundBase::resolveLinks(void)
1374 Inherited::resolveLinks();
1376 #ifdef OSG_MT_CPTR_ASPECT
1377 AspectOffsetStore oOffsets
;
1379 _pAspectStore
->fillOffsetArray(oOffsets
, this);
1382 #ifdef OSG_MT_CPTR_ASPECT
1383 _mfFormats
.terminateShare(Thread::getCurrentAspect(),