Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / Model / Model_AttributeRefAttrList.cpp
index 3cfd46274cc54ce37279d6dd3242c9185c9806be..2b56f8b787140691d5803cca66d45db65f4e304d 100755 (executable)
@@ -90,7 +90,8 @@ void Model_AttributeRefAttrList::remove(AttributePtr theAttr)
   TDF_ListIteratorOfLabelList aRefIter(aRefList);
   TDataStd_ListIteratorOfListOfExtendedString anIDIter(anIDList);
   for (; aRefIter.More(); aRefIter.Next(), anIDIter.Next()) {
-    if (aOneisDeleted || anIDIter.Value() != theAttr->id().c_str() ||  // append now only not removed
+    if (aOneisDeleted || anIDIter.Value() != theAttr->id().c_str() ||  
+        // append now only not removed
         aRefIter.Value() != aTheObjLab || // append now only not removed
         (aTheObjLab.IsNull() && aDoc->objects()->object(aRefIter.Value()) != NULL)) {
       myRef->Append(aRefIter.Value());
@@ -308,11 +309,17 @@ void Model_AttributeRefAttrList::remove(const std::set<int>& theIndices)
 
 Model_AttributeRefAttrList::Model_AttributeRefAttrList(TDF_Label& theLabel)
 {
-  myIsInitialized = theLabel.FindAttribute(TDataStd_ReferenceList::GetID(), myRef) == Standard_True;
+  myLab = theLabel;
+  reinit();
+}
+
+void Model_AttributeRefAttrList::reinit()
+{
+  myIsInitialized = myLab.FindAttribute(TDataStd_ReferenceList::GetID(), myRef) == Standard_True;
   if (!myIsInitialized) {
-    myRef = TDataStd_ReferenceList::Set(theLabel);
-    myIDs = TDataStd_ExtStringList::Set(theLabel);
+    myRef = TDataStd_ReferenceList::Set(myLab);
+    myIDs = TDataStd_ExtStringList::Set(myLab);
   } else {
-    theLabel.FindAttribute(TDataStd_ExtStringList::GetID(), myIDs);
+    myLab.FindAttribute(TDataStd_ExtStringList::GetID(), myIDs);
   }
 }