if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
}
-void
+/*jfa tmp:void
+VisuGUI::
+OnImportMedField()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = It.Value();
+ //SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anIO->getEntry());
+ _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ //if (!aSObject->_is_nil()) {
+ if (aSObject) {
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
+ if (!CORBA::is_nil(anObject)) {
+ SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
+ if (!CORBA::is_nil(aMED.in()))
+ GetVisuGen(this)->ClientImportMed(aSObject);
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
+ if (!CORBA::is_nil(aField.in()))
+ GetVisuGen(this)->ImportMedField(aField);
+ } else {
+ //SALOMEDS::SObject_var aSFather = aSObject->GetFather();
+ _PTR(SObject) aSFather = aSObject->GetFather();
+ //SALOMEDS::GenericAttribute_var anAttr;
+ _PTR(GenericAttribute) anAttr;
+ aSFather->FindAttribute(anAttr, "AttributeName");
+ //SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ _PTR(AttributeName) aName (anAttr);
+ std::string aValue = aName->Value();
+ if (strcmp(aValue.c_str(), "MEDFIELD") == 0)
+ GetVisuGen(this)->ClientImportMed(aSObject);
+ }
+ }
+ }
+ updateObjBrowser(true);
+ QApplication::restoreOverrideCursor();
+}*/
+
+void
+VisuGUI::
+OnImportMedField()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy))
+ return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+ SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = It.Value();
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject->_is_nil()) {
+ CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
+ if (!CORBA::is_nil(anObject)) {
+ SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
+ if (!CORBA::is_nil(aMED.in()))
+ GetVisuGen(this)->ImportMed(aSObject);
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
+ if (!CORBA::is_nil(aField.in()))
+ GetVisuGen(this)->ImportMedField(aField);
+ } else {
+ SALOMEDS::SObject_var aSFather = aSObject->GetFather();
+ SALOMEDS::GenericAttribute_var anAttr;
+ aSFather->FindAttribute(anAttr, "AttributeName");
+ SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ CORBA::String_var aValue = aName->Value();
+ if (strcmp(aValue.in(), "MEDFIELD") == 0)
+ GetVisuGen(this)->ImportMed(aSObject);
+ }
+ }
+ }
+ updateObjBrowser(true);
+ QApplication::restoreOverrideCursor();
+}
+
+void
CreateCurves( SalomeApp_Module* theModule,
VISU::CutLines_i* thePrs,
QDialog* theDlg,
SALOME_ListIO aList;
SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
mgr->selectedObjects(aList);
-
+
Handle(SALOME_InteractiveObject) anIO;
for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
anIO = it.Value();
SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( table->GetObjectEntry() );
}
}
- }
+ }
} else {
// possibly this is Table SObject
SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
return;
VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
- SO,
- false,
+ SO,
+ false,
//SAL2670 Orientation of show tables
- VisuGUI_TableDlg::ttAuto,
+ VisuGUI_TableDlg::ttAuto,
Qt::Vertical );
dlg->show();
}
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
if (aListIO.Extent() != 1) return;
-
+
SalomeApp_Study* aAppStudy = GetAppStudy(this);
const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
CORBA::Object_var anObject = GetSelectedObj( aAppStudy, anIO->getEntry() );
createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
this, SLOT(OnExportTableToFile()));
+ createAction( VISU_IMPORT_MED, tr("MEN_IMPORT_MED"), QIconSet(),
+ tr("MEN_IMPORT_MED"), "", 0, aParent, false,
+ this, SLOT(OnImportMedField()));
+
//aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(), tr("MEN_CREATE_PRS"), "", 0, aParent, false,
this, SLOT(OnCreateMesh()));
mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
+
+ aRule = "client='ObjectBrowser' and type='MEDFIELD'";
+ mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure
+ mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
}
//***************************************************************************
void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, QString& theTitle )
{
SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
-
+
SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
action( VISU_EXPORT_TABLE )->addTo(theMenu);
theMenu->insertSeparator();
action( VISU_DELETE )->addTo(theMenu);
+ } else {
+ if (!CORBA::is_nil(anObject)) {
+ SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
+ if (!CORBA::is_nil(aMED.in())) {
+ action( VISU_IMPORT_MED )->addTo(theMenu);
+ } else {
+ _PTR(SObject) aSFather = SO->GetFather();
+ _PTR(GenericAttribute) anAttr;
+ aSFather->FindAttribute(anAttr, "AttributeName");
+ _PTR(AttributeName) aName (anAttr);
+ std::string aValue = aName->Value();
+ if (strcmp(aValue.c_str(), "MEDFIELD") == 0)
+ action( VISU_IMPORT_MED )->addTo(theMenu);
+ }
+ }
}
}
// VISU VISUGUI : GUI of VISU component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : VisuGUI.h
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
void OnExploreMEDFile();
void OnImportTableFromFile();
void OnExportTableToFile();
+ void OnImportMedField();
void OnCreateMesh();
void OnCreateScalarMap();
return Base_i::GetID();
}
- void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy)
+ void VISU_Gen_i::SetCurrentStudy (SALOMEDS::Study_ptr theStudy)
{
if (!CORBA::is_nil(theStudy))
{
CORBA::String_var aName = theStudy->Name();
QString aStudyName (aName.in());
- MESSAGE("VISU_Gen_i::SetCurrentStudy - StudyId = " <<
- theStudy->StudyId() << "; Name = '" << aName.in() << "'");
+ MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'");
myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
- MESSAGE("Find application for study : " << aName.in());
bool isActive = false;
SUIT_Session* aSession = SUIT_Session::session();
QPtrList<SUIT_Application> anApplications = aSession->applications();
}
}
if (!isActive) {
+ MESSAGE("!!! anApp->onLoadDoc(aName.in()) !!!");
// Has to be loaded in an empty or in a new application
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aFirstApp);
anApp->onLoadDoc(aName.in());
}
} else {
- MESSAGE("VISU_Gen_i::SetCurrentStudy : CORBA::is_nil(theStudy)");
+ MESSAGE("CORBA::is_nil(theStudy)");
}
}
return aResult._retn();
}
- Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){
- if(myStudyDocument->GetProperties()->IsLocked())
+ Result_ptr VISU_Gen_i::ClientImportMed (_PTR(SObject) theMedSObject)
+ {
+ SALOMEDS::SObject_ptr aMedSObject = GetSObject(theMedSObject);
+ return ImportMed(aMedSObject);
+ }
+
+ Result_ptr VISU_Gen_i::ImportMed (SALOMEDS::SObject_ptr theMedSObject)
+ {
+ if (myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
Mutex mt(myMutex);
Result_i* pResult = new Result_i(myStudyDocument,
Result_i::eComponent,
Result_i::eImportMed);
- if(pResult->Create(theMedSObject) != NULL)
+ if (pResult->Create(theMedSObject) != NULL) {
return pResult->_this();
- else{
+ } else {
pResult->_remove_ref();
return VISU::Result::_nil();
}
}
- Result_ptr VISU_Gen_i::ImportMedField(SALOME_MED::FIELD_ptr theField){
- if(myStudyDocument->GetProperties()->IsLocked())
+ Result_ptr VISU_Gen_i::ImportMedField (SALOME_MED::FIELD_ptr theField)
+ {
+ if (myStudyDocument->GetProperties()->IsLocked())
return Result::_nil();
Mutex mt(myMutex);
Result_i* pResult = new Result_i(myStudyDocument,
Result_i::eComponent,
Result_i::eImportMedField);
- if(pResult->Create(theField) != NULL)
+ if (pResult->Create(theField) != NULL) {
return pResult->_this();
- else{
+ } else {
pResult->_remove_ref();
return VISU::Result::_nil();
}