CCAR: improve speed of getAIS by calling CreatePrs that uses entry2aisobjects map

This commit is contained in:
caremoli 2011-01-05 18:10:34 +00:00
parent 643c92eb8f
commit 6aa979f740

View File

@ -36,6 +36,8 @@
#include <OCCViewer_ViewPort3d.h> #include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_ViewModel.h> #include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewWindow.h> #include <OCCViewer_ViewWindow.h>
#include <SOCC_ViewModel.h>
#include <SOCC_Prs.h>
#include <SALOME_ListIO.hxx> #include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx> #include <SALOME_ListIteratorOfListIO.hxx>
@ -388,29 +390,20 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO
foreach ( SUIT_ViewWindow* view, views ) { foreach ( SUIT_ViewWindow* view, views ) {
if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
Handle(AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)view->getViewManager()->getViewModel())->getAISContext(); OCCViewer_Viewer* occViewer=(OCCViewer_Viewer*)view->getViewManager()->getViewModel();
SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
AIS_ListOfInteractive displayed; if (soccViewer) {
anIC->DisplayedObjects( displayed ); SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( IO->getEntry() ) );
anIC->ObjectsInCollector( displayed ); if ( occPrs && !occPrs->IsNull() ) {
AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
AIS_ListIteratorOfListOfInteractive it( displayed ); if( !shapes.Extent() ) continue;
for ( ; it.More(); it.Next() ){ aisObject=shapes.First();
if ( onlyGeom && !it.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) delete occPrs;
continue;
Handle(SALOME_InteractiveObject) obj =
Handle(SALOME_InteractiveObject)::DownCast( it.Value()->GetOwner() );
if ( !obj.IsNull() && obj->isSame( IO ) )
{
aisObject = it.Value();
break;
} }
} }
} }
if ( !aisObject.IsNull() ) break; if ( !aisObject.IsNull() ) break;
} } // foreach
} }
return aisObject; return aisObject;