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 "SALOMEDS_IParameters.hxx"
27 #include <SUIT_Session.h>
28 #include <SUIT_ViewModel.h>
30 #include <SVTK_ViewWindow.h>
31 //#include <SVTK_ViewModel.h>
32 //#include <SVTK_MainWindow.h>
33 //#include <SVTK_RenderWindowInteractor.h>
38 //#include <vtkActorCollection.h>
39 //#include <vtkRenderer.h>
42 SalomeApp_Module::SalomeApp_Module( const QString& name )
43 : LightApp_Module( name )
48 SalomeApp_Module::~SalomeApp_Module()
52 /*!Gets application.*/
53 SalomeApp_Application* SalomeApp_Module::getApp() const
55 return (SalomeApp_Application*)application();
58 /*!Create new instance of data model and return it.*/
59 CAM_DataModel* SalomeApp_Module::createDataModel()
61 return new SalomeApp_DataModel(this);
64 /*!Create and return instance of LightApp_Selection.*/
65 LightApp_Selection* SalomeApp_Module::createSelection() const
67 return LightApp_Module::createSelection();
70 void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_ListIO& dest ) const
72 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
79 SALOME_ListIteratorOfListIO anIt( source );
80 for( ; anIt.More(); anIt.Next() )
82 Handle( SALOME_InteractiveObject ) obj = anIt.Value();
85 _PTR(SObject) SO = study->studyDS()->FindObjectID( obj->getEntry() );
86 if( SO && QString( SO->GetID().c_str() ) == SO->GetFatherComponent()->GetID().c_str() )
87 { //component is selected
88 _PTR(SComponent) SC( SO->GetFatherComponent() );
89 _PTR(ChildIterator) anIter ( study->studyDS()->NewChildIterator( SC ) );
90 anIter->InitEx( true );
91 while( anIter->More() )
93 _PTR(SObject) valSO ( anIter->Value() );
95 if( !valSO->ReferencedObject( refSO ) )
97 QString id = valSO->GetID().c_str(),
98 comp = SC->ComponentDataType().c_str(),
99 val = valSO->GetName().c_str();
101 Handle( SALOME_InteractiveObject ) new_obj =
102 new SALOME_InteractiveObject( id.latin1(), comp.latin1(), val.latin1() );
103 dest.Append( new_obj );
115 * \brief Virtual public
117 * This method is called just before the study document is saved, so the module has a possibility
118 * to store visual parameters in AttributeParameter attribue(s)
120 void SalomeApp_Module::storeVisualParameters(int savePoint)
125 * \brief Virtual public
127 * This method is called after the study document is opened, so the module has a possibility to restore
130 void SalomeApp_Module::restoreVisualParameters(int savePoint)