X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeSelection.cpp;h=4818b3a5794277107285a80bdf3c3664d3845125;hb=1b9dd3633d644c358424227423b330e9551be38f;hp=6ff60d02e363dde45d66a62466e116f72c006518;hpb=3574a5a3c5d5fd1105c92db5f5975ab2240344ce;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 6ff60d02e..4818b3a57 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -166,6 +166,35 @@ std::shared_ptr Model_AttributeSelection::value() return aResult; } +bool Model_AttributeSelection::isInitialized() +{ + if (ModelAPI_AttributeSelection::isInitialized()) { // additional checkings if it is initialized + std::shared_ptr aResult; + if (myRef.isInitialized()) { + TDF_Label aSelLab = selectionLabel(); + if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape + ResultPtr aContext = context(); + return aContext.get(); + } + if (aSelLab.IsAttribute(kCONSTUCTION_SIMPLE_REF_ID)) { // it is just reference to construction, nothing is in value + return true; + } + + Handle(TNaming_NamedShape) aSelection; + if (selectionLabel().FindAttribute(TNaming_NamedShape::GetID(), aSelection)) { + return !aSelection->Get().IsNull(); + } else { // for simple construction element: just shape of this construction element + ResultConstructionPtr aConstr = + std::dynamic_pointer_cast(context()); + if (aConstr.get()) { + return aConstr->shape().get(); + } + } + } + } + return false; +} + Model_AttributeSelection::Model_AttributeSelection(TDF_Label& theLabel) : myRef(theLabel) { @@ -419,9 +448,11 @@ void Model_AttributeSelection::selectBody( } TopoDS_Shape aNewShape = theSubShape ? theSubShape->impl() : aContext; /// fix for issue 411: result modified shapes must not participate in this selection mechanism + /* FeaturePtr aFeatureOwner = std::dynamic_pointer_cast(owner()); if (aFeatureOwner.get()) aFeatureOwner->eraseResults(); + */ if (!aContext.IsNull()) { aSel.Select(aNewShape, aContext); }