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();
315 unsigned int nbPoints =
static_cast<uint32>(tabPoints.size());
319 unsigned int row = 0;
320 for (row = 0; row < nbPoints; row++)
324 msg = QString(
TR(
"id_cell_posx")).arg(tabPoints[row]->_x, 7,
'f', 1);
327 msg = QString(
TR(
"id_cell_posy")).arg(tabPoints[row]->_y, 7,
'f', 1);
330 msg = QString(
TR(
"id_cell_posh")).arg(tabPoints[row]->getHauteur(), 7,
'f', 1);
333 QTableWidgetItem* pCheckItemActif =
new QTableWidgetItem(
"");
335 if (getElement()->getPtCtrlStatus(tabPoints[row]->getID()))
337 pCheckItemActif->setCheckState(Qt::Checked);
341 pCheckItemActif->setCheckState(Qt::Unchecked);
357 for (
int row = 0; row < nbPoints; row++)
362 QTableWidgetItem* pCheckItemActif =
new QTableWidgetItem(
"");
363 if (pMaillage->etat(getElement()) ==
true)
365 pCheckItemActif->setCheckState(Qt::Checked);
369 pCheckItemActif->setCheckState(Qt::Unchecked);
379 OGenID currentId = getElement()->getSolverId();
383 TYPluginManager::TYPluginList::iterator iter;
386 unsigned short i = 0, currentSolverIndex = 0;
388 for (iter = plugList.begin(), i = 0; iter != plugList.end(); iter++, i++)
390 solverName = (*iter)->getPlugin()->getName();
393 if ((*iter)->getPlugin()->getUUID() == currentId)
395 currentSolverIndex = i;
447 QGridLayout* tabLayout =
new QGridLayout();
466 QCheckBox* useReflectionCheckBox =
468 QCheckBox* useLateralDiffCheckBox =
471 QCheckBox* useScreenCheckBox =
476 connect(useScreenCheckBox, &QCheckBox::toggled, useReflectionCheckBox, &QCheckBox::setEnabled);
477 connect(useScreenCheckBox, &QCheckBox::toggled, useLateralDiffCheckBox, &QCheckBox::setEnabled);
480 auto uncheck_reflection_if_not_use_screen = [useScreenCheckBox, useReflectionCheckBox](
bool clicked)
482 if (!useScreenCheckBox->isChecked())
483 useReflectionCheckBox->setChecked(
false);
485 connect(useScreenCheckBox, &QCheckBox::toggled, useReflectionCheckBox,
486 uncheck_reflection_if_not_use_screen);
489 auto check_lateral_diffractions = [useLateralDiffCheckBox](
bool clicked)
490 { useLateralDiffCheckBox->setChecked(
true); };
491 connect(useReflectionCheckBox, &QCheckBox::clicked, useLateralDiffCheckBox,
492 check_lateral_diffractions);
498 std::ostringstream msg;
499 msg <<
TR(
"id_solver_param_tab_err").toStdString() <<
" " <<
TR(
"id_opt_calc").toStdString() <<
": "
511 QGridLayout* tabLayout =
new QGridLayout();
515 QGridLayout* atmosGroupBoxLayout =
new QGridLayout(atmosGroupBox);
516 atmosGroupBox->setLayout(atmosGroupBoxLayout);
517 atmosGroupBoxLayout->setColumnStretch(2, 1);
520 QGridLayout* windGroupBoxLayout =
new QGridLayout(windGroupBox);
521 windGroupBox->setLayout(windGroupBoxLayout);
522 windGroupBoxLayout->setColumnStretch(2, 1);
527 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_pression")), 0, 1, Qt::AlignLeft);
530 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_temp")), 1, 1, Qt::AlignLeft);
533 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_hygro")), 2, 1, Qt::AlignLeft);
539 tabLayout->addWidget(atmosGroupBox, 0, 0);
540 tabLayout->addWidget(windGroupBox, 1, 0);
544 std::ostringstream msg;
545 msg <<
TR(
"id_solver_param_tab_err").toStdString() <<
" " <<
TR(
"id_opt_meteo").toStdString() <<
": "
551 auto enable_wind_params = [windGroupBox](QString value) { windGroupBox->setEnabled(value ==
"2"); };
553 windGroupBox, enable_wind_params);
569 TYPluginManager::TYPluginList::iterator iter;
571 unsigned short i = 0;
572 unsigned short currentIndex =
_comboSolver->currentIndex();
574 for (i = 0, iter = plugList.begin(); i <= currentIndex; i++, iter++)
576 id = (*iter)->getPlugin()->getUUID();
579 getElement()->setSolverId(
id);
589 if (getElement()->getState() ==
TYCalcul::Actif && getElement()->getResultat())
591 getElement()->getResultat()->purge();
596 getElement()->setDateModif(
_editDateModif->date().currentDate().toString(Qt::ISODate));
602 bool need_to_rebuild_result(
false);
606 if (pCheck->checkState() == Qt::Checked)
608 tabPoints[row]->setEtat(getElement()->getID(),
true);
609 need_to_rebuild_result |= getElement()->addPtCtrlToResult(tabPoints[row]);
613 tabPoints[row]->setEtat(getElement()->getID(),
false);
614 need_to_rebuild_result |= getElement()->remPtCtrlFromResult(tabPoints[row]);
618 if (need_to_rebuild_result)
620 getElement()->getResultat()->buildMatrix();
627 if (pCheck->checkState() == Qt::Checked)
629 getElement()->addMaillage(getElement()->getProjet()->getMaillage(row));
633 getElement()->remMaillage(getElement()->getProjet()->getMaillage(row));
649 bool bIsDefaultSolverSelected{
false};
652 bIsDefaultSolverSelected =
false;
656 bIsDefaultSolverSelected =
true;
679 getElement()->getResultat()->edit(
this);
684 QWidget* currentTab =
_tabWidget->currentWidget();
685 unsigned short checkCol = 4;
694 QMenu* pMenu =
new QMenu(
this);
696 QAction* selectAll = pMenu->addAction(
TR(
"id_popup_select_all"));
697 QAction* unSelectAll = pMenu->addAction(
TR(
"id_popup_unselect_all"));
702 if (ret == selectAll)
706 else if (ret == unSelectAll)
716 pCheck->setCheckState(Qt::Checked);
720 pCheck->setCheckState(Qt::Unchecked);
730 if ((point.x() >= 0) && (point.y() >= 0) && (point.x() <=
_tableauMaillages->width()) &&
734 QMenu* pMenu =
new QMenu(
this);
736 QAction* selectAll = pMenu->addAction(
TR(
"id_popup_select_all"));
737 QAction* unSelectAll = pMenu->addAction(
TR(
"id_popup_unselect_all"));
742 if (ret == selectAll)
746 else if (ret == unSelectAll)
753 QTableWidgetItem* pCheck = (QTableWidgetItem*)
_tableauMaillages->item(row, checkCol);
756 pCheck->setCheckState(Qt::Checked);
760 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.