From: asl Date: Tue, 27 May 2008 10:29:34 +0000 (+0000) Subject: PAL16760 - MED file information X-Git-Tag: V4_1_3rc1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ad98a148f0ddb05f89b006f461fffdb9fac54c84;p=modules%2Fvisu.git PAL16760 - MED file information --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 78337588..bfd1dc91 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1854,6 +1854,9 @@ module VISU { /*! Gets current resolution of multi resolution structure for the given mesh and part names */ void SetResolution(in EntityName theMeshName, in EntityName thePartName, in Resolution theResolution); + + /*! Gets information about imported MED file */ + SALOME_MED::MedFileInfo GetMEDFileInfo(); }; //------------------------------------------------------- diff --git a/src/VISUGUI/Makefile.am b/src/VISUGUI/Makefile.am index ae11d80c..e3a86336 100644 --- a/src/VISUGUI/Makefile.am +++ b/src/VISUGUI/Makefile.am @@ -72,7 +72,8 @@ dist_libVISU_la_SOURCES= \ VisuGUI_Slider.cxx \ VisuGUI_InputPane.cxx \ VisuGUI_CacheDlg.cxx \ - VisuGUI_FieldFilter.cxx + VisuGUI_FieldFilter.cxx \ + VisuGUI_FileInfoDlg.cxx MOC_FILES= \ VisuGUI_moc.cxx \ @@ -103,7 +104,8 @@ MOC_FILES= \ VisuGUI_TransparencyDlg_moc.cxx \ VisuGUI_Slider_moc.cxx \ VisuGUI_InputPane_moc.cxx \ - VisuGUI_CacheDlg_moc.cxx + VisuGUI_CacheDlg_moc.cxx \ + VisuGUI_FileInfoDlg_moc.cxx nodist_libVISU_la_SOURCES=$(MOC_FILES) diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index 002b8c62..d34fd121 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -2462,3 +2462,20 @@ msgstr "Hide" msgid "VisuGUI::MEN_HOLO_RENDER" msgstr "Holo render" + + + +msgid "VisuGUI::MEN_FILE_INFO" +msgstr "MED File information" + +msgid "VisuGUI_FileInfoDlg::CAPTION" +msgstr "File information" + +msgid "VisuGUI_FileInfoDlg::FILE_NAME" +msgstr "File name" + +msgid "VisuGUI_FileInfoDlg::FILE_SIZE" +msgstr "File size (bytes)" + +msgid "VisuGUI_FileInfoDlg::MED_VERSION" +msgstr "MED version" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 43648822..ffd912f4 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -76,6 +76,7 @@ #include "LightApp_SelectionMgr.h" #include "LightApp_Selection.h" #include "LightApp_Preferences.h" +#include "LightApp_DataOwner.h" #include "QtxAction.h" @@ -134,6 +135,7 @@ #include "VisuGUI_VectorsDlg.h" #include "VisuGUI_TableDlg.h" +#include "VisuGUI_FileInfoDlg.h" #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(MED_Gen) @@ -2438,6 +2440,10 @@ VisuGUI createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIconSet(aPixmap), tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false, this, SLOT(OnMultiprViewHide())); + + createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIconSet(), + tr("MEN_FILE_INFO"), "", 0, aParent, false, + this, SLOT(OnFileInfo())); } void @@ -2620,7 +2626,9 @@ VisuGUI mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 ); mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 ); mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 ); - + + mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 ); + // Rules QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " @@ -2821,6 +2829,8 @@ VisuGUI QString aCustomRule = aRule + "resolutionState!='H'"; mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule, true ); } + + mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}", true ); } //*************************************************************************** @@ -3793,3 +3803,18 @@ void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution) QApplication::restoreOverrideCursor(); } + +//--------------------------------------------------------------- +void VisuGUI::OnFileInfo() +{ + SalomeApp_Study* aStudy = dynamic_cast( getApp()->activeStudy() ); + SUIT_DataOwnerPtrList lst; + getApp()->selectionMgr()->selected( lst ); + LightApp_DataOwner* owner = dynamic_cast( lst.first().get() ); + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry() ); + VISU::Result_i* aCResult = dynamic_cast( anObjectInfo.myBase ); + if(!aCResult) + return; + VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() ); + dlg.exec(); +} diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 5d19813c..a21eabbe 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -175,6 +175,8 @@ protected slots: void OnMultiprViewHide(); void OnMultiprChangeRes(VISU::Result::Resolution theResolution); + void OnFileInfo(); + protected: virtual LightApp_Selection* createSelection() const; diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 3e0b4bc4..5c1083fa 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -125,4 +125,6 @@ #define VISU_MULTIPR_LOW_RES 4097 #define VISU_MULTIPR_HIDE 4098 +#define VISU_FILE_INFO 4100 + #endif diff --git a/src/VISUGUI/VisuGUI_FileInfoDlg.cxx b/src/VISUGUI/VisuGUI_FileInfoDlg.cxx new file mode 100644 index 00000000..5b5b90d2 --- /dev/null +++ b/src/VISUGUI/VisuGUI_FileInfoDlg.cxx @@ -0,0 +1,77 @@ +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VisuGUI_FileInfoDlg.cxx +// Author : Alexandre SOLOVYOV +// Module : VISU +// $Header$ + +#include + +#include + +#include +#include +#include + +VisuGUI_FileInfoDlg::VisuGUI_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 ); +} + +VisuGUI_FileInfoDlg::~VisuGUI_FileInfoDlg() +{ +} diff --git a/src/VISUGUI/VisuGUI_FileInfoDlg.h b/src/VISUGUI/VisuGUI_FileInfoDlg.h new file mode 100644 index 00000000..e7d8a674 --- /dev/null +++ b/src/VISUGUI/VisuGUI_FileInfoDlg.h @@ -0,0 +1,44 @@ +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VisuGUI_FileInfoDlg.h +// Author : Alexandre SOLOVYOV +// Module : VISU +// $Header$ + +#ifndef VISUGUI_FILE_INFO_DIALOG +#define VISUGUI_FILE_INFO_DIALOG + +#include +#include + +class VisuGUI_FileInfoDlg : public QtxDialog +{ + Q_OBJECT + +public: + VisuGUI_FileInfoDlg( QWidget*, SALOME_MED::MedFileInfo* ); + virtual ~VisuGUI_FileInfoDlg(); +}; + +#endif diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 2c0dc3d6..edfbf5b9 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -1663,3 +1663,23 @@ VISU::Result_i return components; } + +SALOME_MED::MedFileInfo* VISU::Result_i::GetMEDFileInfo() +{ + SALOME_MED::MedFileInfo_var res = new SALOME_MED::MedFileInfo(); + + QString fpath = myFileInfo.absFilePath(); + res->fileName = fpath.latin1(); + res->fileSize = myFileInfo.size(); + int major, minor, release; + if( !MED::getMEDVersion( fpath.latin1(), major, minor, release ) ) + { + major = -1; + minor = -1; + release = -1; + } + res->major = major; + res->minor = minor; + res->release = release; + return res._retn(); +} diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index 40eff416..afb24795 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -196,6 +196,10 @@ namespace VISU ConnectObserver(TResultObserver* theObserver, boost::signalslib::connection& theConnection); + virtual + SALOME_MED::MedFileInfo* + GetMEDFileInfo(); + typedef boost::signal0 TUpdateObserverSignal; typedef VISU_Convertor TInput;