document()->finishOperation();
emit stopped();
+
+ afterCommitOperation();
}
void ModuleBase_IOperation::setRunning(bool theState)
virtual void abortOperation() = 0;
/// Virtual method called when operation committed (see commit() method for more description)
virtual void commitOperation() = 0;
+ /// Virtual method called after operation committed (see commit() method for more description)
+ /// it is important that the method is called after the stop() signal is emitted
+ virtual void afterCommitOperation() = 0;
/// Returns pointer to the root document.
boost::shared_ptr<ModelAPI_Document> document() const;
if (myFeature) myFeature->execute();
}
+void ModuleBase_Operation::afterCommitOperation()
+{
+}
+
void ModuleBase_Operation::flushUpdated()
{
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
virtual void abortOperation();
/// Virtual method called when operation committed (see commit() method for more description)
virtual void commitOperation();
+ /// Virtual method called after operation committed (see commit() method for more description)
+ virtual void afterCommitOperation();
/// Send update message by loop
void flushUpdated();
emit setSelection(aSelected);
}
else if (aFeature) {
- emit launchOperation(PartSet_OperationEditLine::Type(), aFeature);
+ restartOperation(PartSet_OperationEditLine::Type(), aFeature);
}
}
}
if (theHighlighted.size() == 1) {
boost::shared_ptr<ModelAPI_Feature> aFeature = theHighlighted.front().feature();
if (aFeature)
- emit launchOperation(PartSet_OperationEditLine::Type(), aFeature);
+ restartOperation(PartSet_OperationEditLine::Type(), aFeature);
}
else
myFeatures = theHighlighted;
boost::shared_ptr<ModelAPI_Feature> aFeature = PartSet_Tools::NearestFeature(theEvent->pos(),
theView, feature(), myFeatures);
if (aFeature)
- emit launchOperation(PartSet_OperationEditLine::Type(), aFeature);
+ restartOperation(PartSet_OperationEditLine::Type(), aFeature);
}
}
{
keyReleased(theEvent->key());
}
+
+void PartSet_OperationSketchBase::restartOperation(const std::string& theType,
+ boost::shared_ptr<ModelAPI_Feature> theFeature)
+{
+ emit launchOperation(theType, theFeature);
+}
virtual void keyReleased(std::string theName, QKeyEvent* theEvent);
+ /// Emits a signal about the operation start. This signal has an information about the feature.
+ /// If the provided feature is empty, the current operation feature is used.
+ /// \param theType a type of an operation started
+ /// theFeature the operation argument
+ void restartOperation(const std::string& theType,
+ boost::shared_ptr<ModelAPI_Feature> theFeature = boost::shared_ptr<ModelAPI_Feature>());
+
signals:
/// signal about the request to launch operation
/// theName the operation name
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
{
+ if (myPointSelectionMode == SM_DonePoint)
+ {
+ // if the point creation is finished, the next mouse release should commit the modification
+ // the next release can happens by double click in the viewer
+ commit();
+ restartOperation(PartSet_OperationSketchLine::Type(), feature());
+ return;
+ }
+
double aX, anY;
bool isFoundPoint = false;
}
}
}
- //if (!isFoundPoint)
- // return;
switch (myPointSelectionMode)
{
case SM_DonePoint:
{
commit();
- emit featureConstructed(feature(), FM_Deactivation);
- emit launchOperation(PartSet_OperationSketchLine::Type(), feature());
+ restartOperation(PartSet_OperationSketchLine::Type(), feature());
}
default:
break;
if (myPointSelectionMode == SM_DonePoint)
{
commit();
- emit featureConstructed(feature(), FM_Deactivation);
- emit launchOperation(PartSet_OperationSketchLine::Type(), boost::shared_ptr<ModelAPI_Feature>());
+ restartOperation(PartSet_OperationSketchLine::Type(), feature());
}
//else
// abort();
if (myPointSelectionMode == SM_DonePoint)
{
commit();
- emit featureConstructed(feature(), FM_Deactivation);
}
else
abort();
emit multiSelectionEnabled(true);
}
+void PartSet_OperationSketchLine::afterCommitOperation()
+{
+ PartSet_OperationSketchBase::afterCommitOperation();
+ emit featureConstructed(feature(), FM_Deactivation);
+}
+
boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchLine::createFeature(const bool theFlushMessage)
{
boost::shared_ptr<ModelAPI_Feature> aNewFeature = ModuleBase_Operation::createFeature(false);
case SM_SecondPoint:
aPointArg = LINE_ATTR_END;
break;
+ default:
+ break;
}
+ boost::shared_ptr<ModelAPI_Feature> aSkFeature = feature();
+
boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aData->attribute(aPointArg));
/// Restore the multi selection state
virtual void stopOperation();
+ /// Virtual method called after operation committed (see commit() method for more description)
+ virtual void afterCommitOperation();
+
/// Creates an operation new feature
/// In addition to the default realization it appends the created line feature to
/// the sketch feature