changed: gcc8 base update
[opensg.git] / Source / System / Statistics / Foregrounds / OSGSimpleStatisticsForegroundBase.cpp
blob7e59bcdad7994088d1939cc7013a2b8a4ca9e2e8
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 SimpleStatisticsForeground!
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 "OSGSimpleStatisticsForegroundBase.h"
67 #include "OSGSimpleStatisticsForeground.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::SimpleStatisticsForeground
78 SimpleStatisticsForeground displays the Statistics info as simple lines of
79 text.
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
84 pixel.
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
88 possible options.
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
105 value are used.
108 /*! \var Real32 SimpleStatisticsForegroundBase::_sfSize
109 Height of a single line, in pixel.
112 /*! \var Color4f SimpleStatisticsForegroundBase::_sfColor
113 Color of the text.
116 /*! \var Color4f SimpleStatisticsForegroundBase::_sfShadowColor
117 Color of the shadow.
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
141 Color of the border.
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(),
162 nsOSG);
163 #endif
165 OSG_FIELDTRAITS_GETTYPE_NS(SimpleStatisticsForeground *, nsOSG)
167 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
168 SimpleStatisticsForeground *,
169 nsOSG)
171 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
172 SimpleStatisticsForeground *,
173 nsOSG)
175 /***************************************************************************\
176 * Field Description *
177 \***************************************************************************/
179 void SimpleStatisticsForegroundBase::classDescInserter(TypeObject &oType)
181 FieldDescriptionBase *pDesc = NULL;
184 pDesc = new MFString::Description(
185 MFString::getClassType(),
186 "formats",
187 "The format strings for the given StatElemDesc IDs. If not set, name and\n"
188 "value are used. \n",
189 FormatsFieldId, FormatsFieldMask,
190 false,
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(),
199 "size",
200 "Height of a single line, in pixel.\n",
201 SizeFieldId, SizeFieldMask,
202 false,
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(),
211 "color",
212 "Color of the text.\n",
213 ColorFieldId, ColorFieldMask,
214 false,
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(),
223 "shadowColor",
224 "Color of the shadow.\n",
225 ShadowColorFieldId, ShadowColorFieldMask,
226 false,
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(),
235 "bgColor",
236 "Color of the background.\n",
237 BgColorFieldId, BgColorFieldMask,
238 false,
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(),
247 "family",
248 "The font family to be used, e.g. \"SANS\", default if unset.\n",
249 FamilyFieldId, FamilyFieldMask,
250 false,
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(),
259 "shadowOffset",
260 "Offset of the shadow, in pixels.\n",
261 ShadowOffsetFieldId, ShadowOffsetFieldMask,
262 false,
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(),
271 "horizontalAlign",
272 "Simple form of layout management, 0 defaults to left.\n",
273 HorizontalAlignFieldId, HorizontalAlignFieldMask,
274 false,
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(),
283 "verticalAlign",
284 "Simple form of layout management, 0 defaults to top.\n",
285 VerticalAlignFieldId, VerticalAlignFieldMask,
286 false,
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(),
295 "borderColor",
296 "Color of the border.\n",
297 BorderColorFieldId, BorderColorFieldMask,
298 false,
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(),
307 "borderOffset",
308 "Offset of the border in pixels.\n",
309 BorderOffsetFieldId, BorderOffsetFieldMask,
310 false,
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(),
319 "textMargin",
320 "Text margin in pixels.\n",
321 TextMarginFieldId, TextMarginFieldMask,
322 false,
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(),
334 "NULL",
335 nsOSG, //Namespace
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)),
341 false,
343 "<?xml version=\"1.0\"?>\n"
344 "\n"
345 "<FieldContainer\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"
355 " >\n"
356 " SimpleStatisticsForeground displays the Statistics info as simple lines of\n"
357 " text. \n"
358 "\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"
362 " pixel.\n"
363 "\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"
367 "\n"
368 " If no elementIDs are given all elements in the OSG::StatCollector are display,\n"
369 " using the default format.\n"
370 "\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"
373 "\n"
374 " See \\ref PageSystemWindowForegroundStatisticsSimple\n"
375 " <Field\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"
381 "\t >\n"
382 "\tThe format strings for the given StatElemDesc IDs. If not set, name and\n"
383 "\tvalue are used. \n"
384 " </Field>\n"
385 " <Field\n"
386 "\t name=\"size\"\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"
392 "\t >\n"
393 "\tHeight of a single line, in pixel.\n"
394 " </Field>\n"
395 " <Field\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"
402 "\t >\n"
403 "\tColor of the text.\n"
404 " </Field>\n"
405 " <Field\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"
412 "\t >\n"
413 "\tColor of the shadow.\n"
414 " </Field>\n"
415 " <Field\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"
422 "\t >\n"
423 "\tColor of the background.\n"
424 " </Field>\n"
425 " <Field\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"
431 "\t >\n"
432 "\tThe font family to be used, e.g. \"SANS\", default if unset.\n"
433 " </Field>\n"
434 " <Field\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"
441 "\t >\n"
442 "\tOffset of the shadow, in pixels.\n"
443 " </Field>\n"
444 " <Field\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"
451 "\t >\n"
452 "\tSimple form of layout management, 0 defaults to left.\n"
453 " </Field>\n"
454 " <Field\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"
461 "\t >\n"
462 "\tSimple form of layout management, 0 defaults to top.\n"
463 " </Field>\n"
464 " <Field\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"
471 "\t >\n"
472 "\tColor of the border.\n"
473 " </Field>\n"
474 " <Field\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"
481 "\t >\n"
482 "\tOffset of the border in pixels.\n"
483 " </Field>\n"
484 " <Field\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"
491 "\t >\n"
492 "\tText margin in pixels.\n"
493 " </Field>\n"
494 "</FieldContainer>\n",
495 "SimpleStatisticsForeground displays the Statistics info as simple lines of\n"
496 "text. \n"
497 "\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"
501 "pixel.\n"
502 "\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"
506 "\n"
507 "If no elementIDs are given all elements in the OSG::StatCollector are display,\n"
508 "using the default format.\n"
509 "\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"
512 "\n"
513 "See \\ref PageSystemWindowForegroundStatisticsSimple\n"
516 /*------------------------------ get -----------------------------------*/
518 FieldContainerType &SimpleStatisticsForegroundBase::getType(void)
520 return _type;
523 const FieldContainerType &SimpleStatisticsForegroundBase::getType(void) const
525 return _type;
528 UInt32 SimpleStatisticsForegroundBase::getContainerSize(void) const
530 return sizeof(SimpleStatisticsForeground);
533 /*------------------------- decorator get ------------------------------*/
536 MFString *SimpleStatisticsForegroundBase::editMFFormats(void)
538 editMField(FormatsFieldMask, _mfFormats);
540 return &_mfFormats;
543 const MFString *SimpleStatisticsForegroundBase::getMFFormats(void) const
545 return &_mfFormats;
549 SFReal32 *SimpleStatisticsForegroundBase::editSFSize(void)
551 editSField(SizeFieldMask);
553 return &_sfSize;
556 const SFReal32 *SimpleStatisticsForegroundBase::getSFSize(void) const
558 return &_sfSize;
562 SFColor4f *SimpleStatisticsForegroundBase::editSFColor(void)
564 editSField(ColorFieldMask);
566 return &_sfColor;
569 const SFColor4f *SimpleStatisticsForegroundBase::getSFColor(void) const
571 return &_sfColor;
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);
592 return &_sfBgColor;
595 const SFColor4f *SimpleStatisticsForegroundBase::getSFBgColor(void) const
597 return &_sfBgColor;
601 SFString *SimpleStatisticsForegroundBase::editSFFamily(void)
603 editSField(FamilyFieldMask);
605 return &_sfFamily;
608 const SFString *SimpleStatisticsForegroundBase::getSFFamily(void) const
610 return &_sfFamily;
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();
751 return returnValue;
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);
889 return fc;
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);
905 return fc;
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);
921 return fc;
924 SimpleStatisticsForeground *SimpleStatisticsForegroundBase::createEmptyLocal(BitVector bFlags)
926 SimpleStatisticsForeground *returnValue;
928 newPtr<SimpleStatisticsForeground>(returnValue, bFlags);
930 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
932 return returnValue;
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();
945 return returnValue;
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;
960 return returnValue;
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;
974 return returnValue;
977 FieldContainerTransitPtr SimpleStatisticsForegroundBase::shallowCopy(void) const
979 SimpleStatisticsForeground *tmpPtr;
981 newPtr(tmpPtr,
982 dynamic_cast<const SimpleStatisticsForeground *>(this),
983 Thread::getCurrentLocalFlags());
985 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
987 FieldContainerTransitPtr returnValue(tmpPtr);
989 return returnValue;
995 /*------------------------- constructors ----------------------------------*/
997 SimpleStatisticsForegroundBase::SimpleStatisticsForegroundBase(void) :
998 Inherited(),
999 _mfFormats (),
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)),
1004 _sfFamily (),
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) :
1015 Inherited(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(
1043 &_mfFormats,
1044 this->getType().getFieldDesc(FormatsFieldId),
1045 const_cast<SimpleStatisticsForegroundBase *>(this)));
1047 return returnValue;
1050 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleFormats (void)
1052 MFString::EditHandlePtr returnValue(
1053 new MFString::EditHandle(
1054 &_mfFormats,
1055 this->getType().getFieldDesc(FormatsFieldId),
1056 this));
1059 editMField(FormatsFieldMask, _mfFormats);
1061 return returnValue;
1064 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleSize (void) const
1066 SFReal32::GetHandlePtr returnValue(
1067 new SFReal32::GetHandle(
1068 &_sfSize,
1069 this->getType().getFieldDesc(SizeFieldId),
1070 const_cast<SimpleStatisticsForegroundBase *>(this)));
1072 return returnValue;
1075 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleSize (void)
1077 SFReal32::EditHandlePtr returnValue(
1078 new SFReal32::EditHandle(
1079 &_sfSize,
1080 this->getType().getFieldDesc(SizeFieldId),
1081 this));
1084 editSField(SizeFieldMask);
1086 return returnValue;
1089 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleColor (void) const
1091 SFColor4f::GetHandlePtr returnValue(
1092 new SFColor4f::GetHandle(
1093 &_sfColor,
1094 this->getType().getFieldDesc(ColorFieldId),
1095 const_cast<SimpleStatisticsForegroundBase *>(this)));
1097 return returnValue;
1100 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleColor (void)
1102 SFColor4f::EditHandlePtr returnValue(
1103 new SFColor4f::EditHandle(
1104 &_sfColor,
1105 this->getType().getFieldDesc(ColorFieldId),
1106 this));
1109 editSField(ColorFieldMask);
1111 return returnValue;
1114 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleShadowColor (void) const
1116 SFColor4f::GetHandlePtr returnValue(
1117 new SFColor4f::GetHandle(
1118 &_sfShadowColor,
1119 this->getType().getFieldDesc(ShadowColorFieldId),
1120 const_cast<SimpleStatisticsForegroundBase *>(this)));
1122 return returnValue;
1125 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleShadowColor (void)
1127 SFColor4f::EditHandlePtr returnValue(
1128 new SFColor4f::EditHandle(
1129 &_sfShadowColor,
1130 this->getType().getFieldDesc(ShadowColorFieldId),
1131 this));
1134 editSField(ShadowColorFieldMask);
1136 return returnValue;
1139 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleBgColor (void) const
1141 SFColor4f::GetHandlePtr returnValue(
1142 new SFColor4f::GetHandle(
1143 &_sfBgColor,
1144 this->getType().getFieldDesc(BgColorFieldId),
1145 const_cast<SimpleStatisticsForegroundBase *>(this)));
1147 return returnValue;
1150 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleBgColor (void)
1152 SFColor4f::EditHandlePtr returnValue(
1153 new SFColor4f::EditHandle(
1154 &_sfBgColor,
1155 this->getType().getFieldDesc(BgColorFieldId),
1156 this));
1159 editSField(BgColorFieldMask);
1161 return returnValue;
1164 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleFamily (void) const
1166 SFString::GetHandlePtr returnValue(
1167 new SFString::GetHandle(
1168 &_sfFamily,
1169 this->getType().getFieldDesc(FamilyFieldId),
1170 const_cast<SimpleStatisticsForegroundBase *>(this)));
1172 return returnValue;
1175 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleFamily (void)
1177 SFString::EditHandlePtr returnValue(
1178 new SFString::EditHandle(
1179 &_sfFamily,
1180 this->getType().getFieldDesc(FamilyFieldId),
1181 this));
1184 editSField(FamilyFieldMask);
1186 return returnValue;
1189 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleShadowOffset (void) const
1191 SFVec2f::GetHandlePtr returnValue(
1192 new SFVec2f::GetHandle(
1193 &_sfShadowOffset,
1194 this->getType().getFieldDesc(ShadowOffsetFieldId),
1195 const_cast<SimpleStatisticsForegroundBase *>(this)));
1197 return returnValue;
1200 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleShadowOffset (void)
1202 SFVec2f::EditHandlePtr returnValue(
1203 new SFVec2f::EditHandle(
1204 &_sfShadowOffset,
1205 this->getType().getFieldDesc(ShadowOffsetFieldId),
1206 this));
1209 editSField(ShadowOffsetFieldMask);
1211 return returnValue;
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)));
1222 return returnValue;
1225 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleHorizontalAlign(void)
1227 SFUInt8::EditHandlePtr returnValue(
1228 new SFUInt8::EditHandle(
1229 &_sfHorizontalAlign,
1230 this->getType().getFieldDesc(HorizontalAlignFieldId),
1231 this));
1234 editSField(HorizontalAlignFieldMask);
1236 return returnValue;
1239 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleVerticalAlign (void) const
1241 SFUInt8::GetHandlePtr returnValue(
1242 new SFUInt8::GetHandle(
1243 &_sfVerticalAlign,
1244 this->getType().getFieldDesc(VerticalAlignFieldId),
1245 const_cast<SimpleStatisticsForegroundBase *>(this)));
1247 return returnValue;
1250 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleVerticalAlign (void)
1252 SFUInt8::EditHandlePtr returnValue(
1253 new SFUInt8::EditHandle(
1254 &_sfVerticalAlign,
1255 this->getType().getFieldDesc(VerticalAlignFieldId),
1256 this));
1259 editSField(VerticalAlignFieldMask);
1261 return returnValue;
1264 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleBorderColor (void) const
1266 SFColor4f::GetHandlePtr returnValue(
1267 new SFColor4f::GetHandle(
1268 &_sfBorderColor,
1269 this->getType().getFieldDesc(BorderColorFieldId),
1270 const_cast<SimpleStatisticsForegroundBase *>(this)));
1272 return returnValue;
1275 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleBorderColor (void)
1277 SFColor4f::EditHandlePtr returnValue(
1278 new SFColor4f::EditHandle(
1279 &_sfBorderColor,
1280 this->getType().getFieldDesc(BorderColorFieldId),
1281 this));
1284 editSField(BorderColorFieldMask);
1286 return returnValue;
1289 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleBorderOffset (void) const
1291 SFVec2f::GetHandlePtr returnValue(
1292 new SFVec2f::GetHandle(
1293 &_sfBorderOffset,
1294 this->getType().getFieldDesc(BorderOffsetFieldId),
1295 const_cast<SimpleStatisticsForegroundBase *>(this)));
1297 return returnValue;
1300 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleBorderOffset (void)
1302 SFVec2f::EditHandlePtr returnValue(
1303 new SFVec2f::EditHandle(
1304 &_sfBorderOffset,
1305 this->getType().getFieldDesc(BorderOffsetFieldId),
1306 this));
1309 editSField(BorderOffsetFieldMask);
1311 return returnValue;
1314 GetFieldHandlePtr SimpleStatisticsForegroundBase::getHandleTextMargin (void) const
1316 SFVec2f::GetHandlePtr returnValue(
1317 new SFVec2f::GetHandle(
1318 &_sfTextMargin,
1319 this->getType().getFieldDesc(TextMarginFieldId),
1320 const_cast<SimpleStatisticsForegroundBase *>(this)));
1322 return returnValue;
1325 EditFieldHandlePtr SimpleStatisticsForegroundBase::editHandleTextMargin (void)
1327 SFVec2f::EditHandlePtr returnValue(
1328 new SFVec2f::EditHandle(
1329 &_sfTextMargin,
1330 this->getType().getFieldDesc(TextMarginFieldId),
1331 this));
1334 editSField(TextMarginFieldMask);
1336 return returnValue;
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),
1350 whichField,
1351 oOffsets,
1352 syncMode,
1353 uiSyncInfo);
1355 #endif
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));
1368 return returnValue;
1370 #endif
1372 void SimpleStatisticsForegroundBase::resolveLinks(void)
1374 Inherited::resolveLinks();
1376 #ifdef OSG_MT_CPTR_ASPECT
1377 AspectOffsetStore oOffsets;
1379 _pAspectStore->fillOffsetArray(oOffsets, this);
1380 #endif
1382 #ifdef OSG_MT_CPTR_ASPECT
1383 _mfFormats.terminateShare(Thread::getCurrentAspect(),
1384 oOffsets);
1385 #endif
1389 OSG_END_NAMESPACE