]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL11563: Naming Policy. Export to MED groups with duplicated names forbidden: ask...
authorjfa <jfa@opencascade.com>
Tue, 21 Feb 2006 08:52:26 +0000 (08:52 +0000)
committerjfa <jfa@opencascade.com>
Tue, 21 Feb 2006 08:52:26 +0000 (08:52 +0000)
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESH_msg_en.po

index 2c319404880d6b7577cb2afd15d9fcfdddddae5b..8864dfd0a76e55dee41f94d17694551d7a8bb92b 100644 (file)
 using namespace std;
 
 namespace{
-  // Decalarations
+  // Declarations
   //=============================================================
   void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
                            int theCommandID);
@@ -260,30 +260,45 @@ namespace{
        switch ( theCommandID ) {
        case 125:
        case 122:
-         aFilterMap.insert( QObject::tr("MED 2.1 (*.med)"), SMESH::MED_V2_1 );
-         aFilterMap.insert( QObject::tr("MED 2.2 (*.med)"), SMESH::MED_V2_2 );
+          {
+           if (aMesh->HasDuplicatedGroupNamesMED()) {
+              int aRet = SUIT_MessageBox::warn2
+                (SMESHGUI::desktop(),
+                 QObject::tr("SMESH_WRN_WARNING"),
+                 QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg(anIObject->getName()),
+                 QObject::tr("SMESH_BUT_YES"),  QObject::tr("SMESH_BUT_NO"),
+                 0, 1, 0);
+              if (aRet)
+                return;
+            }
+
+            aFilterMap.insert( QObject::tr("MED 2.1 (*.med)"), SMESH::MED_V2_1 );
+            aFilterMap.insert( QObject::tr("MED 2.2 (*.med)"), SMESH::MED_V2_2 );
+          }
          break;
        case 124:
        case 121:
          aFilter = QObject::tr("DAT files (*.dat)");
          break;
        case 126:
-       case 123: {
-         if(aMesh->NbPyramids()){
-           int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
-                                            QObject::tr("SMESH_WRN_WARNING"),
-                                            QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
-                                            QObject::tr("SMESH_BUT_YES"),
-                                            QObject::tr("SMESH_BUT_NO"),
-                                            0,1,0);
-           if(aRet)
-             return;
-         }
-         aFilter = QObject::tr("IDEAS files (*.unv)");
+       case 123:
+          {
+            if (aMesh->NbPyramids()) {
+              int aRet = SUIT_MessageBox::warn2
+                (SMESHGUI::desktop(),
+                 QObject::tr("SMESH_WRN_WARNING"),
+                 QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
+                 QObject::tr("SMESH_BUT_YES"),  QObject::tr("SMESH_BUT_NO"),
+                 0, 1, 0);
+              if (aRet)
+                return;
+            }
+            aFilter = QObject::tr("IDEAS files (*.unv)");
+          }
          break;
        default:
          return;
-       }}
+       }
 
        QString aFilename;
        SMESH::MED_VERSION aFormat;
@@ -295,41 +310,42 @@ namespace{
        
        if ( theCommandID != 122 && theCommandID != 125 )
          aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false);
-       else
-         {
-           QStringList filters;
-           for ( QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin(); it != aFilterMap.end(); ++it )
-             filters.push_back( it.key() );
-
-           //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
-           SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS") ,true, true );
-           fd->setCaption( aTitle );
-           fd->setFilters( filters );
-           fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
-           fd->SetChecked(toCreateGroups);
-           bool is_ok = false;
-           while(!is_ok){
-             fd->exec();
-             aFilename = fd->selectedFile();
-             aFormat = aFilterMap[fd->selectedFilter()];
-             is_ok = true;
-             if( !aFilename.isEmpty()
-                 && (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0)
-                 && aFormat==SMESH::MED_V2_1){
-               int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
-                                                 QObject::tr("SMESH_WRN_WARNING"),
-                                                 QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
-                                                 QObject::tr("SMESH_BUT_YES"),
-                                                 QObject::tr("SMESH_BUT_NO"),
-                                                 0,1,0);
-               if(aRet){
-                 is_ok = false;
-               }
-             }
-           }
-           toCreateGroups = fd->IsChecked();
-           delete fd;
-         }
+       else {
+          QStringList filters;
+          QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
+          for ( ; it != aFilterMap.end(); ++it )
+            filters.push_back( it.key() );
+
+          //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
+          SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
+            ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS") ,true, true );
+          fd->setCaption( aTitle );
+          fd->setFilters( filters );
+          fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
+          fd->SetChecked(toCreateGroups);
+          bool is_ok = false;
+          while (!is_ok) {
+            fd->exec();
+            aFilename = fd->selectedFile();
+            aFormat = aFilterMap[fd->selectedFilter()];
+            is_ok = true;
+            if ( !aFilename.isEmpty()
+                 && (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0)
+                 && aFormat==SMESH::MED_V2_1) {
+              int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
+                                                QObject::tr("SMESH_WRN_WARNING"),
+                                                QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
+                                                QObject::tr("SMESH_BUT_YES"),
+                                                QObject::tr("SMESH_BUT_NO"),
+                                                0,1,0);
+              if (aRet) {
+                is_ok = false;
+              }
+            }
+          }
+          toCreateGroups = fd->IsChecked();
+          delete fd;
+        }
        if ( !aFilename.isEmpty() ) {
          // Check whether the file already exists and delete it if yes
          QFile aFile( aFilename );
index 6dbef1d587c671a1ea94170301edea04b1b18094..9acdf7ce9efdfb21e648d8a53028b241b31151d2 100644 (file)
@@ -1260,6 +1260,13 @@ msgid "SMESH_EXPORT_UNV"
 msgstr "During export mesh with name - \"%1\" to UNV\n"
        "       pyramid's elements will be missed"
 
+msgid "SMESH_EXPORT_MED_DUPLICATED_GRP"
+msgstr "There are duplicated group names in mesh \"%1\".\n"
+       "You can cancel exporting and rename them,\n"
+       "otherwise some group names in the resulting MED file\n"
+       "will not match ones in the study.\n"
+       "Do you want to continue ?"
+
 msgid "SMESH_EXPORT_MED_V2_1"
 msgstr "During export mesh with name - \"%1\" to MED 2.1\n"
        "polygons and polyhedrons elements will be missed\n"