emit started();
}
+/*!
+ * \brief Resumes operation
+ *
+ * Public slot. Verifies whether operation can be started and starts operation.
+ * This slot is not virtual and cannot be redefined. Redefine startOperation method
+ * to change behavior of operation. There is no point in using this method. It would
+ * be better to inherit own operator from base one and redefine startOperation method
+ * instead.
+ */
+void ModuleBase_Operation::resume()
+{
+}
+
/*!
* \brief Aborts operation
*
public slots:
void start();
+ void resume();
void abort();
void commit();
if (!anOperation)
return;
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
- if (aPreviewOp)
- visualizePreview(false);
+ //if (aPreviewOp)
+ // visualizePreview(false);
}
void PartSet_Module::onSelectionChanged()
if (aViewer) {
aViewer->setViewProjection(theX, theY, theZ);
}
+
+ ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
+ if (anOperation) {
+ PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+ if (aPreviewOp) {
+ aPreviewOp->setEditMode(true);
+ // the preview should be shown in another local context
+ visualizePreview(false);
+ visualizePreview(true);
+ }
+ }
+
myWorkshop->actionsMgr()->setNestedActionsEnabled(true);
}
int PartSet_OperationSketch::getSelectionMode() const
{
- return TopAbs_FACE;
+ int aMode = TopAbs_FACE;
+ if (isEditMode())
+ aMode = TopAbs_VERTEX;
+ return aMode;
}
void PartSet_OperationSketch::setSelectedShapes(const NCollection_List<TopoDS_Shape>& theList)
if (theList.IsEmpty())
return;
+ if (isEditMode())
+ return;
+
// get selected shape
const TopoDS_Shape& aShape = theList.First();
boost::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
QObject* theParent)
: ModuleBase_PropPanelOperation(theId, theParent)
{
+ setEditMode(false);
}
PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
/// Processes the mouse move in the point
/// \param thePoint a 3D point clicked in the viewer
virtual void mouseMoved(const gp_Pnt& thePoint) {};
+
+ /// temporary code to provide edition mode
+ void setEditMode(const bool isEditMode) { myIsEditMode = isEditMode; };
+protected:
+ bool isEditMode() const { return myIsEditMode; }
+private:
+ bool myIsEditMode;
};
#endif
break;
case SM_SecondPoint: {
setLinePoint(thePoint, LINE_ATTR_END);
- commit();
+ myPointSelectionMode = SM_None;
}
break;
case SM_None: {
void PartSet_OperationSketchLine::stopOperation()
{
PartSet_OperationSketchBase::stopOperation();
-
myPointSelectionMode = SM_None;
}
<plugin>
<workbench id="Sketch">
<group id="Basic">
- <feature id="Sketch" text="New sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
+ <feature id="Sketch" nested="SketchLine" text="New sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
<label text="Select a plane on which to create a sketch" tooltip="Select a plane on which to create a sketch"/>
<!--icon=":pictures/x_point.png"-->
</feature>
return true;
}
+void XGUI_OperationMgr::resumeOperation(ModuleBase_Operation* theOperation)
+{
+ connect(theOperation, SIGNAL(stopped()), this, SLOT(onOperationStopped()));
+ connect(theOperation, SIGNAL(started()), this, SIGNAL(operationStarted()));
+
+ theOperation->resume();
+}
+
bool XGUI_OperationMgr::canStartOperation(ModuleBase_Operation* theOperation)
{
bool aCanStart = true;
}
}
if (aResultOp)
- startOperation(aResultOp);
+ resumeOperation(aResultOp);
}
/// Returns the current operation or NULL
/// \return the current operation
ModuleBase_Operation* currentOperation() const;
- /// Sets the current operation or NULL
- /// \return the current operation
+ /// Start the operation and append it to the stack of operations
+ /// \param theOperation the started operation
+ /// \return the state whether the current operation is started
bool startOperation(ModuleBase_Operation* theOperation);
signals:
void operationStopped(ModuleBase_Operation* theOperation);
protected:
+ /// Sets the current operation or NULL
+ /// \param theOperation the started operation
+ /// \param isCheckBeforeStart the flag whether to check whether the operation can be started
+ /// \return the state whether the operation is resumed
+ void resumeOperation(ModuleBase_Operation* theOperation);
+
/// Returns whether the operation can be started. Check if there is already started operation and
/// the granted parameter of the launched operation
/// \param theOperation an operation to check