mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
PAL16760 - MED file information
This commit is contained in:
parent
a8d87f2c1b
commit
6ed10b325c
@ -625,6 +625,8 @@ module SMESH
|
||||
*/
|
||||
double_array BaryCenter(in long id);
|
||||
|
||||
/*! Gets information about imported MED file */
|
||||
SALOME_MED::MedFileInfo GetMEDFileInfo();
|
||||
};
|
||||
|
||||
interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
|
||||
|
@ -108,7 +108,8 @@ dist_libSMESH_la_SOURCES = \
|
||||
SMESHGUI_BuildCompoundDlg.cxx \
|
||||
SMESHGUI_ComputeDlg.cxx \
|
||||
SMESHGUI_MakeNodeAtPointDlg.cxx \
|
||||
SMESHGUI_MeshEditPreview.cxx
|
||||
SMESHGUI_MeshEditPreview.cxx \
|
||||
SMESHGUI_FileInfoDlg.cxx
|
||||
|
||||
MOC_FILES = \
|
||||
SMESHGUI_moc.cxx \
|
||||
@ -160,7 +161,8 @@ MOC_FILES = \
|
||||
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)
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include "SMESHGUI_MakeNodeAtPointDlg.h"
|
||||
#include "SMESHGUI_BuildCompoundDlg.h"
|
||||
#include "SMESHGUI_ComputeDlg.h"
|
||||
#include "SMESHGUI_FileInfoDlg.h"
|
||||
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
@ -122,7 +123,7 @@
|
||||
|
||||
#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
|
||||
@ -1292,6 +1293,24 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
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:
|
||||
@ -2461,6 +2480,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
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" );
|
||||
@ -2790,6 +2810,8 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
|
||||
// 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
|
||||
|
75
src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx
Normal file
75
src/SMESHGUI/SMESHGUI_FileInfoDlg.cxx
Normal file
@ -0,0 +1,75 @@
|
||||
// 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()
|
||||
{
|
||||
}
|
44
src/SMESHGUI/SMESHGUI_FileInfoDlg.h
Normal file
44
src/SMESHGUI/SMESHGUI_FileInfoDlg.h
Normal file
@ -0,0 +1,44 @@
|
||||
// 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
|
@ -110,6 +110,8 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
|
||||
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() );
|
||||
@ -487,3 +489,20 @@ QString SMESHGUI_Selection::typeName( const int t )
|
||||
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;
|
||||
}
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
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;
|
||||
|
@ -3537,3 +3537,18 @@ msgstr "Error"
|
||||
|
||||
#-----------------------------------------------------------
|
||||
|
||||
|
||||
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"
|
||||
|
@ -240,6 +240,7 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName )
|
||||
THROW_SALOME_CORBA_EXCEPTION("ImportMEDFile(): unknown exception", SALOME::BAD_PARAM);
|
||||
}
|
||||
|
||||
myFile = theFileName;
|
||||
CreateGroupServants();
|
||||
|
||||
return ConvertDriverMEDReadStatus(status);
|
||||
@ -2479,3 +2480,28 @@ SMESH::ListOfGroups* SMESH_Mesh_i::GetGroups(const list<int>& groupIDs) const
|
||||
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();
|
||||
}
|
||||
|
@ -436,6 +436,10 @@ public:
|
||||
*/
|
||||
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
|
||||
@ -450,6 +454,7 @@ private:
|
||||
map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
|
||||
map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
|
||||
map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
|
||||
string myFile;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user