-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
if (myIsCashed && !theTemporarily) {
- ResultPtr aResContext = std::dynamic_pointer_cast<ModelAPI_Result>(theContext);
- if (aResContext.get())
- myCash[aResContext].push_back(theSubShape);
+ myCash[theContext].push_back(theSubShape);
}
int aNewTag = mySize->Get() + 1;
}
void Model_AttributeSelectionList::append(
- const std::string& theNamingName, const std::string& theType)
+ const std::wstring& theNamingName, const std::string& theType)
{
int aNewTag = mySize->Get() + 1;
TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
}
void Model_AttributeSelectionList::append(const std::string& theType,
- const std::string& theContextName, const int theIndex)
+ const std::wstring& theContextName, const int theIndex)
{
int aNewTag = mySize->Get() + 1;
TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
if (!theDestination.FindAttribute(anAttrIter.Value()->ID(), aTargetAttr)) {
// create a new attribute if not yet exists in the destination
aTargetAttr = anAttrIter.Value()->NewEmpty();
+ if (aTargetAttr->ID() != anAttrIter.Value()->ID())
+ aTargetAttr->SetID(anAttrIter.Value()->ID());
theDestination.AddAttribute(aTargetAttr);
}
// for named shape copy exact shapes (in NamedShape Paste method the CopyTool is used)
}
}
+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();
bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext,
const std::shared_ptr<GeomAPI_Shape>& theSubShape,
- const bool theTemporarily)
+ const bool /*theTemporarily*/)
{
if (myIsCashed) { // the cashing is active
if (theContext.get()) {
if (!aShapes->get())
return true;
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aContext->first);
- if (aRes.get() && (*aShapes)->isSame(aRes->shape()))
+ FeaturePtr aFeat = std::dynamic_pointer_cast<ModelAPI_Feature>(aContext->first);
+ if ((aRes.get() && (*aShapes)->isSame(aRes->shape())) || aFeat.get())
return true;
} else {
// we need to call here isSame instead of isEqual to do not check shapes orientation
for(int anIndex = size() - 1; anIndex >= 0; anIndex--) {
AttributeSelectionPtr anAttr = value(anIndex);
if (anAttr.get()) {
- myCash[anAttr->context()].push_back(anAttr->value());
+ myCash[anAttr->contextObject()].push_back(anAttr->value());
}
}
}