From: nds Date: Thu, 18 Jun 2015 08:43:15 +0000 (+0300) Subject: Issue #599 - hide trihedron when create Sketch, X-Git-Tag: V_1.3.0~222 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f8f03f6e3b092381922b2703670ce57440714839;p=modules%2Fshaper.git Issue #599 - hide trihedron when create Sketch, A fix for external objects using. activateFlushes(true) in setCurrentDocument leads to visualization external edge out of its turn. There was a bug in distance constraint creation to the external edge. --- diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp index 139e86234..83091a254 100644 --- a/src/Events/Events_Loop.cpp +++ b/src/Events/Events_Loop.cpp @@ -133,9 +133,11 @@ void Events_Loop::flush(const Events_ID& theID) } } -void Events_Loop::activateFlushes(const bool theActivate) +bool Events_Loop::activateFlushes(const bool theActivate) { + bool isActive = myFlushActive; myFlushActive = theActivate; + return isActive; } void Events_Loop::clear(const Events_ID& theID) diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h index a11426f1b..adc888351 100644 --- a/src/Events/Events_Loop.h +++ b/src/Events/Events_Loop.h @@ -68,8 +68,10 @@ class Events_Loop //! Allows to disable flushes: needed in synchronization of document mechanism //! (to synchronize all and only then flush create, update, etc in correct order) - EVENTS_EXPORT void activateFlushes(const bool theActivate); - + //! \param theActivate a state about flushe is active. If false, the flush is disabled + //! \return the previous active flush state + EVENTS_EXPORT bool activateFlushes(const bool theActivate); + //! Clears all collected messages EVENTS_EXPORT void clear(const Events_ID& theID); diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index c2e4c355f..291307590 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -665,7 +665,7 @@ void Model_Document::setCurrentFeature(std::shared_ptr theCurr // blocks the flush signals to avoid each objects visualization in the viewer // they should not be shown once after all modifications are performed Events_Loop* aLoop = Events_Loop::loop(); - aLoop->activateFlushes(false); + bool isActive = aLoop->activateFlushes(false); TDF_Label aRefLab = generalLabel().FindChild(TAG_CURRENT_FEATURE); CompositeFeaturePtr aMain; // main feature that may nest the new current @@ -699,7 +699,10 @@ void Model_Document::setCurrentFeature(std::shared_ptr theCurr } if (theCurrent.get()) { std::shared_ptr aData = std::static_pointer_cast(theCurrent->data()); - if (!aData.get() || !aData->isValid()) return; + if (!aData.get() || !aData->isValid()) { + aLoop->activateFlushes(isActive); + return; + } TDF_Label aFeatureLabel = aData->label().Father(); Handle(TDF_Reference) aRef; @@ -736,7 +739,7 @@ void Model_Document::setCurrentFeature(std::shared_ptr theCurr } } // unblock the flush signals and up them after this - aLoop->activateFlushes(true); + aLoop->activateFlushes(isActive); aLoop->flush(aCreateEvent); aLoop->flush(aRedispEvent); diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index be9e80ff3..1b8e3253b 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -476,7 +476,7 @@ void Model_Objects::synchronizeFeatures( static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); static Events_ID aDeleteEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); static Events_ID aToHideEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - aLoop->activateFlushes(false); + bool isActive = aLoop->activateFlushes(false); // update all objects by checking are they on labels or not std::set aNewFeatures, aKeptFeatures; @@ -559,7 +559,7 @@ void Model_Objects::synchronizeFeatures( } anOwner->executeFeatures() = false; - aLoop->activateFlushes(true); + aLoop->activateFlushes(isActive); if (theFlush) { aLoop->flush(aCreateEvent); diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index c8e76a6c6..29d81e6c2 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -71,7 +71,7 @@ bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrs& th Events_Loop* aLoop = Events_Loop::loop(); // blocks the flush signals to avoid the temporary objects visualization in the viewer // they should not be shown in order to do not lose highlight by erasing them - aLoop->activateFlushes(false); + bool isActive = aLoop->activateFlushes(false); aData->blockSendAttributeUpdated(true); bool isAttributeBlocked = anAttribute->blockSetInitialized(true); @@ -87,7 +87,7 @@ bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrs& th restoreAttributeValue(aValid); aData->blockSendAttributeUpdated(false); anAttribute->blockSetInitialized(isAttributeBlocked); - aLoop->activateFlushes(true); + aLoop->activateFlushes(isActive); // In particular case the results are deleted and called as redisplayed inside of this // highlight-selection, to they must be flushed as soon as possible.