X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Displayer.cpp;h=ef89e2bcef6ca0e804b0e0b2e8383f5400f3e689;hb=4fc65e687f2ace553cacd3bd5ce196f4d46f67b4;hp=5a61d00179ed3ee22c41d2325f06be7a9272cb3e;hpb=77b93142eb8ba33bfb9a42040c2fd8926ffea5c8;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 5a61d0017..ef89e2bce 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -96,7 +96,7 @@ QString qIntListInfo(const QIntList& theValues, const QString& theSeparator = QS } XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop) - : myWorkshop(theWorkshop), myEnableUpdateViewer(true) + : myWorkshop(theWorkshop), myEnableUpdateViewer(true), myNeedUpdate(false) { enableUpdateViewer(true); myCustomPrs = std::shared_ptr(new XGUI_CustomPrs()); @@ -363,8 +363,9 @@ void XGUI_Displayer::deactivateObjects(const QObjectPtrList& theObjList, for (; anIt != aLast; anIt++) { deactivate(*anIt, false); } - if (theUpdateViewer) - updateViewer(); + //VSV It seems that there is no necessity to update viewer on deactivation + //if (theUpdateViewer) + // updateViewer(); } void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theModes) @@ -439,12 +440,15 @@ void XGUI_Displayer::activateObjects(const QIntList& theModes, const QObjectPtrL } AIS_ListIteratorOfListOfInteractive aLIt(aPrsList); + bool isActivationChanged = false; for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){ anAISIO = aLIt.Value(); - activate(anAISIO, myActiveSelectionModes, false); + if (activate(anAISIO, myActiveSelectionModes, false)) + isActivationChanged = true; } - if (theUpdateViewer) - updateViewer(); + // VSV It seems that there is no necessity to update viewer on activation + //if (theUpdateViewer && isActivationChanged) + // updateViewer(); } bool XGUI_Displayer::isActive(ObjectPtr theObject) const @@ -685,7 +689,10 @@ bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled) bool aWasEnabled = myEnableUpdateViewer; myEnableUpdateViewer = isEnabled; - + if (myNeedUpdate && myEnableUpdateViewer) { + updateViewer(); + myNeedUpdate = false; + } return aWasEnabled; } @@ -695,6 +702,8 @@ void XGUI_Displayer::updateViewer() const if (!aContext.IsNull() && myEnableUpdateViewer) { myWorkshop->viewer()->Zfitall(); aContext->UpdateCurrentViewer(); + } else { + myNeedUpdate = true; } } @@ -940,14 +949,15 @@ bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const return ::canBeShaded(anAIS); } -void XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO, +bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO, const QIntList& theModes, const bool theUpdateViewer) const { Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull() || theIO.IsNull()) - return; - + return false; + + bool isActivationChanged = false; // deactivate object in all modes, which are not in the list of activation // It seems that after the IO deactivation the selected state of the IO's owners // is modified in OCC(version: 6.8.0) and the selection of the object later is lost. @@ -974,9 +984,12 @@ void XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO, } if (isDeactivated) { // the selection from the previous activation modes should be cleared manually (#26172) + theIO->ClearSelected(); aContext->LocalContext()->ClearOutdatedSelection(theIO, true); - if (theUpdateViewer) - updateViewer(); + // For performance issues + //if (theUpdateViewer) + // updateViewer(); + isActivationChanged = true; } // loading the interactive object allowing the decomposition @@ -998,10 +1011,12 @@ void XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO, //aContext->Load(anAISIO, aMode, true); if (!aModesActivatedForIO.contains(aMode)) { activateAIS(theIO, aMode, theUpdateViewer); + isActivationChanged = true; } } } } + return isActivationChanged; } bool XGUI_Displayer::customizeObject(ObjectPtr theObject)