Salome HOME
Implementation of mechanism of grouping of messages
[modules/shaper.git] / src / PartSet / PartSet_OperationSketchLine.cpp
index 6b64cd2759cff1930c142411f11a40d44ab5d1bc..84d5fc7620bbbb88a01ffe27cdc78f957a6abb08 100644 (file)
@@ -10,6 +10,9 @@
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Sketch.h>
 
+#include <Events_Loop.h>
+#include <Model_Events.h>
+
 #include <GeomDataAPI_Point2D.h>
 
 #include <ModuleBase_OperationDescription.h>
@@ -142,11 +145,15 @@ void PartSet_OperationSketchLine::mouseReleased(QMouseEvent* theEvent, Handle(V3
     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));
+
       myPointSelectionMode = SM_SecondPoint;
     }
     break;
     case SM_SecondPoint: {
       setLinePoint(feature(), aX, anY, LINE_ATTR_END);
+      Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+
       myPointSelectionMode = SM_DonePoint;
     }
     break;
@@ -165,12 +172,14 @@ void PartSet_OperationSketchLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_V
       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));
     }
     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));
     }
     break;
     case SM_DonePoint:
@@ -223,9 +232,9 @@ void PartSet_OperationSketchLine::stopOperation()
   emit multiSelectionEnabled(true);
 }
 
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchLine::createFeature()
+boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchLine::createFeature(const bool theFlushMessage)
 {
-  boost::shared_ptr<ModelAPI_Feature> aNewFeature = ModuleBase_Operation::createFeature();
+  boost::shared_ptr<ModelAPI_Feature> aNewFeature = ModuleBase_Operation::createFeature(false);
   if (sketch()) {
     boost::shared_ptr<SketchPlugin_Feature> aFeature = 
                            boost::dynamic_pointer_cast<SketchPlugin_Feature>(sketch());
@@ -243,6 +252,8 @@ boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchLine::createFeature()
   }
 
   emit featureConstructed(aNewFeature, FM_Activation);
+  if (theFlushMessage)
+    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
   return aNewFeature;
 }