From: apo Date: Thu, 30 Dec 2004 08:05:59 +0000 (+0000) Subject: [Bug PAL7252] DEVELOPMENT: Porting to MED2.2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b479976b780349ffb23e8660277111e1a5367a30;p=modules%2Fsmesh.git [Bug PAL7252] DEVELOPMENT: Porting to MED2.2 --- diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index d64d9389f..e18028a2b 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -132,6 +132,15 @@ module SMESH DRS_FAIL // general failure (exception etc.) }; + /*! + * Enumeration for DriverMED (used by Perform() method) + */ + enum MED_VERSION // in the order of severity + { + MED_V2_1, + MED_V2_2 + }; + typedef sequence log_array; @@ -315,12 +324,18 @@ module SMESH raises (SALOME::SALOME_Exception); /*! - * Export Mesh with DAT and MED Formats + * Export Mesh to MED Formats */ - void ExportDAT( in string file ) + void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion ) raises (SALOME::SALOME_Exception); void ExportMED( in string file, in boolean auto_groups ) raises (SALOME::SALOME_Exception); + + /*! + * Export Mesh to DAT, UNV and STL Formats + */ + void ExportDAT( in string file ) + raises (SALOME::SALOME_Exception); void ExportUNV( in string file ) raises (SALOME::SALOME_Exception); void ExportSTL( in string file, in boolean isascii ) diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 8a3962e4a..9bd62817c 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -629,14 +629,16 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){ my3DActor->GetMapper()->SetScalarVisibility(false); myScalarBarActor->SetVisibility(false); - if(theMode != eNone){ + bool anIsScalarVisible = theMode > eNone; + + if(anIsScalarVisible){ SMESH::Controls::FunctorPtr aFunctor; - SMESH::Controls::NumericalFunctor* aNumFunctor = NULL; switch(theMode){ case eLength: { - aNumFunctor = new SMESH::Controls::Length(); - aFunctor.reset( aNumFunctor ); + SMESH::Controls::Length* aControl = new SMESH::Controls::Length(); + aControl->SetPrecision( myControlsPrecision ); + aFunctor.reset( aControl ); myControlActor = my1DActor; break; } @@ -660,50 +662,57 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){ break; case eArea: { - aNumFunctor = new SMESH::Controls::Area(); - aFunctor.reset( aNumFunctor ); + SMESH::Controls::Area* aControl = new SMESH::Controls::Area(); + aControl->SetPrecision( myControlsPrecision ); + aFunctor.reset( aControl ); myControlActor = my2DActor; break; } case eTaper: { - aNumFunctor = new SMESH::Controls::Taper(); - aFunctor.reset( aNumFunctor ); + SMESH::Controls::Taper* aControl = new SMESH::Controls::Taper(); + aControl->SetPrecision( myControlsPrecision ); + aFunctor.reset( aControl ); myControlActor = my2DActor; break; } case eAspectRatio: { - aNumFunctor = new SMESH::Controls::AspectRatio(); - aFunctor.reset( aNumFunctor ); + SMESH::Controls::AspectRatio* aControl = new SMESH::Controls::AspectRatio(); + aControl->SetPrecision( myControlsPrecision ); + aFunctor.reset( aControl ); myControlActor = my2DActor; break; } case eAspectRatio3D: { - aNumFunctor = new SMESH::Controls::AspectRatio3D(); - aFunctor.reset( aNumFunctor ); + SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D(); + aControl->SetPrecision( myControlsPrecision ); + aFunctor.reset( aControl ); myControlActor = my3DActor; break; } case eMinimumAngle: { - aNumFunctor = new SMESH::Controls::MinimumAngle(); - aFunctor.reset( aNumFunctor ); + SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle(); + aControl->SetPrecision( myControlsPrecision ); + aFunctor.reset( aControl ); myControlActor = my2DActor; break; } case eWarping: { - aNumFunctor = new SMESH::Controls::Warping(); - aFunctor.reset( aNumFunctor ); + SMESH::Controls::Warping* aControl = new SMESH::Controls::Warping(); + aControl->SetPrecision( myControlsPrecision ); + aFunctor.reset( aControl ); myControlActor = my2DActor; break; } case eSkew: { - aNumFunctor = new SMESH::Controls::Skew(); - aFunctor.reset( aNumFunctor ); + SMESH::Controls::Skew* aControl = new SMESH::Controls::Skew(); + aControl->SetPrecision( myControlsPrecision ); + aFunctor.reset( aControl ); myControlActor = my2DActor; break; } @@ -711,9 +720,6 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){ return; } - if(aNumFunctor) - aNumFunctor->SetPrecision( myControlsPrecision ); - vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid(); vtkIdType aNbCells = aGrid->GetNumberOfCells(); if(aNbCells){ diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 0c05113cf..9636e6451 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -631,7 +631,11 @@ throw(SALOME_Exception) */ //============================================================================= -void SMESH_Mesh::ExportMED(const char *file, const char* theMeshName, bool theAutoGroups) throw(SALOME_Exception) +void SMESH_Mesh::ExportMED(const char *file, + const char* theMeshName, + bool theAutoGroups, + int theVersion) + throw(SALOME_Exception) { Unexpect aCatch(SalomeException); DriverMED_W_SMESHDS_Mesh myWriter; diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index 51f085364..0ddd8398b 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -136,8 +136,13 @@ public: // return list of ancestors of theSubShape in the order // that lower dimention shapes come first. + void ExportMED(const char *file, + const char* theMeshName = NULL, + bool theAutoGroups = true, + int theVersion = 0) + throw(SALOME_Exception); + void ExportDAT(const char *file) throw(SALOME_Exception); - void ExportMED(const char *file, const char* theMeshName = NULL, bool theAutoGroups = true) throw(SALOME_Exception); void ExportUNV(const char *file) throw(SALOME_Exception); void ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 0c6049cab..fbac4d8f0 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -155,15 +155,16 @@ namespace{ SMESH::SMESH_Gen_ptr theComponentMesh, int theCommandID) { - QString filter; + QStringList filter; string myExtension; if(theCommandID == 113){ - filter = QObject::tr("MED files (*.med)"); + filter.append(QObject::tr("MED files (*.med)")); + filter.append(QObject::tr("All files (*)")); }else if (theCommandID == 112){ - filter = QObject::tr("IDEAS files (*.unv)"); + filter.append(QObject::tr("IDEAS files (*.unv)")); }else if (theCommandID == 111){ - filter = QObject::tr("DAT files (*.dat)"); + filter.append(QObject::tr("DAT files (*.dat)")); } QString filename = QAD_FileDlg::getFileName(parent, "", @@ -272,7 +273,7 @@ namespace{ QAD_WaitCursor wc; switch ( theCommandID ) { case 122: - aMesh->ExportMED( aFilename.latin1(), true ); // currently, automatic groups are always created + aMesh->ExportToMED( aFilename.latin1(), true, SMESH::MED_V2_1 ); // currently, automatic groups are always created break; case 121: aMesh->ExportDAT( aFilename.latin1() ); diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 1108d14aa..68d747d94 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -41,18 +41,18 @@ #include "OpUtil.hxx" #include "TCollection_AsciiString.hxx" +#include +#include +#include #include "SMESHDS_Command.hxx" #include "SMESHDS_CommandType.hxx" #include "SMESH_MeshEditor_i.hxx" #include "SMESH_Gen_i.hxx" #include "DriverMED_R_SMESHDS_Mesh.h" -#include -#include -#include - #include #include +// _CS_gbo_050504 Ajout explicite du sstream pour ostringstream #include #ifdef _DEBUG_ @@ -1049,10 +1049,13 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor() */ //============================================================================= -void SMESH_Mesh_i::ExportMED(const char *file, CORBA::Boolean auto_groups) throw(SALOME::SALOME_Exception) +void SMESH_Mesh_i::ExportToMED( const char* file, + CORBA::Boolean auto_groups, + SMESH::MED_VERSION theVersion ) + throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); - + char* aMeshName = "Mesh"; SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy(); if ( !aStudy->_is_nil() ) { @@ -1062,10 +1065,10 @@ void SMESH_Mesh_i::ExportMED(const char *file, CORBA::Boolean auto_groups) throw //SCRUTE(file); //SCRUTE(aMeshName); //SCRUTE(aMeshSO->GetID()); - + // asv : 27.10.04 : fix of 6903: check for StudyLocked before adding attributes if ( !aStudy->GetProperties()->IsLocked() ) - { + { SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::AttributeExternalFileDef_var aFileName; @@ -1078,10 +1081,17 @@ void SMESH_Mesh_i::ExportMED(const char *file, CORBA::Boolean auto_groups) throw aFileType = SALOMEDS::AttributeFileType::_narrow(anAttr); ASSERT(!aFileType->_is_nil()); aFileType->SetValue("FICHIERMED"); - } + } } } - _impl->ExportMED( file, aMeshName, auto_groups ); + _impl->ExportMED( file, aMeshName, auto_groups, theVersion ); +} + +void SMESH_Mesh_i::ExportMED( const char* file, + CORBA::Boolean auto_groups) + throw(SALOME::SALOME_Exception) +{ + ExportToMED(file,auto_groups,SMESH::MED_V2_1); } void SMESH_Mesh_i::ExportDAT(const char *file) throw(SALOME::SALOME_Exception) diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 0b010c474..2ded86e36 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -150,8 +150,11 @@ public: SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName ) throw (SALOME::SALOME_Exception); + void ExportToMED( const char* file, CORBA::Boolean auto_groups, SMESH::MED_VERSION theVersion ) + throw (SALOME::SALOME_Exception); void ExportMED( const char* file, CORBA::Boolean auto_groups ) throw (SALOME::SALOME_Exception); + void ExportDAT( const char* file ) throw (SALOME::SALOME_Exception); void ExportUNV( const char* file )