public:
/// Creates an empty message
MODELAPI_EXPORT ModelAPI_EventReentrantMessage(const Events_ID theID,
- const void* theSender = 0);
+ const void* theSender);
/// The virtual destructor
MODELAPI_EXPORT virtual ~ModelAPI_EventReentrantMessage() {}
/// Static. Returns EventID of the message.
#include <PartSet_SketcherMgr.h>
#include <PartSet_SketcherReentrantMgr.h>
+#include "XGUI_CustomPrs.h"
+#include "XGUI_Displayer.h"
#include "XGUI_ModuleConnector.h"
+#include "XGUI_OperationMgr.h"
+#include "XGUI_Tools.h"
#include "XGUI_Workshop.h"
-#include "XGUI_Displayer.h"
-#include "XGUI_CustomPrs.h"
#include "SketcherPrs_SymbolPrs.h"
#include "SketchPlugin_SketchEntity.h"
}
else if (anEventID == ModelAPI_EventReentrantMessage::eventId() ||
anEventID == SketchPlugin_MacroArcReentrantMessage::eventId()) {
- PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
- PartSet_SketcherReentrantMgr* aReentrantMgr = aModule->sketchReentranceMgr();
- aReentrantMgr->setReentrantMessage(theMessage);
+ // the message is sent to sketcher reentrant manager only if the kind of feature
+ // sender is equal to kind of the current operation. E.g. Horizontal create operation
+ // is active. Sketch Line feature is changed, so execute is called, it will send message
+ // This Line's message should not be processed, as the reentrant operation is not for Line
+ std::string aCurrentFeatureKind;
+ ModuleBase_Operation* anOperation =
+ XGUI_Tools::workshop(myWorkshop)->operationMgr()->currentOperation();
+ if (anOperation) {
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (anOperation);
+ if (aFOperation) {
+ FeaturePtr aFeature = aFOperation->feature();
+ if (aFeature.get())
+ aCurrentFeatureKind = aFeature->getKind();
+ }
+ }
+ if (theMessage->sender()) {
+ ModelAPI_Object* aSender = static_cast<ModelAPI_Object*>(theMessage->sender());
+ if (aSender) {
+ FeaturePtr aFeatureSender =
+ std::dynamic_pointer_cast<ModelAPI_Feature>(aSender->data()->owner());
+ if (aFeatureSender.get() && aFeatureSender->getKind() == aCurrentFeatureKind) {
+ PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+ PartSet_SketcherReentrantMgr* aReentrantMgr = aModule->sketchReentranceMgr();
+ aReentrantMgr->setReentrantMessage(theMessage);
+ }
+ }
+ }
}
#ifdef DEBUG_FEATURE_OVERCONSTRAINT_LISTENER
static Events_ID anId = ModelAPI_EventReentrantMessage::eventId();
std::shared_ptr<ModelAPI_EventReentrantMessage> aMessage = std::shared_ptr
- <ModelAPI_EventReentrantMessage>(new ModelAPI_EventReentrantMessage(anId, 0));
+ <ModelAPI_EventReentrantMessage>(new ModelAPI_EventReentrantMessage(anId, this));
aMessage->setCreatedFeature(ModelAPI_Feature::feature(
data()->attribute(START_ID())->owner()));
Events_Loop::loop()->send(aMessage);
// message to init reentrant operation
static Events_ID anId = SketchPlugin_MacroArcReentrantMessage::eventId();
std::shared_ptr<SketchPlugin_MacroArcReentrantMessage> aMessage = std::shared_ptr
- <SketchPlugin_MacroArcReentrantMessage>(new SketchPlugin_MacroArcReentrantMessage(anId, 0));
+ <SketchPlugin_MacroArcReentrantMessage>(new SketchPlugin_MacroArcReentrantMessage(anId, this));
std::string anEditArcType = string(EDIT_ARC_TYPE_ID())->value();
aMessage->setTypeOfCreation(!anEditArcType.empty() ? anEditArcType : anArcType);
public:
/// Creates an empty message
SKETCHPLUGIN_EXPORT SketchPlugin_MacroArcReentrantMessage(const Events_ID theID,
- const void* theSender = 0)
+ const void* theSender)
: ModelAPI_EventReentrantMessage(theID, theSender) {}
/// The virtual destructor
SKETCHPLUGIN_EXPORT virtual ~SketchPlugin_MacroArcReentrantMessage() {}
// message to init reentrant operation
static Events_ID anId = SketchPlugin_MacroArcReentrantMessage::eventId();
std::shared_ptr<SketchPlugin_MacroArcReentrantMessage> aMessage = std::shared_ptr
- <SketchPlugin_MacroArcReentrantMessage>(new SketchPlugin_MacroArcReentrantMessage(anId, 0));
+ <SketchPlugin_MacroArcReentrantMessage>(new SketchPlugin_MacroArcReentrantMessage(anId, this));
std::string anEditType = string(EDIT_CIRCLE_TYPE())->value();
aMessage->setTypeOfCreation(!anEditType.empty() ? anEditType : aType);
if (aPreviewObject.get()) {
std::shared_ptr<ModelAPI_EventReentrantMessage> aMessage = std::shared_ptr
<ModelAPI_EventReentrantMessage>(new ModelAPI_EventReentrantMessage(
- ModelAPI_EventReentrantMessage::eventId(), 0));
+ ModelAPI_EventReentrantMessage::eventId(), this));
aMessage->setSelectedObject(aPreviewObject);
Events_Loop::loop()->send(aMessage);
}