mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3785fda32c
@ -32,40 +32,49 @@ SMESHGUI_FileInfoDlg::SMESHGUI_FileInfoDlg( QWidget* parent, SMESH::MedFileInfo*
|
||||
{
|
||||
setWindowTitle( tr( "CAPTION" ) );
|
||||
setSizeGripEnabled( true );
|
||||
|
||||
|
||||
QLineEdit* fname = new QLineEdit( mainFrame() );
|
||||
fname->setReadOnly( true );
|
||||
QLineEdit* fsize = new QLineEdit( mainFrame() );
|
||||
fsize->setReadOnly( true );
|
||||
QLineEdit* medversion = new QLineEdit( mainFrame() );
|
||||
medversion->setReadOnly( true );
|
||||
QLabel* medversionlabel = new QLabel( tr( "MED_VERSION" ), mainFrame() );
|
||||
fname->setMinimumWidth( 300 );
|
||||
|
||||
|
||||
QGridLayout* lay = new QGridLayout( mainFrame() );
|
||||
lay->setMargin( 5 ); lay->setSpacing( 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( medversionlabel, 2, 0 );
|
||||
lay->addWidget( medversion, 2, 1 );
|
||||
|
||||
fname->setText( (char*)inf->fileName );
|
||||
fname->home( false );
|
||||
fsize->setText( QString::number( inf->fileSize ) );
|
||||
|
||||
QString version;
|
||||
if( inf->major>=0 )
|
||||
if ( fname->text().endsWith("med"))
|
||||
{
|
||||
version = QString::number( inf->major );
|
||||
if( inf->minor>=0 )
|
||||
QString version;
|
||||
if( inf->major>=0 )
|
||||
{
|
||||
version += "." + QString::number( inf->minor );
|
||||
if( inf->release>=0 )
|
||||
version += "." + QString::number( inf->release );
|
||||
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 );
|
||||
}
|
||||
else
|
||||
{
|
||||
medversionlabel->hide();
|
||||
medversion->hide();
|
||||
}
|
||||
medversion->setText( version );
|
||||
}
|
||||
|
||||
SMESHGUI_FileInfoDlg::~SMESHGUI_FileInfoDlg()
|
||||
|
@ -4325,7 +4325,7 @@ Use Display Entity menu command to show them.
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_FILE_INFO</source>
|
||||
<translation>MED File Information</translation>
|
||||
<translation>File Information</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_WRN_NO_APPROPRIATE_SELECTION</source>
|
||||
|
@ -3089,7 +3089,6 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
myMesh->Load(); // load from study file if not yet done
|
||||
TPythonDump pd; // not to dump GetGroups()
|
||||
SMESH::ListOfGroups_var groups = myMesh->GetGroups();
|
||||
pd << ""; // to avoid optimizing pd out
|
||||
for ( CORBA::ULong i = 0; i < groups->length(); ++i )
|
||||
{
|
||||
SMESH_GroupBase_i* grImpl = SMESH::DownCast<SMESH_GroupBase_i*>( groups[i]);
|
||||
@ -3343,6 +3342,17 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
}
|
||||
}
|
||||
|
||||
// Store file info
|
||||
std::string info = myImpl->FileInfoToString();
|
||||
if ( !info.empty() )
|
||||
{
|
||||
aSize[ 0 ] = info.size();
|
||||
aDataset = new HDFdataset( "file info", aTopGroup, HDF_STRING, aSize, 1 );
|
||||
aDataset->CreateOnDisk();
|
||||
aDataset->WriteOnDisk( (char*) info.data() );
|
||||
aDataset->CloseOnDisk();
|
||||
}
|
||||
|
||||
// write applied hypotheses if exist
|
||||
SALOMEDS::SObject_wrap myHypBranch;
|
||||
found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch.inout() );
|
||||
@ -4367,6 +4377,18 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
myNewMeshImpl->GetImpl().GetMeshDS()->SetPersistentId( *meshPersistentId );
|
||||
delete [] meshPersistentId;
|
||||
}
|
||||
|
||||
// Restore file info
|
||||
if ( aTopGroup->ExistInternalObject( "file info" ))
|
||||
{
|
||||
aDataset = new HDFdataset( "file info", aTopGroup );
|
||||
aDataset->OpenOnDisk();
|
||||
size = aDataset->GetSize();
|
||||
std::string info( size, ' ');
|
||||
aDataset->ReadFromDisk( (char*) info.data() );
|
||||
aDataset->CloseOnDisk();
|
||||
myNewMeshImpl->FileInfoFromString( info );
|
||||
}
|
||||
}
|
||||
}
|
||||
} // reading MESHes
|
||||
|
@ -445,6 +445,13 @@ SMESH::DriverMED_ReadStatus SMESH_Mesh_i::ImportCGNSFile( const char* theFileNa
|
||||
|
||||
CreateGroupServants();
|
||||
|
||||
_medFileInfo = new SMESH::MedFileInfo();
|
||||
_medFileInfo->fileName = theFileName;
|
||||
_medFileInfo->major = 0;
|
||||
_medFileInfo->minor = 0;
|
||||
_medFileInfo->release = 0;
|
||||
_medFileInfo->fileSize = SMESH_File( theFileName ).size();
|
||||
|
||||
return ConvertDriverMEDReadStatus(status);
|
||||
}
|
||||
|
||||
@ -479,6 +486,13 @@ int SMESH_Mesh_i::ImportUNVFile( const char* theFileName )
|
||||
|
||||
CreateGroupServants();
|
||||
|
||||
_medFileInfo = new SMESH::MedFileInfo();
|
||||
_medFileInfo->fileName = theFileName;
|
||||
_medFileInfo->major = 0;
|
||||
_medFileInfo->minor = 0;
|
||||
_medFileInfo->release = 0;
|
||||
_medFileInfo->fileSize = SMESH_File( theFileName ).size();
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
|
||||
return 1;
|
||||
@ -503,6 +517,12 @@ int SMESH_Mesh_i::ImportSTLFile( const char* theFileName )
|
||||
SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( _this() );
|
||||
_gen_i->SetName( meshSO, name.c_str() );
|
||||
}
|
||||
_medFileInfo = new SMESH::MedFileInfo();
|
||||
_medFileInfo->fileName = theFileName;
|
||||
_medFileInfo->major = 0;
|
||||
_medFileInfo->minor = 0;
|
||||
_medFileInfo->release = 0;
|
||||
_medFileInfo->fileSize = SMESH_File( theFileName ).size();
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
|
||||
@ -541,6 +561,13 @@ SMESH::ComputeError* SMESH_Mesh_i::ImportGMFFile( const char* theFileName,
|
||||
|
||||
error = _impl->GMFToMesh( theFileName, theMakeRequiredGroups );
|
||||
|
||||
_medFileInfo = new SMESH::MedFileInfo();
|
||||
_medFileInfo->fileName = theFileName;
|
||||
_medFileInfo->major = 0;
|
||||
_medFileInfo->minor = 0;
|
||||
_medFileInfo->release = 0;
|
||||
_medFileInfo->fileSize = SMESH_File( theFileName ).size();
|
||||
|
||||
SMESH_CATCH( exceptionToComputeError );
|
||||
#undef SMESH_CAUGHT
|
||||
#define SMESH_CAUGHT
|
||||
@ -5073,6 +5100,48 @@ SMESH::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo()
|
||||
return res._retn();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FileInfoToString
|
||||
//purpose : Persistence of file info
|
||||
//=======================================================================
|
||||
|
||||
std::string SMESH_Mesh_i::FileInfoToString()
|
||||
{
|
||||
std::string s;
|
||||
if ( &_medFileInfo.in() && _medFileInfo->fileName[0] )
|
||||
{
|
||||
s = SMESH_Comment( _medFileInfo->fileSize )
|
||||
<< " " << _medFileInfo->major
|
||||
<< " " << _medFileInfo->minor
|
||||
<< " " << _medFileInfo->release
|
||||
<< " " << _medFileInfo->fileName;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FileInfoFromString
|
||||
//purpose : Persistence of file info
|
||||
//=======================================================================
|
||||
|
||||
void SMESH_Mesh_i::FileInfoFromString(const std::string& info)
|
||||
{
|
||||
std::string size, major, minor, release, fileName;
|
||||
std::istringstream is(info);
|
||||
is >> size >> major >> minor >> release;
|
||||
fileName = info.data() + ( size.size() + 1 +
|
||||
major.size() + 1 +
|
||||
minor.size() + 1 +
|
||||
release.size()+ 1 );
|
||||
|
||||
_medFileInfo = new SMESH::MedFileInfo();
|
||||
_medFileInfo->fileName = fileName.c_str();
|
||||
_medFileInfo->fileSize = atoi( size.c_str() );
|
||||
_medFileInfo->major = atoi( major.c_str() );
|
||||
_medFileInfo->minor = atoi( minor.c_str() );
|
||||
_medFileInfo->release = atoi( release.c_str() );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* \brief Pass names of mesh groups from study to mesh DS
|
||||
|
@ -600,6 +600,12 @@ public:
|
||||
*/
|
||||
virtual SMESH::MedFileInfo* GetMEDFileInfo();
|
||||
|
||||
/*!
|
||||
* Persistence of file info
|
||||
*/
|
||||
std::string FileInfoToString();
|
||||
void FileInfoFromString(const std::string& info);
|
||||
|
||||
/*!
|
||||
* Sets list of notebook variables used for Mesh operations separated by ":" symbol
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user