Flush call during operation of line creation.
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/src/Config
+ ${CMAKE_SOURCE_DIR}/src/Events
+ ${CMAKE_SOURCE_DIR}/src/Model
${CMAKE_SOURCE_DIR}/src/ModelAPI
${CMAKE_SOURCE_DIR}/src/GeomDataAPI
)
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Document.h>
+#include <Model_Events.h>
+
+#include <Events_Loop.h>
#ifdef _DEBUG
#include <QDebug>
if (myFeature) myFeature->execute();
}
-boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::createFeature()
+boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::createFeature(const bool theFlushMessage)
{
boost::shared_ptr<ModelAPI_Document> aDoc = document();
boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature(
getDescription()->operationId().toStdString());
if (aFeature) // TODO: generate an error if feature was not created
aFeature->execute();
+
+ if (theFlushMessage)
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
return aFeature;
}
virtual void commitOperation();
/// Creates an operation new feature
+ /// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
/// Returns the operation feature
/// \return the feature
myFeatures.clear();
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationEditLine::createFeature()
+boost::shared_ptr<ModelAPI_Feature> PartSet_OperationEditLine::createFeature(const bool /*theFlushMessage*/)
{
// do nothing in order to do not create a new feature
return boost::shared_ptr<ModelAPI_Feature>();
/// Creates an operation new feature
/// Returns NULL feature. This is an operation of edition, not creation.
+ /// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
protected:
/// \brief Save the point to the line.
aModes.push_back(TopAbs_EDGE);
return aModes;
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchBase::createFeature()
+boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
{
- boost::shared_ptr<ModelAPI_Feature> aFeature = ModuleBase_Operation::createFeature();
+ boost::shared_ptr<ModelAPI_Feature> aFeature = ModuleBase_Operation::createFeature(theFlushMessage);
if (aFeature)
emit featureConstructed(aFeature, FM_Activation);
return aFeature;
/// Creates an operation new feature
/// In addition to the default realization it appends the created line feature to
/// the sketch feature
+ /// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
};
#endif
#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));
+
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;
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:
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());
}
emit featureConstructed(aNewFeature, FM_Activation);
+ if (theFlushMessage)
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_CREATED));
return aNewFeature;
}
/// Creates an operation new feature
/// In addition to the default realization it appends the created line feature to
/// the sketch feature
+ /// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
/// Creates a constraint on two points
/// \param thePoint1 the first point