#include <ModelAPI_Object.h>
#include <ModelAPI_Validator.h>
#include <ModelAPI_Session.h>
+#include <ModelAPI_Tools.h>
#include <GeomAPI_Pnt2d.h>
Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
}
+void ModuleBase_OperationFeature::resumeOperation()
+{
+ ModuleBase_Operation::resumeOperation();
+ //if (!myIsEditing)
+ setCurrentFeature(feature());
+ //SessionPtr aMgr = ModelAPI_Session::get();
+ //DocumentPtr aDoc = aMgr->activeDocument();
+ //aDoc->setCurrentFeature(feature(), false);
+}
+
FeaturePtr ModuleBase_OperationFeature::createFeature(const bool theFlushMessage)
{
if (myParentFeature.get()) {
bool aIsOp = aMgr->isOperation();
if (!aIsOp)
aMgr->startOperation();
- aDoc->setCurrentFeature(myPreviousCurrentFeature, true);
+ aDoc->setCurrentFeature(myPreviousCurrentFeature, false);//true);
if (!aIsOp)
aMgr->finishOperation();
myPreviousCurrentFeature = FeaturePtr();
SessionPtr aMgr = ModelAPI_Session::get();
/// Set current feature and remeber old current feature
+
if (myIsEditing) {
- DocumentPtr aDoc = aMgr->activeDocument();
+ setCurrentFeature(myPreviousCurrentFeature);
+ /*DocumentPtr aDoc = aMgr->activeDocument();
bool aIsOp = aMgr->isOperation();
if (!aIsOp)
aMgr->startOperation();
aDoc->setCurrentFeature(myPreviousCurrentFeature, true);
if (!aIsOp)
- aMgr->finishOperation();
+ aMgr->finishOperation();*/
myPreviousCurrentFeature = FeaturePtr();
}
+ else {
+ /*CompositeFeaturePtr aCompositeFeature = ModelAPI_Tools::compositeOwner(feature());
+ if (aCompositeFeature.get())
+ setCurrentFeature(aCompositeFeature);//myPreviousCurrentFeature);
+ //else
+ // setCurrentFeature(feature());*/
+ }
commitOperation();
aMgr->finishOperation();
return false;
}
+void ModuleBase_OperationFeature::setCurrentFeature(const FeaturePtr& theFeature)
+{
+ SessionPtr aMgr = ModelAPI_Session::get();
+ DocumentPtr aDoc = aMgr->activeDocument();
+ bool aIsOp = aMgr->isOperation();
+ if (!aIsOp)
+ aMgr->startOperation();
+ aDoc->setCurrentFeature(theFeature, false);//true);
+ if (!aIsOp)
+ aMgr->finishOperation();
+}
+
void ModuleBase_OperationFeature::activateByPreselection()
{
if (myPreSelection.empty())
/// \return Currently installed property panel
//ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; }
+ void setCurrentFeature(const FeaturePtr& theFeature);
+
/// Activates widgets by preselection if it is accepted. Emits signal if the activation is correct
virtual void activateByPreselection();
/// Hide feature/results if they were hided on start
virtual void stopOperation();
+ /// Virtual method called after operation resume (see resume() method for more description)
+ virtual void resumeOperation();
+
/// Creates an operation new feature
/// \param theFlushMessage the flag whether the create message should be flushed
/// \returns the created feature