-#include <QTabWidget>
-#include <QVBoxLayout>
-#include <QDoubleSpinBox>
-#include <QSpinBox>
-#include <QTreeWidget>
-#include <QTreeWidgetItem>
-#include <QSpacerItem>
-#include <QString>
-#include <QHeaderView>
-#include <QItemDelegate>
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QComboBox>
-
-#include <vtkPoints.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkIdList.h>
-#include <vtkCellArray.h>
-#include <vtkUnsignedCharArray.h>
-#include <vtkDataSetMapper.h>
-#include <VTKViewer_CellLocationsArray.h>
-#include <vtkProperty.h>
-
-#include <ElCLib.hxx>
-// SALOME KERNEL includes
-#include <SALOMEDS_SComponent.hxx>
-#include <SALOMEDS_SObject.hxx>
-#include <SALOMEDS_Study.hxx>
-#include <SALOMEDS_wrap.hxx>
-#include "SalomeApp_Tools.h"
-#include <SALOMEconfig.h>
-#include <med.h>
-#include <utilities.h>
-
-#include <TCollection_AsciiString.hxx>
-
-const int SPACING = 6; // layout spacing
-const int MARGIN = 9; // layout margin
-
-SALOME_ListIO mySelected;
-
-
-//================================================================
-// Function : firstIObject
-// Purpose : Return the first selected object in the selected object list
-//================================================================
-Handle(SALOME_InteractiveObject) firstIObject()
-{
- const SALOME_ListIO& aList = selectedIO();
- return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)();
-}
-//================================================================
-// Function : selectedIO
-// Return the list of selected SALOME_InteractiveObject's
-//================================================================
-const SALOME_ListIO& selectedIO()
-{
- SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > ( SUIT_Session::session()->activeApplication() );
- LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr();
- if( aSelectionMgr )
- {
- aSelectionMgr->selectedObjects( mySelected );
- for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next())
- SCRUTE(it.Value()->getEntry());
- };
- return mySelected;
-}
-//================================================================
-// Function : getStudy
-// Returne un pointeur sur l'etude active
-//================================================================
-_PTR(Study) getStudy()
-{
- static _PTR(Study) _study;
- if(!_study)
- _study = SalomeApp_Application::getStudy();
- return _study;
-}
-
-bool createAndPublishMed(QString fileName)
-{
-
- SMESH::DriverMED_ReadStatus res;
- SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
- // SMESHGUI aGui;
-
- aMeshes = SMESHGUI::GetSMESHGen()->CreateMeshesFromMED( fileName.toUtf8().constData(), res );
- _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[0] );
- _PTR(Study) aStudy = SMESH::getStudy();
- QStringList anEntryList;
- // bool isEmpty;
- if ( aMeshSO ) {
- _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
- _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
- aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
- anEntryList.append( aMeshSO->GetID().c_str() );
- }
- else {
- // isEmpty = true;
- return false;
- }
- SMESHGUI::GetSMESHGUI()->updateObjBrowser();
-
- // browse to the published meshes
- if( LightApp_Application* anApp =
- dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
- anApp->browseObjects( anEntryList );
- return true;
-}
-bool createMgAdaptObject(MgAdapt *myMgAdapt )
-{
- // SMESH::SMESH_Mesh_var newMesh = SMESHGUI::GetSMESHGen()->CreateEmptyMesh();
-
- // _PTR(SObject) aHypothesis;
- _PTR(Study) aStudy = SMESH::getStudy();
- QStringList anEntryList;
- _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
- _PTR(SComponent) mgadapt = aStudy->FindComponent("MG-ADAPT");
- _PTR(GenericAttribute) ga;
- if (!aBuilder->FindAttribute(mgadapt, ga, "AttributeName") )
- {
- mgadapt = aBuilder->NewComponent("MG-ADAPT");
- _PTR(AttributeName) Name = aBuilder->FindOrCreateAttribute(mgadapt, "AttributeName");
- Name->SetValue("MG-ADAPT");
- _PTR(AttributePixMap) myPixmap = aBuilder->FindOrCreateAttribute( mgadapt, "AttributePixMap" );
- myPixmap->SetPixMap( "ICON_MG_ADAPT" );
- anEntryList.append( mgadapt->GetID().c_str() );
- }
-
- _PTR(SObject) obj = aBuilder->NewObject(mgadapt);
- _PTR(AttributeName) myName = aBuilder->FindOrCreateAttribute(obj, "AttributeName");
- myName->SetValue("hypo");
- _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( obj, "AttributePixMap" );
- aPixmap->SetPixMap( "ICON_SMESH_TREE_HYPO" );
- anEntryList.append( obj->GetID().c_str() );
-
- SMESHGUI::GetSMESHGUI()->updateObjBrowser();
-
- // // browse to the published meshes
- if( LightApp_Application* anApp =
- dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
- anApp->browseObjects( anEntryList );
- return true;
-}
-