From 3673e667cd188e862a8f9a298fe0d50e741c49d5 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 6 Jul 2018 11:00:16 +0300 Subject: [PATCH] Fix for the issue #2555 : measurement - problem with preselection --- src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp | 15 +++------------ src/Model/Model_AttributeSelection.cpp | 9 +++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) 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; } -- 2.39.2