-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;
-}
-
-
-// MG ADAPT UTILS
-//================================================================
-// Function : IObjectCount
-// Return the number of selected objects
-//================================================================
-int IObjectCount()
-{
- SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
- LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr();
- if( aSelectionMgr )
- {
- aSelectionMgr->selectedObjects( mySelected );
- SCRUTE(mySelected.Extent());
- return mySelected.Extent();
- }
- return 0;
-}
-
+// 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;
+// }