X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOMEDS%2FSALOMEDS_SObject_i.cxx;h=1d95e8bd1d0eaaaf142a1feb2cab0ca83068c3e4;hb=bfcf9ccdeeb86a800841fb87770a854baecaab76;hp=e3681ccf44f9923435f9dc7db35a9d2339465450;hpb=1068d0d60e5e59de0899f8e3ed2b3516f64399d5;p=modules%2Fyacs.git diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index e3681ccf4..1d95e8bd1 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -188,7 +188,7 @@ namespace SALOMEDS{ TAttrID2FunMap::const_iterator anEnd = __AttrID2FunMap__.end(); for(; anIter != anEnd; anIter++){ const TAttrID2FunMap::key_type& aKey = anIter->first; - const TAttrID2FunMap::data_type& aValue = anIter->second; + const TAttrID2FunMap::mapped_type& aValue = anIter->second; __GUID2AttrIDMap__[aValue.myGetGUID()] = aKey; }; @@ -365,12 +365,19 @@ char* SALOMEDS_SObject_i::GetID() * Purpose : */ //============================================================================ +TDF_Label SALOMEDS_SObject_i::GetFatherComponentLabel() +{ + TDF_Label aLabel = _lab; + while(!SALOMEDS_SComponent_i::IsA(aLabel) && !aLabel.IsRoot()) + aLabel = aLabel.Father(); + + return aLabel; +} + SALOMEDS::SComponent_ptr SALOMEDS_SObject_i::GetFatherComponent() { - TDF_Label aSCompLabel = _lab; - while(!SALOMEDS_SComponent_i::IsA(aSCompLabel) && !aSCompLabel.IsRoot()){ - aSCompLabel = aSCompLabel.Father(); - } + TDF_Label aSCompLabel = GetFatherComponentLabel(); + return SALOMEDS_SComponent_i::NewRef(_study,aSCompLabel)._retn(); } @@ -530,17 +537,8 @@ char* SALOMEDS_SObject_i::GetIOR() { SALOMEDS_SObject_i::TAttrHolder SALOMEDS_SObject_i::_FindGenAttribute(const Handle(TDF_Attribute)& theAttr) { - TAttrHolder anGenAttr; - - Standard_GUID aGUID = theAttr->ID(); - - TGUID2AttrIDMap::const_iterator anIter = __GUID2AttrIDMap__.find(aGUID); - if(anIter != __GUID2AttrIDMap__.end()){ - const TAttributeID& anAttributeID = anIter->second; - anGenAttr = _FindGenAttribute(anAttributeID.c_str()); - } - - return anGenAttr; + std::string aType = GetType(theAttr); + return _FindGenAttribute(aType.c_str()); } @@ -623,7 +621,7 @@ SALOMEDS_SObject_i::_FindGenAttribute(const char* theType) if(aGenAttr != NULL) myAttrMap[theType] = anAttrHolder; }else{ - myAttrMap.erase(theType); + //myAttrMap.erase(theType); //if(anGenAttr != NULL) // anGenAttr->Destroy(); return TAttrHolder(); @@ -688,7 +686,6 @@ Handle(TDF_Attribute) if(!_lab.FindAttribute(aGUID,anAttr)){ _study->CheckLocked(); anAttr = TDataStd_TreeNode::Set(_lab,aGUID); - _lab.AddAttribute(anAttr); return anAttr; } } @@ -698,7 +695,6 @@ Handle(TDF_Attribute) if(!_lab.FindAttribute(aGUID,anAttr)){ _study->CheckLocked(); anAttr = TDataStd_UAttribute::Set(_lab,aGUID); - _lab.AddAttribute(anAttr); return anAttr; } } @@ -745,7 +741,7 @@ void SALOMEDS_SObject_i::RemoveAttribute(const char* theType) } TAttrMap::iterator anIter = myAttrMap.find(theType); if(anIter != myAttrMap.end()){ - myAttrMap.erase(anIter); + //myAttrMap.erase(anIter); } _lab.ForgetAttribute(::GetGUID(theType)); } @@ -765,8 +761,8 @@ void SALOMEDS_SObject_i::OnRemove() _study->AddPostponed(TCollection_AsciiString(anAttr->Get()).ToCString()); } - myAttrMap.clear(); + //myAttrMap.clear(); - SALOMEDS_Study_i::TSObjectMap& anSObjectMap = _study->GetSObjectMap(); - anSObjectMap.erase(_lab); + //SALOMEDS_Study_i::TSObjectMap& anSObjectMap = _study->GetSObjectMap(); + //anSObjectMap.erase(_lab); }