From: azv Date: Thu, 5 Jul 2018 09:08:27 +0000 (+0300) Subject: Issue #2551: clear Measurement when selection lost X-Git-Tag: EDF_2018-1~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ae92c91d4f41540bec8abc0715d1fdee90f97976;p=modules%2Fshaper.git Issue #2551: clear Measurement when selection lost --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp index 6b00601e3..3f4487d43 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp @@ -106,8 +106,10 @@ void FeaturesPlugin_Measurement::computeLength() aShape = aSelectedFeature->context()->shape(); if (aShape && aShape->isEdge()) anEdge = GeomEdgePtr(new GeomAPI_Edge(aShape)); - if (!anEdge) + if (!anEdge) { + string(RESULT_ID())->setValue(""); return; + } std::ostringstream anOutput; anOutput << "Length = " << std::setprecision(10) << anEdge->length(); @@ -135,8 +137,10 @@ void FeaturesPlugin_Measurement::computeDistance() if (!aShape2 && aSecondFeature->context()) aShape2 = aSecondFeature->context()->shape(); - if (!aShape1 || !aShape2) + if (!aShape1 || !aShape2) { + string(RESULT_ID())->setValue(""); return; + } double aDistance = GeomAlgoAPI_ShapeTools::minimalDistance(aShape1, aShape2); @@ -173,8 +177,10 @@ void FeaturesPlugin_Measurement::computeRadius() } } - if (aRadius < 0.0) + if (aRadius < 0.0) { + string(RESULT_ID())->setValue(""); return; + } std::ostringstream anOutput; anOutput << "Radius = " << std::setprecision(10) << aRadius; @@ -198,7 +204,6 @@ void FeaturesPlugin_Measurement::computeAngle() if (aShape1 && aShape1->isEdge()) anEdge1 = GeomEdgePtr(new GeomAPI_Edge(aShape1)); - AttributeSelectionPtr aSecondFeature = selection(ANGLE_TO_EDGE_ID()); GeomShapePtr aShape2; GeomEdgePtr anEdge2; @@ -209,8 +214,10 @@ void FeaturesPlugin_Measurement::computeAngle() if (aShape2 && aShape2->isEdge()) anEdge2 = GeomEdgePtr(new GeomAPI_Edge(aShape2)); - if (!anEdge1 || !anEdge2) + if (!anEdge1 || !anEdge2) { + string(RESULT_ID())->setValue(""); return; + } GeomShapePtr anInter = anEdge1->intersect(anEdge2);