if (myFeature) myFeature->execute();
}
+void ModuleBase_Operation::flushUpdated()
+{
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+}
+
+void ModuleBase_Operation::flushCreated()
+{
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
+}
+
boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::createFeature(const bool theFlushMessage)
{
boost::shared_ptr<ModelAPI_Document> aDoc = document();
aFeature->execute();
if (theFlushMessage)
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
+ flushCreated();
return aFeature;
}
/// Virtual method called when operation committed (see commit() method for more description)
virtual void commitOperation();
+ /// Send update message by loop
+ void flushUpdated();
+ /// Send created message by loop
+ void flushCreated();
+
/// Creates an operation new feature
/// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SKETCH_ATTR_DIRY));
aDirY->setValue(aC, anA, aB);
boost::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+
+ flushUpdated();
+
emit featureConstructed(feature(), FM_Hide);
emit closeLocalContext();
emit planeSelected(aDir->x(), aDir->y(), aDir->z());
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Sketch.h>
-#include <Events_Loop.h>
-#include <Model_Events.h>
-
#include <GeomDataAPI_Point2D.h>
#include <ModuleBase_OperationDescription.h>
case SM_FirstPoint: {
setLinePoint(feature(), aX, anY, LINE_ATTR_START);
setLinePoint(feature(), aX, anY, LINE_ATTR_END);
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+ flushUpdated();
myPointSelectionMode = SM_SecondPoint;
}
break;
case SM_SecondPoint: {
setLinePoint(feature(), aX, anY, LINE_ATTR_END);
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+ flushUpdated();
myPointSelectionMode = SM_DonePoint;
}
PartSet_Tools::ConvertTo2D(aPoint, sketch(), theView, aX, anY);
setLinePoint(feature(), aX, anY, LINE_ATTR_START);
setLinePoint(feature(), aX, anY, LINE_ATTR_END);
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+ flushUpdated();
}
break;
case SM_SecondPoint:
{
gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView);
setLinePoint(aPoint, theView, LINE_ATTR_END);
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+ flushUpdated();
}
break;
case SM_DonePoint:
emit featureConstructed(aNewFeature, FM_Activation);
if (theFlushMessage)
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
+ flushCreated();
return aNewFeature;
}