#define PI 3.141592653589793
using namespace std;
+
// ------------------------------------------------------------------------------------------------------------------------
MonCreateBoundaryAn::MonCreateBoundaryAn(MonCreateCase* parent, bool modal,
HOMARD::HOMARD_Gen_var myHomardGen0,
*/
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),
QDialog(0), Ui_CreateBoundaryAn(),
myHomardGen(myHomardGen0),
_parent(parent),
- _aName (""),
+ _Name (""),
_aCaseName(caseName),
_Type(1),
_BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0),
}
+// 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() ; }
}
// ---------------------------------------------------
-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 ="<<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()
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;
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();
return false;
}
}
+//
+// Création ou mise à jour de la zone
+//
bool bOK = CreateOrUpdateZone() ;
if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; }
}
// ---------------------------------------------------
-bool MonCreateZone:: CreateOrUpdateZone()
+bool MonCreateZone::CreateOrUpdateZone()
//----------------------------------------------------
// Creation de la zone
{
MESSAGE("Debut de CreateOrUpdateZone avec _Type ="<<_Type<<", _Name ="<<_Name.toStdString().c_str()<<" et LEName ="<<LEName->text().trimmed().toStdString().c_str());
+//
if (_Name != LEName->text().trimmed())
{
_Name = LEName->text().trimmed() ;
{ 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 )
{
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();
}
// ------------------------------------------------------------------------
void MonEditBoundaryAn::InitValEdit()
// ------------------------------------------------------------------------
{
- LEName->setText(_aName);
+ LEName->setText(_Name);
LEName->setReadOnly(true);
_Type = aBoundaryAn->GetType();
MESSAGE("_Type : "<<_Type);
}
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;
break;
}
}
- if (Chgt) myHomardGen->InvalideBoundary(_aName.toStdString().c_str());
+ if (Chgt) myHomardGen->InvalideBoundary(_Name.toStdString().c_str());
HOMARD_UTILS::updateObjBrowser();
return true;
}