From: GERALD NICOLAS Date: Mon, 7 Jan 2019 13:23:47 +0000 (+0100) Subject: Appliquer et/ou fermer pour les zones et les frontières analytiques X-Git-Tag: V9_3_0a1~1^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2c76ba0a456958754e937df11e98b7a4225b5ad0;p=modules%2Fhomard.git Appliquer et/ou fermer pour les zones et les frontières analytiques --- diff --git a/src/HOMARDGUI/MonCreateBoundaryAn.cxx b/src/HOMARDGUI/MonCreateBoundaryAn.cxx index 6f822606..78c10c41 100644 --- a/src/HOMARDGUI/MonCreateBoundaryAn.cxx +++ b/src/HOMARDGUI/MonCreateBoundaryAn.cxx @@ -38,6 +38,7 @@ #define PI 3.141592653589793 using namespace std; + // ------------------------------------------------------------------------------------------------------------------------ MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, @@ -49,7 +50,7 @@ MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, bool modal, */ QDialog(0), Ui_CreateBoundaryAn(), _parent(parent), - _aName (""), + _Name (""), _aCaseName(caseName), _Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0), _DMax(0), _Type(1), @@ -109,7 +110,7 @@ MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, QDialog(0), Ui_CreateBoundaryAn(), myHomardGen(myHomardGen0), _parent(parent), - _aName (""), + _Name (""), _aCaseName(caseName), _Type(1), _BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0), @@ -417,6 +418,22 @@ bool MonCreateBoundaryAn::PushOnApply() } +// Controles +// L'axe pour un cylindre + if ( _Type == 5 ) + { + double daux = _BoundaryAnXaxis*_BoundaryAnXaxis + _BoundaryAnYaxis*_BoundaryAnYaxis + _BoundaryAnZaxis*_BoundaryAnZaxis ; + if ( daux < 0.0000001 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_AXE") ); + return false; + } + } + +// +// Création ou mise à jour de la frontière +// bool bOK = CreateOrUpdateBoundaryAn(); if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; } @@ -425,94 +442,64 @@ bool MonCreateBoundaryAn::PushOnApply() } // --------------------------------------------------- -bool MonCreateBoundaryAn:: CreateOrUpdateBoundaryAn() +bool MonCreateBoundaryAn::CreateOrUpdateBoundaryAn() //---------------------------------------------------- // Creation de l'objet boundary { - _aName = LEName->text().trimmed(); - switch (_Type) + MESSAGE("Debut de CreateOrUpdateBoundaryAn avec _Type ="<<_Type<<", _Name ="<<_Name.toStdString().c_str()<<" et LEName ="<text().trimmed().toStdString().c_str()); +// + if (_Name != LEName->text().trimmed()) { - case 1 : // il s agit d un cylindre - { - try - { - aBoundaryAn = myHomardGen->CreateBoundaryCylinder(CORBA::string_dup(_aName.toStdString().c_str()), \ - _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon ); - } - catch( SALOME::SALOME_Exception& S_ex ) - { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr(CORBA::string_dup(S_ex.details.text)) ); - return false ; - } - break; - } - case 2 : // il s agit d une sphere - { - try - { - aBoundaryAn = myHomardGen->CreateBoundarySphere(CORBA::string_dup(_aName.toStdString().c_str()), \ - _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon); - } - catch( SALOME::SALOME_Exception& S_ex ) - { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr(CORBA::string_dup(S_ex.details.text)) ); - return false ; - } - break; - } - case 3 : // il s agit d un cone defini par un axe et un angle - { - try - { - aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_aName.toStdString().c_str()), \ - _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \ - _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone); - } - catch( SALOME::SALOME_Exception& S_ex ) - { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr(CORBA::string_dup(S_ex.details.text)) ); - return false ; - } - break; - } - case 4 : // il s agit d un cone defini par les 2 rayons + _Name = LEName->text().trimmed() ; + try { - try - { - aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_aName.toStdString().c_str()), \ - _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \ - _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2); - } - catch( SALOME::SALOME_Exception& S_ex ) + switch (_Type) { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr(CORBA::string_dup(S_ex.details.text)) ); - return false ; + case 1 : // il s agit d un cylindre + { aBoundaryAn = myHomardGen->CreateBoundaryCylinder(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon ); + break; + } + case 2 : // il s agit d une sphere + { aBoundaryAn = myHomardGen->CreateBoundarySphere(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon); + break; + } + case 3 : // il s agit d un cone defini par un axe et un angle + { 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(_Name.toStdString().c_str()), \ + _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \ + _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2); + break; + } + case 5 : // il s agit d un tore + { aBoundaryAn = myHomardGen->CreateBoundaryTorus(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre, _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe, _BoundaryAnToreRRev, _BoundaryAnToreRPri ); + break; + } } - break; } - case 5 : // il s agit d un tore + catch( SALOME::SALOME_Exception& S_ex ) { - try - { - aBoundaryAn = myHomardGen->CreateBoundaryTorus(CORBA::string_dup(_aName.toStdString().c_str()), \ - _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre, _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe, _BoundaryAnToreRRev, _BoundaryAnToreRPri ); - } - catch( SALOME::SALOME_Exception& S_ex ) - { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr(CORBA::string_dup(S_ex.details.text)) ); - return false ; - } - break; + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false ; } - } - _parent->AddBoundaryAn(_aName); + _parent->AddBoundaryAn(_Name); - return true; + return true; + } + else { + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_SELECT_OBJECT_4") ); + return false ; + } + MESSAGE("Fin de CreateOrUpdateBoundaryAn"); } // ------------------------------------------------------------------------ void MonCreateBoundaryAn::PushOnOK() diff --git a/src/HOMARDGUI/MonCreateBoundaryAn.h b/src/HOMARDGUI/MonCreateBoundaryAn.h index a3ce2139..fa2cb869 100644 --- a/src/HOMARDGUI/MonCreateBoundaryAn.h +++ b/src/HOMARDGUI/MonCreateBoundaryAn.h @@ -50,14 +50,14 @@ protected : MonCreateCase * _parent; - QString _aName; + QString _Name; QString _aCaseName; - double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr, _DMax ; int _Type; double _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon; double _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis; double _Xcentre, _Ycentre, _Zcentre, _Rayon ; + double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr, _DMax ; double _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1; double _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2; double _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone; @@ -77,8 +77,8 @@ protected : virtual void InitValBoundaryAn(); virtual void InitMinMax(); virtual void SetNewName(); - virtual void convertRayonAngle(int option); virtual bool CreateOrUpdateBoundaryAn(); + virtual void convertRayonAngle(int option); public slots: virtual void SetCylinder(); diff --git a/src/HOMARDGUI/MonCreateZone.cxx b/src/HOMARDGUI/MonCreateZone.cxx index 9eaa02e8..298f836d 100644 --- a/src/HOMARDGUI/MonCreateZone.cxx +++ b/src/HOMARDGUI/MonCreateZone.cxx @@ -469,6 +469,9 @@ bool MonCreateZone::PushOnApply() return false; } } +// +// Création ou mise à jour de la zone +// bool bOK = CreateOrUpdateZone() ; if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; } @@ -477,11 +480,12 @@ bool MonCreateZone::PushOnApply() } // --------------------------------------------------- -bool MonCreateZone:: CreateOrUpdateZone() +bool MonCreateZone::CreateOrUpdateZone() //---------------------------------------------------- // Creation de la zone { MESSAGE("Debut de CreateOrUpdateZone avec _Type ="<<_Type<<", _Name ="<<_Name.toStdString().c_str()<<" et LEName ="<text().trimmed().toStdString().c_str()); +// if (_Name != LEName->text().trimmed()) { _Name = LEName->text().trimmed() ; @@ -538,22 +542,22 @@ bool MonCreateZone:: CreateOrUpdateZone() { aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \ _ZoneXcentre, _ZoneYcentre, _ZoneRayon, _ZoneRayonInt, _Orient ); break; - } + } case 62 : // il s agit d un disque avec trou, dans le plan (Y,Z) { aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \ _ZoneYcentre, _ZoneZcentre, _ZoneRayon, _ZoneRayonInt, _Orient ); break; - } + } case 63 : // il s agit d un disque avec trou, dans le plan (Z,X) { aZone = myHomardGen->CreateZoneDiskWithHole(CORBA::string_dup(_Name.toStdString().c_str()), \ _ZoneZcentre, _ZoneXcentre, _ZoneRayon, _ZoneRayonInt, _Orient ); break; - } + } case 7 : // il s agit d un tuyau { aZone = myHomardGen->CreateZonePipe(CORBA::string_dup(_Name.toStdString().c_str()), \ _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayon, _ZoneHaut, _ZoneRayonInt ); break; - } + } } } catch( SALOME::SALOME_Exception& S_ex ) diff --git a/src/HOMARDGUI/MonCreateZone.h b/src/HOMARDGUI/MonCreateZone.h index c0707756..a8347693 100644 --- a/src/HOMARDGUI/MonCreateZone.h +++ b/src/HOMARDGUI/MonCreateZone.h @@ -55,8 +55,8 @@ protected : int _Orient; int _Type; double _Xcentre, _Ycentre, _Zcentre, _Rayon ; - double _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon ; double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr ; + double _ZoneXcentre, _ZoneYcentre, _ZoneZcentre, _ZoneRayon ; double _ZoneXmin, _ZoneXmax, _ZoneYmin, _ZoneYmax, _ZoneZmin, _ZoneZmax ; double _Xaxis, _Yaxis, _Zaxis, _RayonInt, _Haut ; double _ZoneXaxis, _ZoneYaxis, _ZoneZaxis, _ZoneRayonInt, _ZoneHaut ; diff --git a/src/HOMARDGUI/MonEditBoundaryAn.cxx b/src/HOMARDGUI/MonEditBoundaryAn.cxx index 23f7868c..27981973 100644 --- a/src/HOMARDGUI/MonEditBoundaryAn.cxx +++ b/src/HOMARDGUI/MonEditBoundaryAn.cxx @@ -37,8 +37,8 @@ MonEditBoundaryAn::MonEditBoundaryAn( MonCreateCase* parent, bool modal, { MESSAGE("Debut de MonEditBoundaryAn pour " << Name.toStdString().c_str()); setWindowTitle(QObject::tr("HOM_BOUN_A_EDIT_WINDOW_TITLE")); - _aName=Name; - aBoundaryAn = myHomardGen->GetBoundary(_aName.toStdString().c_str()); + _Name=Name; + aBoundaryAn = myHomardGen->GetBoundary(_Name.toStdString().c_str()); InitValEdit(); } // ------------------------------------------------------------------------ @@ -51,7 +51,7 @@ MonEditBoundaryAn::~MonEditBoundaryAn() void MonEditBoundaryAn::InitValEdit() // ------------------------------------------------------------------------ { - LEName->setText(_aName); + LEName->setText(_Name); LEName->setReadOnly(true); _Type = aBoundaryAn->GetType(); MESSAGE("_Type : "<<_Type); @@ -374,14 +374,14 @@ 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; @@ -392,7 +392,7 @@ bool MonEditBoundaryAn::CreateOrUpdateBoundaryAn() break; } } - if (Chgt) myHomardGen->InvalideBoundary(_aName.toStdString().c_str()); + if (Chgt) myHomardGen->InvalideBoundary(_Name.toStdString().c_str()); HOMARD_UTILS::updateObjBrowser(); return true; }