void DrawableStatsAttachment::attachTo(AttachmentContainer *obj) { if(getMFParents()->size()) { FNOTICE(("GeoStatsAttachment::attachTo: " "already attached, detaching!\n")); while(getMFParents()->size()) { AttachmentContainer *p = dynamic_cast<AttachmentContainer *>(this->getParents(0)); p->subChangedFunctor(&DrawableStatsAttachment::invalidateFunctor); p->subAttachment (this ); } } obj->addAttachment(this); reset(); obj->addChangedFunctor(&DrawableStatsAttachment::invalidateFunctor, "DrawableStats invalidator"); }
//! react to field changes void DVRLookupTable::changed(BitVector whichField, UInt32 origin) { SINFO << "DVRLookupTable::changed" << std::endl; if(whichField & DataFieldMask) { // copy data from interleaved field to single fields UInt32 iter = 0; for(UInt32 i = 0; i < _sfDimension.getValue(); i++) { for(UInt32 j = 0; j < _mfSize[i]; j++) { for (UInt32 k = 0; k < _sfChannel.getValue(); k++) { #if 1 //!! TODO: REMOVE as soon as the loader works correctly if(_mfDataR.size() < _mfData.size() / 4) { int size = _mfData.size() / 4; _mfDataR.resize(size); _mfDataG.resize(size); _mfDataB.resize(size); _mfDataA.resize(size); } #endif //!! setValue ( <value>, index ) if(k == 0) { _mfDataR[j] = Real32(_mfData[iter++]) / Real32(TypeTraits<UInt8>::getMax()); } else if(k == 1) { _mfDataG[j] = Real32(_mfData[iter++]) / Real32(TypeTraits<UInt8>::getMax()); } else if(k == 2) { _mfDataB[j] = Real32(_mfData[iter++]) / Real32(TypeTraits<UInt8>::getMax()); } else if(k == 3) { _mfDataA[j] = Real32(_mfData[iter++]) / Real32(TypeTraits<UInt8>::getMax()); } } } } } if(whichField & DataRFieldMask) { // copy data from R field to channel 0 of interleaved field UInt32 iter = 0; UInt32 numChannels = _sfChannel.getValue(); for(UInt32 i = 0; i < _sfDimension.getValue(); i++) { for(UInt32 j = 0; j < _mfSize[i]; j++) { //!! setValue ( <value>, index ) _mfData[iter] = UInt8(Real32(_mfDataR[j]) * Real32(TypeTraits<UInt8>::getMax())); iter += numChannels; } } } if(whichField & DataGFieldMask) { // copy data from G field to channel 1 of interleaved field UInt32 iter = 1; UInt32 numChannels = _sfChannel.getValue(); for(UInt32 i = 0; i < _sfDimension.getValue(); i++) { for(UInt32 j = 0; j < _mfSize[i]; j++) { //!! setValue ( <value>, index ) _mfData[iter] = UInt8(Real32(_mfDataG[j]) * Real32(TypeTraits<UInt8>::getMax())); iter += numChannels; } } } if(whichField & DataBFieldMask) { // copy data from B field to channel 2 of interleaved field UInt32 iter = 2; UInt32 numChannels = _sfChannel.getValue(); for(UInt32 i = 0; i < _sfDimension.getValue(); i++) { for(UInt32 j = 0; j < _mfSize[i]; j++) { //!! setValue ( <value>, index ) _mfData[iter] = UInt8(Real32(_mfDataB[j]) * Real32(TypeTraits<UInt8>::getMax())); iter += numChannels; } } } if(whichField & DataAFieldMask) { // copy data from A field to to channel 3 interleaved field UInt32 iter = 3; UInt32 numChannels = _sfChannel.getValue(); for(UInt32 i = 0; i < _sfDimension.getValue(); i++) { for(UInt32 j = 0; j < _mfSize[i]; j++) { //!! setValue ( <value>, index ) _mfData[iter] = UInt8(Real32(_mfDataA[j]) * Real32(TypeTraits<UInt8>::getMax())); iter += numChannels; } } } if(whichField & (DimensionFieldMask | SizeFieldMask | ChannelFieldMask)) { SINFO << "DVRLookupTable::changed - DimensionFieldMask | " << "SizeFieldMask | ChannelFieldMask " << std::endl; if(whichField & DimensionFieldMask) { SINFO << "DVRLookupTable::changed - dimension " << _sfDimension.getValue() << std::endl; } if(whichField & SizeFieldMask) { SINFO << "DVRLookupTable::changed - size " << _mfSize[0] << std::endl; } if(whichField & ChannelFieldMask) { SINFO << "DVRLookupTable::changed - channel " << _sfChannel.getValue() << std::endl; } #if 0 commonConstructor(); #endif } if(whichField & TouchedFieldMask) { SINFO << "DVRLookupTable::changed - touched " << std::endl; } #if 0 // mark table as being changed setTouched( true ); #endif // notify parent if appearance // CHECK #if 0 MFFieldContainerPtr *par = getMFParents(); for(UInt32 i = 0; i < par->size(); i++) { } #endif Inherited::changed(whichField, origin); }