changed: gcc8 base update
[opensg.git] / Source / System / Image / OSGGeoReferenceAttachmentBase.cpp
blobfdf6f4cf63777d20dbb4ae6c29ce519802bff671
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 GeoReferenceAttachment!
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 "OSGGeoReferenceAttachmentBase.h"
67 #include "OSGGeoReferenceAttachment.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::GeoReferenceAttachment
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt32 GeoReferenceAttachmentBase::_sfDatum
89 /*! \var Vec2f GeoReferenceAttachmentBase::_sfEllipsoidAxis
93 /*! \var Vec2f GeoReferenceAttachmentBase::_sfOrigin
97 /*! \var Vec2f GeoReferenceAttachmentBase::_sfPixelSize
101 /*! \var Real64 GeoReferenceAttachmentBase::_sfNoDataValue
106 /***************************************************************************\
107 * FieldType/FieldTrait Instantiation *
108 \***************************************************************************/
110 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
111 PointerType FieldTraits<GeoReferenceAttachment *, nsOSG>::_type(
112 "GeoReferenceAttachmentPtr",
113 "AttachmentPtr",
114 GeoReferenceAttachment::getClassType(),
115 nsOSG);
116 #endif
118 OSG_FIELDTRAITS_GETTYPE_NS(GeoReferenceAttachment *, nsOSG)
120 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
121 GeoReferenceAttachment *,
122 nsOSG)
124 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
125 GeoReferenceAttachment *,
126 nsOSG)
128 /***************************************************************************\
129 * Field Description *
130 \***************************************************************************/
132 void GeoReferenceAttachmentBase::classDescInserter(TypeObject &oType)
134 FieldDescriptionBase *pDesc = NULL;
137 pDesc = new SFUInt32::Description(
138 SFUInt32::getClassType(),
139 "datum",
141 DatumFieldId, DatumFieldMask,
142 false,
143 (Field::SFDefaultFlags | Field::FStdAccess),
144 static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandleDatum),
145 static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandleDatum));
147 oType.addInitialDesc(pDesc);
149 pDesc = new SFVec2f::Description(
150 SFVec2f::getClassType(),
151 "ellipsoidAxis",
153 EllipsoidAxisFieldId, EllipsoidAxisFieldMask,
154 false,
155 (Field::SFDefaultFlags | Field::FStdAccess),
156 static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandleEllipsoidAxis),
157 static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandleEllipsoidAxis));
159 oType.addInitialDesc(pDesc);
161 pDesc = new SFVec2f::Description(
162 SFVec2f::getClassType(),
163 "origin",
165 OriginFieldId, OriginFieldMask,
166 false,
167 (Field::SFDefaultFlags | Field::FStdAccess),
168 static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandleOrigin),
169 static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandleOrigin));
171 oType.addInitialDesc(pDesc);
173 pDesc = new SFVec2f::Description(
174 SFVec2f::getClassType(),
175 "pixelSize",
177 PixelSizeFieldId, PixelSizeFieldMask,
178 false,
179 (Field::SFDefaultFlags | Field::FStdAccess),
180 static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandlePixelSize),
181 static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandlePixelSize));
183 oType.addInitialDesc(pDesc);
185 pDesc = new SFReal64::Description(
186 SFReal64::getClassType(),
187 "noDataValue",
189 NoDataValueFieldId, NoDataValueFieldMask,
190 false,
191 (Field::SFDefaultFlags | Field::FStdAccess),
192 static_cast<FieldEditMethodSig>(&GeoReferenceAttachment::editHandleNoDataValue),
193 static_cast<FieldGetMethodSig >(&GeoReferenceAttachment::getHandleNoDataValue));
195 oType.addInitialDesc(pDesc);
199 GeoReferenceAttachmentBase::TypeObject GeoReferenceAttachmentBase::_type(
200 GeoReferenceAttachmentBase::getClassname(),
201 Inherited::getClassname(),
202 "GeoReferenceAttachment",
203 nsOSG, //Namespace
204 reinterpret_cast<PrototypeCreateF>(&GeoReferenceAttachmentBase::createEmptyLocal),
205 reinterpret_cast<InitContainerF>(&GeoReferenceAttachment::initMethod),
206 reinterpret_cast<ExitContainerF>(&GeoReferenceAttachment::exitMethod),
207 reinterpret_cast<InitalInsertDescFunc>(
208 reinterpret_cast<void *>(&GeoReferenceAttachment::classDescInserter)),
209 false,
211 "<?xml version=\"1.0\"?>\n"
212 "\n"
213 "<FieldContainer\n"
214 " name=\"GeoReferenceAttachment\"\n"
215 " parent=\"Attachment\"\n"
216 " library=\"System\"\n"
217 " pointerfieldtypes=\"both\"\n"
218 " structure=\"concrete\"\n"
219 " systemcomponent=\"true\"\n"
220 " parentsystemcomponent=\"true\"\n"
221 " decoratable=\"false\"\n"
222 " docGroupBase=\"GrpSystemImage\"\n"
223 " >\n"
224 " <Field\n"
225 "\t name=\"datum\"\n"
226 "\t type=\"UInt32\"\n"
227 "\t cardinality=\"single\"\n"
228 "\t visibility=\"external\"\n"
229 "\t defaultValue=\"GeoReferenceAttachment::WGS84\"\n"
230 "\t access=\"public\"\n"
231 "\t >\n"
232 " </Field>\n"
233 " <Field\n"
234 "\t name=\"ellipsoidAxis\"\n"
235 "\t type=\"Vec2f\"\n"
236 "\t cardinality=\"single\"\n"
237 "\t visibility=\"external\"\n"
238 "\t defaultValue=\"\"\n"
239 "\t access=\"public\"\n"
240 "\t >\n"
241 " </Field>\n"
242 " <Field\n"
243 "\t name=\"origin\"\n"
244 "\t type=\"Vec2f\"\n"
245 "\t cardinality=\"single\"\n"
246 "\t visibility=\"external\"\n"
247 "\t defaultValue=\"\"\n"
248 "\t access=\"public\"\n"
249 "\t >\n"
250 " </Field>\n"
251 " <Field\n"
252 "\t name=\"pixelSize\"\n"
253 "\t type=\"Vec2f\"\n"
254 "\t cardinality=\"single\"\n"
255 "\t visibility=\"external\"\n"
256 "\t defaultValue=\"\"\n"
257 "\t access=\"public\"\n"
258 "\t >\n"
259 " </Field>\n"
260 " <Field\n"
261 "\t name=\"noDataValue\"\n"
262 "\t type=\"Real64\"\n"
263 "\t cardinality=\"single\"\n"
264 "\t visibility=\"external\"\n"
265 "\t defaultValue=\"\"\n"
266 "\t access=\"public\"\n"
267 "\t >\n"
268 " </Field>\n"
269 "</FieldContainer>\n",
273 /*------------------------------ get -----------------------------------*/
275 FieldContainerType &GeoReferenceAttachmentBase::getType(void)
277 return _type;
280 const FieldContainerType &GeoReferenceAttachmentBase::getType(void) const
282 return _type;
285 UInt32 GeoReferenceAttachmentBase::getContainerSize(void) const
287 return sizeof(GeoReferenceAttachment);
290 /*------------------------- decorator get ------------------------------*/
293 SFUInt32 *GeoReferenceAttachmentBase::editSFDatum(void)
295 editSField(DatumFieldMask);
297 return &_sfDatum;
300 const SFUInt32 *GeoReferenceAttachmentBase::getSFDatum(void) const
302 return &_sfDatum;
306 SFVec2f *GeoReferenceAttachmentBase::editSFEllipsoidAxis(void)
308 editSField(EllipsoidAxisFieldMask);
310 return &_sfEllipsoidAxis;
313 const SFVec2f *GeoReferenceAttachmentBase::getSFEllipsoidAxis(void) const
315 return &_sfEllipsoidAxis;
319 SFVec2f *GeoReferenceAttachmentBase::editSFOrigin(void)
321 editSField(OriginFieldMask);
323 return &_sfOrigin;
326 const SFVec2f *GeoReferenceAttachmentBase::getSFOrigin(void) const
328 return &_sfOrigin;
332 SFVec2f *GeoReferenceAttachmentBase::editSFPixelSize(void)
334 editSField(PixelSizeFieldMask);
336 return &_sfPixelSize;
339 const SFVec2f *GeoReferenceAttachmentBase::getSFPixelSize(void) const
341 return &_sfPixelSize;
345 SFReal64 *GeoReferenceAttachmentBase::editSFNoDataValue(void)
347 editSField(NoDataValueFieldMask);
349 return &_sfNoDataValue;
352 const SFReal64 *GeoReferenceAttachmentBase::getSFNoDataValue(void) const
354 return &_sfNoDataValue;
362 /*------------------------------ access -----------------------------------*/
364 SizeT GeoReferenceAttachmentBase::getBinSize(ConstFieldMaskArg whichField)
366 SizeT returnValue = Inherited::getBinSize(whichField);
368 if(FieldBits::NoField != (DatumFieldMask & whichField))
370 returnValue += _sfDatum.getBinSize();
372 if(FieldBits::NoField != (EllipsoidAxisFieldMask & whichField))
374 returnValue += _sfEllipsoidAxis.getBinSize();
376 if(FieldBits::NoField != (OriginFieldMask & whichField))
378 returnValue += _sfOrigin.getBinSize();
380 if(FieldBits::NoField != (PixelSizeFieldMask & whichField))
382 returnValue += _sfPixelSize.getBinSize();
384 if(FieldBits::NoField != (NoDataValueFieldMask & whichField))
386 returnValue += _sfNoDataValue.getBinSize();
389 return returnValue;
392 void GeoReferenceAttachmentBase::copyToBin(BinaryDataHandler &pMem,
393 ConstFieldMaskArg whichField)
395 Inherited::copyToBin(pMem, whichField);
397 if(FieldBits::NoField != (DatumFieldMask & whichField))
399 _sfDatum.copyToBin(pMem);
401 if(FieldBits::NoField != (EllipsoidAxisFieldMask & whichField))
403 _sfEllipsoidAxis.copyToBin(pMem);
405 if(FieldBits::NoField != (OriginFieldMask & whichField))
407 _sfOrigin.copyToBin(pMem);
409 if(FieldBits::NoField != (PixelSizeFieldMask & whichField))
411 _sfPixelSize.copyToBin(pMem);
413 if(FieldBits::NoField != (NoDataValueFieldMask & whichField))
415 _sfNoDataValue.copyToBin(pMem);
419 void GeoReferenceAttachmentBase::copyFromBin(BinaryDataHandler &pMem,
420 ConstFieldMaskArg whichField)
422 Inherited::copyFromBin(pMem, whichField);
424 if(FieldBits::NoField != (DatumFieldMask & whichField))
426 editSField(DatumFieldMask);
427 _sfDatum.copyFromBin(pMem);
429 if(FieldBits::NoField != (EllipsoidAxisFieldMask & whichField))
431 editSField(EllipsoidAxisFieldMask);
432 _sfEllipsoidAxis.copyFromBin(pMem);
434 if(FieldBits::NoField != (OriginFieldMask & whichField))
436 editSField(OriginFieldMask);
437 _sfOrigin.copyFromBin(pMem);
439 if(FieldBits::NoField != (PixelSizeFieldMask & whichField))
441 editSField(PixelSizeFieldMask);
442 _sfPixelSize.copyFromBin(pMem);
444 if(FieldBits::NoField != (NoDataValueFieldMask & whichField))
446 editSField(NoDataValueFieldMask);
447 _sfNoDataValue.copyFromBin(pMem);
451 //! create a new instance of the class
452 GeoReferenceAttachmentTransitPtr GeoReferenceAttachmentBase::createLocal(BitVector bFlags)
454 GeoReferenceAttachmentTransitPtr fc;
456 if(getClassType().getPrototype() != NULL)
458 FieldContainerTransitPtr tmpPtr =
459 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
461 fc = dynamic_pointer_cast<GeoReferenceAttachment>(tmpPtr);
464 return fc;
467 //! create a new instance of the class, copy the container flags
468 GeoReferenceAttachmentTransitPtr GeoReferenceAttachmentBase::createDependent(BitVector bFlags)
470 GeoReferenceAttachmentTransitPtr fc;
472 if(getClassType().getPrototype() != NULL)
474 FieldContainerTransitPtr tmpPtr =
475 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
477 fc = dynamic_pointer_cast<GeoReferenceAttachment>(tmpPtr);
480 return fc;
483 //! create a new instance of the class
484 GeoReferenceAttachmentTransitPtr GeoReferenceAttachmentBase::create(void)
486 GeoReferenceAttachmentTransitPtr fc;
488 if(getClassType().getPrototype() != NULL)
490 FieldContainerTransitPtr tmpPtr =
491 getClassType().getPrototype()-> shallowCopy();
493 fc = dynamic_pointer_cast<GeoReferenceAttachment>(tmpPtr);
496 return fc;
499 GeoReferenceAttachment *GeoReferenceAttachmentBase::createEmptyLocal(BitVector bFlags)
501 GeoReferenceAttachment *returnValue;
503 newPtr<GeoReferenceAttachment>(returnValue, bFlags);
505 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
507 return returnValue;
510 //! create an empty new instance of the class, do not copy the prototype
511 GeoReferenceAttachment *GeoReferenceAttachmentBase::createEmpty(void)
513 GeoReferenceAttachment *returnValue;
515 newPtr<GeoReferenceAttachment>(returnValue, Thread::getCurrentLocalFlags());
517 returnValue->_pFieldFlags->_bNamespaceMask &=
518 ~Thread::getCurrentLocalFlags();
520 return returnValue;
524 FieldContainerTransitPtr GeoReferenceAttachmentBase::shallowCopyLocal(
525 BitVector bFlags) const
527 GeoReferenceAttachment *tmpPtr;
529 newPtr(tmpPtr, dynamic_cast<const GeoReferenceAttachment *>(this), bFlags);
531 FieldContainerTransitPtr returnValue(tmpPtr);
533 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
535 return returnValue;
538 FieldContainerTransitPtr GeoReferenceAttachmentBase::shallowCopyDependent(
539 BitVector bFlags) const
541 GeoReferenceAttachment *tmpPtr;
543 newPtr(tmpPtr, dynamic_cast<const GeoReferenceAttachment *>(this), ~bFlags);
545 FieldContainerTransitPtr returnValue(tmpPtr);
547 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
549 return returnValue;
552 FieldContainerTransitPtr GeoReferenceAttachmentBase::shallowCopy(void) const
554 GeoReferenceAttachment *tmpPtr;
556 newPtr(tmpPtr,
557 dynamic_cast<const GeoReferenceAttachment *>(this),
558 Thread::getCurrentLocalFlags());
560 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
562 FieldContainerTransitPtr returnValue(tmpPtr);
564 return returnValue;
570 /*------------------------- constructors ----------------------------------*/
572 GeoReferenceAttachmentBase::GeoReferenceAttachmentBase(void) :
573 Inherited(),
574 _sfDatum (UInt32(GeoReferenceAttachment::WGS84)),
575 _sfEllipsoidAxis (),
576 _sfOrigin (),
577 _sfPixelSize (),
578 _sfNoDataValue ()
582 GeoReferenceAttachmentBase::GeoReferenceAttachmentBase(const GeoReferenceAttachmentBase &source) :
583 Inherited(source),
584 _sfDatum (source._sfDatum ),
585 _sfEllipsoidAxis (source._sfEllipsoidAxis ),
586 _sfOrigin (source._sfOrigin ),
587 _sfPixelSize (source._sfPixelSize ),
588 _sfNoDataValue (source._sfNoDataValue )
593 /*-------------------------- destructors ----------------------------------*/
595 GeoReferenceAttachmentBase::~GeoReferenceAttachmentBase(void)
600 GetFieldHandlePtr GeoReferenceAttachmentBase::getHandleDatum (void) const
602 SFUInt32::GetHandlePtr returnValue(
603 new SFUInt32::GetHandle(
604 &_sfDatum,
605 this->getType().getFieldDesc(DatumFieldId),
606 const_cast<GeoReferenceAttachmentBase *>(this)));
608 return returnValue;
611 EditFieldHandlePtr GeoReferenceAttachmentBase::editHandleDatum (void)
613 SFUInt32::EditHandlePtr returnValue(
614 new SFUInt32::EditHandle(
615 &_sfDatum,
616 this->getType().getFieldDesc(DatumFieldId),
617 this));
620 editSField(DatumFieldMask);
622 return returnValue;
625 GetFieldHandlePtr GeoReferenceAttachmentBase::getHandleEllipsoidAxis (void) const
627 SFVec2f::GetHandlePtr returnValue(
628 new SFVec2f::GetHandle(
629 &_sfEllipsoidAxis,
630 this->getType().getFieldDesc(EllipsoidAxisFieldId),
631 const_cast<GeoReferenceAttachmentBase *>(this)));
633 return returnValue;
636 EditFieldHandlePtr GeoReferenceAttachmentBase::editHandleEllipsoidAxis (void)
638 SFVec2f::EditHandlePtr returnValue(
639 new SFVec2f::EditHandle(
640 &_sfEllipsoidAxis,
641 this->getType().getFieldDesc(EllipsoidAxisFieldId),
642 this));
645 editSField(EllipsoidAxisFieldMask);
647 return returnValue;
650 GetFieldHandlePtr GeoReferenceAttachmentBase::getHandleOrigin (void) const
652 SFVec2f::GetHandlePtr returnValue(
653 new SFVec2f::GetHandle(
654 &_sfOrigin,
655 this->getType().getFieldDesc(OriginFieldId),
656 const_cast<GeoReferenceAttachmentBase *>(this)));
658 return returnValue;
661 EditFieldHandlePtr GeoReferenceAttachmentBase::editHandleOrigin (void)
663 SFVec2f::EditHandlePtr returnValue(
664 new SFVec2f::EditHandle(
665 &_sfOrigin,
666 this->getType().getFieldDesc(OriginFieldId),
667 this));
670 editSField(OriginFieldMask);
672 return returnValue;
675 GetFieldHandlePtr GeoReferenceAttachmentBase::getHandlePixelSize (void) const
677 SFVec2f::GetHandlePtr returnValue(
678 new SFVec2f::GetHandle(
679 &_sfPixelSize,
680 this->getType().getFieldDesc(PixelSizeFieldId),
681 const_cast<GeoReferenceAttachmentBase *>(this)));
683 return returnValue;
686 EditFieldHandlePtr GeoReferenceAttachmentBase::editHandlePixelSize (void)
688 SFVec2f::EditHandlePtr returnValue(
689 new SFVec2f::EditHandle(
690 &_sfPixelSize,
691 this->getType().getFieldDesc(PixelSizeFieldId),
692 this));
695 editSField(PixelSizeFieldMask);
697 return returnValue;
700 GetFieldHandlePtr GeoReferenceAttachmentBase::getHandleNoDataValue (void) const
702 SFReal64::GetHandlePtr returnValue(
703 new SFReal64::GetHandle(
704 &_sfNoDataValue,
705 this->getType().getFieldDesc(NoDataValueFieldId),
706 const_cast<GeoReferenceAttachmentBase *>(this)));
708 return returnValue;
711 EditFieldHandlePtr GeoReferenceAttachmentBase::editHandleNoDataValue (void)
713 SFReal64::EditHandlePtr returnValue(
714 new SFReal64::EditHandle(
715 &_sfNoDataValue,
716 this->getType().getFieldDesc(NoDataValueFieldId),
717 this));
720 editSField(NoDataValueFieldMask);
722 return returnValue;
726 #ifdef OSG_MT_CPTR_ASPECT
727 void GeoReferenceAttachmentBase::execSyncV( FieldContainer &oFrom,
728 ConstFieldMaskArg whichField,
729 AspectOffsetStore &oOffsets,
730 ConstFieldMaskArg syncMode,
731 const UInt32 uiSyncInfo)
733 GeoReferenceAttachment *pThis = static_cast<GeoReferenceAttachment *>(this);
735 pThis->execSync(static_cast<GeoReferenceAttachment *>(&oFrom),
736 whichField,
737 oOffsets,
738 syncMode,
739 uiSyncInfo);
741 #endif
744 #ifdef OSG_MT_CPTR_ASPECT
745 FieldContainer *GeoReferenceAttachmentBase::createAspectCopy(
746 const FieldContainer *pRefAspect) const
748 GeoReferenceAttachment *returnValue;
750 newAspectCopy(returnValue,
751 dynamic_cast<const GeoReferenceAttachment *>(pRefAspect),
752 dynamic_cast<const GeoReferenceAttachment *>(this));
754 return returnValue;
756 #endif
758 void GeoReferenceAttachmentBase::resolveLinks(void)
760 Inherited::resolveLinks();
766 OSG_END_NAMESPACE