]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp
Salome HOME
Issue #3222: 1D fillet
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Fillet1D.cpp
index d62fdee303b0f58619de778366ab0967663b29bc..c19cfa34d8ef0c9ad3326defbe48e3ab5602f0c7 100644 (file)
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Events.h>
 
+void sendMessageWithFailedShapes(const ListOfShape& theVertices)
+{
+  std::shared_ptr<ModelAPI_ShapesFailedMessage> aMessage(
+      new ModelAPI_ShapesFailedMessage(Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED)));
+  aMessage->setShapes(theVertices);
+  Events_Loop::loop()->send(aMessage);
+}
+
 FeaturesPlugin_Fillet1D::FeaturesPlugin_Fillet1D()
 {
 }
@@ -60,6 +68,15 @@ void FeaturesPlugin_Fillet1D::execute()
   removeResults(aResultIndex);
 }
 
+void FeaturesPlugin_Fillet1D::attributeChanged(const std::string& theID)
+{
+  if (theID == CREATION_METHOD()) {
+    // creation method is changed, drop failed vertices and send the message
+    removeResults(0);
+    sendMessageWithFailedShapes(ListOfShape());
+  }
+}
+
 bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape& theWires, MapShapeSubs& theWireVertices)
 {
   std::set<GeomShapePtr, GeomAPI_Shape::Comparator> aProcessedWires;
@@ -164,10 +181,7 @@ bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr& theWire,
 
   if (isSendMessage) {
     // send message to highlight the failed vertices
-    std::shared_ptr<ModelAPI_Fillet1DFailedMessage> aMessage(
-        new ModelAPI_Fillet1DFailedMessage(Events_Loop::eventByName(EVENT_1DFILLET_FAILED)));
-    aMessage->setVertices(myFailedVertices);
-    Events_Loop::loop()->send(aMessage);
+    sendMessageWithFailedShapes(myFailedVertices);
   }
 
   static const std::string THE_PREFIX = "Fillet1D";