// hides the presentation of the current operation feature
myIsPropertyPanelValueChanged = false;
- updateVisibilityOfCreatedFeature();
+ visualizeFeature(aOperation, false);
}
void PartSet_SketcherMgr::onValuesChangedInPropertyPanel()
// visualize the current operation feature
myIsPropertyPanelValueChanged = true;
- updateVisibilityOfCreatedFeature();
+ ModuleBase_Operation* aOperation = myModule->workshop()->currentOperation();
+ visualizeFeature(aOperation, true);
}
void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
if (aDistanceWdg) {
aDistanceWdg->onMouseMove(theWnd, theEvent);
}
- updateVisibilityOfCreatedFeature();
+ visualizeFeature(aOperation, true);
}
myClickedPoint.clear();
connectToPropertyPanel(true);
}
-void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* )
+void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation)
{
connectToPropertyPanel(false);
myIsPropertyPanelValueChanged = false;
myIsMouseOverViewProcessed = true;
+ visualizeFeature(theOperation, true);
}
bool PartSet_SketcherMgr::canUndo() const
return aOperation && !aOperation->isEditOperation() && isNestedSketchOperation(aOperation);
}
-void PartSet_SketcherMgr::updateVisibilityOfCreatedFeature()
+void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation,
+ const bool isToDisplay)
{
- ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
- ModuleBase_Operation* aOperation = aWorkshop->currentOperation();
- if (!aOperation || aOperation->isEditOperation())
+ if (!theOperation || theOperation->isEditOperation())
return;
+
+ ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
- bool aToDisplay = canDisplayObject();
// 1. change visibility of the object itself, here the presentable object is processed,
// e.g. constraints features
- FeaturePtr aFeature = aOperation->feature();
+ FeaturePtr aFeature = theOperation->feature();
std::list<ResultPtr> aResults = aFeature->results();
- if (aToDisplay)
+ if (isToDisplay)
aDisplayer->display(aFeature, false);
else
aDisplayer->erase(aFeature, false);
// change visibility of the object results, e.g. non-constraint features
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
- if (aToDisplay) {
+ if (isToDisplay) {
aDisplayer->display(*aIt, false);
}
else {
/// Process sketch plane selected event
void onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
- /// Listens the value changed signal and display the current operation feature
- void onValuesChangedInPropertyPanel();
-
private slots:
/// Process the enter mouse to the view port. If the current operation is a create of
/// a nested sketch feature, it updates internal flags to display the feature on mouse move
/// Process the leave mouse of the view port. If the current operation is a create of
/// a nested sketch feature, it hides the feature in the viewer
void onLeaveViewPort();
+ /// Listens the value changed signal and display the current operation feature
+ void onValuesChangedInPropertyPanel();
void onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*);
void onMouseReleased(ModuleBase_IViewWindow*, QMouseEvent*);
/// 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
- void updateVisibilityOfCreatedFeature();
+ /// \param theOperation an operation which feature is to be displayed, it is nested create operation
+ /// \param isToDisplay a flag about the display or erase the feature
+ void visualizeFeature(ModuleBase_Operation* theOperation, const bool isToDisplay);
private:
PartSet_Module* myModule;