From 97655a9bd7e1e0a52c211db37702c8c2e7645227 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 11 Jul 2016 11:00:20 +0300 Subject: [PATCH] Issue #1629 : it is not anymore possible to select entities first in the sketcher and then to apply constraints --- src/PartSet/PartSet_Module.cpp | 17 ++++++++++++++++- src/PartSet/PartSet_Module.h | 8 +++++++- src/PartSet/PartSet_SketcherMgr.cpp | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 2473454c7..7f8367528 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -123,7 +123,8 @@ extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) : ModuleBase_IModule(theWshop), - myVisualLayerId(0) + myVisualLayerId(0), + myIsOperationIsLaunched(false) { new PartSet_IconFactory(); @@ -557,6 +558,17 @@ bool PartSet_Module::isMouseOverWindow() return mySketchMgr->isMouseOverWindow(); } +bool PartSet_Module::isSketchNeutralPointActivated() const +{ + bool isNeutralPoint = true; + if (sketchReentranceMgr()->isInternalEditStarted()) + isNeutralPoint = false; + if (myIsOperationIsLaunched) + isNeutralPoint = false; + + return isNeutralPoint; +} + void PartSet_Module::closeDocument() { clearViewer(); @@ -845,10 +857,13 @@ bool PartSet_Module::canCommitOperation() const void PartSet_Module::launchOperation(const QString& theCmdId, const bool isUpdatePropertyPanel) { + myIsOperationIsLaunched = true; storeConstraintsState(theCmdId.toStdString()); updateConstraintsState(theCmdId.toStdString()); ModuleBase_IModule::launchOperation(theCmdId, isUpdatePropertyPanel); + + myIsOperationIsLaunched = false; } void PartSet_Module::storeConstraintsState(const std::string& theFeatureKind) diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index ada062897..0ad602e0c 100755 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -202,12 +202,17 @@ public: PartSet_SketcherMgr* sketchMgr() const { return mySketchMgr; } /// Returns sketch reentrant manager - PartSet_SketcherReetntrantMgr* sketchReentranceMgr() { return mySketchReentrantMgr; } + PartSet_SketcherReetntrantMgr* sketchReentranceMgr() const { return mySketchReentrantMgr; } /// Returns listener of overconstraint signal /// \return the listener PartSet_OverconstraintListener* overconstraintListener() { return myOverconstraintListener; } + /// Returns true if the current operation is not reentrant and the current state of the + /// application is not in launch operation mode + /// \return boolean value + bool isSketchNeutralPointActivated() const; + /// Performs functionality on closing document virtual void closeDocument(); @@ -401,6 +406,7 @@ protected: void setDefaultConstraintShown(); private: + bool myIsOperationIsLaunched; /// state of application between launch and stop operation SelectMgr_ListOfFilter mySelectionFilters; PartSet_SketcherMgr* mySketchMgr; diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index c6a7a1884..29a428ed1 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -1048,7 +1048,7 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation) /// improvement to deselect automatically all eventual selected objects, when // returning to the neutral point of the Sketcher // if the operation is restarted, the previous selection is used to initialize started operation - if (!myModule->sketchReentranceMgr()->isInternalEditStarted()) + if (myModule->isSketchNeutralPointActivated()) workshop()->selector()->clearSelection(); } -- 2.39.2