23 #include <QCloseEvent>
27 #include <qstatusbar.h>
33 #include <qfiledialog.h>
34 #include <qfileinfo.h>
35 #include <qtoolbutton.h>
36 #include <qbuttongroup.h>
37 #include <qmessagebox.h>
39 #include <qmainwindow.h>
41 #include <qtextbrowser.h>
42 #include <qtextstream.h>
43 #include <QDockWidget>
45 #include <QMdiSubWindow>
47 #include <qeventloop.h>
50 #include "Tympan/core/config.h"
84 #define TR(id) OLocalizator::getString("TYMainWindow", (id))
85 #define IMG(id) OLocalizator::getPicture("TYMainWindow", (id))
108 _pWorkspace->setActivationOrder(QMdiArea::ActivationHistoryOrder);
121 if (QFile::exists(help_index_file))
144 _pOpenAction =
new QAction(QPixmap(
IMG(
"id_icon_open")),
TR(
"id_menuitem_open"),
this);
147 QObject::connect(
_pOpenAction, &QAction::triggered,
this, tyMainWindow_open);
149 _pCloseAction =
new QAction(QPixmap(
IMG(
"id_icon_close")),
TR(
"id_menuitem_close"),
this);
154 _pSaveAction =
new QAction(QPixmap(
IMG(
"id_icon_save")),
TR(
"id_menuitem_save"),
this);
157 QObject::connect(
_pSaveAction, &QAction::triggered,
this, tyMainWindow_save);
159 _pSaveAsAction =
new QAction(QPixmap(
IMG(
"id_icon_save")),
TR(
"id_menuitem_saveas"),
this);
161 QObject::connect(
_pSaveAsAction, &QAction::triggered,
this, tyMainWindow_saveAs);
164 new QAction(QPixmap(
IMG(
"id_icon_save")),
TR(
"id_menuitem_saveas_noresult"),
this);
173 _pPrintAction =
new QAction(QPixmap(
IMG(
"id_icon_print")),
TR(
"id_menuitem_print"),
this);
179 _pUndoAction =
new QAction(QPixmap(
IMG(
"id_icon_undo")),
TR(
"id_menuitem_undo_na"),
this);
185 _pRedoAction =
new QAction(QPixmap(
IMG(
"id_icon_redo")),
TR(
"id_menuitem_redo_na"),
this);
191 _pCutAction =
new QAction(QPixmap(
IMG(
"id_icon_cut")),
TR(
"id_menuitem_cut"),
this);
197 _pCopyAction =
new QAction(QPixmap(
IMG(
"id_icon_copy")),
TR(
"id_menuitem_copy"),
this);
203 _pPasteAction =
new QAction(QPixmap(
IMG(
"id_icon_paste")),
TR(
"id_menuitem_paste"),
this);
210 new QAction(QPixmap(
IMG(
"id_icon_show_spectremngr")),
TR(
"id_menuitem_show_spectremngr"),
this);
218 new QAction(QPixmap(
IMG(
"id_icon_show_maillagemngr")),
TR(
"id_menuitem_show_maillagemngr"),
this);
226 new QAction(QPixmap(
IMG(
"id_icon_show_biblio")),
TR(
"id_menuitem_show_biblio"),
this);
233 new QAction(QPixmap(
IMG(
"id_icon_show_output")),
TR(
"id_menuitem_show_output"),
this);
239 new QAction(QPixmap(
IMG(
"id_icon_edit_curcalcul")),
TR(
"id_menuitem_edit_curcalcul"),
this);
244 _pGoAltiAction =
new QAction(QPixmap(
IMG(
"id_icon_alti")),
TR(
"id_menuitem_lancer_calcul_alti"),
this);
250 new QAction(QPixmap(
IMG(
"id_icon_go_curcalcul")),
TR(
"id_menuitem_lancer_calcul_courant"),
this);
255 QAction* pPrefDialogAction =
256 new QAction(QPixmap(
IMG(
"id_icon_prefdlg")),
TR(
"id_menuitem_prefdlg"),
this);
260 QMenu* pFileMenu =
new QMenu(
TR(
"id_menu_file"),
this);
261 menuBar()->addMenu(pFileMenu);
263 QMenu* pNewMenu =
new QMenu(
TR(
"id_menuitem_new"),
this);
264 pNewMenu->setTearOffEnabled(
true);
272 pFileMenu->addMenu(pNewMenu);
275 pFileMenu->addSeparator();
279 pFileMenu->addSeparator();
281 pFileMenu->addSeparator();
283 pFileMenu->addSeparator();
286 QMenu* pEditMenu =
new QMenu(
TR(
"id_menu_edit"),
this);
287 menuBar()->addMenu(pEditMenu);
290 pEditMenu->addSeparator();
294 pEditMenu->addSeparator();
295 pEditMenu->addAction(QPixmap(
IMG(
"id_icon_prefdlg")),
TR(
"id_menuitem_prefdlg"),
this,
302 menuBar()->addSeparator();
304 QMenu* pHelpMenu =
new QMenu(
TR(
"id_menu_help"),
this);
305 menuBar()->addMenu(pHelpMenu);
307 pHelpMenu->addSeparator();
313 QToolButton* pToolNewFile =
new QToolButton(
this);
314 pToolNewFile->setIcon(QPixmap(
IMG(
"id_icon_new")));
315 pToolNewFile->setToolTip(
TR(
"id_menuitem_new"));
316 pToolNewFile->setMenu(pNewMenu);
317 pToolNewFile->setPopupMode(QToolButton::InstantPopup);
434 QObject::connect(
_pOutputDockWnd, &QDockWidget::visibilityChanged,
this,
445 QShortcut* shortcut =
new QShortcut(QKeySequence(Qt::Key_Escape),
this);
463 statusBar()->showMessage(
TR(
"id_status_ready"));
477 QMenu* returnedMenu = QMainWindow::createPopupMenu();
479 myMenu->addActions(returnedMenu->actions());
487 TYPreferenceManager::saveGeometryToPreferences(metaObject()->className(),
this);
490 QObjectList objectsList = children();
491 QWidget* pDockWnd = NULL;
492 QObject* pObject = NULL;
494 for (
int _i = 0; _i < objectsList.size(); _i++)
496 pObject = objectsList[_i];
497 if ((pObject->objectName() ==
"ProjetDockWnd") || (pObject->objectName() ==
"SiteDockWnd") ||
498 (pObject->objectName() ==
"OutputDockWnd") ||
499 (strcmp(pObject->metaObject()->className(),
"QToolBar") == 0) ||
500 (
dynamic_cast<QToolBar*
>(pObject) !=
nullptr))
503 pDockWnd = (QWidget*)pObject;
504 QString key = pDockWnd->objectName();
507 TYPreferenceManager::saveGeometryToPreferences(key, pDockWnd);
519 statusBar()->showMessage(
TR(
"id_status_load_settings"), 3000);
523 QString userDir = QDir::toNativeSeparators(
getTYApp()->tympanUserDir());
526 QString(
"Settings4.[0-9]MainWindowIHM.bin"));
528 if (inFile !=
nullptr && inFile->open(QIODevice::ReadOnly))
530 QByteArray byteArray = inFile->readAll();
531 if (!byteArray.isEmpty())
533 restoreState(byteArray);
539 bool isCopiedFromDefaultSettings =
false;
541 searchSettingsFile(userDir, fileName, QString(
".xml"), QString(
"Settings4.[0-9].xml"));
545 TYPreferenceManager::init(fileName +
".xml", isCopiedFromDefaultSettings, std::move(settingsFile));
549 res = res && TYPreferenceManager::read();
554 if (isCopiedFromDefaultSettings)
557 QString libraryDir = QDir::toNativeSeparators(userDir +
"/library/");
562 TYPreferenceManager::loadGeometryFromPreferences(metaObject()->className(),
this);
565 QObjectList objectsList = children();
566 QWidget* pDockWnd = NULL;
567 QObject* pObject = NULL;
569 for (
int _i = 0; _i < objectsList.size(); _i++)
571 pObject = objectsList[_i];
572 if ((pObject->objectName() ==
"ProjetDockWnd") || (pObject->objectName() ==
"SiteDockWnd") ||
573 (pObject->objectName() ==
"OutputDockWnd") ||
574 (strcmp(pObject->metaObject()->className(),
"QToolBar") == 0) ||
575 (
dynamic_cast<QToolBar*
>(pObject) !=
nullptr))
577 pDockWnd = (QWidget*)pObject;
578 QString key = pDockWnd->objectName();
580 TYPreferenceManager::loadGeometryFromPreferences(key, pDockWnd);
590 const QString& fileNameBegin,
591 const QString& fileNameEnd,
592 const QString& fileNamePattern)
595 auto regularFile = std::make_unique<QFile>(QString(fileNameBegin) + QString(fileNameEnd));
596 if (regularFile->exists())
598 qDebug() <<
"Regular file" << QString(fileNameBegin + fileNameEnd) <<
"found.";
604 qDebug() <<
"Regular file" << QString(fileNameBegin + fileNameEnd)
605 <<
"NOT found, searching for oldest files";
608 QDir folder(TympanUserDir);
611 QStringList matchingFiles = folder.entryList(QStringList(fileNamePattern), QDir::Files);
614 if (!matchingFiles.isEmpty())
616 qDebug() <<
"File(s) macthing" << fileNamePattern <<
"pattern found in the folder.";
618 QString selectedFile;
622 for (
const QString& matchingFile : matchingFiles)
625 int digit = matchingFile.mid(10, 1).toInt();
628 if (digit > maxDigit)
631 selectedFile = matchingFile;
636 qDebug() <<
"Selected file: " << selectedFile;
637 return std::make_unique<QFile>(QDir::toNativeSeparators(TympanUserDir +
"/" + selectedFile));
642 qDebug() <<
"No matching files found in the folder.";
652 QByteArray byteArray = saveState();
653 QFile* outFile =
new QFile(QString(fileName) + QString(
"MainWindowIHM.bin"));
654 if (outFile->open(QIODevice::WriteOnly))
656 outFile->write(byteArray);
663 QString finalFileName = QString(fileName) + QString(
".xml");
664 TYPreferenceManager::setFileName(finalFileName);
665 res = TYPreferenceManager::write();
678 QMessageBox* pAboutTympan =
new QMessageBox(NULL);
679 pAboutTympan->setWindowTitle(windowTitle());
680 QString msg =
TR(
"id_about_msg");
681 msg = msg.arg(TY_PRODUCT_NAME_);
682 msg = msg.arg(TY_CURRENT_RELEASE_);
684 msg = msg.arg(TY_PRODUCT_COPYRIGHT_);
685 msg = msg.arg(TY_BUILD_DATE_);
686 msg = msg.arg(TY_BUILD_TIME_);
687 msg = msg.arg(TY_CUSTOMER_);
688 msg = msg.arg(TY_LICENCE_NUMBER_);
689 msg = msg.arg(TY_TIME_LIMIT_);
690 pAboutTympan->setText(msg);
691 pAboutTympan->setIconPixmap(
IMG(
"id_logo_about"));
694 pAboutTympan->exec();
709 if (pProj !=
nullptr)
714 else if (pElt->
isA(
"TYSiteNode"))
719 else if (pElt->
isA(
"TYBatiment"))
723 else if (pElt->
isA(
"TYMachine"))
738 pBatimentModeler->setAttribute(Qt::WA_DeleteOnClose);
739 _pWorkspace->addSubWindow(pBatimentModeler)->setObjectName(
"TYBatimentModelerFrame");
753 pBatimentModeler->showMaximized();
754 pBatimentModeler->
fit();
777 pMachineModeler->setAttribute(Qt::WA_DeleteOnClose);
779 _pWorkspace->addSubWindow(pMachineModeler)->setObjectName(
"TYMachineModelerFrame");
793 pMachineModeler->showMaximized();
794 pMachineModeler->
fit();
815 pSiteModeler->setAttribute(Qt::WA_DeleteOnClose);
817 _pWorkspace->addSubWindow(pSiteModeler)->setObjectName(
"TYSiteModelerFrame");
825 pSiteModeler->showMaximized();
832 pSiteModeler->setAttribute(Qt::WA_DeleteOnClose);
834 _pWorkspace->addSubWindow(pSiteModeler)->setObjectName(
"TYSiteModelerFrame");
842 pSiteModeler->showMaximized();
874 QList<QMdiSubWindow*> windows =
_pWorkspace->subWindowList();
876 for (
int i = 0; i < int(windows.count()); ++i)
878 QWidget* internal_window = windows.at(i)->widget();
890 if (pModelerFrame !=
nullptr)
893 bool keepRays =
false;
901 if (pSiteModelerFrame !=
nullptr)
904 bool enableAltimetrieButton =
false;
911 if (!enableAltimetrieButton)
918 ((
TYModelerFrame*)internal_window)->updateView(clipping, axesAndGrid);
931 QList<QMdiSubWindow*> windows =
_pWorkspace->subWindowList();
933 for (
int i = 0; i < int(windows.count()); ++i)
935 QWidget* internal_window = windows.at(i)->widget();
947 QList<QMdiSubWindow*> windows =
_pWorkspace->subWindowList();
949 for (
int i = 0; i < int(windows.count()); ++i)
951 QWidget* internal_window = windows.at(i)->widget();
957 QString windowTitle = internal_window->windowTitle();
962 if (pInW->isActiveWindow())
967 if (psiteframe !=
nullptr)
979 if (pbatimentframe !=
nullptr)
984 if (newElement !=
nullptr)
990 if (pmachineframe !=
nullptr)
995 if (newElement !=
nullptr)
1011 QList<QMdiSubWindow*> windows =
_pWorkspace->subWindowList();
1013 for (
int i = 0; i < int(windows.count()); ++i)
1015 QWidget* internal_window = windows.at(i)->widget();
1016 QWidget* container_window = windows.at(i);
1023 container_window->close();
1031 QList<QMdiSubWindow*> windows =
_pWorkspace->subWindowList();
1033 for (
int i = 0; i < int(windows.count()); ++i)
1035 QWidget* container_window = windows.at(i);
1036 container_window->close();
1051 logger.
debug(
"goAltiCalcul");
1075 QAction* cascadeId =
1080 QList<QMdiSubWindow*> windows =
_pWorkspace->subWindowList();
1082 if (windows.isEmpty())
1084 cascadeId->setEnabled(
false);
1085 tileId->setEnabled(
false);
1091 viewMenu->setTitle(
TR(
"id_menuitem_views"));
1096 for (
int i = 0; i < int(windows.count()); ++i)
1098 QWidget* internal_window = windows.at(i)->widget();
1100 if (!internal_window)
1105 QAction*
id =
_pWindowsMenu->addAction(internal_window->windowTitle(),
this,
1108 id->setChecked(
_pWorkspace->activeSubWindow() == windows.at(i));
1114 QAction* action = (QAction*)sender();
1115 int id = action->data().toInt();
1117 QWidget* pWidget =
_pWorkspace->subWindowList().at(
id)->widget();
1121 pWidget->showNormal();
1122 pWidget->setFocus();
1124 if (QString(pWidget->metaObject()->className()).compare(
"TYSpectreManager") == 0)
1128 else if (QString(pWidget->metaObject()->className()).compare(
"TYDataBaseFrame") == 0)
1132 else if (QString(pWidget->metaObject()->className()).compare(
"TYMaillageManager") == 0)
1151 QMdiSubWindow* subWindow =
_pWorkspace->activeSubWindow();
1152 if (
_pWorkspace->subWindowList().count() > 0 && subWindow)
1154 pW = subWindow->widget();
1187 void (QButtonGroup::*qButtonGroup_clicked)(int) = &QButtonGroup::idClicked;
1220 if (QString(pW->metaObject()->className()).compare(
"TYSiteModelerFrame") == 0)
1229 bool bActiveCalculToolBar =
false;
1234 bActiveCalculToolBar =
true;
1240 bActiveCalculToolBar =
true;
1266 else if (QString(pW->metaObject()->className()).compare(
"TYMachineModelerFrame") == 0)
1292 else if (QString(pW->metaObject()->className()).compare(
"TYBatimentModelerFrame") == 0)
1317 else if (QString(pW->metaObject()->className()).compare(
"TYFaceModelerFrame") == 0)
1321 QObject::disconnect(pF, tyFaceModelerFrame_editorModeChanged,
this,
1385 const QString& redoCmd)
1390 if (!undoCmd.isEmpty())
1399 if (!redoCmd.isEmpty())
1453 if (QMessageBox::warning(
this,
"Tympan",
TR(
"id_msg_solver_out"), QMessageBox::Yes,
1454 QMessageBox::No) == QMessageBox::Yes)
1519 bool hasMockSucceeded;
1521 if (!hasMockSucceeded)
1524 <<
"Mocking IGN Geoplatform resources has failed. Please check mock resources availability.";
1550 QFileInfo fileInfo(
getTYApp()->getCurrentFileName());
1551 QString imageFilePath =
1552 fileInfo.path().replace(
"\\",
"/") +
"/" + fileInfo.completeBaseName() +
"." +
"png";
1556 qInfo() <<
"Impossible to save image file to " << imageFilePath;
1564 imageFilePath =
"C:/projects/tympan/issues/530 - Mock IGN/image.png";
1573 QString dirName = QFileInfo(imageFilePath).absolutePath();
1574 QDir::setCurrent(dirName);
1581 if (coord.isEmpty())
1583 qDebug() <<
"Error getting selected zone coords, aborting project creation";
1588 QStringList listCoords = coord.split(
",");
1589 const int len = listCoords.size();
1592 qDebug() <<
"The zone must be a box, aborting project creation";
1599 OBox selectedZone{coordsDouble[0], coordsDouble[1], 0.0, coordsDouble[2], coordsDouble[3], 0.0};
1600 OCoord3D SIGCoords{(selectedZone._min._x + selectedZone._max._x) * 0.5,
1601 (selectedZone._min._y + selectedZone._max._y) * 0.5, 0.0};
1604 double imageWidth = imageWidthString.toDouble();
1606 qInfo() <<
"scaleFactorString : " << scaleFactorString;
1607 double scaleFactor = scaleFactorString.toDouble();
1608 qInfo() <<
"scaleFactor : " << scaleFactor;
1609 mainSite->
setEchelle(abs(coordsDouble[2] - coordsDouble[0]) * scaleFactor / imageWidth);
1615 std::vector<TYPoint> coords(4);
1616 double demiX = abs(coordsDouble[2] - coordsDouble[0]) * scaleFactor / 2;
1617 double demiY = abs(coordsDouble[3] - coordsDouble[1]) * scaleFactor / 2;
1618 coords[0] =
TYPoint(demiX, demiY, 0,
false);
1619 coords[1] =
TYPoint(demiX, -demiY, 0,
false);
1620 coords[2] =
TYPoint(-demiX, -demiY, 0,
false);
1621 coords[3] =
TYPoint(-demiX, demiY, 0,
false);
1681 if (pDlg->result() == QDialog::Accepted)
1693 TYApplication::setOverrideCursor(Qt::WaitCursor);
1695 QString strExtend =
"";
1698 strExtend =
TR(
"id_status_file_ro");
1704 ") : " + fileName +
' ' + strExtend);
1711 TYApplication::restoreOverrideCursor();
1724 if (pDlg->result() == QDialog::Accepted)
1744 auto ret = QMessageBox::warning(
this,
"Attention",
TR(
"id_file_not_saved"),
1745 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
1746 QMessageBox::Cancel);
1749 case QMessageBox::Yes:
1761 case QMessageBox::No:
1765 case QMessageBox::Cancel:
1774 QList<QMdiSubWindow*> windows =
_pWorkspace->subWindowList();
1776 for (
int i = 0; i < int(windows.count()); ++i)
1778 windows.at(i)->close();
1789 QString fileName =
"";
1834 QWidget* pW = this->focusWidget();
1869 QMessageBox::warning(
this,
"Tympan",
TR(
"id_nothingtoexport"));
1874 QString fileName =
getFileName(
"XML (*.xml)", dirName);
1876 bRet =
save(dirName, fileName, pElement,
true);
1880 QMessageBox::information(
this,
"Tympan",
TR(
"id_export_ok").arg(fileName));
1888 QMessageBox::critical(
this,
"Tympan",
TR(
"id_export_failed").arg(fileName));
1895 const bool& saveBackup )
1898 if (!pElement || fileName.isEmpty())
1902 if (dirName.isEmpty())
1912 QString version(TY_CURRENT_RELEASE_);
1913 QString tiret(
" - ");
1914 QString licencie(TY_CUSTOMER_);
1915 QString licenceNumber(TY_LICENCE_NUMBER_);
1917 QString messageVersion = version + tiret + licencie + tiret + licenceNumber;
1920 xmlManager.
createDoc(TY_PRODUCT_XMLTAG_, messageVersion);
1923 bool saveSucceeded = xmlManager.
save(fileName) == 0;
1932 bool saveBakSucceeded =
backupFile(fileName);
1933 if (!saveBakSucceeded)
1950 QMessageBox::warning(
this,
"Tympan",
TR(
"id_nothingtoexport"));
1955 QString fileName =
getFileName(
"XML (*.xml)", dirName,
true);
1959 bRet =
save(dirName, fileName, pElement,
true);
1963 QMessageBox::information(
this,
"Tympan",
TR(
"id_export_ok").arg(fileName));
1971 QMessageBox::critical(
this,
"Tympan",
TR(
"id_export_failed").arg(fileName));
1986 QMessageBox::warning(
this,
"Tympan",
TR(
"id_nothingtoexport"));
1991 QString fileName =
getFileName(
"XML (*.xml)", dirName,
true);
1996 bRet =
save(dirName, fileName, pProjet,
true);
2000 QMessageBox::information(
this,
"Tympan",
TR(
"id_export_ok").arg(fileName));
2004 QMessageBox::critical(
this,
"Tympan",
TR(
"id_export_failed").arg(fileName));
2017 if (pElement == NULL)
2023 QString fileName =
getFileName(
"XML (*.xml)", dirName,
true);
2027 bRet =
save(dirName, fileName, pElement);
2031 QMessageBox::information(
this,
"Tympan",
TR(
"id_export_ok").arg(fileName));
2035 QMessageBox::critical(
this,
"Tympan",
TR(
"id_export_failed").arg(fileName));
2054 QFileInfo fi(fileName);
2056 QString bakBasename = fi.absolutePath() +
'/' + fi.completeBaseName() +
".bak";
2057 QDateTime now = QDateTime::currentDateTime();
2058 QString nowAsStr = now.toString(
"yyyy-MM-dd_hh-mm-ss");
2059 QString nomFichier = bakBasename +
"_" + nowAsStr;
2062 QFile fileToSave(fileName);
2063 bool bOpen = fileToSave.open(QIODevice::ReadOnly);
2072 bOpen =
backupFile.open(QIODevice::WriteOnly);
2087 const int nbBackupsToKeep = 3;
2114 QFileInfo fi(fileName);
2119 QFile* file =
new QFile(fileName);
2121 QMessageBox::warning(
this,
"Attention",
TR(
"id_file_exist"), QMessageBox::Yes, QMessageBox::No))
2123 case QMessageBox::Yes:
2124 if (!file->remove())
2126 QMessageBox::warning(
this,
"Attention",
TR(
"id_file_cannot_be_clear"));
2131 case QMessageBox::No:
2144 const bool& forceNewName )
2150 if (!forceNewName && !fileName.isEmpty())
2156 short index = filter.indexOf(
".");
2157 QString end = filter.mid(index, 4);
2159 QFileDialog* pDialog =
new QFileDialog(parentWidget(),
"Choose a file", dirName, filter);
2160 pDialog->setFileMode(QFileDialog::AnyFile);
2161 pDialog->setAcceptMode(QFileDialog::AcceptSave);
2162 pDialog->setWindowModality(Qt::WindowModal);
2165 QStringList list = pDialog->selectedFiles();
2166 if ((pDialog->result() == QDialog::Accepted) && (!list.isEmpty()))
2168 fileName = list.first();
2170 QDir dir = pDialog->directory();
2171 dirName = dir.absolutePath();
2175 if (!fileName.endsWith(end))
2190 const QFileInfo fiBakBasename(bakBasename);
2192 QDir workingDir(fiBakBasename.absolutePath());
2194 workingDir.setNameFilters(QStringList(fiBakBasename.fileName() +
"*"));
2195 workingDir.setFilter(QDir::Files);
2196 workingDir.setSorting(QDir::Name);
2197 const QFileInfoList fiBakList = workingDir.entryInfoList();
2199 const int nbBakFiles = fiBakList.size();
2200 if (nbBakFiles > nbToKeep)
2202 const int nbBakToRemove = nbBakFiles - nbToKeep;
2203 const QFileInfoList fiBakToRemoveList = fiBakList.sliced(0, nbBakToRemove);
2204 for (
const QFileInfo& fiBakToRemove : fiBakToRemoveList)
2206 const bool removeSucceeded = workingDir.remove(fiBakToRemove.fileName());
2207 if (!removeSucceeded)
2219 QWidget* pW = this->focusWidget();
2276 QProcess* pImporterLauncher =
new QProcess(
this);
2285 pImporterLauncher->start(
"Importer", QStringList(
""));
2287 if (pImporterLauncher->state() == QProcess::Running)
void writeOutputMsg(QString msg)
Affiche un message dans la fenetre de sortie.
TYApplication * getTYApp()
Retourne le pointeur sur l'application.
pour l'application Tympan (fichier header)
Modeler specialisee pour l'edition des batiments (fichier header)
Boite de dialogue pour la creation d'un nouvel element metier. L'element cree peut etre sauvegarde en...
#define TYDIRPREFERENCEMANAGER
Classe Modeler specialisee pour l'edition des faces (fichier header)
Modeler specialisee pour l'edition des machines (fichier header)
Fenetre principale de l'application Tympan (fichier header)
Classe generique pour une fenetre de modeleur (fichier header)
Boite de dialogue pour le chargement d'un element metier (fichier header)
Frame pour les messages de retour (fichier header)
Gestion de la table de correspondance indice/element pour le picking (fichier header)
Boite de dialogue pour la selection du plugin de calcul (fichier header)
#define DEFAULT_SOLVER_UUID
Tables pour le dialogue de la gestion des preferences (fichier header)
Frame pour la gestion de projet (fichier header)
Frame pour la gestion de site (fichier header)
Classe Modeler specialisee pour l'edition des sites (fichier header)
virtual void debug(const char *message,...)
static OMessageManager * get()
static OPrototype * safeDownCast(OPrototype *pObject)
bool isA(const char *className) const
size_t getNbChild() const
void redo()
Effectue a nouveau la derniere action annulee.
void undo()
Annule la derniere action.
void emitUndoRedo()
Envoie un signal informant sur l'etat de ce ActionManager.
void undoRedoChanged(bool undoAvailable, bool redoAvailable, const QString &undoCmd, const QString &redoCmd)
Indique l'etat de ce ActionManager.
void setCurSiteNode(LPTYSiteNode pSiteNode)
Set/Get du site node courant.
static const QString & getCurrentDirName()
LPTYProjet getCurProjet()
Set/Get du projet courant.
static QString tympanAppDir()
Retourne le chemin du dossier de l'application.
TYCalculManager * getCalculManager()
Get du gestionnaire de calculs.
static const QString & getCurrentFileName()
Retourne le nom du fichier en cours d'utilisation.
void curSiteNodeChanged(LPTYSiteNode pCurSiteNode)
Signal que le site node courant a change.
void curProjetChanged(LPTYProjet pCurProjet)
Signal que le projet courant a change.
static void setCurrentFileName(const QString &fileName)
Enregistre le nom du fichier de travail courant.
static QString tympanUserDir()
Retourne le chemin du dossier de sauvegarde de l'utilisateur courant. Celui-ci est donne par la varia...
void setCurProjet(LPTYProjet pProjet)
Set/Get du projet courant.
static void setCurrentDirName(const QString &dirName)
Get/Set du repertoire de travail courant.
Classe Modeler specialisee pour l'edition des batiments.
void setBatiment(LPTYBatiment pBatiment)
Set/Get du bâtiment a editer.
LPTYBatiment getBatiment()
virtual void setEditorMode(int mode)
bool launchCurrent()
Execute le calcul courant.
void setCurrent(LPTYCalcul pCalcul)
Set du Calcul et Projet courant.
void launchAltiComputation(LPTYSiteNode pRootSite)
Execute altimetry computation.
int getState()
Get calculation state.
void setSolverId(const OGenID &iD)
Set solver ID.
void setState(int state)
Set editable attribute.
bool getKeepRays() const
Returns if computation contains rays or not \ returns true if computation contains rays else returns ...
bool addToSelection(TYUUID id)
Adds the item to the selection of this Calculation.
Boite de dialogue pour la creation d'un nouvel element metier. L'element cree peut etre sauvegarde en...
void createElement(QString eltType)
Gere la creation d'un nouvel element au sein de l'application.
TYElement * getParent() const
static void setLogInstances(bool log)
static void setIsSavedOk(const bool &toSave)
const TYUUID & getID() const
static void setRegenerateID(const bool &bRegenerate)
static bool getIsSavedOk()
static TYElement * getInstance(TYUUID uuid)
Classe Modeler specialisee pour l'edition des faces.
virtual void setEditorMode(int mode)
This class holds a singleton instance which is an entry point for accessing IGN Geoplatform in order ...
std::shared_ptr< TYIGNLevelCurvesParser > _parser
const QString getLandtakeCoord()
const QString getImageWidth()
static TYIGNGeoProvider * getInstance()
void geoProjectCreationRequested()
std::vector< double > coordinatesToDouble(const QString &coord)
void buildLevelCurves(const OCoord3D &SIGCoords, const OBox &selectedZone, double scaleFactor)
void openModalWindow(QWidget *mainWindow)
bool mockGeoPf()
Mocks IGN Geoplatform web services when they are down.
bool saveImageToFile(const QString &filePath)
const QString getScaleFactor()
void courbeNiveauCreated(LPTYCourbeNiveau courbeNiveau)
Classe Modeler specialisee pour l'edition des machines.
void setMachine(LPTYMachine pMachine)
virtual void setEditorMode(int mode)
Main window of the Tympan application.
void updateModelersAfterComputation(LPTYProjet &result)
void updateHideOrShowOutputAction(bool visibilityChanged)
QDockWidget * _pOutputDockWnd
Dockable window for feedback messages.
TYProjetFrame * _pProjetFrame
Frame for project management.
TYInfraToolbar * _pToolbarInfra
Infrastructure toolbar.
TYElement * elementToSave()
void updateCurrentAppFile(const QString &dirName, const QString &fileName)
TYFaceToolbar * _pToolbarFace
Face toolbar.
QString getFileName(const QString &filter, QString &dirName, const bool &forceNewName=false)
Produces a valid file name (or nothing!)
QButtonGroup * _pBatimentBtnGroup
Button group for building toolbar.
QAction * _pOpenAction
Action to open the library manager.
QDockWidget * _pSiteDockWnd
Dockable window for site management.
void updateCurrentFileName(const QString &fileName)
void saveCurBatimentMode(int mode)
bool keepOnlyMostRecentBackups(const QString &xmlFilename, const int &nbToKeep) const
TYSiteFrame * _pSiteFrame
Frame for site management.
void saveCurFaceMode(int mode)
TYTopoToolbar * _pToolbarTopo
Topography toolbar.
void setCurSiteNode(LPTYSiteNode pSiteNode)
QAction * _pCreateNewAction
Action to create a new element.
void onCourbeNiveauCreated(LPTYCourbeNiveau courbeNiveau)
bool loadSettings(const QString &fileName)
void makeSiteModeler(LPTYSiteNode pSite=NULL)
bool _closeAndQuit
Indicator for canceling the exit command.
TYCalculToolbar * _pToolbarCalcul
Calculation toolbar.
void formatFileName(QString &fileName)
bool backupFile(const QString &fileName)
QAction * _pSaveAsAction
Action to save an element with a specific name.
void updateUndoRedo(bool undoAvailable, bool redoAvailable, const QString &undoCmd, const QString &redoCmd)
bool makeBatimentModeler(LPTYBatiment pBatiment=NULL)
QAction * _pUndoAction
Action to perform an undo.
int _curSiteMode
Preserves the current mode of SiteModeler windows.
QAction * _pPrintAction
Action to print.
QAction * _pRedoAction
Action to perform a redo.
void windowsMenuActivated()
QButtonGroup * _pFaceBtnGroup
Button group for face toolbar.
QAction * _pSaveAction
Action to save an element.
QAction * _pHideOrShowOutputAction
Shows or hides the output messages window.
QMdiArea * _pWorkspace
Workspace for MDI management.
TYProjetFrame * getProjetFrame()
QAction * _pPasteAction
Action to perform a paste.
bool makeModeler(TYElement *pElt)
void saveCurMachineMode(int mode)
QAction * _pCloseAction
Action to close the current project or site.
void createNewGeoProjet()
QButtonGroup * _pMachineBtnGroup
Button group for machine toolbar.
void updateModelers(bool clipping=true, bool axesAndGrid=true, bool displayList=true)
void connectActionManager(TYActionManager *pActionManager)
TYSiteFrame * getSiteFrame()
TYModelerToolbar * _pToolbarModeler
General toolbar for modelers.
void showBiblio(bool show)
QAction * _pHideOrShowSpectreMngrAction
Shows or hides the Spectrum Manager.
int _curFaceMode
Preserves the current mode of FaceModeler windows.
TYMachineToolbar * _pToolbarMachine
Machine toolbar.
QMenu * _pWindowsMenu
Spectra manager.
QAction * _pGoAltiAction
Action to start the altimetry calculation.
void refreshWindowTitle()
void showPreferenceDialog()
QAction * _pHideOrShowMaillageMngrAction
Shows or hides the Mesh Manager.
void showZoneSelectPage()
void makeProjetModeler(LPTYProjet pProjet=NULL)
virtual void closeEvent(QCloseEvent *pEvent)
void showMaillageManager(bool show)
bool saveSettings(const QString &fileName)
TYModelerFrame * _pCurrentModeler
Currently displayed modeler.
void connectDefaultActionManager()
QOpenGLWidget * _pDummyQOpenGLWidget
QAction * _pGoCurCalculAction
Action to start the current calculation.
void updateModelersElementGraphic(bool force=false)
QToolBar * _pCalculAcousticToolbar
Toolbar for acoustic calculations.
QAction * _pCutAction
Action to perform a cut.
bool makeMachineModeler(LPTYMachine pMachine=NULL)
QAction * _pEditCurCalculAction
Action to edit the preferences of the current calculation.
void setCurProjet(LPTYProjet pProjet)
QAction * _pSaveAsNoResultAction
Action to save an element with a specific name without calculation results.
void showOutput(bool show)
virtual QMenu * createPopupMenu()
bool testFile(const QString &fileName)
Tests the existence and the possibility of writing the file.
QTextBrowser * _pHelpBrowser
Help browser.
void saveGeometryToPreferences()
save geometry of windows to preferences
int _curMachineMode
Preserves the current mode of MachineModeler windows.
std::unique_ptr< QFile > searchSettingsFile(const QString &TympanUserDir, const QString &fileNameBegin, const QString &fileNameEnd, const QString &fileNamePattern)
Returns a regular file name or the most recent file matching the file name pattern in the Tympan user...
void windowsMenuAboutToShow()
QToolBar * _pWindowToolbar
Toolbar for window management.
TYOutputFrame * _pOutputFrame
Frame for feedback messages.
void saveCurSiteMode(int mode)
void closeModeler(const TYElement *pElement)
QButtonGroup * _pSiteBtnGroup
Button group for site toolbars.
QAction * _pCopyAction
Action to perform a copy.
QToolBar * _pMainToolbar
Main toolbar.
QAction * _pShowPluginManagerAction
Action to display the plug-in manager.
TYBatimentToolbar * _pToolbarBatiment
Building toolbar.
void subWindowActivated()
int _curBatimentMode
Preserves the current mode of BatimentModeler windows.
QDockWidget * _pProjetDockWnd
Dockable window for project management.
void showSpectreManager(bool show)
QAction * _pHideOrShowBiblioAction
Shows or hides the Library of elements.
void setDefaultCameraMode()
Generic class for a modeler window.
void updateElementGraphic(bool force=false)
TYRenderWindowInteractor * getView()
void setEditorModeToCamera()
void setKeepRays(bool keepRays)
void editorModeChanged(int mode)
void viewTypeChanged(int)
TYActionManager * getActionManager()
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
Boite de dialogue pour le chargement d'un element metier. L'element peut etre ouvert dans un modeleur...
void openElement(LPTYElement pElt)
void setDirName(const QString &value)
Set du nom du repertoire de travail.
void setMultiSelect(const bool &b)
QString getDirName()
Get du nom du repertoire de travail.
std::vector< LPTYElement > getTabElem()
LPTYElementArray getAvailableElements()
Realise le rendu VTK et le rendu OpenGL.
void invalidateScene(void)
void clearTabSelectedElement()
Frame pour les messages de retour.
classe graphique pour la gestion de la table de correspondanceindice/element pour le picking
Boite de dialogue pour la selection du plugin de calcul.
Boite de dialogue pour la gestion des preferences.
Frame pour la gestion de projet.
void changeSite(LPTYSiteNode pSite)
void setProjet(LPTYProjet pProjet)
void changeCurrentCalcul(LPTYCalcul pCalcul)
classe de definition d'un projet.
void setStatusSolver(const bool &bStatus)
bool getStatusSolver()
Get/Set du statut de disponibilite du solveur du calcul courant.
LPTYSiteNode getSite()
Get du site.
LPTYCalcul getCurrentCalcul()
Set/Get du pointeur du Calcul courant.
Le role de cette classe est limite a emettre des signaux pouvant etre utilise pour interagir sur le r...
TYOpenGLRenderer * getRenderer()
Frame pour la gestion de site.
TYSiteNode * getSiteNodeRoot()
void setSiteNodeRoot(LPTYSiteNode pSiteNode)
void setCurrentCalcul(LPTYCalcul pCalcul)
Classe Modeler specialisee pour l'edition des sites.
virtual void setEditorMode(int mode)
void setProjet(LPTYProjet pProjet)
virtual void setMaillageRenderModeSlot()
void showAltimetrie(bool show)
void enableAltimetrieButton(bool enable)
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
LPTYAltimetrie getAltimetry() const
LPTYTopographie getTopographie()
void setEmprise(TYTabPoint points)
void setTopoFileName(const QString &name)
void setUseEmpriseAsCrbNiv(bool b)
void loadTopoFile(const QString &fileName)
void setUseTopoFile(bool flag)
bool addCrbNiv(LPTYCourbeNiveauGeoNode pCrbNivGeoNode)
int save(QString fileName)
void createDoc(QString docName, QString version)
int addElement(TYElement *pElt)
static void setSavedFileName(QString savedFileName)
#define TY_PRODUCT_PLATFORM_