From e8fef283cdff35f7f0ff6163094e78367c75c606 Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Wed, 24 Jun 2020 09:00:48 +0300 Subject: [PATCH] Issue #3222: 1D fillet Send the message about failed vertices when creation method is changed. --- .../FeaturesPlugin_Fillet1D.cpp | 22 +++++++++++++++---- src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h | 4 ++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp index d2b9bac94..c19cfa34d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp @@ -34,6 +34,14 @@ #include #include +void sendMessageWithFailedShapes(const ListOfShape& theVertices) +{ + std::shared_ptr 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 aProcessedWires; @@ -164,10 +181,7 @@ bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr& theWire, if (isSendMessage) { // send message to highlight the failed vertices - std::shared_ptr aMessage( - new ModelAPI_ShapesFailedMessage(Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED))); - aMessage->setShapes(myFailedVertices); - Events_Loop::loop()->send(aMessage); + sendMessageWithFailedShapes(myFailedVertices); } static const std::string THE_PREFIX = "Fillet1D"; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h index 7cf37cc23..074d03ce4 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h @@ -91,6 +91,10 @@ public: /// Request for initialization of data model of the feature: adding all attributes. FEATURESPLUGIN_EXPORT virtual void initAttributes(); + /// Called on change of any argument-attribute of this object + /// \param theID identifier of changed attribute + FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + /// Performs the fillet algorithm and stores it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); -- 2.39.2