From: mpv Date: Fri, 6 Jul 2018 08:00:16 +0000 (+0300) Subject: Fix for the issue #2555 : measurement - problem with preselection X-Git-Tag: EDF_2018-1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3673e667cd188e862a8f9a298fe0d50e741c49d5;p=modules%2Fshaper.git Fix for the issue #2555 : measurement - problem with preselection --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp index 3da939237..f038ecc95 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp @@ -75,21 +75,12 @@ void FeaturesPlugin_Measurement::execute() void FeaturesPlugin_Measurement::attributeChanged(const std::string& theID) { if (theID == MEASURE_KIND()) { - // clear selected objects - selection(EDGE_FOR_LENGTH_ID())->reset(); - selection(DISTANCE_FROM_OBJECT_ID())->reset(); - selection(DISTANCE_TO_OBJECT_ID())->reset(); - selection(CIRCULAR_OBJECT_ID())->reset(); - selection(ANGLE_FROM_EDGE_ID())->reset(); - selection(ANGLE_TO_EDGE_ID())->reset(); - selection(ANGLE_POINT1_ID())->reset(); - selection(ANGLE_POINT2_ID())->reset(); - selection(ANGLE_POINT3_ID())->reset(); + // clear results string(RESULT_ID())->setValue(""); std::dynamic_pointer_cast( - attribute(RESULT_VALUES_ID()))->setSize(0); + attribute(RESULT_VALUES_ID()))->setSize(0); } - else if (theID != RESULT_ID()) { + if (theID != RESULT_ID()) { std::string aKind = string(MEASURE_KIND())->value(); if (aKind == MEASURE_LENGTH()) computeLength(); diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index af3b9cb9d..50b2ad865 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -273,6 +273,10 @@ GeomShapePtr centerByEdge(GeomShapePtr theEdge, ModelAPI_AttributeSelection::Cen std::shared_ptr Model_AttributeSelection::value() { + /* + if (!ModelAPI_AttributeSelection::isInitialized() && !myTmpContext.get() && !myTmpSubShape.get()) + return std::shared_ptr(); + */ CenterType aType = NOT_CENTER; std::shared_ptr aResult = internalValue(aType); return centerByEdge(aResult, aType); @@ -407,6 +411,11 @@ void Model_AttributeSelection::setID(const std::string theID) } ResultPtr Model_AttributeSelection::context() { + /* + if (!ModelAPI_AttributeSelection::isInitialized() && !myTmpContext.get() && !myTmpSubShape.get()) + return ResultPtr(); + */ + if (myTmpContext.get() || myTmpSubShape.get()) { return myTmpContext; }