1 // File: SalomeApp_Module.cxx
2 // Created: 10/25/2004 11:39:56 AM
3 // Author: Sergey LITONIN
4 // Copyright (C) CEA 2004
6 #include "SalomeApp_Module.h"
7 #include "SalomeApp_DataModel.h"
8 #include "SalomeApp_Application.h"
9 #include "SalomeApp_Study.h"
11 #include "LightApp_Selection.h"
12 #include "LightApp_Operation.h"
13 #include "LightApp_Preferences.h"
14 //#include "LightApp_Displayer.h"
16 #include "CAM_DataModel.h"
18 #include "OB_Browser.h"
20 #include <SALOME_ListIO.hxx>
21 #include <SALOME_ListIteratorOfListIO.hxx>
22 #include <SALOME_InteractiveObject.hxx>
23 //#include <SALOME_Actor.h>
25 #include <SUIT_Session.h>
26 #include <SUIT_ViewModel.h>
28 #include <SVTK_ViewWindow.h>
29 //#include <SVTK_ViewModel.h>
30 //#include <SVTK_MainWindow.h>
31 //#include <SVTK_RenderWindowInteractor.h>
36 //#include <vtkActorCollection.h>
37 //#include <vtkRenderer.h>
40 SalomeApp_Module::SalomeApp_Module( const QString& name )
41 : LightApp_Module( name )
46 SalomeApp_Module::~SalomeApp_Module()
50 /*!Gets application.*/
51 SalomeApp_Application* SalomeApp_Module::getApp() const
53 return (SalomeApp_Application*)application();
56 /*!Create new instance of data model and return it.*/
57 CAM_DataModel* SalomeApp_Module::createDataModel()
59 return new SalomeApp_DataModel(this);
62 /*!Create and return instance of LightApp_Selection.*/
63 LightApp_Selection* SalomeApp_Module::createSelection() const
65 return LightApp_Module::createSelection();
69 Converts objects-containers to list of objects, those are contained
70 Other objects must be added without conversion
71 \param source - source list of objects
72 \param dest - list of converted objects
74 void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_ListIO& dest ) const
76 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
83 SALOME_ListIteratorOfListIO anIt( source );
84 for( ; anIt.More(); anIt.Next() )
86 Handle( SALOME_InteractiveObject ) obj = anIt.Value();
89 _PTR(SObject) SO = study->studyDS()->FindObjectID( obj->getEntry() );
90 if( SO && QString( SO->GetID().c_str() ) == SO->GetFatherComponent()->GetID().c_str() )
91 { //component is selected
92 _PTR(SComponent) SC( SO->GetFatherComponent() );
93 _PTR(ChildIterator) anIter ( study->studyDS()->NewChildIterator( SC ) );
94 anIter->InitEx( true );
95 while( anIter->More() )
97 _PTR(SObject) valSO ( anIter->Value() );
99 if( !valSO->ReferencedObject( refSO ) )
101 QString id = valSO->GetID().c_str(),
102 comp = SC->ComponentDataType().c_str(),
103 val = valSO->GetName().c_str();
105 Handle( SALOME_InteractiveObject ) new_obj =
106 new SALOME_InteractiveObject( id.latin1(), comp.latin1(), val.latin1() );
107 dest.Append( new_obj );
119 * \brief Virtual public
121 * This method is called just before the study document is saved, so the module has a possibility
122 * to store visual parameters in AttributeParameter attribue(s)
124 void SalomeApp_Module::storeVisualParameters(int savePoint)
129 * \brief Virtual public
131 * This method is called after the study document is opened, so the module has a possibility to restore
134 void SalomeApp_Module::restoreVisualParameters(int savePoint)