From: caremoli Date: Wed, 5 Jan 2011 18:10:34 +0000 (+0000) Subject: CCAR: improve speed of getAIS by calling CreatePrs that uses entry2aisobjects map X-Git-Tag: Start_BR_19998_21191~95 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6aa979f7402fb06a6bf5f959726241541b83e839;hp=643c92eb8f6e84b5643ba9c3bc990110d166f96b;p=modules%2Fgeom.git CCAR: improve speed of getAIS by calling CreatePrs that uses entry2aisobjects map --- diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index 018f62266..1a8bc880f 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include #include @@ -388,29 +390,20 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO foreach ( SUIT_ViewWindow* view, views ) { if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { - Handle(AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)view->getViewManager()->getViewModel())->getAISContext(); - - AIS_ListOfInteractive displayed; - anIC->DisplayedObjects( displayed ); - anIC->ObjectsInCollector( displayed ); - - AIS_ListIteratorOfListOfInteractive it( displayed ); - for ( ; it.More(); it.Next() ){ - if ( onlyGeom && !it.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) - continue; - - Handle(SALOME_InteractiveObject) obj = - Handle(SALOME_InteractiveObject)::DownCast( it.Value()->GetOwner() ); - - if ( !obj.IsNull() && obj->isSame( IO ) ) - { - aisObject = it.Value(); - break; - } + OCCViewer_Viewer* occViewer=(OCCViewer_Viewer*)view->getViewManager()->getViewModel(); + SOCC_Viewer* soccViewer = dynamic_cast(occViewer); + if (soccViewer) { + SOCC_Prs* occPrs = dynamic_cast( soccViewer->CreatePrs( IO->getEntry() ) ); + if ( occPrs && !occPrs->IsNull() ) { + AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); + if( !shapes.Extent() ) continue; + aisObject=shapes.First(); + delete occPrs; + } } } if ( !aisObject.IsNull() ) break; - } + } // foreach } return aisObject;