From: nds Date: Thu, 22 May 2014 12:50:03 +0000 (+0400) Subject: Implementation of mechanism of grouping of messages X-Git-Tag: V_0.2~26^2~1^2^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=53616e843559242f53c2f57d57185b172107cfe0;p=modules%2Fshaper.git Implementation of mechanism of grouping of messages Flush call during operation of line creation. --- diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 642718ece..313ad4d9b 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -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 ModuleBase_Operation::createFeature(const bool theFlushMessage) { boost::shared_ptr aDoc = document(); @@ -96,7 +106,7 @@ boost::shared_ptr ModuleBase_Operation::createFeature(const bo aFeature->execute(); if (theFlushMessage) - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED)); + flushCreated(); return aFeature; } diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index 21bfacc8d..e992762ab 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -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 diff --git a/src/PartSet/PartSet_OperationEditLine.cpp b/src/PartSet/PartSet_OperationEditLine.cpp index c355c82c0..18d3bbc4d 100644 --- a/src/PartSet/PartSet_OperationEditLine.cpp +++ b/src/PartSet/PartSet_OperationEditLine.cpp @@ -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); diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index d527cd0f3..cd2e3920d 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -167,6 +167,9 @@ void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape) boost::dynamic_pointer_cast(aData->attribute(SKETCH_ATTR_DIRY)); aDirY->setValue(aC, anA, aB); boost::shared_ptr aDir = aPlane->direction(); + + flushUpdated(); + emit featureConstructed(feature(), FM_Hide); emit closeLocalContext(); emit planeSelected(aDir->x(), aDir->y(), aDir->z()); diff --git a/src/PartSet/PartSet_OperationSketchLine.cpp b/src/PartSet/PartSet_OperationSketchLine.cpp index 84d5fc762..91ad9ebe6 100644 --- a/src/PartSet/PartSet_OperationSketchLine.cpp +++ b/src/PartSet/PartSet_OperationSketchLine.cpp @@ -10,9 +10,6 @@ #include #include -#include -#include - #include #include @@ -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 PartSet_OperationSketchLine::createFeature(c emit featureConstructed(aNewFeature, FM_Activation); if (theFlushMessage) - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED)); + flushCreated(); return aNewFeature; }