]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #2555 : measurement - problem with preselection
authormpv <mpv@opencascade.com>
Fri, 6 Jul 2018 08:00:16 +0000 (11:00 +0300)
committermpv <mpv@opencascade.com>
Fri, 6 Jul 2018 08:00:29 +0000 (11:00 +0300)
src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp
src/Model/Model_AttributeSelection.cpp

index 3da93923712377a9e4cca01c7f43a0d160694369..f038ecc954c613a43005cfe84be48b0d4755a247 100644 (file)
@@ -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<ModelAPI_AttributeDoubleArray>(
-        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();
index af3b9cb9d854fe384b84ee2bbf6c0e41a80e0277..50b2ad865e7dc83747309d4ea5e3b1c678569d7d 100644 (file)
@@ -273,6 +273,10 @@ GeomShapePtr centerByEdge(GeomShapePtr theEdge, ModelAPI_AttributeSelection::Cen
 
 std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::value()
 {
+  /*
+  if (!ModelAPI_AttributeSelection::isInitialized() && !myTmpContext.get() && !myTmpSubShape.get())
+    return std::shared_ptr<GeomAPI_Shape>();
+  */
   CenterType aType = NOT_CENTER;
   std::shared_ptr<GeomAPI_Shape> 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;
   }