From: caremoli Date: Mon, 10 Jan 2011 10:29:13 +0000 (+0000) Subject: CCAR: optimize method isVisible of SOCC viewer by using entry2aisobjects map X-Git-Tag: V6_3_0a1~98 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d59d899e014904be77739ba6549c24af08fb6792;p=modules%2Fgui.git CCAR: optimize method isVisible of SOCC viewer by using entry2aisobjects map --- 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;