21 #include <qtablewidget.h>
22 #include <qtabwidget.h>
23 #include <qradiobutton.h>
24 #include <qbuttongroup.h>
26 #include <qstringlist.h>
27 #include <qcombobox.h>
30 #include <QGridLayout>
34 #include <QTreeWidgetItem>
38 #include "Tympan/core/config.h"
52 #define TR(id) OLocalizator::getString("TYCalculWidget", (id))
60 setWindowTitle(
TR(
"id_caption"));
77 QGridLayout* groupBoxStateLayout =
new QGridLayout();
81 QGroupBox* groupBoxState =
new QGroupBox();
82 groupBoxState->setTitle(
TR(
"id_etat_calcul"));
83 groupBoxState->setLayout(groupBoxStateLayout);
88 QGroupBox* groupBoxCalcMethod =
new QGroupBox(
this);
89 groupBoxCalcMethod->setTitle(
TR(
""));
90 QGridLayout* groupBoxCalcMethodLayout =
new QGridLayout();
91 groupBoxCalcMethod->setLayout(groupBoxCalcMethodLayout);
93 QLabel* labelCalcMethod =
new QLabel(groupBoxCalcMethod);
94 labelCalcMethod->setText(
TR(
"id_calc_method_label"));
95 groupBoxCalcMethodLayout->addWidget(labelCalcMethod, 0, 0);
101 groupBoxCalcMethodLayout->addWidget(
_comboSolver, 0, 1);
109 QString dataModelPath(QCoreApplication::applicationDirPath() +
"/" + SOLVER_PARAMS_JSON);
151 QGridLayout* groupBoxLayout =
new QGridLayout();
164 if (getElement()->getDateCreation() ==
"2001-10-01")
166 getElement()->setDateCreation(date.currentDate().toString(Qt::ISODate));
168 _editDateCreation->setDate(date.fromString(getElement()->getDateCreation(), Qt::ISODate));
180 if (getElement()->getDateModif() ==
"2001-10-01")
182 getElement()->setDateModif(date.currentDate().toString(Qt::ISODate));
184 _editDateModif->setDate(date.fromString(getElement()->getDateModif(), Qt::ISODate));
199 QGroupBox* pGroupBoxTableEtats =
new QGroupBox(
this);
200 pGroupBoxTableEtats->setTitle(
TR(
"id_map_box"));
201 QGridLayout* groupBoxTableEtatsLayout =
new QGridLayout();
202 pGroupBoxTableEtats->setLayout(groupBoxTableEtatsLayout);
204 QLineEdit* pLineEditNomTableEtats =
new QLineEdit(pGroupBoxTableEtats);
205 pLineEditNomTableEtats->setEnabled(
false);
206 groupBoxTableEtatsLayout->addWidget(pLineEditNomTableEtats, 0, 0);
208 QPushButton* pPushButtonTableEtats =
new QPushButton(pGroupBoxTableEtats);
209 pPushButtonTableEtats->setText(
TR(
"id_proprietes"));
210 groupBoxTableEtatsLayout->addWidget(pPushButtonTableEtats, 0, 1);
219 QGridLayout* groupBoxResultatLayout =
new QGridLayout();
239 connect(pPushButtonTableEtats, &QPushButton::clicked,
_etatsWidget, &TYEtatsWidget::show);
257 _elmW->setEnabled(
true);
264 _editDateCreation->setDate(date.fromString(getElement()->getDateCreation(), Qt::ISODate));
282 TYProjet* pProjet = getElement()->getProjet();
301 unsigned int nbPoints =
static_cast<uint32>(tabPoints.size());
305 unsigned int row = 0;
306 for (row = 0; row < nbPoints; row++)
310 msg = QString(
TR(
"id_cell_posx")).arg(tabPoints[row]->_x, 7,
'f', 1);
313 msg = QString(
TR(
"id_cell_posy")).arg(tabPoints[row]->_y, 7,
'f', 1);
316 msg = QString(
TR(
"id_cell_posh")).arg(tabPoints[row]->getHauteur(), 7,
'f', 1);
319 QTableWidgetItem* pCheckItemActif =
new QTableWidgetItem(
"");
321 if (getElement()->getPtCtrlStatus(tabPoints[row]->getID()))
323 pCheckItemActif->setCheckState(Qt::Checked);
327 pCheckItemActif->setCheckState(Qt::Unchecked);
343 for (
int row = 0; row < nbPoints; row++)
348 QTableWidgetItem* pCheckItemActif =
new QTableWidgetItem(
"");
349 if (pMaillage->etat(getElement()) ==
true)
351 pCheckItemActif->setCheckState(Qt::Checked);
355 pCheckItemActif->setCheckState(Qt::Unchecked);
365 OGenID currentId = getElement()->getSolverId();
369 TYPluginManager::TYPluginList::iterator iter;
372 unsigned short i = 0, currentSolverIndex = 0;
374 for (iter = plugList.begin(), i = 0; iter != plugList.end(); iter++, i++)
376 solverName = (*iter)->getPlugin()->getName();
379 if ((*iter)->getPlugin()->getUUID() == currentId)
381 currentSolverIndex = i;
433 QGridLayout* tabLayout =
new QGridLayout();
452 QCheckBox* useReflectionCheckBox =
454 QCheckBox* useLateralDiffCheckBox =
457 QCheckBox* useScreenCheckBox =
462 connect(useScreenCheckBox, &QCheckBox::toggled, useReflectionCheckBox, &QCheckBox::setEnabled);
463 connect(useScreenCheckBox, &QCheckBox::toggled, useLateralDiffCheckBox, &QCheckBox::setEnabled);
466 auto uncheck_reflection_if_not_use_screen = [useScreenCheckBox, useReflectionCheckBox](
bool clicked)
468 if (!useScreenCheckBox->isChecked())
469 useReflectionCheckBox->setChecked(
false);
471 connect(useScreenCheckBox, &QCheckBox::toggled, useReflectionCheckBox,
472 uncheck_reflection_if_not_use_screen);
475 auto check_lateral_diffractions = [useLateralDiffCheckBox](
bool clicked)
476 { useLateralDiffCheckBox->setChecked(
true); };
477 connect(useReflectionCheckBox, &QCheckBox::clicked, useLateralDiffCheckBox,
478 check_lateral_diffractions);
484 std::ostringstream msg;
485 msg <<
TR(
"id_solver_param_tab_err").toStdString() <<
" " <<
TR(
"id_opt_calc").toStdString() <<
": "
497 QGridLayout* tabLayout =
new QGridLayout();
501 QGridLayout* atmosGroupBoxLayout =
new QGridLayout(atmosGroupBox);
502 atmosGroupBox->setLayout(atmosGroupBoxLayout);
503 atmosGroupBoxLayout->setColumnStretch(2, 1);
506 QGridLayout* windGroupBoxLayout =
new QGridLayout(windGroupBox);
507 windGroupBox->setLayout(windGroupBoxLayout);
508 windGroupBoxLayout->setColumnStretch(2, 1);
513 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_pression")), 0, 1, Qt::AlignLeft);
516 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_temp")), 1, 1, Qt::AlignLeft);
519 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_hygro")), 2, 1, Qt::AlignLeft);
525 tabLayout->addWidget(atmosGroupBox, 0, 0);
526 tabLayout->addWidget(windGroupBox, 1, 0);
530 std::ostringstream msg;
531 msg <<
TR(
"id_solver_param_tab_err").toStdString() <<
" " <<
TR(
"id_opt_meteo").toStdString() <<
": "
537 auto enable_wind_params = [windGroupBox](QString value) { windGroupBox->setEnabled(value ==
"2"); };
539 windGroupBox, enable_wind_params);
555 TYPluginManager::TYPluginList::iterator iter;
557 unsigned short i = 0;
558 unsigned short currentIndex =
_comboSolver->currentIndex();
560 for (i = 0, iter = plugList.begin(); i <= currentIndex; i++, iter++)
562 id = (*iter)->getPlugin()->getUUID();
565 getElement()->setSolverId(
id);
575 if (getElement()->getState() ==
TYCalcul::Actif && getElement()->getResultat())
577 getElement()->getResultat()->purge();
582 getElement()->setDateModif(
_editDateModif->date().currentDate().toString(Qt::ISODate));
588 bool need_to_rebuild_result(
false);
592 if (pCheck->checkState() == Qt::Checked)
594 tabPoints[row]->setEtat(getElement()->getID(),
true);
595 need_to_rebuild_result |= getElement()->addPtCtrlToResult(tabPoints[row]);
599 tabPoints[row]->setEtat(getElement()->getID(),
false);
600 need_to_rebuild_result |= getElement()->remPtCtrlFromResult(tabPoints[row]);
604 if (need_to_rebuild_result)
606 getElement()->getResultat()->buildMatrix();
613 if (pCheck->checkState() == Qt::Checked)
615 getElement()->addMaillage(getElement()->getProjet()->getMaillage(row));
619 getElement()->remMaillage(getElement()->getProjet()->getMaillage(row));
635 bool bIsDefaultSolverSelected{
false};
636 if (pSolverName ==
"9613Solver" || pSolverName ==
"9613Solver_2024" ||
_pRadioButtonLocked->isChecked())
638 bIsDefaultSolverSelected =
false;
642 bIsDefaultSolverSelected =
true;
665 getElement()->getResultat()->edit(
this);
670 QWidget* currentTab =
_tabWidget->currentWidget();
671 unsigned short checkCol = 4;
680 QMenu* pMenu =
new QMenu(
this);
682 QAction* selectAll = pMenu->addAction(
TR(
"id_popup_select_all"));
683 QAction* unSelectAll = pMenu->addAction(
TR(
"id_popup_unselect_all"));
688 if (ret == selectAll)
692 else if (ret == unSelectAll)
702 pCheck->setCheckState(Qt::Checked);
706 pCheck->setCheckState(Qt::Unchecked);
716 if ((point.x() >= 0) && (point.y() >= 0) && (point.x() <=
_tableauMaillages->width()) &&
720 QMenu* pMenu =
new QMenu(
this);
722 QAction* selectAll = pMenu->addAction(
TR(
"id_popup_select_all"));
723 QAction* unSelectAll = pMenu->addAction(
TR(
"id_popup_unselect_all"));
728 if (ret == selectAll)
732 else if (ret == unSelectAll)
739 QTableWidgetItem* pCheck = (QTableWidgetItem*)
_tableauMaillages->item(row, checkCol);
742 pCheck->setCheckState(Qt::Checked);
746 pCheck->setCheckState(Qt::Unchecked);
utilitaire pour la gestion des messages dans Tympan (fichier header)
std::vector< LPTYPointControl > TYTabLPPointControl
Collection de Smart Pointer sur TYPointControl.
virtual void error(const char *message,...)
static OMessageManager * get()
std::list< TYPluginData * > TYPluginList
static LPTYPluginManager get()
classe de definition d'un projet.
TYTabMaillageGeoNode & getMaillages()
Get de la collection de maillages.
LPTYMaillage getMaillage(int index)
Retourne un maillage a partir de son index.
TYTabLPPointControl & getPointsControl()
The base exception class for errors due to invalid data.
Utilities to interact with Python subprocesses from the Tympan application.