Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / Model / Model_AttributeRefList.cpp
index 36d11541c50724c82befa3355af40875bee1e31a..bb7a1dd265ece2fb7c2bbfa0df073269f59c67d3 100644 (file)
@@ -129,7 +129,8 @@ int Model_AttributeRefList::size(const bool theWithEmpty) const
 
 bool Model_AttributeRefList::isInitialized()
 {
-  if (size(false) == 0) { // empty list is not initialized list: sketch will be not valid after add/undo
+  if (size(false) == 0) {
+    // empty list is not initialized list: sketch will be not valid after add/undo
     return false;
   }
   return ModelAPI_AttributeRefList::isInitialized();
@@ -343,11 +344,17 @@ void Model_AttributeRefList::remove(const std::set<int>& theIndices)
 
 Model_AttributeRefList::Model_AttributeRefList(TDF_Label& theLabel)
 {
-  myIsInitialized = theLabel.FindAttribute(TDataStd_ReferenceList::GetID(), myRef) == Standard_True;
+  myLab = theLabel;
+  reinit();
+}
+
+void Model_AttributeRefList::reinit()
+{
+  myIsInitialized = myLab.FindAttribute(TDataStd_ReferenceList::GetID(), myRef) == Standard_True;
   if (!myIsInitialized) {
-    myRef = TDataStd_ReferenceList::Set(theLabel);
+    myRef = TDataStd_ReferenceList::Set(myLab);
   }
-  if (!theLabel.FindAttribute(TDataStd_ExtStringList::GetID(), myExtDocRef)) {
-    myExtDocRef = TDataStd_ExtStringList::Set(theLabel);
+  if (!myLab.FindAttribute(TDataStd_ExtStringList::GetID(), myExtDocRef)) {
+    myExtDocRef = TDataStd_ExtStringList::Set(myLab);
   }
 }