Salome HOME
Frontière analytique torique
[modules/homard.git] / src / HOMARDGUI / MonEditBoundaryAn.cxx
index 12450634cc1e216f293c0a4b73478319ee216982..d17d128b4c851091d9b258b4b1747820ca00f280 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-using namespace std;
-
 #include "MonEditBoundaryAn.h"
 
 #include "SalomeApp_Tools.h"
 #include "HOMARDGUI_Utils.h"
 #include <utilities.h>
 
+using namespace std;
 
 // ------------------------------------------------------------------------
 MonEditBoundaryAn::MonEditBoundaryAn( MonCreateCase* parent, bool modal,
@@ -84,6 +83,12 @@ void MonEditBoundaryAn::InitValEdit()
       SetConeR();
       break;
     }
+    case 5: // il s agit d un tore
+    {
+      InitValBoundaryAnTore();
+      SetTore();
+      break;
+    }
   };
 }
 // ------------------------------------------------------------------------
@@ -153,18 +158,33 @@ void MonEditBoundaryAn::InitValBoundaryAnConeR()
   convertRayonAngle(1) ;
 }
 // ------------------------------------------------------------------------
+void MonEditBoundaryAn::InitValBoundaryAnTore()
+// ------------------------------------------------------------------------
+{
+  HOMARD::double_array_var  mesCoordBoundary = aBoundaryAn->GetCoords();
+  ASSERT(mesCoordBoundary->length() == 8 );
+  _BoundaryAnXcentre=mesCoordBoundary[0];
+  _BoundaryAnYcentre=mesCoordBoundary[1];
+  _BoundaryAnZcentre=mesCoordBoundary[2];
+  _BoundaryAnXaxis=mesCoordBoundary[3];
+  _BoundaryAnYaxis=mesCoordBoundary[4];
+  _BoundaryAnZaxis=mesCoordBoundary[5];
+  _BoundaryAnRayon1=mesCoordBoundary[6];
+  _BoundaryAnRayon2=mesCoordBoundary[7];
+}
+// ------------------------------------------------------------------------
 void MonEditBoundaryAn::SetCylinder()
 // ------------------------------------------------------------------------
 {
   gBCylindre->setVisible(1);
   gBSphere->setVisible(0);
   gBCone->setVisible(0);
+  gBTore->setVisible(0);
   RBCylindre->setChecked(1);
-  adjustSize();
   _Type=1;
   RBSphere->setDisabled(true);
   RBCone->setDisabled(true);
-  adjustSize();
+  RBTore->setDisabled(true);
 
   SpinBox_Xcent->setValue(_BoundaryAnXcentre);
   SpinBox_Ycent->setValue(_BoundaryAnYcentre);
@@ -184,7 +204,8 @@ void MonEditBoundaryAn::SetCylinder()
 // Rayon
   SpinBox_Radius->setValue(_BoundaryAnRayon);
   SpinBox_Radius->setSingleStep(_BoundaryAnRayon/10.);
-
+//
+  adjustSize();
 }
 // ------------------------------------------------------------------------
 void MonEditBoundaryAn::SetSphere()
@@ -194,9 +215,10 @@ void MonEditBoundaryAn::SetSphere()
   gBSphere->setVisible(1);
   RBSphere->setChecked(1);
   gBCone->setVisible(0);
+  gBTore->setVisible(0);
   RBCylindre->setDisabled(true);
   RBCone->setDisabled(true);
-  adjustSize();
+  RBTore->setDisabled(true);
   _Type=2 ;
 
   SpinBox_Xcentre->setValue(_BoundaryAnXcentre);
@@ -211,8 +233,9 @@ void MonEditBoundaryAn::SetSphere()
   if ( _Zincr > 0) { SpinBox_Zcentre->setSingleStep(_Zincr); }
   else             { SpinBox_Zcentre->setSingleStep(1);}
 
-  SpinBox_Rayon->setMinimum(0.);
   SpinBox_Rayon->setValue(_BoundaryAnRayon);
+//
+  adjustSize();
 }
 // ------------------------------------------------------------------------
 void MonEditBoundaryAn::SetConeA()
@@ -222,10 +245,11 @@ void MonEditBoundaryAn::SetConeA()
   gBSphere->setVisible(0);
   gBCone->setVisible(1);
   RBCone->setChecked(1);
+  gBTore->setVisible(0);
   RB_Def_angle->setChecked(1);
   RBCylindre->setDisabled(true);
   RBSphere->setDisabled(true);
-  adjustSize();
+  RBTore->setDisabled(true);
   _Type=3;
 //
   TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0, QApplication::UnicodeUTF8));
@@ -249,6 +273,8 @@ void MonEditBoundaryAn::SetConeA()
 //
   TLCone_V2->setVisible(0);
   SpinBox_Cone_V2->setVisible(0);
+//
+  adjustSize();
 }
 // ------------------------------------------------------------------------
 void MonEditBoundaryAn::SetConeR()
@@ -257,11 +283,12 @@ void MonEditBoundaryAn::SetConeR()
   gBCylindre->setVisible(0);
   gBSphere->setVisible(0);
   gBCone->setVisible(1);
+  gBTore->setVisible(0);
   RBCone->setChecked(1);
   RB_Def_radius->setChecked(1);
   RBCylindre->setDisabled(true);
   RBSphere->setDisabled(true);
-  adjustSize();
+  RBTore->setDisabled(true);
   _Type=4;
 //
   TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0, QApplication::UnicodeUTF8));
@@ -287,6 +314,46 @@ void MonEditBoundaryAn::SetConeR()
   SpinBox_Cone_V2->setVisible(1);
   TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0, QApplication::UnicodeUTF8));
   SpinBox_Cone_V2->setValue(_BoundaryAnRayon2);
+//
+  adjustSize();
+}
+// ------------------------------------------------------------------------
+void MonEditBoundaryAn::SetTore()
+// ------------------------------------------------------------------------
+{
+  gBCylindre->setVisible(0);
+  gBSphere->setVisible(0);
+  gBCone->setVisible(0);
+  gBTore->setVisible(1);
+  RBTore->setChecked(1);
+  _Type=5;
+  RBCylindre->setDisabled(true);
+  RBSphere->setDisabled(true);
+  RBCone->setDisabled(true);
+
+  SpinBoxToreXcent->setValue(_BoundaryAnXcentre);
+  SpinBoxToreYcent->setValue(_BoundaryAnYcentre);
+  SpinBoxToreZcent->setValue(_BoundaryAnZcentre);
+
+  SpinBoxToreXaxe->setValue(_BoundaryAnXaxis);
+  SpinBoxToreYaxe->setValue(_BoundaryAnYaxis);
+  SpinBoxToreZaxe->setValue(_BoundaryAnZaxis);
+
+
+  SpinBoxToreXaxe->setSingleStep(0.1);
+  SpinBoxToreXcent->setSingleStep(_Xincr);
+  SpinBoxToreYaxe->setSingleStep(0.1);
+  SpinBoxToreYcent->setSingleStep(_Yincr);
+  SpinBoxToreZaxe->setSingleStep(0.1);
+  SpinBoxToreZcent->setSingleStep(_Zincr);
+// Rayon de revolution
+  SpinBoxToreRRev->setValue(_BoundaryAnRayon1);
+  SpinBoxToreRRev->setSingleStep(_BoundaryAnRayon1/10.);
+// Rayon primaire
+  SpinBoxToreRPri->setValue(_BoundaryAnRayon2);
+  SpinBoxToreRPri->setSingleStep(_BoundaryAnRayon2/10.);
+//
+  adjustSize();
 }
 // ---------------------------------------------------
 bool MonEditBoundaryAn::CreateOrUpdateBoundaryAn()
@@ -313,12 +380,17 @@ bool MonEditBoundaryAn::CreateOrUpdateBoundaryAn()
       break;
     }
     case 4 : // il s agit d un cone defini par les 2 rayons
-      {
+    {
       aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_aName.toStdString().c_str()), \
         _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \
         _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2);
       break;
     }
+    case 5 : // il s agit d un tore
+    {
+      aBoundaryAn->SetTorus(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon1, _BoundaryAnRayon2 );
+      break;
+    }
   }
   if (Chgt) myHomardGen->InvalideBoundary(_aName.toStdString().c_str());
   HOMARD_UTILS::updateObjBrowser();