Salome HOME
Updated copyright comment
[modules/homard.git] / src / HOMARDGUI / MonEditCase.cxx
index 7017bbf7e51c922dce3efc136a8de54da3d6e7d7..199ff27da6fefb89703779e4a8c5e4df049c32d0 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2011-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2024  CEA, EDF
 //
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,8 +17,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-using namespace std;
-
 #include "MonEditCase.h"
 
 #include "SalomeApp_Tools.h"
@@ -26,16 +24,17 @@ using namespace std;
 #include "HomardQtCommun.h"
 #include <utilities.h>
 
+using namespace std;
 
 // -------------------------------------------------------------
 /* Constructs a MonEditCase
     herite de MonCreateCase
 */
 // -------------------------------------------------------------
-MonEditCase::MonEditCase ( QWidget* parent, bool modal,
+MonEditCase::MonEditCase ( bool modal,
                            HOMARD::HOMARD_Gen_var myHomardGen,
                            QString CaseName ):
-   MonCreateCase(parent, modal, myHomardGen)
+   MonCreateCase(modal, myHomardGen)
 {
     MESSAGE("Debut de MonEditCase" << CaseName.toStdString().c_str());
     setWindowTitle(QObject::tr("HOM_CASE_EDIT_WINDOW_TITLE"));
@@ -69,52 +68,49 @@ void MonEditCase::InitValEdit()
   PushFichier->setVisible(0);
 
   int ConfType=aCase->GetConfType();
-  if(ConfType==1)
-  {
-      GBTypeNoConf->setVisible(0);
-      RBConforme->setChecked(true);
-  }
-  else
-  {
-    RBNonConforme->setChecked(true);
-    GBTypeNoConf->setVisible(1);
-    RB1NpM->setEnabled(false);
-    RB1NpA->setEnabled(false);
-    RBQuelconque->setEnabled(false);
-  };
-
-  if (_ConfType==2) { RB1NpM->setChecked(true);};
-  if (_ConfType==3) { RB1NpA->setChecked(true);};
-  if (_ConfType==4) { RBQuelconque->setChecked(true);};
-
-  RBNonConforme->setEnabled(false);
+  if ( ( ConfType == 0 ) || ( ConfType == -1 ) ) { RBConforme->setChecked(true); }
+  else                                           { RBNonConforme->setChecked(true); };
   RBConforme->setEnabled(false);
+  RBNonConforme->setEnabled(false);
+  int ExtType=aCase->GetExtType();
 
-//    Non affichage du mode de suivi de frontiere
-  CBBoundaryA->setVisible(0);
-  GBBoundaryA->setVisible(0);
+
+// Suivi de frontiere
+// A priori, aucun affichage
+  GBTypeBoun->setVisible(0);
   CBBoundaryD->setVisible(0);
+  CBBoundaryA->setVisible(0);
+  GBBoundaryC->setVisible(0);
   GBBoundaryD->setVisible(0);
-
+  GBBoundaryA->setVisible(0);
 //    On passe en revue tous les couples (frontiere,groupe) du cas
   HOMARD::ListBoundaryGroupType_var mesBoundarys = aCase->GetBoundaryGroup();
   if (mesBoundarys->length()>0)
   {
     QStringList ListeFron ;
     QString NomFron ;
+    bool BounCAO = false ;
     bool BounDi = false ;
     bool BounAn = false ;
     for (int i=0; i<mesBoundarys->length(); i++)
     {
-//        Nom de la frontiere
+//    Nom de la frontiere
       NomFron = mesBoundarys[i++];
       MESSAGE("NomFron "<<NomFron.toStdString().c_str());
-//        L'objet associe pour en deduire le type
+//    L'objet associe pour en deduire le type
       HOMARD::HOMARD_Boundary_var myBoundary = myHomardGen->GetBoundary(NomFron.toStdString().c_str());
       int type_obj = myBoundary->GetType() ;
+      MESSAGE("type_obj "<<type_obj);
+//        C'est une frontiere CAO
+//        Remarque : on ne gere pas les groupes
+      if ( type_obj==-1 )
+      {
+        BounCAO = true ;
+        CBBoundaryCAO->addItem(NomFron);
+      }
 //        C'est une frontiere discrete
 //        Rermarque : on ne gere pas les groupes
-      if ( type_obj==0 )
+      else if ( type_obj==0 )
       {
         BounDi = true ;
         CBBoundaryDi->addItem(NomFron);
@@ -154,9 +150,23 @@ void MonEditCase::InitValEdit()
         TWBoundary->item( 0, ok )->setCheckState( Qt::Checked );
       }
     }
-    MESSAGE("BounDi "<<BounDi<<", BounAn "<<BounAn);
+    MESSAGE("BounCAO "<<BounCAO<<",BounDi "<<BounDi<<", BounAn "<<BounAn);
+    GBTypeBoun->setVisible(1);
+    if ( BounCAO )
+    { RBBoundaryCAO->setChecked(true);
+      GBBoundaryC->setVisible(1);
+      CBBoundaryCAO->setDisabled(true);
+      PBBoundaryCAONew->setVisible(0);
+      PBBoundaryCAOHelp->setVisible(0); }
+    if ( BounDi )
+    { RBBoundaryNonCAO->setChecked(true);
+      GBBoundaryD->setVisible(1);
+      CBBoundaryDi->setDisabled(true);
+      PBBoundaryDiNew->setVisible(0);
+      PBBoundaryDiHelp->setVisible(0); }
     if ( BounAn )
-    { GBBoundaryA->setVisible(1);
+    { RBBoundaryNonCAO->setChecked(true);
+      GBBoundaryA->setVisible(1);
 //    On rend les cases non modifiables.
 //    On ne peut pas le faire pour tout le tableau sinon on perd l'ascenseur !
       int nbcol = TWBoundary->columnCount();
@@ -165,17 +175,15 @@ void MonEditCase::InitValEdit()
       { for ( int j = 0; j < nbcol; j++ ) TWBoundary->item( i, j )->setFlags( Qt::ItemIsSelectable ); }
 //    on met un nom blanc au coin
       QTableWidgetItem *__colItem = new QTableWidgetItem();
-      __colItem->setText(QApplication::translate("CreateCase", "", 0, QApplication::UnicodeUTF8));
+      __colItem->setText(QApplication::translate("CreateCase", "", 0));
       TWBoundary->setHorizontalHeaderItem(0, __colItem);
 //    on cache les boutons inutiles
       PBBoundaryAnNew->setVisible(0);
       PBBoundaryAnHelp->setVisible(0);
     }
-    if ( BounDi )
-    { GBBoundaryD->setVisible(1);
-      CBBoundaryDi->setDisabled(true);
-      PBBoundaryDiNew->setVisible(0);
-      PBBoundaryDiHelp->setVisible(0); }
+    RBBoundaryNo->setEnabled(false);
+    RBBoundaryCAO->setEnabled(false);
+    RBBoundaryNonCAO->setEnabled(false);
   }
 //
 // Les options avancees (non modifiables)
@@ -183,21 +191,70 @@ void MonEditCase::InitValEdit()
   CBAdvanced->setEnabled(false) ;
   int Pyram = aCase->GetPyram();
   MESSAGE("Pyram "<<Pyram);
-  if ( Pyram > 0 )
+  if ( ( Pyram > 0 ) || ( ConfType < 0 ) || ( ConfType > 1 ) || ( ExtType > 0 ) )
   { GBAdvancedOptions->setVisible(1);
-    CBPyramid->setChecked(true);
+//
+    if ( Pyram > 0 )
+    { CBPyramid->setChecked(true);
+      CBPyramid->setVisible(1);
+    }
+    else
+    { CBPyramid->setChecked(false);
+      CBPyramid->setVisible(0);
+    }
     CBPyramid->setEnabled(false);
+//
+    if ( ( ConfType == 0 ) || ( ConfType == -1 ) )
+    { if ( ConfType == 0 ) { RBStandard->setChecked(true); }
+      else                 { RBBox->setChecked(true); }
+      RBStandard->setVisible(1);
+      RBBox->setVisible(1);
+      RBNC1NpA->setVisible(0);
+      RBNCQuelconque->setVisible(0);
+    }
+    else
+    { if (ConfType==-2) { RBBox->setChecked(true);};
+      if (ConfType==1) { RBStandard->setChecked(true);};
+      if (ConfType==2) { RBNC1NpA->setChecked(true);};
+      if (ConfType==3) { RBNCQuelconque->setChecked(true);};
+      RBStandard->setVisible(1);
+      RBBox->setVisible(1);
+      RBNC1NpA->setVisible(1);
+      RBNCQuelconque->setVisible(1);
+    }
+    RBStandard->setEnabled(false);
+    RBBox->setEnabled(false);
+    RBNC1NpA->setEnabled(false);
+    RBNCQuelconque->setEnabled(false);
+//
+    if ( ExtType == 0 )
+    { GBFormat->setVisible(0);
+      RBMED->setChecked(true);
+    }
+    else
+    { GBFormat->setVisible(1);
+      RBMED->setVisible(1);
+      RBSaturne->setVisible(1);
+      RBSaturne2D->setVisible(1);
+      if ( ExtType == 1 ) { RBSaturne->setChecked(true); }
+      else                { RBSaturne2D->setChecked(true); }
+    }
+    RBMED->setEnabled(false);
+    RBSaturne->setEnabled(false);
+    RBSaturne2D->setEnabled(false);
   }
   else
   { GBAdvancedOptions->setVisible(0);
     CBPyramid->setChecked(false);
- }
+    RBStandard->setChecked(true);
+    RBMED->setChecked(true);
+  }
 //
 // L'etat
   int etat = aCase->GetState();
   MESSAGE("etat "<<etat);
-  if ( etat == 0 ) { Comment->setText(QApplication::translate("CreateCase", "HOM_CASE_EDIT_STATE_0", 0, QApplication::UnicodeUTF8)); }
-  else             { Comment->setText(QApplication::translate("CreateCase", "HOM_CASE_EDIT_STATE", 0, QApplication::UnicodeUTF8)); }
+  if ( etat == 0 ) { Comment->setText(QApplication::translate("CreateCase", "HOM_CASE_EDIT_STATE_0", 0)); }
+  else             { Comment->setText(QApplication::translate("CreateCase", "HOM_CASE_EDIT_STATE", 0)); }
 
   Comment->setVisible(1);
 //