From: azv Date: Thu, 5 Jul 2018 11:47:17 +0000 (+0300) Subject: Issue #2551: clear Measurement when selection lost X-Git-Tag: EDF_2018-1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6faf9c32b4e0a99d325472b55830e32cd139f9ca;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 3f4487d43..4865abfd9 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp @@ -100,10 +100,11 @@ void FeaturesPlugin_Measurement::computeLength() GeomShapePtr aShape; GeomEdgePtr anEdge; - if (aSelectedFeature) + if (aSelectedFeature && aSelectedFeature->isInitialized()) { aShape = aSelectedFeature->value(); - if (!aShape && aSelectedFeature->context()) - aShape = aSelectedFeature->context()->shape(); + if (!aShape && aSelectedFeature->context()) + aShape = aSelectedFeature->context()->shape(); + } if (aShape && aShape->isEdge()) anEdge = GeomEdgePtr(new GeomAPI_Edge(aShape)); if (!anEdge) { @@ -125,17 +126,19 @@ void FeaturesPlugin_Measurement::computeDistance() { AttributeSelectionPtr aFirstFeature = selection(DISTANCE_FROM_OBJECT_ID()); GeomShapePtr aShape1; - if (aFirstFeature) + if (aFirstFeature && aFirstFeature->isInitialized()) { aShape1 = aFirstFeature->value(); - if (!aShape1 && aFirstFeature->context()) - aShape1 = aFirstFeature->context()->shape(); + if (!aShape1 && aFirstFeature->context()) + aShape1 = aFirstFeature->context()->shape(); + } AttributeSelectionPtr aSecondFeature = selection(DISTANCE_TO_OBJECT_ID()); GeomShapePtr aShape2; - if (aSecondFeature) + if (aSecondFeature && aSecondFeature->isInitialized()) { aShape2 = aSecondFeature->value(); - if (!aShape2 && aSecondFeature->context()) - aShape2 = aSecondFeature->context()->shape(); + if (!aShape2 && aSecondFeature->context()) + aShape2 = aSecondFeature->context()->shape(); + } if (!aShape1 || !aShape2) { string(RESULT_ID())->setValue(""); @@ -159,10 +162,11 @@ void FeaturesPlugin_Measurement::computeRadius() AttributeSelectionPtr aSelectedFeature = selection(CIRCULAR_OBJECT_ID()); GeomShapePtr aShape; - if (aSelectedFeature) + if (aSelectedFeature && aSelectedFeature->isInitialized()) { aShape = aSelectedFeature->value(); - if (!aShape && aSelectedFeature->context()) - aShape = aSelectedFeature->context()->shape(); + if (!aShape && aSelectedFeature->context()) + aShape = aSelectedFeature->context()->shape(); + } double aRadius = -1.0; if (aShape) { @@ -197,20 +201,22 @@ void FeaturesPlugin_Measurement::computeAngle() AttributeSelectionPtr aFirstFeature = selection(ANGLE_FROM_EDGE_ID()); GeomShapePtr aShape1; GeomEdgePtr anEdge1; - if (aFirstFeature) + if (aFirstFeature && aFirstFeature->isInitialized()) { aShape1 = aFirstFeature->value(); - if (!aShape1 && aFirstFeature->context()) - aShape1 = aFirstFeature->context()->shape(); + if (!aShape1 && aFirstFeature->context()) + aShape1 = aFirstFeature->context()->shape(); + } if (aShape1 && aShape1->isEdge()) anEdge1 = GeomEdgePtr(new GeomAPI_Edge(aShape1)); AttributeSelectionPtr aSecondFeature = selection(ANGLE_TO_EDGE_ID()); GeomShapePtr aShape2; GeomEdgePtr anEdge2; - if (aSecondFeature) + if (aSecondFeature && aSecondFeature->isInitialized()) { aShape2 = aSecondFeature->value(); - if (!aShape2 && aSecondFeature->context()) - aShape2 = aSecondFeature->context()->shape(); + if (!aShape2 && aSecondFeature->context()) + aShape2 = aSecondFeature->context()->shape(); + } if (aShape2 && aShape2->isEdge()) anEdge2 = GeomEdgePtr(new GeomAPI_Edge(aShape2));