From d59d899e014904be77739ba6549c24af08fb6792 Mon Sep 17 00:00:00 2001 From: caremoli Date: Mon, 10 Jan 2011 10:29:13 +0000 Subject: [PATCH] CCAR: optimize method isVisible of SOCC viewer by using entry2aisobjects map --- src/SOCC/SOCC_ViewModel.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/SOCC/SOCC_ViewModel.cxx b/src/SOCC/SOCC_ViewModel.cxx index ab5e2829f..32487ea43 100755 --- a/src/SOCC/SOCC_ViewModel.cxx +++ b/src/SOCC/SOCC_ViewModel.cxx @@ -182,17 +182,19 @@ bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj, */ bool SOCC_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& obj ) { - AIS_ListOfInteractive List; - getAISContext()->DisplayedObjects( List ); - AIS_ListIteratorOfListOfInteractive ite( List ); - for ( ; ite.More(); ite.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - - if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) ) - return getAISContext()->IsDisplayed( ite.Value() ); + std::map< std::string , std::vector >::iterator it=entry2aisobjects.find(obj->getEntry()); + if(it != entry2aisobjects.end()) + { + // get context + Handle (AIS_InteractiveContext) ic = getAISContext(); + std::vector& List = it->second; + for( unsigned int ind = 0; ind < List.size(); ind++ ) + { + Handle(AIS_InteractiveObject) anAIS=List[ind]; + if(ic->IsDisplayed(anAIS)) + return true; + } } return false; -- 2.39.2