Back to index

salome-geom  6.5.0
Functions
GEOMBase.cxx File Reference
#include "GEOMBase.h"
#include <GeometryGUI.h>
#include <GEOM_Client.hxx>
#include <GEOM_Actor.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewWindow.h>
#include <SOCC_ViewModel.h>
#include <SOCC_Prs.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_MessageBox.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepPrimAPI_MakeCone.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS.hxx>
#include <Precision.hxx>
#include <vtkRenderer.h>
#include <set>

Go to the source code of this file.

Functions

 Handle (GEOM_AISShape) GEOMBase
 Handle (AIS_InteractiveObject) GEOMBase

Function Documentation

Definition at line 286 of file GEOMBase.cxx.

{
  Handle(GEOM_AISShape) shape;

  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
  if ( study ) {
    _PTR(Study) studyDS = study->studyDS();
    _PTR(SObject) obj( studyDS->FindObjectIOR( IOR.toLatin1().constData() ) );
    if ( obj ) {
      QList<SUIT_ViewWindow*> views;
      if ( onlyInActiveView ) 
       views.append( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() );
      else 
       views = SUIT_Session::session()->activeApplication()->desktop()->windows();
      foreach ( SUIT_ViewWindow* view, views ) {
       if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
         Handle(AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)view->getViewManager()->getViewModel())->getAISContext();

         AIS_ListOfInteractive displayed;
         ic->DisplayedObjects( displayed );
         ic->ObjectsInCollector( displayed );

         AIS_ListIteratorOfListOfInteractive it( displayed );
         while ( it.More() && shape.IsNull() ) {
           if ( it.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) {
             Handle(GEOM_AISShape) sh = Handle(GEOM_AISShape)::DownCast( it.Value() );
             if ( !sh.IsNull() && sh->hasIO() ) {
              Handle(SALOME_InteractiveObject) IO = Handle(SALOME_InteractiveObject)::DownCast( sh->getIO() );
              if ( !IO.IsNull() && IO->hasEntry() && obj->GetID() == IO->getEntry() )
                shape = sh;
             }
           }
           it.Next();
         }
       }
       if ( !shape.IsNull() ) break;
      }
    }
  }
  return shape;
}

Here is the call graph for this function:

Handle ( AIS_InteractiveObject  )

Definition at line 379 of file GEOMBase.cxx.

{
  Handle(AIS_InteractiveObject) aisObject;

  if ( !IO.IsNull() && IO->hasEntry() ) {
    QList<SUIT_ViewWindow*> views;
    if ( onlyInActiveView ) 
      views.append( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() );
    else 
      views = SUIT_Session::session()->activeApplication()->desktop()->windows();
    
    foreach ( SUIT_ViewWindow* view, views ) {
      if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
        OCCViewer_Viewer* occViewer=(OCCViewer_Viewer*)view->getViewManager()->getViewModel();
        SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
        if (soccViewer) {
          SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( 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;
}

Here is the call graph for this function: