X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARDGUI%2FMonEditBoundaryAn.cxx;h=2798197344f5e8a204241f269fefadb1135795c3;hb=2c76ba0a456958754e937df11e98b7a4225b5ad0;hp=63082733308077b6c8d2f1e93c4c1ad594159aaf;hpb=633ecb2c6133ab4f266d218ff13da5e46310c90f;p=modules%2Fhomard.git diff --git a/src/HOMARDGUI/MonEditBoundaryAn.cxx b/src/HOMARDGUI/MonEditBoundaryAn.cxx index 63082733..27981973 100644 --- a/src/HOMARDGUI/MonEditBoundaryAn.cxx +++ b/src/HOMARDGUI/MonEditBoundaryAn.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2012 CEA/DEN, EDF R&D +// Copyright (C) 2011-2016 CEA/DEN, EDF R&D // // 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,29 +17,28 @@ // 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 +using namespace std; // ------------------------------------------------------------------------ MonEditBoundaryAn::MonEditBoundaryAn( MonCreateCase* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, - QString caseName, QString boundaryName ): + QString caseName, QString Name ): // ------------------------------------------------------------------------ /* Constructs a MonEditBoundaryAn herite de MonCreateBoundaryAn */ MonCreateBoundaryAn(parent, myHomardGen, caseName) { - MESSAGE("Debut de MonEditBoundaryAn pour " << boundaryName.toStdString().c_str()); + MESSAGE("Debut de MonEditBoundaryAn pour " << Name.toStdString().c_str()); setWindowTitle(QObject::tr("HOM_BOUN_A_EDIT_WINDOW_TITLE")); - _aName=boundaryName; - aBoundaryAn = _myHomardGen->GetBoundary(_aName.toStdString().c_str()); + _Name=Name; + aBoundaryAn = myHomardGen->GetBoundary(_Name.toStdString().c_str()); InitValEdit(); } // ------------------------------------------------------------------------ @@ -52,8 +51,8 @@ MonEditBoundaryAn::~MonEditBoundaryAn() void MonEditBoundaryAn::InitValEdit() // ------------------------------------------------------------------------ { - LEBoundaryName->setText(_aName); - LEBoundaryName->setReadOnly(true); + LEName->setText(_Name); + LEName->setReadOnly(true); _Type = aBoundaryAn->GetType(); MESSAGE("_Type : "<<_Type); InitValBoundaryAnLimit(); @@ -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,33 +245,36 @@ 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)); + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0)); SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone); - TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0, QApplication::UnicodeUTF8)); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0)); SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone); - TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0, QApplication::UnicodeUTF8)); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0)); SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone); // - TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0, QApplication::UnicodeUTF8)); + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0)); SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone); - TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0, QApplication::UnicodeUTF8)); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0)); SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone); - TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0, QApplication::UnicodeUTF8)); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0)); SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone); // - TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0, QApplication::UnicodeUTF8)); + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0)); SpinBox_Cone_V1->setValue(_BoundaryAngle); SpinBox_Cone_V1->setSingleStep(1.); SpinBox_Cone_V1->setMaximum(90.); // TLCone_V2->setVisible(0); SpinBox_Cone_V2->setVisible(0); +// + adjustSize(); } // ------------------------------------------------------------------------ void MonEditBoundaryAn::SetConeR() @@ -257,36 +283,77 @@ 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)); + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0)); SpinBox_Cone_X1->setValue(_BoundaryAnXcone1); - TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0, QApplication::UnicodeUTF8)); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0)); SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1); - TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0, QApplication::UnicodeUTF8)); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0)); SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1); // - TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0, QApplication::UnicodeUTF8)); + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0)); SpinBox_Cone_V1->setSingleStep(_Rayon/10.); SpinBox_Cone_V1->setMaximum(100000.*_DMax); SpinBox_Cone_V1->setValue(_BoundaryAnRayon1); // - TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0, QApplication::UnicodeUTF8)); + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0)); SpinBox_Cone_X2->setValue(_BoundaryAnXcone2); - TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0, QApplication::UnicodeUTF8)); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0)); SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2); - TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0, QApplication::UnicodeUTF8)); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0)); SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2); // TLCone_V2->setVisible(1); SpinBox_Cone_V2->setVisible(1); - TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0, QApplication::UnicodeUTF8)); + TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0)); 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() @@ -307,20 +374,25 @@ bool MonEditBoundaryAn::CreateOrUpdateBoundaryAn() } case 3 : // il s agit d un cone defini par un axe et un angle { - aBoundaryAn = _myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_aName.toStdString().c_str()), \ + aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \ _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \ _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone); break; } case 4 : // il s agit d un cone defini par les 2 rayons - { - aBoundaryAn = _myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_aName.toStdString().c_str()), \ + { + aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.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()); + if (Chgt) myHomardGen->InvalideBoundary(_Name.toStdString().c_str()); HOMARD_UTILS::updateObjBrowser(); return true; }