1 #include "SUPERVGUI_Selection.h"
4 #include <SalomeApp_DataOwner.h>
5 #include <SalomeApp_Study.h>
7 #include <SUIT_Session.h>
8 #include <SUIT_ViewWindow.h>
9 #include <SUIT_ViewManager.h>
10 #include <SUIT_ViewModel.h>
12 #include <SALOMEDSClient_SObject.hxx>
13 #include <SALOMEDSClient_Study.hxx>
14 #include <SALOMEDS_SObject.hxx>
15 #include <SALOME_Prs.h>
16 #include <SALOME_InteractiveObject.hxx>
20 #include <OCCViewer_ViewModel.h>
22 SUPERVGUI_Selection::SUPERVGUI_Selection()
26 SUPERVGUI_Selection::~SUPERVGUI_Selection()
30 QtxValue SUPERVGUI_Selection::param( const int ind, const QString& p ) const
32 QtxValue val( SalomeApp_Selection::param( ind, p ) );
33 if ( !val.isValid() ) {
34 if ( p == "type" ) val = QtxValue( typeName( ind ) );
37 //printf( "--> param() : [%s] = %s\n", p.latin1(), val.toString ().latin1() );
42 QString SUPERVGUI_Selection::typeName( const int index ) const
44 if ( isComponent( index ) )
47 _PTR(SObject) anIObj = getObject( index );
49 bool aIsOwner, aIsDataflow;
50 SUPERVGUI::Supervision()->whatIsSelected(anIObj, aIsOwner, aIsDataflow);
51 if ( aIsDataflow ) //selected dataflow object
53 if ( aIsOwner ) //selected object belongs to Supervisor
54 return "SupervisorObject";
59 bool SUPERVGUI_Selection::isComponent( const int index ) const
61 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
62 (SUIT_Session::session()->activeApplication()->activeStudy());
64 if ( appStudy && index >= 0 && index < count() ) {
65 _PTR(Study) study = appStudy->studyDS();
66 QString anEntry = entry( index );
68 if ( study && !anEntry.isNull() ) {
69 _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );
70 if ( aSO && aSO->GetFatherComponent() )
71 return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR();
77 _PTR(SObject) SUPERVGUI_Selection::getObject( const int index ) const
79 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
80 (SUIT_Session::session()->activeApplication()->activeStudy());
82 if ( appStudy && index >= 0 && index < count() ) {
83 _PTR(Study) study = appStudy->studyDS();
84 QString anEntry = entry( index );
86 if ( study && !anEntry.isNull() ) {
87 _PTR(SObject) aSO( study->FindObjectID( anEntry.latin1() ) );