]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Implementation of mechanism of grouping of messages
authornds <natalia.donis@opencascade.com>
Thu, 22 May 2014 12:50:03 +0000 (16:50 +0400)
committernds <natalia.donis@opencascade.com>
Thu, 22 May 2014 12:50:03 +0000 (16:50 +0400)
Flush call during operation of line creation.

src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/PartSet/PartSet_OperationEditLine.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketchLine.cpp

index 642718ece14c854abfa87af3a6718ab709de10c6..313ad4d9b39f39a57e2952bf38f10cefd1c3d083 100644 (file)
@@ -87,6 +87,16 @@ void ModuleBase_Operation::commitOperation()
   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();
@@ -96,7 +106,7 @@ boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::createFeature(const bo
     aFeature->execute();
 
   if (theFlushMessage)
-    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
+    flushCreated();
   return aFeature;
 }
 
index 21bfacc8da4839026b384db9dd485268c0905a5a..e992762aba096e6b98ef741925fabaf23d94ff21 100644 (file)
@@ -70,6 +70,11 @@ protected:
   /// 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
index c355c82c0b57c1c76bc0d4b24295b1ef15a22f95..18d3bbc4df1576e0893d23dee64e91d183160c39 100644 (file)
@@ -102,6 +102,7 @@ void PartSet_OperationEditLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_Vie
       moveLinePoint(aFeature, aDeltaX, aDeltaY, LINE_ATTR_END);
     }
   }
+  flushUpdated();
   sendFeatures();
 
   myCurPoint.setPoint(aPoint);
index d527cd0f3f1aee9d07598e9a2b2c36c40f1cbf6f..cd2e3920d1d39e919a8d215ed2531d97f90b5750 100644 (file)
@@ -167,6 +167,9 @@ void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape)
     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());
index 84d5fc7620bbbb88a01ffe27cdc78f957a6abb08..91ad9ebe607133180df981d9f65a162248a7b5c5 100644 (file)
@@ -10,9 +10,6 @@
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Sketch.h>
 
-#include <Events_Loop.h>
-#include <Model_Events.h>
-
 #include <GeomDataAPI_Point2D.h>
 
 #include <ModuleBase_OperationDescription.h>
@@ -145,14 +142,14 @@ 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));
+      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;
     }
@@ -172,14 +169,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));
+      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:
@@ -253,7 +250,7 @@ boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchLine::createFeature(c
 
   emit featureConstructed(aNewFeature, FM_Activation);
   if (theFlushMessage)
-    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
+    flushCreated();
   return aNewFeature;
 }