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>
37 #include "Tympan/core/config.h"
51 #define TR(id) OLocalizator::getString("TYCalculWidget", (id))
59 setWindowTitle(
TR(
"id_caption"));
76 QGridLayout* groupBoxStateLayout =
new QGridLayout();
80 QGroupBox* groupBoxState =
new QGroupBox();
81 groupBoxState->setTitle(
TR(
"id_etat_calcul"));
82 groupBoxState->setLayout(groupBoxStateLayout);
87 QGroupBox* groupBoxCalcMethod =
new QGroupBox(
this);
88 groupBoxCalcMethod->setTitle(
TR(
""));
89 QGridLayout* groupBoxCalcMethodLayout =
new QGridLayout();
90 groupBoxCalcMethod->setLayout(groupBoxCalcMethodLayout);
92 QLabel* labelCalcMethod =
new QLabel(groupBoxCalcMethod);
93 labelCalcMethod->setText(
TR(
"id_calc_method_label"));
94 groupBoxCalcMethodLayout->addWidget(labelCalcMethod, 0, 0);
100 groupBoxCalcMethodLayout->addWidget(
_comboSolver, 0, 1);
108 QString dataModelPath(QCoreApplication::applicationDirPath() +
"/" + SOLVER_PARAMS_JSON);
113 bool bDefaultSolverSelected{
false};
116 if (getElement()->getSolverId() ==
OGenID(
"{B45873B6-550C-11ED-BDC3-0242AC120002}"))
118 bDefaultSolverSelected =
false;
123 bDefaultSolverSelected =
true;
164 QGridLayout* groupBoxLayout =
new QGridLayout();
177 if (getElement()->getDateCreation() ==
"2001-10-01")
179 getElement()->setDateCreation(date.currentDate().toString(Qt::ISODate));
181 _editDateCreation->setDate(date.fromString(getElement()->getDateCreation(), Qt::ISODate));
193 if (getElement()->getDateModif() ==
"2001-10-01")
195 getElement()->setDateModif(date.currentDate().toString(Qt::ISODate));
197 _editDateModif->setDate(date.fromString(getElement()->getDateModif(), Qt::ISODate));
212 QGroupBox* pGroupBoxTableEtats =
new QGroupBox(
this);
213 pGroupBoxTableEtats->setTitle(
TR(
"id_map_box"));
214 QGridLayout* groupBoxTableEtatsLayout =
new QGridLayout();
215 pGroupBoxTableEtats->setLayout(groupBoxTableEtatsLayout);
217 QLineEdit* pLineEditNomTableEtats =
new QLineEdit(pGroupBoxTableEtats);
218 pLineEditNomTableEtats->setEnabled(
false);
219 groupBoxTableEtatsLayout->addWidget(pLineEditNomTableEtats, 0, 0);
221 QPushButton* pPushButtonTableEtats =
new QPushButton(pGroupBoxTableEtats);
222 pPushButtonTableEtats->setText(
TR(
"id_proprietes"));
223 groupBoxTableEtatsLayout->addWidget(pPushButtonTableEtats, 0, 1);
232 QGridLayout* groupBoxResultatLayout =
new QGridLayout();
252 connect(pPushButtonTableEtats, &QPushButton::clicked,
_etatsWidget, &TYEtatsWidget::show);
268 _elmW->setEnabled(
true);
275 _editDateCreation->setDate(date.fromString(getElement()->getDateCreation(), Qt::ISODate));
293 TYProjet* pProjet = getElement()->getProjet();
311 unsigned int nbPoints =
static_cast<uint32>(tabPoints.size());
315 unsigned int row = 0;
316 for (row = 0; row < nbPoints; row++)
320 msg = QString(
TR(
"id_cell_posx")).arg(tabPoints[row]->_x, 7,
'f', 1);
323 msg = QString(
TR(
"id_cell_posy")).arg(tabPoints[row]->_y, 7,
'f', 1);
326 msg = QString(
TR(
"id_cell_posh")).arg(tabPoints[row]->getHauteur(), 7,
'f', 1);
329 QTableWidgetItem* pCheckItemActif =
new QTableWidgetItem(
"");
331 if (getElement()->getPtCtrlStatus(tabPoints[row]->getID()))
333 pCheckItemActif->setCheckState(Qt::Checked);
337 pCheckItemActif->setCheckState(Qt::Unchecked);
353 for (
int row = 0; row < nbPoints; row++)
358 QTableWidgetItem* pCheckItemActif =
new QTableWidgetItem(
"");
359 if (pMaillage->etat(getElement()) ==
true)
361 pCheckItemActif->setCheckState(Qt::Checked);
365 pCheckItemActif->setCheckState(Qt::Unchecked);
375 OGenID currentId = getElement()->getSolverId();
379 TYPluginManager::TYPluginList::iterator iter;
382 unsigned short i = 0, currentSolverIndex = 0;
384 for (iter = plugList.begin(), i = 0; iter != plugList.end(); iter++, i++)
386 solverName = (*iter)->getPlugin()->getName();
389 if ((*iter)->getPlugin()->getUUID() == currentId)
391 currentSolverIndex = i;
429 QGridLayout* tabLayout =
new QGridLayout();
448 QCheckBox* useReflectionCheckBox =
450 QCheckBox* useLateralDiffCheckBox =
453 QCheckBox* useScreenCheckBox =
458 connect(useScreenCheckBox, &QCheckBox::toggled, useReflectionCheckBox, &QCheckBox::setEnabled);
459 connect(useScreenCheckBox, &QCheckBox::toggled, useLateralDiffCheckBox, &QCheckBox::setEnabled);
462 auto uncheck_reflection_if_not_use_screen = [useScreenCheckBox, useReflectionCheckBox](
bool clicked)
464 if (!useScreenCheckBox->isChecked())
465 useReflectionCheckBox->setChecked(
false);
467 connect(useScreenCheckBox, &QCheckBox::toggled, useReflectionCheckBox,
468 uncheck_reflection_if_not_use_screen);
471 auto check_lateral_diffractions = [useLateralDiffCheckBox](
bool clicked)
472 { useLateralDiffCheckBox->setChecked(
true); };
473 connect(useReflectionCheckBox, &QCheckBox::clicked, useLateralDiffCheckBox,
474 check_lateral_diffractions);
481 msg <<
TR(
"id_solver_param_tab_err").toStdString() <<
" " <<
TR(
"id_opt_calc").toStdString() <<
": "
493 QGridLayout* tabLayout =
new QGridLayout();
497 QGridLayout* atmosGroupBoxLayout =
new QGridLayout(atmosGroupBox);
498 atmosGroupBox->setLayout(atmosGroupBoxLayout);
499 atmosGroupBoxLayout->setColumnStretch(2, 1);
502 QGridLayout* windGroupBoxLayout =
new QGridLayout(windGroupBox);
503 windGroupBox->setLayout(windGroupBoxLayout);
504 windGroupBoxLayout->setColumnStretch(2, 1);
509 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_pression")), 0, 1, Qt::AlignLeft);
512 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_temp")), 1, 1, Qt::AlignLeft);
515 atmosGroupBoxLayout->addWidget(
new QLabel(
TR(
"id_unite_hygro")), 2, 1, Qt::AlignLeft);
521 tabLayout->addWidget(atmosGroupBox, 0, 0);
522 tabLayout->addWidget(windGroupBox, 1, 0);
527 msg <<
TR(
"id_solver_param_tab_err").toStdString() <<
" " <<
TR(
"id_opt_meteo").toStdString() <<
": "
533 auto enable_wind_params = [windGroupBox](QString value) { windGroupBox->setEnabled(value ==
"2"); };
535 windGroupBox, enable_wind_params);
551 TYPluginManager::TYPluginList::iterator iter;
553 unsigned short i = 0;
554 unsigned short currentIndex =
_comboSolver->currentIndex();
556 for (i = 0, iter = plugList.begin(); i <= currentIndex; i++, iter++)
558 id = (*iter)->getPlugin()->getUUID();
561 getElement()->setSolverId(
id);
572 if (getElement()->getResultat())
574 getElement()->getResultat()->purge();
578 getElement()->setDateModif(
_editDateModif->date().currentDate().toString(Qt::ISODate));
584 bool need_to_rebuild_result(
false);
588 if (pCheck->checkState() == Qt::Checked)
590 tabPoints[row]->setEtat(getElement()->getID(),
true);
591 need_to_rebuild_result |= getElement()->addPtCtrlToResult(tabPoints[row]);
595 tabPoints[row]->setEtat(getElement()->getID(),
false);
596 need_to_rebuild_result |= getElement()->remPtCtrlFromResult(tabPoints[row]);
600 if (need_to_rebuild_result)
602 getElement()->getResultat()->buildMatrix();
609 if (pCheck->checkState() == Qt::Checked)
611 getElement()->addMaillage(getElement()->getProjet()->getMaillage(row));
615 getElement()->remMaillage(getElement()->getProjet()->getMaillage(row));
631 bool bIsDefaultSolverSelected{
false};
632 if (pSolverName ==
"9613Solver")
634 bIsDefaultSolverSelected =
false;
638 bIsDefaultSolverSelected =
true;
645 getElement()->getResultat()->edit(
this);
650 QWidget* currentTab =
_tabWidget->currentWidget();
651 unsigned short checkCol = 4;
660 QMenu* pMenu =
new QMenu(
this);
662 QAction* selectAll = pMenu->addAction(
TR(
"id_popup_select_all"));
663 QAction* unSelectAll = pMenu->addAction(
TR(
"id_popup_unselect_all"));
668 if (ret == selectAll)
672 else if (ret == unSelectAll)
682 pCheck->setCheckState(Qt::Checked);
686 pCheck->setCheckState(Qt::Unchecked);
696 if ((point.x() >= 0) && (point.y() >= 0) && (point.x() <=
_tableauMaillages->width()) &&
700 QMenu* pMenu =
new QMenu(
this);
702 QAction* selectAll = pMenu->addAction(
TR(
"id_popup_select_all"));
703 QAction* unSelectAll = pMenu->addAction(
TR(
"id_popup_unselect_all"));
708 if (ret == selectAll)
712 else if (ret == unSelectAll)
719 QTableWidgetItem* pCheck = (QTableWidgetItem*)
_tableauMaillages->item(row, checkCol);
722 pCheck->setCheckState(Qt::Checked);
726 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.
Utilitaires pour les interactions entre l'application tympan et des sous- processus python.