void PartSet_SketcherMgr::onEnterViewPort()
{
- if (!isNestedCreateOperation())
+ if (!isNestedCreateOperation(getCurrentOperation()))
return;
// 1. if the mouse over window, update the next flag. Do not perform update visibility of
// created feature because it should be done in onMouseMove(). Some widgets watch
void PartSet_SketcherMgr::onLeaveViewPort()
{
- if (!isNestedCreateOperation())
+ if (!isNestedCreateOperation(getCurrentOperation()))
return;
myIsMouseOverViewProcessed = false;
// disable the viewer update in order to avoid visualization of redisplayed feature in viewer
// obtained after reset value
bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false);
- ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ ModuleBase_Operation* aOperation = getCurrentOperation();
ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
ModuleBase_ModelWidget* aActiveWgt = aPanel->activeWidget();
if (aActiveWgt) {
void PartSet_SketcherMgr::onValuesChangedInPropertyPanel()
{
- if (!isNestedCreateOperation())
+ if (!isNestedCreateOperation(getCurrentOperation()))
return;
// visualize the current operation feature
myIsPropertyPanelValueChanged = true;
- ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ ModuleBase_Operation* aOperation = getCurrentOperation();
visualizeFeature(aOperation, true);
}
if (!aViewer->canDragByMouse())
return;
- ModuleBase_Operation* aOperation = aWorkshop->currentOperation();
+ ModuleBase_Operation* aOperation = getCurrentOperation();
if (aOperation && aOperation->isEditOperation()) {
ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
ModuleBase_ModelWidget* aActiveWgt = aPanel->activeWidget();
ModuleBase_IViewer* aViewer = aWorkshop->viewer();
if (!aViewer->canDragByMouse())
return;
- ModuleBase_Operation* aOp = aWorkshop->currentOperation();
+ ModuleBase_Operation* aOp = getCurrentOperation();
if (aOp) {
if (isNestedSketchOperation(aOp)) {
get2dPoint(theWnd, theEvent, myClickedPoint);
void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
- if (isNestedCreateOperation() && !myIsMouseOverViewProcessed) {
+ if (isNestedCreateOperation(getCurrentOperation()) && !myIsMouseOverViewProcessed) {
myIsMouseOverViewProcessed = true;
// 1. perform the widget mouse move functionality and display the presentation
- ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ ModuleBase_Operation* aOperation = getCurrentOperation();
ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
ModuleBase_ModelWidget* anActiveWdg = aPanel->activeWidget();
// the mouse move should be processed in the widget, if it can in order to visualize correct
ModuleBase_IViewer* aViewer = myModule->workshop()->viewer();
aViewer->enableSelection(false);
- ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ ModuleBase_Operation* aOperation = getCurrentOperation();
if (!aOperation)
return;
if (isSketchOperation(aOperation))
void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
- ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ ModuleBase_Operation* aOperation = getCurrentOperation();
if (aOperation && aOperation->isEditOperation()) {
std::string aId = aOperation->id().toStdString();
if (isDistanceOperation(aOperation))
if (!myClickedPoint.myIsInitialized)
return;
- ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ ModuleBase_Operation* aOperation = getCurrentOperation();
// the distance constraint feature should not use the clickedd point
// this is workaround in order to don't throw down the flyout point value,
// set by execute() method of these type of features
connectToPropertyPanel(false);
myIsPropertyPanelValueChanged = false;
myIsMouseOverViewProcessed = true;
- visualizeFeature(theOperation, true);
+}
+
+void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation)
+{
+ if (isNestedCreateOperation(theOperation))
+ visualizeFeature(theOperation, true);
}
bool PartSet_SketcherMgr::canUndo() const
{
- return isNestedCreateOperation();
+ return isNestedCreateOperation(getCurrentOperation());
}
bool PartSet_SketcherMgr::canRedo() const
{
- return isNestedCreateOperation();
+ return isNestedCreateOperation(getCurrentOperation());
}
bool PartSet_SketcherMgr::canDisplayObject() const
{
bool aCanDisplay = true;
- if (!isNestedCreateOperation())
+ if (!isNestedCreateOperation(getCurrentOperation()))
return aCanDisplay;
// during a nested create operation, the feature is redisplayed only if the mouse over view
}
}
-bool PartSet_SketcherMgr::isNestedCreateOperation() const
+ModuleBase_Operation* PartSet_SketcherMgr::getCurrentOperation() const
+{
+ return myModule->workshop()->currentOperation();
+}
+
+bool PartSet_SketcherMgr::isNestedCreateOperation(ModuleBase_Operation* theOperation) const
{
- ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
- return aOperation && !aOperation->isEditOperation() && isNestedSketchOperation(aOperation);
+ return theOperation && !theOperation->isEditOperation() && isNestedSketchOperation(theOperation);
}
void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation,
/// Stops sketch operation
void stopSketch(ModuleBase_Operation* );
- /// Starts sketch operation
- void startNestedSketch(ModuleBase_Operation* );
+ /// Starts sketch operation, connects to the opeation property panel
+ /// \param theOperation a committed operation
+ void startNestedSketch(ModuleBase_Operation* theOperation);
- /// Stops sketch operation
- void stopNestedSketch(ModuleBase_Operation* );
+ /// Stop sketch operation, disconnects from the opeation property panel
+ /// \param theOperation a stopped operation
+ void stopNestedSketch(ModuleBase_Operation* theOperation);
+
+ /// Visualizes the operation feature if it is a creation nested feature operation
+ /// \param theOperation a committed operation
+ void commitNestedSketch(ModuleBase_Operation* theOperation);
/// Returns True if there are available Undos and the sketch manager allows undo
/// \return the boolean result
/// \param
bool isVisibleCreatedFeature() const;
- /// Returns true if the current operation is create a nested feature
+ /// Returns a current operation
+ /// \return an operation
+ ModuleBase_Operation* getCurrentOperation() const;
+
+ /// Returns true if the operation is a create nested feature one
+ /// \param theOperation a checked operation
//// \return boolean value
- bool isNestedCreateOperation() const;
+ bool isNestedCreateOperation(ModuleBase_Operation* theOperation) const;
/// Erase or display the feature of the current operation. If the mouse over the active view or
/// a current value is changed by property panel, the feature is displayed otherwise it is hidden