From: nge Date: Tue, 8 Jul 2008 14:23:31 +0000 (+0000) Subject: Suppression de l'appel aux méthodes DisplayedObjects et ObjectsInCollector et rempla... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ffa85558e92755a51cfffa02d4763e9d0840b8e6;p=modules%2Fgui.git Suppression de l'appel aux méthodes DisplayedObjects et ObjectsInCollector et remplacement des boucles for par l'appel aux méthodes IsDisplayed et IsInCollector. --- diff --git a/src/SOCC/SOCC_ViewModel.cxx b/src/SOCC/SOCC_ViewModel.cxx index 51e48fc01..539836496 100755 --- a/src/SOCC/SOCC_ViewModel.cxx +++ b/src/SOCC/SOCC_ViewModel.cxx @@ -24,7 +24,6 @@ #include "SUIT_Session.h" #include "SUIT_Application.h" #include -#include //#include "ToolsGUI.h" @@ -40,15 +39,6 @@ #include #include -struct AISLessThan -{ - bool operator()(const Handle(AIS_InteractiveObject)* theRightIO, - const Handle(AIS_InteractiveObject)* theLeftIO) const - { - return (theLeftIO( prs ); if ( !anOCCPrs || anOCCPrs->IsNull() ) @@ -345,43 +336,12 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs ) // get context Handle (AIS_InteractiveContext) ic = getAISContext(); - // get all displayed objects - AIS_ListOfInteractive List; -//CCAR -#if 0 -#else - ic->DisplayedObjects( List ); -#endif - // get objects in the collector - AIS_ListOfInteractive ListCollector; -//CCAR -#if 0 -#else - ic->ObjectsInCollector( ListCollector ); -#endif - - - START_TIMING // get objects to be displayed AIS_ListOfInteractive anAISObjects; anOCCPrs->GetObjects( anAISObjects ); AIS_ListIteratorOfListOfInteractive aIter( anAISObjects ); - AIS_ListIteratorOfListOfInteractive ite( List ); - - std::set check; - std::set checkCollector; - - for ( ; ite.More();ite.Next()) - { - check.insert(&ite.Value()); - } - ite.Initialize(ListCollector); - for ( ; ite.More();ite.Next()) - { - checkCollector.insert(&ite.Value()); - } - + //~ START_TIMING for ( ; aIter.More(); aIter.Next() ) { Handle(AIS_InteractiveObject) anAIS = aIter.Value(); @@ -390,17 +350,19 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs ) // try to find presentation in the viewer bool bDisplayed = false; // if insert.second is True object was not displayed before - if ((check.insert(&anAIS)).second) + if (ic->IsDisplayed(anAIS)) + { // compare presentations by handles // if the object is already displayed - nothing to do more // Deactivate object if necessary if ( !anOCCPrs->ToActivate() ) ic->Deactivate( anAIS ); bDisplayed = true; - + } + // then try to find presentation in the collector bDisplayed = false; - if ((checkCollector.insert(&anAIS)).second) + if (ic->IsInCollector(anAIS)) { // compare presentations by handles // if the object is in collector - display it