AttributeStringPtr aTypeAttr = string(EXPORT_TYPE_ID());
if (aTypeAttr->isInitialized() && aTypeAttr->value() == "XAO") {
AttributeSelectionListPtr aSelList = selectionList(SELECTION_LIST_ID());
- int aSelListSize = aSelList->size();
AttributeSelectionListPtr aXAOSelList = selectionList(XAO_SELECTION_LIST_ID());
- if (aSelListSize > 0 && aXAOSelList->size() == 0) {
- for (int i = 0; i < aSelListSize; ++i) {
- AttributeSelectionPtr aSelection = aSelList->value(i);
- aXAOSelList->append(aSelection->context(), aSelection->value());
- }
- aXAOSelList->setSelectionType(aSelList->selectionType());
- }
+ if (aSelList->size() > 0 && aXAOSelList->size() == 0)
+ aSelList->copyTo(aXAOSelList);
aSelList->clear();
}
}
}
}
+void Model_AttributeSelectionList::copyTo(AttributeSelectionListPtr theTarget) const
+{
+ std::shared_ptr<Model_AttributeSelectionList> aTarget =
+ std::dynamic_pointer_cast<Model_AttributeSelectionList>(theTarget);
+ if (aTarget) {
+ copyAttrs(myLab, aTarget->myLab);
+ aTarget->reinit();
+ }
+}
+
int Model_AttributeSelectionList::size()
{
return mySize->Get();
MODEL_EXPORT virtual void append(const std::string& theType, const std::string& theContextName,
const int theIndex);
+ /// Copy the selection list to the destination attribute
+ MODEL_EXPORT virtual void copyTo(AttributeSelectionListPtr theTarget) const;
+
/// Reset temporary stored values
virtual void removeTemporaryValues();
virtual void append(const std::string& theType, const std::string& theContextName,
const int theIndex) = 0;
+ /// Copy the selection list to the destination attribute
+ virtual void copyTo(std::shared_ptr<ModelAPI_AttributeSelectionList> theTarget) const = 0;
+
/// Reset temporary stored values
virtual void removeTemporaryValues() = 0;