X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelectionList.cpp;h=5a692ae9b7c63474c52c53fbbbdb2d7e66858176;hb=20d35238897e717b51eaba89f9ba3695ebf57e49;hp=9e7b0b6ff1144cf9957a4cf6599808398844e791;hpb=645e2cb70c0e40290725f28fdc5fec8a93338d28;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 9e7b0b6ff..5a692ae9b 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2020 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 @@ -65,9 +65,7 @@ void Model_AttributeSelectionList::append( } if (myIsCashed && !theTemporarily) { - ResultPtr aResContext = std::dynamic_pointer_cast(theContext); - if (aResContext.get()) - myCash[aResContext].push_back(theSubShape); + myCash[theContext].push_back(theSubShape); } int aNewTag = mySize->Get() + 1; @@ -90,7 +88,7 @@ void Model_AttributeSelectionList::append( } 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); @@ -125,7 +123,7 @@ void Model_AttributeSelectionList::append(const GeomPointPtr& thePoint, const st } 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); @@ -219,6 +217,8 @@ static void copyAttrs(TDF_Label theSource, TDF_Label theDestination) { 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) @@ -301,7 +301,7 @@ static bool isIn(GeomShapePtr theInList, GeomShapePtr theShape) { bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext, const std::shared_ptr& theSubShape, - const bool theTemporarily) + const bool /*theTemporarily*/) { if (myIsCashed) { // the cashing is active if (theContext.get()) { @@ -315,7 +315,8 @@ bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext, if (!aShapes->get()) return true; ResultPtr aRes = std::dynamic_pointer_cast(aContext->first); - if (aRes.get() && (*aShapes)->isSame(aRes->shape())) + FeaturePtr aFeat = std::dynamic_pointer_cast(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 @@ -442,7 +443,7 @@ void Model_AttributeSelectionList::cashValues(const bool theEnabled) 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()); } } }