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);
114 bool bDefaultSolverSelected{
false};
117 if (getElement()->getSolverId() ==
OGenID(
"{B45873B6-550C-11ED-BDC3-0242AC120002}"))
119 bDefaultSolverSelected =
false;
124 bDefaultSolverSelected =
true;
165 QGridLayout* groupBoxLayout =
new QGridLayout();
178 if (getElement()->getDateCreation() ==
"2001-10-01")
180 getElement()->setDateCreation(date.currentDate().toString(Qt::ISODate));
182 _editDateCreation->setDate(date.fromString(getElement()->getDateCreation(), Qt::ISODate));
194 if (getElement()->getDateModif() ==
"2001-10-01")
196 getElement()->setDateModif(date.currentDate().toString(Qt::ISODate));
198 _editDateModif->setDate(date.fromString(getElement()->getDateModif(), Qt::ISODate));
213 QGroupBox* pGroupBoxTableEtats =
new QGroupBox(
this);
214 pGroupBoxTableEtats->setTitle(
TR(
"id_map_box"));
215 QGridLayout* groupBoxTableEtatsLayout =
new QGridLayout();
216 pGroupBoxTableEtats->setLayout(groupBoxTableEtatsLayout);
218 QLineEdit* pLineEditNomTableEtats =
new QLineEdit(pGroupBoxTableEtats);
219 pLineEditNomTableEtats->setEnabled(
false);
220 groupBoxTableEtatsLayout->addWidget(pLineEditNomTableEtats, 0, 0);
222 QPushButton* pPushButtonTableEtats =
new QPushButton(pGroupBoxTableEtats);
223 pPushButtonTableEtats->setText(
TR(
"id_proprietes"));
224 groupBoxTableEtatsLayout->addWidget(pPushButtonTableEtats, 0, 1);
233 QGridLayout* groupBoxResultatLayout =
new QGridLayout();
253 connect(pPushButtonTableEtats, &QPushButton::clicked,
_etatsWidget, &TYEtatsWidget::show);
271 _elmW->setEnabled(
true);
278 _editDateCreation->setDate(date.fromString(getElement()->getDateCreation(), Qt::ISODate));
296 TYProjet* pProjet = getElement()->getProjet();
314 unsigned int nbPoints =
static_cast<uint32>(tabPoints.size());
318 unsigned int row = 0;
319 for (row = 0; row < nbPoints; row++)
323 msg = QString(
TR(
"id_cell_posx")).arg(tabPoints[row]->_x, 7,
'f', 1);
326 msg = QString(
TR(
"id_cell_posy")).arg(tabPoints[row]->_y, 7,
'f', 1);
329 msg = QString(
TR(
"id_cell_posh")).arg(tabPoints[row]->getHauteur(), 7,
'f', 1);
332 QTableWidgetItem* pCheckItemActif =
new QTableWidgetItem(
"");
334 if (getElement()->getPtCtrlStatus(tabPoints[row]->getID()))
336 pCheckItemActif->setCheckState(Qt::Checked);
340 pCheckItemActif->setCheckState(Qt::Unchecked);
356 for (
int row = 0; row < nbPoints; row++)
361 QTableWidgetItem* pCheckItemActif =
new QTableWidgetItem(
"");
362 if (pMaillage->etat(getElement()) ==
true)
364 pCheckItemActif->setCheckState(Qt::Checked);
368 pCheckItemActif->setCheckState(Qt::Unchecked);
378 OGenID currentId = getElement()->getSolverId();
382 TYPluginManager::TYPluginList::iterator iter;
385 unsigned short i = 0, currentSolverIndex = 0;
387 for (iter = plugList.begin(), i = 0; iter != plugList.end(); iter++, i++)
389 solverName = (*iter)->getPlugin()->getName();
392 if ((*iter)->getPlugin()->getUUID() == currentId)
394 currentSolverIndex = i;
446 QGridLayout* tabLayout =
new QGridLayout();
465 QCheckBox* useReflectionCheckBox =
467 QCheckBox* useLateralDiffCheckBox =
470 QCheckBox* useScreenCheckBox =
475 connect(useScreenCheckBox, &QCheckBox::toggled, useReflectionCheckBox, &QCheckBox::setEnabled);
476 connect(useScreenCheckBox, &QCheckBox::toggled, useLateralDiffCheckBox, &QCheckBox::setEnabled);
479 auto uncheck_reflection_if_not_use_screen = [useScreenCheckBox, useReflectionCheckBox](
bool clicked)
481 if (!useScreenCheckBox->isChecked())
482 useReflectionCheckBox->setChecked(
false);
484 connect(useScreenCheckBox, &QCheckBox::toggled, useReflectionCheckBox,
485 uncheck_reflection_if_not_use_screen);
488 auto check_lateral_diffractions = [useLateralDiffCheckBox](
bool clicked)
489 { useLateralDiffCheckBox->setChecked(
true); };
490 connect(useReflectionCheckBox, &QCheckBox::clicked, useLateralDiffCheckBox,
491 check_lateral_diffractions);
497 std::ostringstream msg;
498 msg <<
TR(
"id_solver_param_tab_err").toStdString() <<
" " <<
TR(
"id_opt_calc").toStdString() <<
": "
510 QGridLayout* tabLayout =
new QGridLayout();
514 QGridLayout* atmosGroupBoxLayout =
new QGridLayout(atmosGroupBox);
515 atmosGroupBox->setLayout(atmosGroupBoxLayout);
516 atmosGroupBoxLayout->setColumnStretch(2, 1);
519 QGridLayout* windGroupBoxLayout =
new QGridLayout(windGroupBox);
520 windGroupBox->setLayout(windGroupBoxLayout);
521 windGroupBoxLayout->setColumnStretch(2, 1);
526 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_pression")), 0, 1, Qt::AlignLeft);
529 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_temp")), 1, 1, Qt::AlignLeft);
532 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_hygro")), 2, 1, Qt::AlignLeft);
538 tabLayout->addWidget(atmosGroupBox, 0, 0);
539 tabLayout->addWidget(windGroupBox, 1, 0);
543 std::ostringstream msg;
544 msg <<
TR(
"id_solver_param_tab_err").toStdString() <<
" " <<
TR(
"id_opt_meteo").toStdString() <<
": "
550 auto enable_wind_params = [windGroupBox](QString value) { windGroupBox->setEnabled(value ==
"2"); };
552 windGroupBox, enable_wind_params);
568 TYPluginManager::TYPluginList::iterator iter;
570 unsigned short i = 0;
571 unsigned short currentIndex =
_comboSolver->currentIndex();
573 for (i = 0, iter = plugList.begin(); i <= currentIndex; i++, iter++)
575 id = (*iter)->getPlugin()->getUUID();
578 getElement()->setSolverId(
id);
589 if (getElement()->getResultat())
591 getElement()->getResultat()->purge();
595 getElement()->setDateModif(
_editDateModif->date().currentDate().toString(Qt::ISODate));
601 bool need_to_rebuild_result(
false);
605 if (pCheck->checkState() == Qt::Checked)
607 tabPoints[row]->setEtat(getElement()->getID(),
true);
608 need_to_rebuild_result |= getElement()->addPtCtrlToResult(tabPoints[row]);
612 tabPoints[row]->setEtat(getElement()->getID(),
false);
613 need_to_rebuild_result |= getElement()->remPtCtrlFromResult(tabPoints[row]);
617 if (need_to_rebuild_result)
619 getElement()->getResultat()->buildMatrix();
626 if (pCheck->checkState() == Qt::Checked)
628 getElement()->addMaillage(getElement()->getProjet()->getMaillage(row));
632 getElement()->remMaillage(getElement()->getProjet()->getMaillage(row));
648 bool bIsDefaultSolverSelected{
false};
651 bIsDefaultSolverSelected =
false;
655 bIsDefaultSolverSelected =
true;
676 getElement()->getResultat()->edit(
this);
681 QWidget* currentTab =
_tabWidget->currentWidget();
682 unsigned short checkCol = 4;
691 QMenu* pMenu =
new QMenu(
this);
693 QAction* selectAll = pMenu->addAction(
TR(
"id_popup_select_all"));
694 QAction* unSelectAll = pMenu->addAction(
TR(
"id_popup_unselect_all"));
699 if (ret == selectAll)
703 else if (ret == unSelectAll)
713 pCheck->setCheckState(Qt::Checked);
717 pCheck->setCheckState(Qt::Unchecked);
727 if ((point.x() >= 0) && (point.y() >= 0) && (point.x() <=
_tableauMaillages->width()) &&
731 QMenu* pMenu =
new QMenu(
this);
733 QAction* selectAll = pMenu->addAction(
TR(
"id_popup_select_all"));
734 QAction* unSelectAll = pMenu->addAction(
TR(
"id_popup_unselect_all"));
739 if (ret == selectAll)
743 else if (ret == unSelectAll)
750 QTableWidgetItem* pCheck = (QTableWidgetItem*)
_tableauMaillages->item(row, checkCol);
753 pCheck->setCheckState(Qt::Checked);
757 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.