*/
double_array BaryCenter(in long id);
+ /*! Gets information about imported MED file */
+ SALOME_MED::MedFileInfo GetMEDFileInfo();
};
interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
SMESHGUI_BuildCompoundDlg.cxx \
SMESHGUI_ComputeDlg.cxx \
SMESHGUI_MakeNodeAtPointDlg.cxx \
- SMESHGUI_MeshEditPreview.cxx
+ SMESHGUI_MeshEditPreview.cxx \
+ SMESHGUI_FileInfoDlg.cxx
MOC_FILES = \
SMESHGUI_moc.cxx \
SMESHGUI_ConvToQuadOp_moc.cxx \
SMESHGUI_BuildCompoundDlg_moc.cxx \
SMESHGUI_ComputeDlg_moc.cxx \
- SMESHGUI_MakeNodeAtPointDlg_moc.cxx
+ SMESHGUI_MakeNodeAtPointDlg_moc.cxx \
+ SMESHGUI_FileInfoDlg_moc.cxx
nodist_libSMESH_la_SOURCES= \
$(MOC_FILES)
#include "SMESHGUI_MakeNodeAtPointDlg.h"
#include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI_ComputeDlg.h"
+#include "SMESHGUI_FileInfoDlg.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_GEOMGenUtils.h"
#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
-#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
+#include CORBA_CLIENT_HEADER(SMESH_MeshEditor)
// QT Includes
#define INCLUDE_MENUITEM_DEF
break;
}
+ case 150: //MED FILE INFORMATION
+ {
+ SALOME_ListIO selected;
+ LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+ if( aSel )
+ aSel->selectedObjects( selected );
+ if( selected.Extent() )
+ {
+ Handle(SALOME_InteractiveObject) anIObject = selected.First();
+ SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
+ if ( !aMesh->_is_nil() )
+ {
+ SMESHGUI_FileInfoDlg dlg( desktop(), aMesh->GetMEDFileInfo() );
+ dlg.exec();
+ }
+ }
+ break;
+ }
case 122: // EXPORT MED
case 121:
case 123:
createSMESHAction( 125, "EXPORT_MED" );
createSMESHAction( 126, "EXPORT_UNV" );
createSMESHAction( 141, "EXPORT_STL" );
+ createSMESHAction( 150, "FILE_INFO" );
createSMESHAction( 33, "DELETE", "ICON_DELETE", Key_Delete );
createSMESHAction( 5105, "SEL_FILTER_LIB" );
createSMESHAction( 701, "COMPUTE", "ICON_COMPUTE" );
// popup for object browser
+ createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION
+
createPopupItem( 704, OB, mesh, "&& isComputable"); // EDIT_MESHSUBMESH
createPopupItem( 704, OB, subMesh, "&& isComputable" ); // EDIT_MESHSUBMESH
createPopupItem( 803, OB, group ); // EDIT_GROUP
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SMESHGUI_FileInfoDlg.cxx
+// Author : Alexandre SOLOVYOV
+// Module : SMESH
+// $Header$
+
+#include <SMESHGUI_FileInfoDlg.h>
+
+#include <MED_Common.hxx>
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+
+SMESHGUI_FileInfoDlg::SMESHGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf )
+ : QtxDialog( parent, 0, true, false, QtxDialog::OK )
+{
+ setCaption( tr( "CAPTION" ) );
+
+ QLineEdit* fname = new QLineEdit( mainFrame() );
+ fname->setReadOnly( true );
+ QLineEdit* fsize = new QLineEdit( mainFrame() );
+ fsize->setReadOnly( true );
+ QLineEdit* medversion = new QLineEdit( mainFrame() );
+ medversion->setReadOnly( true );
+
+ QGridLayout* lay = new QGridLayout( mainFrame(), 4, 2, 5, 5 );
+ lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 );
+ lay->addWidget( fname, 0, 1 );
+ lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 );
+ lay->addWidget( fsize, 1, 1 );
+ lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 );
+ lay->addWidget( medversion, 2, 1 );
+
+ fname->setText( (char*)inf->fileName );
+ fsize->setText( QString::number( inf->fileSize ) );
+
+ QString version;
+ if( inf->major>=0 )
+ {
+ version = QString::number( inf->major );
+ if( inf->minor>=0 )
+ {
+ version += "." + QString::number( inf->minor );
+ if( inf->release>=0 )
+ version += "." + QString::number( inf->release );
+ }
+ }
+ medversion->setText( version );
+ setFixedSize( 640, 480 );
+}
+
+SMESHGUI_FileInfoDlg::~SMESHGUI_FileInfoDlg()
+{
+}
--- /dev/null
+// SMESH SMESHGUI : GUI for SMESH 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : SMESHGUI_FileInfoDlg.h
+// Author : Alexandre SOLOVYOV
+// Module : SMESH
+// $Header$
+
+#ifndef SMESHGUI_FILE_INFO_DIALOG
+#define SMESHGUI_FILE_INFO_DIALOG
+
+#include <MED.hh>
+#include <QtxDialog.h>
+
+class SMESHGUI_FileInfoDlg : public QtxDialog
+{
+ Q_OBJECT
+
+public:
+ SMESHGUI_FileInfoDlg( QWidget*, SALOME_MED::MedFileInfo* );
+ virtual ~SMESHGUI_FileInfoDlg();
+};
+
+#endif
else if ( p=="displayMode" ) val = QtxValue( displayMode( ind ) );
else if ( p=="isComputable" ) val = QtxValue( isComputable( ind ) );
else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) );
+ else if( p=="isImported" ) val = QtxValue( isImported( ind ) );
+
// else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) );
// printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() );
return "Unknown";
}
}
+
+bool SMESHGUI_Selection::isImported( const int ind ) const
+{
+ QString e = entry( ind );
+ _PTR(SObject) SO = SMESH::GetActiveStudyDocument()->FindObjectID( e );
+ bool res = false;
+ if( SO )
+ {
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( SO ) );
+ if( !aMesh->_is_nil() )
+ {
+ SALOME_MED::MedFileInfo* inf = aMesh->GetMEDFileInfo();
+ res = strlen( (char*)inf->fileName ) > 0;
+ }
+ }
+ return res;
+}
static int type( const QString&, _PTR(Study) );
static QString typeName( const int type);
+ bool isImported( const int ) const;
+
private:
QStringList myTypes;
QPtrList<SMESH_Actor> myActors;
#-----------------------------------------------------------
+
+msgid "MEN_FILE_INFO"
+msgstr "MED file information"
+
+msgid "SMESHGUI_FileInfoDlg::CAPTION"
+msgstr "File information"
+
+msgid "SMESHGUI_FileInfoDlg::FILE_NAME"
+msgstr "File name"
+
+msgid "SMESHGUI_FileInfoDlg::FILE_SIZE"
+msgstr "File size (bytes)"
+
+msgid "SMESHGUI_FileInfoDlg::MED_VERSION"
+msgstr "MED version"
THROW_SALOME_CORBA_EXCEPTION("ImportMEDFile(): unknown exception", SALOME::BAD_PARAM);
}
+ myFile = theFileName;
CreateGroupServants();
return ConvertDriverMEDReadStatus(status);
aList->length( nbGroups );
return aList._retn();
}
+
+//=============================================================================
+/*!
+ * \brief Return information about imported file
+ */
+//=============================================================================
+SALOME_MED::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo()
+{
+ SALOME_MED::MedFileInfo_var res = new SALOME_MED::MedFileInfo();
+
+ const char* name = myFile.c_str();
+ res->fileName = name;
+ res->fileSize = 0;//myFileInfo.size();
+ int major, minor, release;
+ if( !MED::getMEDVersion( name, major, minor, release ) )
+ {
+ major = -1;
+ minor = -1;
+ release = -1;
+ }
+ res->major = major;
+ res->minor = minor;
+ res->release = release;
+ return res._retn();
+}
*/
SMESH::double_array* BaryCenter(CORBA::Long id);
+ /*!
+ * Returns information about imported MED file
+ */
+ virtual SALOME_MED::MedFileInfo* GetMEDFileInfo();
map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI
map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
+ string myFile;
};
#endif