}
XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
- : myWorkshop(theWorkshop)
+ : myWorkshop(theWorkshop), myEnableUpdateViewer(true), myNeedUpdate(false)
{
enableUpdateViewer(true);
myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new XGUI_CustomPrs());
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)
}
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
bool aWasEnabled = myEnableUpdateViewer;
myEnableUpdateViewer = isEnabled;
-
+ if (myNeedUpdate && myEnableUpdateViewer) {
+ updateViewer();
+ myNeedUpdate = false;
+ }
return aWasEnabled;
}
if (!aContext.IsNull() && myEnableUpdateViewer) {
myWorkshop->viewer()->Zfitall();
aContext->UpdateCurrentViewer();
+ } else {
+ myNeedUpdate = true;
}
}
void XGUI_Displayer::deactivateSelectionFilters()
{
Handle(AIS_InteractiveContext) aContext = AISContext();
- if (!aContext.IsNull() && !myAndFilter.IsNull()) {
+ if (!myAndFilter.IsNull()) {
bool aFound = false;
- const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
- SelectMgr_ListIteratorOfListOfFilter anIt(aFilters);
- for (; anIt.More() && !aFound; anIt.Next()) {
- Handle(SelectMgr_Filter) aFilter = anIt.Value();
- aFound = aFilter == myAndFilter;
- }
- if (aFound) {
- aContext->RemoveFilter(myAndFilter);
- myAndFilter.Nullify();
+ if (!aContext.IsNull()) {
+ const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
+ SelectMgr_ListIteratorOfListOfFilter anIt(aFilters);
+ for (; anIt.More() && !aFound; anIt.Next()) {
+ Handle(SelectMgr_Filter) aFilter = anIt.Value();
+ aFound = aFilter == myAndFilter;
+ }
+ if (aFound)
+ aContext->RemoveFilter(myAndFilter);
}
+ myAndFilter.Nullify();
}
}
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.
}
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
//aContext->Load(anAISIO, aMode, true);
if (!aModesActivatedForIO.contains(aMode)) {
activateAIS(theIO, aMode, theUpdateViewer);
+ isActivationChanged = true;
}
}
}
}
+ return isActivationChanged;
}
bool XGUI_Displayer::customizeObject(ObjectPtr theObject)