Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYMainWindow.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
21 // Added by qt3to4:
22 #include <QPixmap>
23 #include <QCloseEvent>
24 #include <qaction.h>
25 #include <qdir.h>
26 #include <qslider.h>
27 #include <qstatusbar.h>
28 #include <qmenubar.h>
29 #include <qtoolbar.h>
30 #include <qdialog.h>
31 #include <qlabel.h>
32 #include <qfile.h>
33 #include <qfiledialog.h>
34 #include <qfileinfo.h>
35 #include <qtoolbutton.h>
36 #include <qbuttongroup.h>
37 #include <qmessagebox.h>
38 #include <qcursor.h>
39 #include <qmainwindow.h>
40 #include <qprocess.h>
41 #include <qtextbrowser.h>
42 #include <qtextstream.h>
43 #include <QDockWidget>
44 #include <QMdiArea>
45 #include <QMdiSubWindow>
46 #include <QShortcut>
47 #include <qeventloop.h>
48 
49 #include "Tympan/core/config.h"
50 #include <Tympan/core/logging.h>
68 
81 #include "TYMainWindow.h"
82 
83 #define TR(id) OLocalizator::getString("TYMainWindow", (id))
84 #define IMG(id) OLocalizator::getPicture("TYMainWindow", (id))
85 
86 // using namespace Qt;
87 
88 // to avoid X11 macro conflit
89 #ifdef Always
90  #undef Always
91 #endif
92 
93 TYMainWindow::TYMainWindow() : QMainWindow(0)
94 {
95  // QApplication::setStyle(new QGtkStyle());
96  _pDummyQOpenGLWidget = new QOpenGLWidget(this);
97  _pDummyQOpenGLWidget->setVisible(false);
98 
99  TYPickingTable _pPickingTable;
100 
101  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ + ")");
102 
103  _closeAndQuit = true;
104 
105  // Gestion du workspace
106  _pWorkspace = new QMdiArea();
107  _pWorkspace->setActivationOrder(QMdiArea::ActivationHistoryOrder);
108  setCentralWidget(_pWorkspace);
109 
110  // CLM-NT35 : Empecher de deplacer/tourner en vue perspective/mobile
111  _pCurrentModeler = NULL;
112 
113  // Settings du docking
114  // setDockWindowsMovable(true);
115 
116  // Navigateur d'aide
117  _pHelpBrowser = new QTextBrowser(NULL);
118  _pHelpBrowser->resize(800, 600);
119  QString help_index_file = TYApplication::tympanAppDir() + "/" + TR("id_help_index_path");
120  if (QFile::exists(help_index_file))
121  {
122  _pHelpBrowser->setSource(help_index_file);
123  }
124  _pHelpBrowser->hide();
125 
126  // Modes des Modelers
131 
132  // Disambiguate the overloaded TYMainWindow signals
133  void (TYMainWindow::*tyMainWindow_open)() = &TYMainWindow::open;
134  bool (TYMainWindow::*tyMainWindow_save)() = &TYMainWindow::save;
135  bool (TYMainWindow::*tyMainWindow_saveAs)() = &TYMainWindow::saveAs;
136 
137  // Actions
138  _pCreateNewAction = new QAction(QPixmap(IMG("id_icon_createnew")), TR("id_menuitem_createnew"), this);
139  _pCreateNewAction->setShortcut(Qt::CTRL + Qt::Key_N);
140  _pCreateNewAction->setStatusTip(TR("id_status_createnew"));
141  QObject::connect(_pCreateNewAction, &QAction::triggered, this, &TYMainWindow::createNew);
142 
143  _pOpenAction = new QAction(QPixmap(IMG("id_icon_open")), TR("id_menuitem_open"), this);
144  _pOpenAction->setShortcut(Qt::CTRL + Qt::Key_O);
145  _pOpenAction->setStatusTip(TR("id_status_open"));
146  QObject::connect(_pOpenAction, &QAction::triggered, this, tyMainWindow_open);
147 
148  _pCloseAction = new QAction(QPixmap(IMG("id_icon_close")), TR("id_menuitem_close"), this);
149  _pCloseAction->setStatusTip(TR("id_status_close"));
150  QObject::connect(_pCloseAction, &QAction::triggered, this, &TYMainWindow::close);
151  _pCloseAction->setEnabled(false);
152 
153  _pSaveAction = new QAction(QPixmap(IMG("id_icon_save")), TR("id_menuitem_save"), this);
154  _pSaveAction->setShortcut(Qt::CTRL + Qt::Key_S);
155  _pSaveAction->setStatusTip(TR("id_status_save"));
156  QObject::connect(_pSaveAction, &QAction::triggered, this, tyMainWindow_save);
157 
158  _pSaveAsAction = new QAction(QPixmap(IMG("id_icon_save")), TR("id_menuitem_saveas"), this);
159  _pSaveAsAction->setStatusTip(TR("id_status_saveas"));
160  QObject::connect(_pSaveAsAction, &QAction::triggered, this, tyMainWindow_saveAs);
161 
163  new QAction(QPixmap(IMG("id_icon_save")), TR("id_menuitem_saveas_noresult"), this);
164  _pSaveAsNoResultAction->setStatusTip(TR("id_status_saveas_noresult"));
165  QObject::connect(_pSaveAsNoResultAction, &QAction::triggered, this, &TYMainWindow::saveAsNoResult);
166 
167  _pShowPluginManagerAction = new QAction(QPixmap(IMG("id_icon_plugin")), TR("id_menuitem_plugin"), this);
168  _pShowPluginManagerAction->setStatusTip(TR("id_status_plugin"));
169  QObject::connect(_pShowPluginManagerAction, &QAction::triggered, this, &TYMainWindow::showPluginManager);
170 
171  // az++:
172  _pPrintAction = new QAction(QPixmap(IMG("id_icon_print")), TR("id_menuitem_print"), this);
173  _pPrintAction->setShortcut(Qt::CTRL + Qt::Key_P);
174  _pPrintAction->setStatusTip(TR("id_status_print"));
175  QObject::connect(_pPrintAction, &QAction::triggered, this, &TYMainWindow::print);
176  _pPrintAction->setEnabled(false);
177 
178  _pUndoAction = new QAction(QPixmap(IMG("id_icon_undo")), TR("id_menuitem_undo_na"), this);
179  _pUndoAction->setShortcut(Qt::CTRL + Qt::Key_Z);
180  _pUndoAction->setStatusTip(TR("id_status_undo"));
181  QObject::connect(_pUndoAction, &QAction::triggered, this, &TYMainWindow::undo);
182  _pUndoAction->setEnabled(false);
183 
184  _pRedoAction = new QAction(QPixmap(IMG("id_icon_redo")), TR("id_menuitem_redo_na"), this);
185  _pRedoAction->setShortcut(Qt::CTRL + Qt::Key_Y);
186  _pRedoAction->setStatusTip(TR("id_status_redo"));
187  QObject::connect(_pRedoAction, &QAction::triggered, this, &TYMainWindow::redo);
188  _pRedoAction->setEnabled(false);
189 
190  _pCutAction = new QAction(QPixmap(IMG("id_icon_cut")), TR("id_menuitem_cut"), this);
191  _pCutAction->setShortcut(Qt::CTRL + Qt::Key_X);
192  _pCutAction->setStatusTip(TR("id_status_cut"));
193  QObject::connect(_pCutAction, &QAction::triggered, this, &TYMainWindow::cut);
194  _pCutAction->setEnabled(false);
195 
196  _pCopyAction = new QAction(QPixmap(IMG("id_icon_copy")), TR("id_menuitem_copy"), this);
197  _pCopyAction->setShortcut(Qt::CTRL + Qt::Key_C);
198  _pCopyAction->setStatusTip(TR("id_status_cut"));
199  QObject::connect(_pCopyAction, &QAction::triggered, this, &TYMainWindow::copy);
200  _pCopyAction->setEnabled(false);
201 
202  _pPasteAction = new QAction(QPixmap(IMG("id_icon_paste")), TR("id_menuitem_paste"), this);
203  _pPasteAction->setShortcut(Qt::CTRL + Qt::Key_V);
204  _pPasteAction->setStatusTip(TR("id_status_paste"));
205  QObject::connect(_pPasteAction, &QAction::triggered, this, &TYMainWindow::paste);
206  _pPasteAction->setEnabled(false);
207 
209  new QAction(QPixmap(IMG("id_icon_show_spectremngr")), TR("id_menuitem_show_spectremngr"), this);
210  _pHideOrShowSpectreMngrAction->setCheckable(false); // DT 18-05-04 (true change en false)
211  _pHideOrShowSpectreMngrAction->setStatusTip(TR("id_status_show_spectremngr"));
212  _pHideOrShowSpectreMngrAction->setEnabled(false); // Inactive au depart
213  QObject::connect(_pHideOrShowSpectreMngrAction, &QAction::toggled, this,
215 
217  new QAction(QPixmap(IMG("id_icon_show_maillagemngr")), TR("id_menuitem_show_maillagemngr"), this);
218  _pHideOrShowMaillageMngrAction->setCheckable(false); // DT 18-05-04 (true change en false)
219  _pHideOrShowMaillageMngrAction->setStatusTip(TR("id_status_show_maillagemngr"));
220  _pHideOrShowMaillageMngrAction->setEnabled(false); // Inactive au depart
221  QObject::connect(_pHideOrShowMaillageMngrAction, &QAction::toggled, this,
223 
225  new QAction(QPixmap(IMG("id_icon_show_biblio")), TR("id_menuitem_show_biblio"), this);
226  _pHideOrShowBiblioAction->setCheckable(true);
227  _pHideOrShowBiblioAction->setStatusTip(TR("id_status_show_biblio"));
228  QObject::connect(_pHideOrShowBiblioAction, &QAction::toggled, this, &TYMainWindow::showBiblio);
229  _pHideOrShowBiblioAction->setEnabled(false);
230 
232  new QAction(QPixmap(IMG("id_icon_show_output")), TR("id_menuitem_show_output"), this);
233  _pHideOrShowOutputAction->setCheckable(true);
234  _pHideOrShowOutputAction->setStatusTip(TR("id_status_show_output"));
235  QObject::connect(_pHideOrShowOutputAction, &QAction::toggled, this, &TYMainWindow::showOutput);
236 
238  new QAction(QPixmap(IMG("id_icon_edit_curcalcul")), TR("id_menuitem_edit_curcalcul"), this);
239  _pEditCurCalculAction->setStatusTip(TR("id_status_edit_curcalcul"));
240  QObject::connect(_pEditCurCalculAction, &QAction::triggered, this, &TYMainWindow::editCurCalcul);
241  _pEditCurCalculAction->setEnabled(false);
242 
244  new QAction(QPixmap(IMG("id_icon_go_curcalcul")), TR("id_menuitem_go_curcalcul"), this);
245  _pGoCurCalculAction->setStatusTip(TR("id_status_go_curcalcul"));
246  QObject::connect(_pGoCurCalculAction, &QAction::triggered, this, &TYMainWindow::goCurCalcul);
247  _pGoCurCalculAction->setEnabled(false);
248 
249  QAction* pPrefDialogAction =
250  new QAction(QPixmap(IMG("id_icon_prefdlg")), TR("id_menuitem_prefdlg"), this);
251  QObject::connect(pPrefDialogAction, &QAction::triggered, this, &TYMainWindow::showPreferenceDialog);
252 
253  // Barre de menu
254  QMenu* pFileMenu = new QMenu(TR("id_menu_file"), this);
255  menuBar()->addMenu(pFileMenu);
256 
257  QMenu* pNewMenu = new QMenu(TR("id_menuitem_new"), this);
258  pNewMenu->setTearOffEnabled(true);
259  pNewMenu->addAction(TR("id_menuitem_newprojet"), this, &TYMainWindow::createNewProjet);
260  pNewMenu->addAction(TR("id_menuitem_newgeoprojet"), this, &TYMainWindow::showZoneSelectPage);
261  pNewMenu->addAction(TR("id_menuitem_newsite"), this, &TYMainWindow::createNewSite);
262  pNewMenu->addAction(TR("id_menuitem_newbatiment"), this, &TYMainWindow::createNewBatiment);
263  pNewMenu->addAction(TR("id_menuitem_newmachine"), this, &TYMainWindow::createNewMachine);
264  pNewMenu->addAction(_pCreateNewAction);
265 
266  pFileMenu->addMenu(pNewMenu);
267  pFileMenu->addAction(_pOpenAction);
268  pFileMenu->addAction(_pCloseAction);
269  pFileMenu->addSeparator();
270  pFileMenu->addAction(_pSaveAction);
271  pFileMenu->addAction(_pSaveAsAction);
272  pFileMenu->addAction(_pSaveAsNoResultAction);
273  pFileMenu->addSeparator();
274  pFileMenu->addAction(_pShowPluginManagerAction);
275  pFileMenu->addSeparator();
276  pFileMenu->addAction(_pPrintAction);
277  pFileMenu->addSeparator();
278  pFileMenu->addAction(TR("id_menuitem_quit"), this, &TYMainWindow::quitte, QKeySequence("Ctrl+Q"));
279 
280  QMenu* pEditMenu = new QMenu(TR("id_menu_edit"), this);
281  menuBar()->addMenu(pEditMenu);
282  pEditMenu->addAction(_pUndoAction);
283  pEditMenu->addAction(_pRedoAction);
284  pEditMenu->addSeparator();
285  pEditMenu->addAction(_pCutAction);
286  pEditMenu->addAction(_pCopyAction);
287  pEditMenu->addAction(_pPasteAction);
288  pEditMenu->addSeparator();
289  pEditMenu->addAction(QPixmap(IMG("id_icon_prefdlg")), TR("id_menuitem_prefdlg"), this,
291 
292  _pWindowsMenu = new QMenu(TR("id_menu_windows"), this);
293  connect(_pWindowsMenu, &QMenu::aboutToShow, this, &TYMainWindow::windowsMenuAboutToShow);
294  menuBar()->addMenu(_pWindowsMenu);
295 
296  menuBar()->addSeparator();
297 
298  QMenu* pHelpMenu = new QMenu(TR("id_menu_help"), this);
299  menuBar()->addMenu(pHelpMenu);
300  pHelpMenu->addAction(TR("id_menuitem_help"), this, &TYMainWindow::showHelp, QKeySequence("F1"));
301  pHelpMenu->addSeparator();
302  pHelpMenu->addAction(TR("id_menuitem_about"), this, &TYMainWindow::about);
303 
304  // Barre d'outils fichier
305  _pMainToolbar = new QToolBar(TR("id_toolbar_file"), this);
306  addToolBar(_pMainToolbar);
307  QToolButton* pToolNewFile = new QToolButton(this);
308  pToolNewFile->setIcon(QPixmap(IMG("id_icon_new")));
309  pToolNewFile->setToolTip(TR("id_menuitem_new"));
310  pToolNewFile->setMenu(pNewMenu);
311  pToolNewFile->setPopupMode(QToolButton::InstantPopup);
312  _pMainToolbar->addWidget(pToolNewFile);
313  _pMainToolbar->addSeparator();
314  _pMainToolbar->addAction(_pOpenAction);
315  _pMainToolbar->addAction(_pSaveAction);
316  _pMainToolbar->addSeparator();
317  _pMainToolbar->addAction(_pPrintAction);
318  _pMainToolbar->addSeparator();
319  _pMainToolbar->addAction(_pCutAction);
320  _pMainToolbar->addAction(_pCopyAction);
321  _pMainToolbar->addAction(_pPasteAction);
322  _pMainToolbar->addSeparator();
323  _pMainToolbar->addAction(_pUndoAction);
324  _pMainToolbar->addAction(_pRedoAction);
325  _pMainToolbar->setObjectName("MainToolbar");
326 
327  // Barre d'outils des fenetres
328  _pWindowToolbar = new QToolBar(TR("id_toolbar_window"), this);
329  addToolBar(_pWindowToolbar);
333  _pWindowToolbar->addSeparator();
335  _pWindowToolbar->addSeparator();
336  _pWindowToolbar->addAction(pPrefDialogAction);
337  _pWindowToolbar->setObjectName("WindowToolbar");
338 
339  // Barre d'outils de calcul acoustique
340  _pCalculAcousticToolbar = new QToolBar(TR("id_toolbar_calculacoustic"), this);
341  addToolBar(_pCalculAcousticToolbar);
344  _pCalculAcousticToolbar->setObjectName("CalculAcousticToolbar");
345 
346  // Barre d'outils pour les modelers
347  _pToolbarModeler = new TYModelerToolbar(0, this, TR("id_toolbar_modeler"));
348  addToolBar(_pToolbarModeler);
349  _pToolbarModeler->setObjectName("ToolbarModeler");
350 
351  // Btn group pour Site
352  _pSiteBtnGroup = new QButtonGroup(this);
353  // _pSiteBtnGroup->hide();
354  _pSiteBtnGroup->setExclusive(true);
355 
356  // Barre d'outils Topographie
357  _pToolbarTopo = new TYTopoToolbar(_pSiteBtnGroup, this, TR("id_toolbar_topo"));
358  addToolBar(_pToolbarTopo);
359  _pToolbarTopo->setObjectName("ToolbarTopo");
360 
361  // Barre d'outils Calcul
362  _pToolbarCalcul = new TYCalculToolbar(_pSiteBtnGroup, this, TR("id_toolbar_calcul"));
363  addToolBar(_pToolbarCalcul);
364  _pToolbarCalcul->setObjectName("ToolbarCalcul");
365 
366  // Barre d'outils Infrastructure
367  _pToolbarInfra = new TYInfraToolbar(_pSiteBtnGroup, this, TR("id_toolbar_infra"));
368  addToolBar(_pToolbarInfra);
369  _pToolbarInfra->setObjectName("ToolbarInfra");
370 
371  // Btn group pour Machine
372  _pMachineBtnGroup = new QButtonGroup(this);
373  // _pMachineBtnGroup->hide();
374  _pMachineBtnGroup->setExclusive(true);
375 
376  // Barre d'outils Machine
377  _pToolbarMachine = new TYMachineToolbar(_pMachineBtnGroup, this, TR("id_toolbar_machine"));
378  addToolBar(_pToolbarMachine);
379  _pToolbarMachine->setObjectName("ToolbarMachine");
380 
381  // Btn group pour Face
382  _pFaceBtnGroup = new QButtonGroup(this);
383  // _pFaceBtnGroup->hide();
384  _pFaceBtnGroup->setExclusive(true);
385 
386  // Barre d'outils Face
387  _pToolbarFace = new TYFaceToolbar(_pFaceBtnGroup, this, TR("id_toolbar_Face"));
388  addToolBar(_pToolbarFace);
389  _pToolbarFace->setObjectName("ToolbarFace");
390 
391  // Btn group pour Batiment
392  _pBatimentBtnGroup = new QButtonGroup(this);
393  // _pBatimentBtnGroup->hide();
394  _pBatimentBtnGroup->setExclusive(true);
395 
396  // Barre d'outils Batiment
397  _pToolbarBatiment = new TYBatimentToolbar(_pBatimentBtnGroup, this, TR("id_toolbar_batiment"));
398  addToolBar(_pToolbarBatiment);
399  _pToolbarBatiment->setObjectName("ToolbarBatiment");
400 
401  // Fenetre Projet
402  _pProjetDockWnd = new QDockWidget(TR("id_toolbar_projet"), this);
403  _pProjetDockWnd->setFloating(false);
405  _pProjetDockWnd->setWidget(_pProjetFrame);
406  _pProjetDockWnd->setObjectName("ProjetDockWnd");
407  _pProjetDockWnd->setContentsMargins(0, 0, 0, 0);
408  addDockWidget(Qt::LeftDockWidgetArea, _pProjetDockWnd);
409 
410  // Fenetre Site
411  _pSiteDockWnd = new QDockWidget(TR("id_toolbar_site"), this);
412  _pSiteDockWnd->setFloating(false);
414  _pSiteDockWnd->setWidget(_pSiteFrame);
415  _pSiteDockWnd->setObjectName("SiteDockWnd");
416  addDockWidget(Qt::LeftDockWidgetArea, _pSiteDockWnd);
417 
418  // Fenetre Output
419  _pOutputDockWnd = new QDockWidget(TR("id_toolbar_output"), this);
420  _pOutputDockWnd->setFloating(false);
422  _pOutputDockWnd->setWidget(_pOutputFrame);
423  _pOutputDockWnd->setObjectName("OutputDockWnd");
424  addDockWidget(Qt::LeftDockWidgetArea, _pOutputDockWnd);
425 
426  // Connexion des signaux
427  QObject::connect(_pOutputDockWnd, &QDockWidget::visibilityChanged, this,
434  QObject::connect(_pProjetFrame, &TYProjetFrame::changeCurrentCalcul, this,
436  QObject::connect(_pWorkspace, &QMdiArea::subWindowActivated, this, &TYMainWindow::subWindowActivated);
437 
438  QShortcut* shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
439  connect(shortcut, &QShortcut::activated, this, &TYMainWindow::setDefaultCameraMode);
440 
441  // Connecte l'Action Manager de l'Application
443 
444  // Connecte le gestionnaire geographique IGN
446  QObject::connect(geoProvider, &TYIGNGeoProvider::geoProjectCreationRequested, this,
448 
449  // Desactive tous les boutons
451 
452  // On active la sauvegarde des instances de type TYElement et derivees
454 
455  // Ready to work !!
456  statusBar()->showMessage(TR("id_status_ready"));
457 
458  // Indique que les TYElement sont ok (rien a sauvegarder)
460 }
461 
463 {
464  delete _pHelpBrowser;
465  _pHelpBrowser = NULL;
466 }
467 
469 {
470  QMenu* returnedMenu = QMainWindow::createPopupMenu();
471  TYCustomPopupMenu* myMenu = new TYCustomPopupMenu();
472  myMenu->addActions(returnedMenu->actions());
473  delete returnedMenu;
474  return myMenu;
475 }
476 
478 {
479  // Main window
480  TYPreferenceManager::saveGeometryToPreferences(metaObject()->className(), this);
481 
482  // Dock windows
483  QObjectList objectsList = children(); // dockWindows();
484  QWidget* pDockWnd = NULL;
485  QObject* pObject = NULL;
486 
487  for (int _i = 0; _i < objectsList.size(); _i++)
488  {
489  pObject = objectsList[_i];
490  if ((pObject->objectName() == "ProjetDockWnd") || (pObject->objectName() == "SiteDockWnd") ||
491  (pObject->objectName() == "OutputDockWnd") ||
492  (strcmp(pObject->metaObject()->className(), "QToolBar") == 0) ||
493  (dynamic_cast<QToolBar*>(pObject) != nullptr))
494  {
495 
496  pDockWnd = (QWidget*)pObject;
497  QString key = pDockWnd->objectName();
498 
499  // Geometry
500  TYPreferenceManager::saveGeometryToPreferences(key, pDockWnd);
501  }
502  }
503 }
504 
506 
507 bool TYMainWindow::loadSettings(const QString& fileName)
508 {
509  // Only for loading settings
510  bool res = true;
511 
512  statusBar()->showMessage(TR("id_status_load_settings"), 3000);
513 
514  // Save user dir before loading settings from file for the case Settings.xml is copied from
515  // DefaultSettings.xml
516  QString userDir = QDir::toNativeSeparators(getTYApp()->tympanUserDir());
517  // Try to load MainWindowIHM.bin in order to restore Main Window state
518  auto inFile = searchSettingsFile(userDir, fileName, QString("MainWindowIHM.bin"),
519  QString("Settings4.[0-9]MainWindowIHM.bin"));
520  // If a file SettingsMainWindowIHM.bin has been found
521  if (inFile != nullptr && inFile->open(QIODevice::ReadOnly))
522  {
523  QByteArray byteArray = inFile->readAll();
524  if (!byteArray.isEmpty())
525  {
526  restoreState(byteArray);
527  }
528  inFile->close();
529  }
530 
531  // Init Settings.xml file
532  bool isCopiedFromDefaultSettings = false;
533  auto settingsFile =
534  searchSettingsFile(userDir, fileName, QString(".xml"), QString("Settings4.[0-9].xml"));
535 
536  // If initialization succeeds
537  res = res &&
538  TYPreferenceManager::init(fileName + ".xml", isCopiedFromDefaultSettings, std::move(settingsFile));
539  if (res)
540  {
541  // Load settings from file Settings.xml
542  res = res && TYPreferenceManager::read();
543  // If reading succeeded
544  if (res)
545  {
546  // If file is newly created, then we have to init path preferences with specific user path
547  if (isCopiedFromDefaultSettings)
548  {
549  TYPreferenceManager::setString(TYDIRPREFERENCEMANAGER, "WorkDirPath", userDir);
550  QString libraryDir = QDir::toNativeSeparators(userDir + "/library/");
551  TYPreferenceManager::setString(TYDIRPREFERENCEMANAGER, "BiblioPath", libraryDir);
552  }
553 
554  // Apply settings
555  TYPreferenceManager::loadGeometryFromPreferences(metaObject()->className(), this);
556 
557  // Dock windows
558  QObjectList objectsList = children(); // dockWindows();
559  QWidget* pDockWnd = NULL;
560  QObject* pObject = NULL;
561 
562  for (int _i = 0; _i < objectsList.size(); _i++)
563  {
564  pObject = objectsList[_i];
565  if ((pObject->objectName() == "ProjetDockWnd") || (pObject->objectName() == "SiteDockWnd") ||
566  (pObject->objectName() == "OutputDockWnd") ||
567  (strcmp(pObject->metaObject()->className(), "QToolBar") == 0) ||
568  (dynamic_cast<QToolBar*>(pObject) != nullptr))
569  {
570  pDockWnd = (QWidget*)pObject;
571  QString key = pDockWnd->objectName();
572  // Geometry
573  TYPreferenceManager::loadGeometryFromPreferences(key, pDockWnd);
574  }
575  }
576  }
577  }
578 
579  return res;
580 }
581 
582 std::unique_ptr<QFile> TYMainWindow::searchSettingsFile(const QString& TympanUserDir,
583  const QString& fileNameBegin,
584  const QString& fileNameEnd,
585  const QString& fileNamePattern)
586 {
587  // First try to load regular SettingsMainWindowIHM.bin
588  auto regularFile = std::make_unique<QFile>(QString(fileNameBegin) + QString(fileNameEnd));
589  if (regularFile->exists())
590  {
591  qDebug() << "Regular file" << QString(fileNameBegin + fileNameEnd) << "found.";
592  return regularFile;
593  }
594  else
595  // Else try to load the most recent file matching the pattern
596  {
597  qDebug() << "Regular file" << QString(fileNameBegin + fileNameEnd)
598  << "NOT found, searching for oldest files";
599 
600  // Create a QDir object for the specified folder
601  QDir folder(TympanUserDir);
602 
603  // Get a list of files matching the pattern
604  QStringList matchingFiles = folder.entryList(QStringList(fileNamePattern), QDir::Files);
605 
606  // Check if any matching files were found
607  if (!matchingFiles.isEmpty())
608  {
609  qDebug() << "File(s) macthing" << fileNamePattern << "pattern found in the folder.";
610 
611  QString selectedFile; // Variable to store the selected file
612  int maxDigit = -1; // Variable to store the maximum digit value
613 
614  // Iterate through the matching files
615  for (const QString& matchingFile : matchingFiles)
616  {
617  // Extract the digit 'x' from the file name
618  int digit = matchingFile.mid(10, 1).toInt();
619 
620  // Check if the current digit is greater than the maximum digit found so far
621  if (digit > maxDigit)
622  {
623  maxDigit = digit;
624  selectedFile = matchingFile;
625  }
626  }
627 
628  // Print and return the selected file
629  qDebug() << "Selected file: " << selectedFile;
630  return std::make_unique<QFile>(QDir::toNativeSeparators(TympanUserDir + "/" + selectedFile));
631  }
632  else
633  {
634  // Return nullptr if no file is found
635  qDebug() << "No matching files found in the folder.";
636  return nullptr;
637  }
638  }
639 }
640 
641 bool TYMainWindow::saveSettings(const QString& fileName)
642 {
643  bool res = false;
644 
645  QByteArray byteArray = saveState();
646  QFile* outFile = new QFile(QString(fileName) + QString("MainWindowIHM.bin"));
647  if (outFile->open(QIODevice::WriteOnly))
648  {
649  outFile->write(byteArray);
650  outFile->close();
651  }
652 
653  delete outFile;
654 
655  // Sauvegarde des settings
656  QString finalFileName = QString(fileName) + QString(".xml");
657  TYPreferenceManager::setFileName(finalFileName);
658  res = TYPreferenceManager::write();
659 
660  return res;
661 }
662 
664 {
665  _pHelpBrowser->show();
666 }
667 
669 {
670  // Dlg "A propos de Tympan"
671  QMessageBox* pAboutTympan = new QMessageBox(NULL);
672  pAboutTympan->setWindowTitle(windowTitle());
673  QString msg = TR("id_about_msg");
674  msg = msg.arg(TY_PRODUCT_NAME_);
675  msg = msg.arg(TY_CURRENT_RELEASE_);
676  msg = msg.arg(TY_PRODUCT_PLATFORM_);
677  msg = msg.arg(TY_PRODUCT_COPYRIGHT_);
678  msg = msg.arg(TY_BUILD_DATE_);
679  msg = msg.arg(TY_BUILD_TIME_);
680  msg = msg.arg(TY_CUSTOMER_);
681  msg = msg.arg(TY_LICENCE_NUMBER_);
682  msg = msg.arg(TY_TIME_LIMIT_);
683  pAboutTympan->setText(msg);
684  pAboutTympan->setIconPixmap(IMG("id_logo_about"));
685 
686  // Affichage
687  pAboutTympan->exec();
688 
689  // Nettoyage
690  delete pAboutTympan;
691  pAboutTympan = NULL;
692 }
693 
695 {
696  if (!pElt)
697  {
698  return true;
699  }
700 
701  TYProjet* pProj = dynamic_cast<TYProjet*>(pElt);
702  if (pProj != nullptr)
703  {
704  makeProjetModeler(pProj);
705  return true;
706  }
707  else if (pElt->isA("TYSiteNode"))
708  {
709  makeSiteModeler(static_cast<TYSiteNode*>(pElt));
710  return true;
711  }
712  else if (pElt->isA("TYBatiment"))
713  {
714  return (makeBatimentModeler(static_cast<TYBatiment*>(pElt)));
715  }
716  else if (pElt->isA("TYMachine"))
717  {
718  return (makeMachineModeler(static_cast<TYMachine*>(pElt)));
719  }
720  else
721  {
722  return true;
723  }
724 }
725 
727 {
728  bool ret = false;
729  TYBatimentModelerFrame* pBatimentModeler =
730  new TYBatimentModelerFrame(NULL, _pWorkspace, "TYBatimentModelerFrame");
731  pBatimentModeler->setAttribute(Qt::WA_DeleteOnClose);
732  _pWorkspace->addSubWindow(pBatimentModeler)->setObjectName("TYBatimentModelerFrame");
733 
734  QObject::connect(pBatimentModeler, &TYBatimentModelerFrame::editorModeChanged, this,
736  QObject::connect(pBatimentModeler, &TYBatimentModelerFrame::frameResized, this,
738  QObject::connect(pBatimentModeler, &QObject::destroyed, this, &TYMainWindow::onDestroyed);
739 
740  if (!pBatiment)
741  {
742  pBatiment = new TYBatiment();
743  }
744  pBatimentModeler->setBatiment(pBatiment);
745 
746  pBatimentModeler->showMaximized();
747  pBatimentModeler->fit();
748 
749  // Waiting for the "aboutToClose" signal to be emited before moving to the next step
750  QEventLoop loop;
751  connect(pBatimentModeler, &TYBatimentModelerFrame::aboutToClose, &loop, &QEventLoop::quit);
752  loop.exec();
753  // If there is no volume, the modeler maker returns false
754  if (pBatiment->getNbChild() == 0)
755  {
756  ret = false;
757  }
758  else
759  {
760  ret = true;
761  }
762  return ret;
763 }
764 
766 {
767  bool ret = false;
768  TYMachineModelerFrame* pMachineModeler =
769  new TYMachineModelerFrame(NULL, _pWorkspace, "TYMachineModelerFrame");
770  pMachineModeler->setAttribute(Qt::WA_DeleteOnClose);
771 
772  _pWorkspace->addSubWindow(pMachineModeler)->setObjectName("TYMachineModelerFrame");
773 
774  QObject::connect(pMachineModeler, &TYMachineModelerFrame::editorModeChanged, this,
776  QObject::connect(pMachineModeler, &TYMachineModelerFrame::frameResized, this,
778  QObject::connect(pMachineModeler, &QObject::destroyed, this, &TYMainWindow::onDestroyed);
779 
780  if (!pMachine)
781  {
782  pMachine = new TYMachine();
783  }
784  pMachineModeler->setMachine(pMachine);
785 
786  pMachineModeler->showMaximized();
787  pMachineModeler->fit();
788 
789  // Waiting for the "aboutTpClose" signal to be emited before moving to the next step
790  QEventLoop loop;
791  connect(pMachineModeler, &TYMachineModelerFrame::aboutToClose, &loop, &QEventLoop::quit);
792  loop.exec();
793  // If there is no volume, the modeler maker returns false
794  if (pMachine->getNbChild() == 0)
795  {
796  ret = false;
797  }
798  else
799  {
800  ret = true;
801  }
802  return ret;
803 }
804 
806 {
807  TYSiteModelerFrame* pSiteModeler = new TYSiteModelerFrame(pSite, _pWorkspace, "TYSiteModelerFrame");
808  pSiteModeler->setAttribute(Qt::WA_DeleteOnClose);
809 
810  _pWorkspace->addSubWindow(pSiteModeler)->setObjectName("TYSiteModelerFrame");
811 
812  QObject::connect(pSiteModeler, &TYSiteModelerFrame::editorModeChanged, this,
814  QObject::connect(pSiteModeler, &TYSiteModelerFrame::frameResized, this,
816  QObject::connect(pSiteModeler, &QObject::destroyed, this, &TYMainWindow::onDestroyed);
817 
818  pSiteModeler->showMaximized();
819  pSiteModeler->fit();
820 }
821 
823 {
824  TYSiteModelerFrame* pSiteModeler = new TYSiteModelerFrame(pProjet, _pWorkspace, "TYSiteModelerFrame");
825  pSiteModeler->setAttribute(Qt::WA_DeleteOnClose);
826 
827  _pWorkspace->addSubWindow(pSiteModeler)->setObjectName("TYSiteModelerFrame");
828 
829  QObject::connect(pSiteModeler, &TYSiteModelerFrame::editorModeChanged, this,
831  QObject::connect(pSiteModeler, &TYSiteModelerFrame::frameResized, this,
833  QObject::connect(pSiteModeler, &QObject::destroyed, this, &TYMainWindow::onDestroyed);
834 
835  pSiteModeler->showMaximized();
836  pSiteModeler->fit();
837 }
838 
840 {
841  QObject::disconnect(this, &TYMainWindow::onUndo, 0, 0);
842  QObject::disconnect(this, &TYMainWindow::onRedo, 0, 0);
843 
844  if (pActionManager)
845  {
846  QObject::connect(this, &TYMainWindow::onUndo, pActionManager, &TYActionManager::undo);
847  QObject::connect(this, &TYMainWindow::onRedo, pActionManager, &TYActionManager::redo);
848 
849  QObject::connect(pActionManager, &TYActionManager::undoRedoChanged, this,
851  pActionManager->emitUndoRedo();
852  }
853  else
854  {
856  }
857 }
858 
860 {
861  connectActionManager(getTYApp()->getActionManager());
862 }
863 
864 void TYMainWindow::updateModelers(bool clipping /*=true*/, bool axesAndGrid /*=true*/,
865  bool displayList /*=true*/)
866 {
867  QList<QMdiSubWindow*> windows = _pWorkspace->subWindowList();
868 
869  for (int i = 0; i < int(windows.count()); ++i)
870  {
871  QWidget* internal_window = windows.at(i)->widget();
872 
873  TYModelerFrame* pInW = dynamic_cast<TYModelerFrame*>(internal_window);
874  if (pInW != nullptr)
875  {
876  pInW->updateView(clipping, axesAndGrid);
877  if (displayList)
878  {
879  TYRenderWindowInteractor* pView = ((TYModelerFrame*)internal_window)->getView();
880  TYOpenGLRenderer* pOpenGLRenderer = pView->getRenderer();
881 
882  TYModelerFrame* pModelerFrame = dynamic_cast<TYModelerFrame*>(internal_window);
883  if (pModelerFrame != nullptr)
884  {
885  // Update state of keep rays button
886  bool keepRays = false;
888  {
890  }
891  pModelerFrame->setKeepRays(keepRays);
892  }
893  TYSiteModelerFrame* pSiteModelerFrame = dynamic_cast<TYSiteModelerFrame*>(internal_window);
894  if (pSiteModelerFrame != nullptr)
895  {
896  // Enable or disable altimetry button
897  bool enableAltimetrieButton = false;
899  {
900  enableAltimetrieButton = _pSiteFrame->getSiteNodeRoot()->getAltimetry()->isUpToDate();
901  }
902  pSiteModelerFrame->enableAltimetrieButton(enableAltimetrieButton);
903  // If altimetry is not consistent with data then hide it
904  if (!enableAltimetrieButton)
905  {
906  pSiteModelerFrame->showAltimetrie(false);
907  }
908  }
909 
910  pOpenGLRenderer->invalidateScene();
911  ((TYModelerFrame*)internal_window)->updateView(clipping, axesAndGrid);
912  pView->update();
913  }
914  }
915  }
916  if (_pCurrentModeler != nullptr)
917  {
918  _pCurrentModeler->setFocus();
919  }
920 }
921 
922 void TYMainWindow::updateModelersElementGraphic(bool force /* = false */)
923 {
924  QList<QMdiSubWindow*> windows = _pWorkspace->subWindowList();
925 
926  for (int i = 0; i < int(windows.count()); ++i)
927  {
928  QWidget* internal_window = windows.at(i)->widget();
929 
930  TYModelerFrame* pInW = dynamic_cast<TYModelerFrame*>(internal_window);
931  if (pInW != nullptr)
932  {
933  pInW->updateElementGraphic(force);
934  }
935  }
936 }
937 
939 {
940  QList<QMdiSubWindow*> windows = _pWorkspace->subWindowList();
941 
942  for (int i = 0; i < int(windows.count()); ++i)
943  {
944  QWidget* internal_window = windows.at(i)->widget();
945 
946  TYModelerFrame* pInW = dynamic_cast<TYModelerFrame*>(internal_window);
947 
948 #ifdef _DEBUG
949  // For Debug purpose
950  QString windowTitle = internal_window->windowTitle();
951 #endif
952 
953  if (pInW != nullptr)
954  {
955  if (pInW->isActiveWindow())
956  {
957  _pCurrentModeler = pInW;
958  }
959  TYSiteModelerFrame* psiteframe = dynamic_cast<TYSiteModelerFrame*>(internal_window);
960  if (psiteframe != nullptr)
961  {
962  psiteframe->getView()->getRenderer()->clearTabSelectedElement();
963  psiteframe->setProjet(result);
964  psiteframe->getView()->getRenderer()->invalidateScene();
965  psiteframe->updateView();
966  psiteframe->setMaillageRenderModeSlot();
967  }
968  else
969  {
970  TYBatimentModelerFrame* pbatimentframe =
971  dynamic_cast<TYBatimentModelerFrame*>(internal_window);
972  if (pbatimentframe != nullptr)
973  {
974  TYUUID uuid = pbatimentframe->getBatiment()->getID();
975  TYElement* newElement = TYElement::getInstance(uuid);
976  // When batiment modeler is empty, newElement is null
977  if (newElement != nullptr)
978  {
979  pbatimentframe->setBatiment((TYBatiment*)newElement);
980  }
981  }
982  TYMachineModelerFrame* pmachineframe = dynamic_cast<TYMachineModelerFrame*>(internal_window);
983  if (pmachineframe != nullptr)
984  {
985  TYUUID uuid = pmachineframe->getMachine()->getID();
986  TYElement* newElement = TYElement::getInstance(uuid);
987  // When machine modeler is empty, newElement is null
988  if (newElement != nullptr)
989  {
990  pmachineframe->setMachine((TYMachine*)newElement);
991  }
992  }
993  }
994  }
995  }
996  if (_pCurrentModeler != nullptr)
997  {
998  _pCurrentModeler->setFocus();
999  }
1000 }
1001 
1003 {
1004  QList<QMdiSubWindow*> windows = _pWorkspace->subWindowList();
1005 
1006  for (int i = 0; i < int(windows.count()); ++i)
1007  {
1008  QWidget* internal_window = windows.at(i)->widget();
1009  QWidget* container_window = windows.at(i);
1010 
1011  if (dynamic_cast<TYModelerFrame*>(internal_window) != nullptr)
1012  {
1013  if (static_cast<TYModelerFrame*>(internal_window)->getElement() == pElement)
1014  {
1015  // internal_window->close();
1016  container_window->close();
1017  }
1018  }
1019  }
1020 }
1021 
1023 {
1024  QList<QMdiSubWindow*> windows = _pWorkspace->subWindowList();
1025 
1026  for (int i = 0; i < int(windows.count()); ++i)
1027  {
1028  QWidget* container_window = windows.at(i);
1029  container_window->close();
1030  }
1031 }
1032 
1034 {
1036  {
1037  _pProjetFrame->getProjet()->getCurrentCalcul()->edit(this);
1038  }
1039 }
1040 
1042 {
1044 }
1045 
1047 {
1048  _pWindowsMenu->clear();
1049 
1050  QAction* cascadeId =
1051  _pWindowsMenu->addAction(TR("id_menuitem_cascade"), _pWorkspace, &QMdiArea::cascadeSubWindows);
1052  QAction* tileId =
1053  _pWindowsMenu->addAction(TR("id_menuitem_tile"), _pWorkspace, &QMdiArea::tileSubWindows);
1054 
1055  QList<QMdiSubWindow*> windows = _pWorkspace->subWindowList();
1056 
1057  if (windows.isEmpty())
1058  {
1059  cascadeId->setEnabled(false);
1060  tileId->setEnabled(false);
1061  }
1062 
1063  _pWindowsMenu->addSeparator();
1064 
1065  QMenu* viewMenu = createPopupMenu();
1066  viewMenu->setTitle(TR("id_menuitem_views"));
1067  _pWindowsMenu->addMenu(viewMenu);
1068 
1069  _pWindowsMenu->addSeparator();
1070 
1071  for (int i = 0; i < int(windows.count()); ++i)
1072  {
1073  QWidget* internal_window = windows.at(i)->widget();
1074 
1075  if (!internal_window)
1076  {
1077  break;
1078  } // Securite
1079 
1080  QAction* id = _pWindowsMenu->addAction(internal_window->windowTitle(), this,
1082  id->setData(i);
1083  id->setChecked(_pWorkspace->activeSubWindow() == windows.at(i));
1084  }
1085 }
1086 
1088 {
1089  QAction* action = (QAction*)sender();
1090  int id = action->data().toInt();
1091 
1092  QWidget* pWidget = _pWorkspace->subWindowList().at(id)->widget();
1093 
1094  if (pWidget)
1095  {
1096  pWidget->showNormal();
1097  pWidget->setFocus();
1098 
1099  if (QString(pWidget->metaObject()->className()).compare("TYSpectreManager") == 0)
1100  {
1101  _pHideOrShowSpectreMngrAction->setChecked(true);
1102  }
1103  else if (QString(pWidget->metaObject()->className()).compare("TYDataBaseFrame") == 0)
1104  {
1105  _pHideOrShowBiblioAction->setChecked(true);
1106  }
1107  else if (QString(pWidget->metaObject()->className()).compare("TYMaillageManager") == 0)
1108  {
1109  _pHideOrShowMaillageMngrAction->setChecked(true);
1110  }
1111  }
1112 }
1113 
1115 {
1116  if (_pCurrentModeler != NULL)
1117  {
1119  }
1120 }
1121 
1123 {
1124  _pCurrentModeler = nullptr;
1125  QWidget* pW = NULL;
1126  QMdiSubWindow* subWindow = _pWorkspace->activeSubWindow();
1127  if (_pWorkspace->subWindowList().count() > 0 && subWindow)
1128  {
1129  pW = subWindow->widget();
1130  }
1131 
1132  _pPrintAction->setEnabled(false);
1133 
1134  // Toolbars modeler
1136  _pToolbarInfra->activeButtons(false);
1137  _pToolbarTopo->activeButtons(false);
1138  _pSiteBtnGroup->disconnect();
1139 
1141  _pMachineBtnGroup->disconnect();
1142 
1143  _pToolbarFace->activeButtons(false);
1144  _pFaceBtnGroup->disconnect();
1145 
1147  _pBatimentBtnGroup->disconnect();
1148 
1150  _pBatimentBtnGroup->disconnect();
1151 
1152  // TODO Check this work around : it seems we were emptying the BtnGroups here,
1153  // which is a priori doubtful
1154  /*
1155  _pToolbarModeler->removeFromButtonGroup(_pSiteBtnGroup);
1156  _pToolbarModeler->removeFromButtonGroup(_pMachineBtnGroup);
1157  _pToolbarModeler->removeFromButtonGroup(_pFaceBtnGroup);
1158  _pToolbarModeler->removeFromButtonGroup(_pBatimentBtnGroup);
1159  */
1160 
1161  // Disambiguate the overloaded signals
1162  void (QButtonGroup::*qButtonGroup_clicked)(int) = &QButtonGroup::idClicked;
1163  void (TYFaceModelerFrame::*tyFaceModelerFrame_editorModeChanged)(int) =
1165 
1166  connectDefaultActionManager(); // On commence par desactiver tous les boutons
1167 
1168  if (pW == NULL)
1169  {
1171  return;
1172  }
1173 
1174  if (dynamic_cast<TYModelerFrame*>(pW) != nullptr)
1175  {
1176  TYModelerFrame* pModeler = (TYModelerFrame*)pW;
1177  _pCurrentModeler = pModeler;
1178 
1180 
1181  _pPrintAction->setEnabled(true);
1182 
1183  QObject::connect(pModeler, &TYModelerFrame::viewTypeChanged, _pToolbarModeler,
1185 
1186  // On desactive toutes les toolbars...
1188  _pToolbarInfra->activeButtons(false);
1189  _pToolbarTopo->activeButtons(false);
1192  _pToolbarFace->activeButtons(false);
1193  // ...Puis on active celles qui nous sont utiles
1194 
1195  if (QString(pW->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1196  {
1198 
1199  QObject::connect(_pSiteBtnGroup, qButtonGroup_clicked, this, &TYMainWindow::saveCurSiteMode);
1200  QObject::connect(_pSiteBtnGroup, qButtonGroup_clicked, pS, &TYSiteModelerFrame::setEditorMode);
1201 
1202  // On fait en sorte de n'activer la toolbar de calcul que pour le modeler pointant
1203  // sur le site racine ou le projet
1204  bool bActiveCalculToolBar = false;
1205 
1206  // On recupere le site node represente
1207  if (pS->getElement()->isA("TYProjet"))
1208  {
1209  bActiveCalculToolBar = true;
1210  }
1211  else
1212  {
1213  if (TYSiteNode::safeDownCast(pS->getElement())->getRoot())
1214  {
1215  bActiveCalculToolBar = true;
1216  }
1217  }
1218 
1219  // Si le calcul est bloque, on ne peut modifier le projet // DTn 20110915 : Meme comportement
1220  // dans tous les cas
1223  {
1224  _pToolbarCalcul->activeButtons(bActiveCalculToolBar);
1228  }
1229  else
1230  {
1231  _pToolbarCalcul->activeButtons(bActiveCalculToolBar);
1235  }
1236 
1238 
1240  }
1241  else if (QString(pW->metaObject()->className()).compare("TYMachineModelerFrame") == 0)
1242  {
1244 
1245  QObject::connect(_pMachineBtnGroup, qButtonGroup_clicked, this,
1247  QObject::connect(_pMachineBtnGroup, qButtonGroup_clicked, pM,
1249 
1250  // Si le calcul est bloque, on ne peut modifier le projet
1252  TYCalcul::Locked)) // DTn : Neutralisation : 20110915
1253  {
1256  }
1257  else
1258  {
1261  }
1262 
1264 
1266  }
1267  else if (QString(pW->metaObject()->className()).compare("TYBatimentModelerFrame") == 0)
1268  {
1270 
1271  QObject::connect(_pBatimentBtnGroup, qButtonGroup_clicked, this,
1273  QObject::connect(_pBatimentBtnGroup, qButtonGroup_clicked, pB,
1275 
1277  TYCalcul::Locked)) // DTn : Neutralisation : 20110915
1278  {
1279  _pToolbarModeler->activeModif(false);
1281  }
1282  else
1283  {
1286  }
1287 
1289 
1291  }
1292  else if (QString(pW->metaObject()->className()).compare("TYFaceModelerFrame") == 0)
1293  {
1295 
1296  QObject::disconnect(pF, tyFaceModelerFrame_editorModeChanged, this,
1298  QObject::connect(pF, tyFaceModelerFrame_editorModeChanged, this, &TYMainWindow::saveCurFaceMode);
1299 
1300  QObject::connect(_pFaceBtnGroup, qButtonGroup_clicked, this, &TYMainWindow::saveCurFaceMode);
1301  QObject::connect(_pFaceBtnGroup, qButtonGroup_clicked, pF, &TYFaceModelerFrame::setEditorMode);
1302 
1304  TYCalcul::Locked)) // DTn : Neutralisation : 20110915
1305  {
1306  _pToolbarModeler->activeModif(false);
1307  _pToolbarFace->activeButtons(false);
1308  }
1309  else
1310  {
1313  }
1314 
1316 
1318  }
1319 
1321 
1322  pModeler->getView()->getRenderer()->invalidateScene();
1323  }
1324  else
1325  {
1327  _pCurrentModeler = NULL;
1328  }
1329 }
1330 
1332 {
1333  _curSiteMode = mode;
1334  assert(_pSiteBtnGroup->button(mode)); // XXX This is a bug point : mode does not match a button.
1335  _pSiteBtnGroup->button(mode)->setChecked(true);
1336 }
1337 
1339 {
1340  _curMachineMode = mode;
1341  assert(_pMachineBtnGroup->button(mode));
1342  _pMachineBtnGroup->button(mode)->setChecked(true);
1343 }
1344 
1346 {
1347  _curBatimentMode = mode;
1348  assert(_pBatimentBtnGroup->button(mode)); // XXX This is a bug point : mode does not match a button.
1349  _pBatimentBtnGroup->button(mode)->setChecked(true);
1350 }
1351 
1353 {
1354  _curFaceMode = mode;
1355  assert(_pFaceBtnGroup->button(mode));
1356  _pFaceBtnGroup->button(mode)->setChecked(true);
1357 }
1358 
1359 void TYMainWindow::updateUndoRedo(bool undoAvailable, bool redoAvailable, const QString& undoCmd,
1360  const QString& redoCmd)
1361 {
1362  _pUndoAction->setEnabled(undoAvailable);
1363  _pRedoAction->setEnabled(redoAvailable);
1364 
1365  if (!undoCmd.isEmpty())
1366  {
1367  _pUndoAction->setText(TR("id_menuitem_undo_name").arg(undoCmd));
1368  }
1369  else
1370  {
1371  _pUndoAction->setText(TR("id_menuitem_undo_na"));
1372  }
1373 
1374  if (!redoCmd.isEmpty())
1375  {
1376  _pRedoAction->setText(TR("id_menuitem_redo_name").arg(redoCmd));
1377  }
1378  else
1379  {
1380  _pRedoAction->setText(TR("id_menuitem_redo_na"));
1381  }
1382 
1383  _pUndoAction->setToolTip(_pUndoAction->text());
1384  _pRedoAction->setToolTip(_pRedoAction->text());
1385 }
1386 
1388 {
1389  LPTYSiteNode mainSite = this->getProjetFrame()->getProjet()->getSite();
1390  mainSite->getTopographie()->addCrbNiv(courbeNiveau);
1391 }
1392 
1394 {
1395  _pProjetFrame->setProjet(pProjet);
1396 
1397  // if (pProjet) {
1398  // getTYApp()->setCurSiteNode(pProjet->getSite());
1399  //} else {
1400  // getTYApp()->setCurSiteNode(NULL);
1401  //}
1402 
1403  _pCloseAction->setEnabled(pProjet ? true : false);
1404  // updateCurCalcul();
1405 }
1406 
1408 {
1409  _pSiteFrame->setSiteNodeRoot(pSiteNode);
1410  _pCloseAction->setEnabled(pSiteNode ? true : false);
1411 }
1412 
1414 {
1416  {
1417  if (!_pProjetFrame->getProjet()->getStatusSolver()) // Le solveur du calcul n'est pas disponible
1418  {
1419  if (QMessageBox::warning(this, "Tympan", TR("id_msg_solver_out"), QMessageBox::Yes,
1420  QMessageBox::No) == QMessageBox::Yes)
1421  {
1422  // L'utilisateur accepte d'utiliser le solveur par defaut
1424  OGenID(QString(DEFAULT_SOLVER_UUID)));
1426  _pProjetFrame->getProjet()->setStatusSolver(true); // On est ok sur le solveur
1427  }
1428  else
1429  {
1430  // Le calcul est bloque. Si l'utilisateur le debloque, lancer le calcul appelera le solveur
1431  // courant
1433  }
1434  }
1435  }
1436 
1437  _pGoCurCalculAction->setEnabled(true);
1438  _pEditCurCalculAction->setEnabled(true);
1439 }
1440 
1442 {
1443  close(); // Fermeture de l'lement precedemment actif
1444  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1445  pDlg->exec();
1447 }
1448 
1450 {
1451  close(); // Fermeture de l'élément précédemment actif
1452  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1453  pDlg->createElement("TYProjet");
1455 
1456  // Save project
1457  bool ret = saveAs();
1458  if (!ret)
1459  {
1460  qInfo() << "Impossible to save project file to " << getTYApp()->getCurrentFileName();
1461  TYElement::setIsSavedOk(false);
1462  close();
1463  return;
1464  }
1465 
1466  // CLM-NT33 - Ouverture automatique du modeler projet
1467  // DTn 20111003 Plus la peine : ouverture assuree par le openElementDialog appele par le
1468  // createElementDialog
1469  // makeProjetModeler(_pProjetFrame->getProjet());
1470 }
1471 
1473 {
1474  close(); // Fermeture de l'lement precedemment actif
1475 
1476  // Initialize geo provider engine if necessary
1477  if (!TYIGNGeoProvider::getInstance()->isInitialised())
1478  {
1480  }
1481 
1482  // If TYMPAN_MOCK_IGN option is activated
1483 #if MOCK_IGN
1484  bool hasMockSucceeded;
1485  hasMockSucceeded = TYIGNGeoProvider::getInstance()->mockGeoPf();
1486  if (!hasMockSucceeded)
1487  {
1488  qCritical()
1489  << "Mocking IGN Geoplatform resources has failed. Please check mock resources availability.";
1490  }
1491 
1492 #else
1493  // Call the function to open the modal window
1495 #endif
1496 }
1497 
1499 {
1500  OMessageManager::get()->debug(QString("TYMainWindow::createNewGeoProjet"));
1501  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1502  pDlg->createElement("TYProjet");
1503  LPTYSiteNode mainSite = this->getProjetFrame()->getProjet()->getSite();
1504 
1505  // Save project
1506  bool ret = saveAs();
1507  if (!ret)
1508  {
1509  qInfo() << "Impossible to save project file to " << getTYApp()->getCurrentFileName();
1510  TYElement::setIsSavedOk(false);
1511  close();
1512  return;
1513  }
1514 
1515  QFileInfo fileInfo(getTYApp()->getCurrentFileName());
1516  QString imageFilePath = fileInfo.path().replace("\\", "/") + "/" + fileInfo.baseName() + "." + "png";
1517  bool retImageSave = TYIGNGeoProvider::getInstance()->saveImageToFile(imageFilePath);
1518  if (!retImageSave)
1519  {
1520  qInfo() << "Impossible to save image file to " << imageFilePath;
1521  TYElement::setIsSavedOk(false);
1522  close();
1523  return;
1524  }
1525 
1526  mainSite->setUseTopoFile(true);
1527 #if MOCK_IGN
1528  imageFilePath = "C:/projects/tympan/issues/530 - Mock IGN/image.png";
1529  mainSite->setTopoFileName(imageFilePath);
1531 #else
1532  mainSite->setTopoFileName(imageFilePath);
1533 #endif
1534 
1535  // Set current working directory of the application to folder containing background image to ensure
1536  // correct loading of topographic file.
1537  QString dirName = QFileInfo(imageFilePath).absolutePath();
1538  QDir::setCurrent(dirName);
1539 
1540  // Build level curves from geo provider
1541  std::shared_ptr<TYIGNLevelCurvesParser> parser = TYIGNGeoProvider::getInstance()->_parser;
1542  // Build coordinate system to build level curves
1543 
1544  QString coord = TYIGNGeoProvider::getInstance()->getLandtakeCoord().trimmed();
1545  if (coord.isEmpty())
1546  {
1547  qDebug() << "Error getting selected zone coords, aborting project creation";
1548  TYElement::setIsSavedOk(false);
1549  close();
1550  return;
1551  }
1552  QStringList listCoords = coord.split(",");
1553  const int len = listCoords.size();
1554  if (len != 4)
1555  {
1556  qDebug() << "The zone must be a box, aborting project creation";
1557  TYElement::setIsSavedOk(false);
1558  close();
1559  return;
1560  }
1561 
1562  std::vector<double> coordsDouble = TYIGNGeoProvider::getInstance()->coordinatesToDouble(coord);
1563  OBox selectedZone{coordsDouble[0], coordsDouble[1], 0.0, coordsDouble[2], coordsDouble[3], 0.0};
1564  OCoord3D SIGCoords{(selectedZone._min._x + selectedZone._max._x) * 0.5,
1565  (selectedZone._min._y + selectedZone._max._y) * 0.5, 0.0};
1566  // Temporary scale set
1567  QString imageWidthString = TYIGNGeoProvider::getInstance()->getImageWidth();
1568  double imageWidth = imageWidthString.toDouble();
1569  QString scaleFactorString = TYIGNGeoProvider::getInstance()->getScaleFactor();
1570  qInfo() << "scaleFactorString : " << scaleFactorString;
1571  double scaleFactor = scaleFactorString.toDouble();
1572  qInfo() << "scaleFactor : " << scaleFactor;
1573  mainSite->setEchelle(abs(coordsDouble[2] - coordsDouble[0]) * scaleFactor / imageWidth);
1574  connect(parser.get(), &TYIGNLevelCurvesParser::courbeNiveauCreated, this,
1576  TYIGNGeoProvider::getInstance()->buildLevelCurves(SIGCoords, selectedZone, scaleFactor);
1577 
1578  // Landtake creation
1579  std::vector<TYPoint> coords(4);
1580  double demiX = abs(coordsDouble[2] - coordsDouble[0]) * scaleFactor / 2;
1581  double demiY = abs(coordsDouble[3] - coordsDouble[1]) * scaleFactor / 2;
1582  coords[0] = TYPoint(demiX, demiY, 0, false);
1583  coords[1] = TYPoint(demiX, -demiY, 0, false);
1584  coords[2] = TYPoint(-demiX, -demiY, 0, false);
1585  coords[3] = TYPoint(-demiX, demiY, 0, false);
1586  mainSite->setEmprise(coords);
1587  mainSite->setUseEmpriseAsCrbNiv(false);
1588 
1589  mainSite->loadTopoFile();
1590 
1592 
1593  ret = save();
1594  if (!ret)
1595  {
1596  qInfo() << "Impossible to save project file to " << getTYApp()->getCurrentFileName();
1597  TYElement::setIsSavedOk(false);
1598  close();
1599  return;
1600  }
1601 
1602  // Update
1603  getSiteFrame()->updateList();
1604  updateModelers(false, false);
1605 }
1606 
1608 {
1609  close(); // Fermeture de l'lement precedemment actif
1610  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1611  pDlg->createElement("TYSiteNode");
1613 }
1614 
1616 {
1617  close(); // Fermeture de l'lement precedemment actif
1618  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1619  pDlg->createElement("TYBatiment");
1621 }
1622 
1624 {
1625  close(); // Fermeture de l'lement precedemment actif
1626  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1627  pDlg->createElement("TYMachine");
1629 }
1630 
1632 {
1633  close(); // Ferme l'element en cours en demandant la sauvegarde si necessaire
1634  if (!_closeAndQuit) // L'utilisateur ne souhaite pas fermer son projet
1635  {
1636  _closeAndQuit = true;
1637  return;
1638  }
1639 
1640  TYOpenElementDialog* pDlg = new TYOpenElementDialog(this);
1641  pDlg->setMultiSelect(false); // Un seul element peut etre selectionne
1642  pDlg->setDirName(getTYApp()->getCurrentDirName());
1643  pDlg->open();
1644 
1645  if (pDlg->result() == QDialog::Accepted) // si le choix du fichier XML est OK
1646  {
1647  // CLM-NT33 - Choix automatique
1648  if (pDlg->getAvailableElements().size() == 1)
1649  {
1650  pDlg->openElement(pDlg->getAvailableElements()[0]);
1651  }
1652  else
1653  {
1654  pDlg->exec();
1655  }
1656 
1657  TYApplication::setOverrideCursor(Qt::WaitCursor);
1658 
1659  QString strExtend = "";
1660  if (pDlg->isFileReadOnly())
1661  {
1662  strExtend = TR("id_status_file_ro");
1663  _pSaveAction->setEnabled(false); // Desactivation de la fnction de sauvegarde
1664  }
1665 
1666  QString fileName = pDlg->getFileName(); // Nom du fichier lu
1667  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ +
1668  ") : " + fileName + ' ' + strExtend);
1669 
1672 
1673  TYElement::setIsSavedOk(false); // Tous les elements sont up to date apres le chargement
1674 
1675  TYApplication::restoreOverrideCursor();
1676  }
1677 }
1678 
1679 void TYMainWindow::open(std::vector<LPTYElement>& tabElem, const bool& bRegenerate /*=false*/)
1680 {
1681  TYElement::setRegenerateID(bRegenerate);
1682 
1683  TYOpenElementDialog* pDlg = new TYOpenElementDialog(this);
1684  pDlg->setMultiSelect(true); // Plusieurs elements peuvent etre selectionnes
1685  pDlg->setDirName(getTYApp()->getCurrentDirName());
1686  pDlg->open();
1687 
1688  if (pDlg->result() == QDialog::Accepted)
1689  {
1690  if (pDlg->getAvailableElements().size() == 1)
1691  {
1692  tabElem.push_back(pDlg->getAvailableElements()[0]);
1693  }
1694  else
1695  {
1696  pDlg->exec();
1697  tabElem = pDlg->getTabElem();
1698  }
1699  }
1700 
1702 }
1703 
1705 {
1706  if (TYElement::getIsSavedOk() == true) // Si un element a ete modifie, il faut sauvegarder
1707  {
1708  switch (QMessageBox::warning(this, "Attention", TR("id_file_not_saved"), QMessageBox::Yes,
1709  QMessageBox::No))
1710  {
1711  case QMessageBox::Yes:
1712  if (_pSaveAction->isEnabled())
1713  {
1714  _closeAndQuit = save();
1715  }
1716  else
1717  {
1718  _closeAndQuit = saveAs();
1719  }
1720 
1721  break;
1722  case QMessageBox::No:
1723  _closeAndQuit = true;
1724  break;
1725  // case QMessageBox::Cancel:
1726  // _closeAndQuit = false;
1727  // break;
1728  }
1729  }
1730 
1731  if (_closeAndQuit)
1732  {
1733  // Fermeture de toutes les fenetres
1734  QList<QMdiSubWindow*> windows = _pWorkspace->subWindowList();
1735 
1736  for (int i = 0; i < int(windows.count()); ++i)
1737  {
1738  windows.at(i)->close();
1739  }
1740 
1741  // On reinitialise le projet et le site courant
1742  getTYApp()->setCurProjet(NULL);
1743  getTYApp()->setCurSiteNode(NULL);
1744  // Par securite, on inhibe le calcul courant connu du calculManager (pourrait expliquer des plantages
1745  // ...)
1746  getTYApp()->getCalculManager()->setCurrent(NULL);
1747 
1748  // On efface le nom de fichier en cours
1749  QString fileName = "";
1750  updateCurrentFileName(fileName);
1751 
1752  _pSaveAction->setEnabled(true); // Plus de fichier ouvert, remise en etat de save
1753 
1754  // plus rien en memoire (theoriquement) donc rien a sauvegarder
1755  TYElement::setIsSavedOk(false);
1756  }
1757 }
1758 
1760 {
1761  _closeAndQuit = true; // A priori
1762 
1763  // Ferme le projet courant et demande si necessaire la sauvegarde du fichier.
1764  close();
1765 
1766  // Ferme l'application
1767  if (_closeAndQuit)
1768  {
1769  // Sauvegarde la geometrie des fenetres dans les preferences
1771  // Sauvegarde des settings
1772  saveSettings(QDir::toNativeSeparators(getTYApp()->getSettingsDir() + "/Settings"));
1773  // Fermeture de toutes les fenetres
1774  closeModelers();
1775  // Quitte l'application
1776  getTYApp()->quit();
1777  }
1778 }
1779 
1781 {
1782  TYElement* pElement = NULL;
1783 
1784  if (_pProjetFrame->getProjet()) // Si on est dans un projet, on le sauve (avec son site)
1785  {
1786  pElement = (TYElement*)_pProjetFrame->getProjet();
1787  }
1788  else if (_pSiteFrame->getSiteNodeRoot()) // On sauve que le site si pas de projet mais un site
1789  {
1790  pElement = (TYElement*)_pSiteFrame->getSiteNodeRoot();
1791  }
1792  else // Sinon on sauve ce qu'on peut, l'element actif
1793  {
1794  QWidget* pW = this->focusWidget();
1795  if (pW && (dynamic_cast<TYModelerFrame*>(pW) != nullptr))
1796  {
1797  pElement = ((TYModelerFrame*)pW)->getElement();
1798 
1799  if (pElement && (dynamic_cast<TYAcousticVolume*>(pElement) != nullptr))
1800  {
1801  return pElement;
1802  }
1803 
1804  // Recherche d'un parent de type "acousticVolume"
1805  TYElement* pParent = pElement->getParent();
1806  while (pParent && (dynamic_cast<TYAcousticVolumeNode*>(pParent) == nullptr))
1807  {
1808  pParent = pParent->getParent();
1809  };
1810 
1811  if (pParent && (dynamic_cast<TYAcousticVolumeNode*>(pParent) != nullptr))
1812  {
1813  return pParent;
1814  }
1815  }
1816  }
1817 
1818  return pElement;
1819 }
1820 
1822 {
1823  bool bRet = false;
1824 
1825  TYElement* pElement = elementToSave();
1826 
1827  if (!pElement)
1828  {
1829  QMessageBox::warning(this, "Tympan", TR("id_nothingtoexport"));
1830  return false;
1831  }
1832 
1833  QString dirName;
1834  QString fileName = getFileName("XML (*.xml)", dirName); // Recuperation du nom du fichier courant
1835 
1836  bRet = save(dirName, fileName, pElement); // Sauvegarde effective de l'objet
1837 
1838  if (bRet)
1839  {
1840  QMessageBox::information(this, "Tympan", TR("id_export_ok").arg(fileName));
1841  updateCurrentAppFile(dirName, fileName);
1842 
1843  // Indique que les TYElement sont ok (rien a sauvegarder)
1844  TYElement::setIsSavedOk(false);
1845  }
1846  else
1847  {
1848  QMessageBox::warning(this, "Tympan", TR("id_export_failed").arg(fileName));
1849  }
1850 
1851  return bRet;
1852 }
1853 
1854 bool TYMainWindow::save(QString dirName, QString& fileName, TYElement* pElement)
1855 {
1856  // Controle des parametres
1857  if (!pElement || fileName.isEmpty())
1858  {
1859  return false;
1860  }
1861  if (dirName.isEmpty())
1862  {
1863  dirName = getTYApp()->getCurrentDirName();
1864  }
1865 
1866  bool bRet = false;
1867 
1868  formatFileName(fileName); // Ajoute l'extension si necessaire
1869 
1870  // Creation du fichier XML
1871  TYXMLManager xmlManager;
1872 
1873  QString version(TY_CURRENT_RELEASE_);
1874  QString tiret(" - ");
1875  QString licencie(TY_CUSTOMER_);
1876  QString licenceNumber(TY_LICENCE_NUMBER_);
1877 
1878  QString messageVersion = version + tiret + licencie + tiret + licenceNumber;
1880 
1881  xmlManager.createDoc(TY_PRODUCT_XMLTAG_, messageVersion); // TY_PRODUCT_VERSION_);
1882  xmlManager.addElement(pElement);
1883 
1884  if (xmlManager.save(fileName) == 0)
1885  {
1886  return true;
1887  }
1888 
1889  return bRet;
1890 }
1891 
1893 {
1894  bool bRet = false;
1895 
1896  TYElement* pElement = elementToSave();
1897 
1898  if (!pElement)
1899  {
1900  QMessageBox::warning(this, "Tympan", TR("id_nothingtoexport"));
1901  return false;
1902  }
1903 
1904  QString dirName;
1905  QString fileName = getFileName("XML (*.xml)", dirName, true);
1906 
1907  if (testFile(fileName))
1908  {
1909  bRet = save(dirName, fileName, pElement); // On fait la sauvegarde en ecrasant l'ancienne version
1910 
1911  if (bRet)
1912  {
1913  QMessageBox::information(this, "Tympan", TR("id_export_ok").arg(fileName));
1914  updateCurrentAppFile(dirName, fileName);
1915 
1916  // Indique que les TYElement sont ok (rien a sauvegarder)
1917  TYElement::setIsSavedOk(false);
1918  }
1919  else
1920  {
1921  QMessageBox::warning(this, "Tympan", TR("id_export_failed").arg(fileName));
1922  }
1923  }
1924 
1925  return bRet;
1926 }
1927 
1929 {
1930  bool bRet = false;
1931 
1932  TYProjet* pProjet = getTYApp()->getCurProjet();
1933 
1934  if (!pProjet)
1935  {
1936  QMessageBox::warning(this, "Tympan", TR("id_nothingtoexport"));
1937  return false;
1938  }
1939 
1940  QString dirName;
1941  QString fileName = getFileName("XML (*.xml)", dirName, true);
1942 
1943  TYProjet::gSaveValues = false;
1944  if (testFile(fileName))
1945  {
1946  bRet = save(dirName, fileName, pProjet); // On fait la sauvegarde en ecrasant l'ancienne version
1947 
1948  if (bRet)
1949  {
1950  QMessageBox::information(this, "Tympan", TR("id_export_ok").arg(fileName));
1951  }
1952  else
1953  {
1954  QMessageBox::warning(this, "Tympan", TR("id_export_failed").arg(fileName));
1955  }
1956  }
1957 
1958  TYProjet::gSaveValues = true;
1959 
1960  return bRet;
1961 }
1962 
1964 {
1965  bool bRet = false;
1966 
1967  if (pElement == NULL)
1968  {
1969  return bRet;
1970  }
1971 
1972  QString dirName;
1973  QString fileName = getFileName("XML (*.xml)", dirName, true);
1974 
1975  if (testFile(fileName))
1976  {
1977  bRet = save(dirName, fileName, pElement);
1978 
1979  if (bRet)
1980  {
1981  QMessageBox::information(this, "Tympan", TR("id_export_ok").arg(fileName));
1982  }
1983  else
1984  {
1985  QMessageBox::warning(this, "Tympan", TR("id_export_failed").arg(fileName));
1986  }
1987  }
1988 
1989  return bRet;
1990 }
1991 
1992 void TYMainWindow::updateCurrentAppFile(const QString& dirName, const QString& fileName)
1993 {
1994  getTYApp()->setCurrentDirName(dirName);
1995  getTYApp()->setCurrentFileName(fileName);
1996 
1997  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ +
1998  ") : " + fileName);
1999 }
2000 
2001 bool TYMainWindow::backupFile(const QString& fileName)
2002 {
2003  // Creation du nom du fichier
2004  QFileInfo fi(fileName);
2005 
2006  QString nomFichier = fi.absolutePath() + '/' + fi.baseName() + ".bak";
2007 
2008  // Ouverture du fichier d'origine
2009  QFile fileToSave(fileName);
2010  bool bOpen = fileToSave.open(QIODevice::ReadOnly);
2011 
2012  if (!bOpen)
2013  {
2014  return false;
2015  }
2016 
2017  // Ouverture du fichier backup
2018  QFile backupFile(nomFichier);
2019  bOpen = backupFile.open(QIODevice::WriteOnly);
2020 
2021  if (!bOpen)
2022  {
2023  fileToSave.close();
2024  return false;
2025  }
2026 
2027  // Copie en bloc de l'un dans l'autre
2028  backupFile.write(fileToSave.readAll());
2029 
2030  // Fermeture des fichier
2031  fileToSave.close();
2032  backupFile.close();
2033 
2034  return true;
2035 }
2036 
2038 {
2039  TYPluginDialog* pDlg = new TYPluginDialog(this);
2040  pDlg->exec();
2041 
2042  // Mise a jour du solveur pour le calcul courant si calcul pas bloque
2043  if (_pProjetFrame->getProjet())
2046  {
2048  }
2049 }
2050 
2051 bool TYMainWindow::testFile(const QString& fileName)
2052 {
2053  // Verification de l'etat du fichier
2054  QFileInfo fi(fileName);
2055  // Si le fichier existe , on demande confirmation a l'utilisateur
2056  if (fi.exists())
2057  {
2058  // On ecrase le fichier, puis on sauve
2059  QFile* file = new QFile(fileName);
2060  switch (
2061  QMessageBox::warning(this, "Attention", TR("id_file_exist"), QMessageBox::Yes, QMessageBox::No))
2062  {
2063  case QMessageBox::Yes:
2064  if (!file->remove())
2065  {
2066  QMessageBox::warning(this, "Attention", TR("id_file_cannot_be_clear"));
2067  return false;
2068  }
2069 
2070  break;
2071  case QMessageBox::No:
2072  return false; // On sort sans sauvegarder
2073  break;
2074  }
2075 
2076  delete file;
2077  file = NULL;
2078  }
2079 
2080  return true;
2081 }
2082 
2083 QString TYMainWindow::getFileName(const QString& filter, QString& dirName,
2084  const bool& forceNewName /*=false*/)
2085 {
2086  QString fileName = getTYApp()->getCurrentFileName(); // Recuperation du nom du fichier courant
2087  // NOUVELLE VERSION POUR RECUPERER LE REPERTOIRE
2088  dirName = getTYApp()->getCurrentDirName();
2089 
2090  if (!forceNewName && !fileName.isEmpty())
2091  {
2092  return fileName;
2093  }
2094 
2095  // Recuperation de la terminaison de fichier a creer
2096  short index = filter.indexOf(".");
2097  QString end = filter.mid(index, 4);
2098 
2099  QFileDialog* pDialog = new QFileDialog(parentWidget(), "Choose a file", dirName, filter);
2100  pDialog->setFileMode(QFileDialog::AnyFile);
2101  pDialog->setAcceptMode(QFileDialog::AcceptSave);
2102  pDialog->setWindowModality(Qt::WindowModal); // Set window modality
2103  pDialog->exec();
2104 
2105  QStringList list = pDialog->selectedFiles();
2106  if ((pDialog->result() == QDialog::Accepted) && (!list.isEmpty()))
2107  {
2108  fileName = list.first();
2109 
2110  QDir dir = pDialog->directory();
2111  dirName = dir.absolutePath();
2112 
2113  pDialog = NULL;
2114 
2115  if (!fileName.endsWith(end))
2116  {
2117  fileName += end;
2118  }
2119  }
2120  else
2121  {
2122  fileName = "";
2123  }
2124 
2125  return fileName;
2126 }
2127 
2129 {
2130  QWidget* pW = this->focusWidget();
2131 
2132  if (pW && (dynamic_cast<TYModelerFrame*>(pW) != nullptr))
2133  {
2134  ((TYModelerFrame*)pW)->print();
2135  }
2136 }
2137 
2139 {
2140  emit onUndo();
2141 }
2142 
2144 {
2145  emit onRedo();
2146 }
2147 
2149 {
2150  about();
2151 }
2152 
2154 {
2155  about();
2156 }
2157 
2159 {
2160  about();
2161 }
2162 
2164 
2166 
2167 void TYMainWindow::showBiblio(bool show) {}
2168 
2170 {
2171  TYPreferenceDialog* pDlg = new TYPreferenceDialog(this);
2172  pDlg->exec();
2173 }
2174 
2176 {
2177  _pOutputDockWnd->setVisible(show);
2178 }
2179 
2181 {
2182  _pHideOrShowOutputAction->setChecked(_pOutputDockWnd->isVisible());
2183 }
2184 
2186 {
2187  QProcess* pImporterLauncher = new QProcess(this);
2188 
2189  // On travail dans le repertoire utilisateur
2190  pImporterLauncher->setWorkingDirectory(TYApplication::tympanUserDir());
2191 
2192  // Le nom de l'executable
2193  // pImporterLauncher->addArgument("Importer");
2194 
2195  // Lancement
2196  pImporterLauncher->start("Importer", QStringList(""));
2197 
2198  if (pImporterLauncher->state() == QProcess::Running)
2199  {
2200  writeOutputMsg(TR("id_msg_importer_ok"));
2201  }
2202  else
2203  {
2204  writeOutputMsg(TR("id_msg_importer_fail"));
2205  }
2206 }
2207 
2208 void TYMainWindow::closeEvent(QCloseEvent* pEvent)
2209 {
2210  // Sauvegarde la geometrie des fenetres dans les preferences
2212 
2213  // Sauvegarde des settings
2214  saveSettings(QDir::toNativeSeparators(getTYApp()->getSettingsDir() + "/Settings"));
2215 }
2216 
2217 void TYMainWindow::updateCurrentFileName(const QString& fileName)
2218 {
2219  // Informe l'application du nom du fichier courant
2221 
2222  // Change le titre de la fenetre pour afficher le nom du fichier
2223  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ +
2224  ") : " + fileName);
2225 }
2226 
2227 // CLM-NT33 : Raffraichissement du nom de fichier en vue modeleur
2229 {
2230  // Change le titre de la fenetre pour afficher le nom du fichier
2231  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ +
2233 }
2234 
2235 // CLM-NT33 : Fin
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)
Barre d'outils Batiment (fichier header)
Barre d'outil calcul (fichier header)
Boite de dialogue pour la creation d'un nouvel element metier. L'element cree peut etre sauvegarde en...
Definit un popup menu, necessaire pour maitriser l'ouverture automtique apres un createPopupMenu (fic...
class OGenID TYUUID
Definition: TYDefines.h:59
#define TYDIRPREFERENCEMANAGER
Definition: TYElement.h:51
Classe Modeler specialisee pour l'edition des faces (fichier header)
Barre d'outils Face (fichier header)
Barre d'outil infastructure (fichier header)
Modeler specialisee pour l'edition des machines (fichier header)
Barre d'outils Machine (fichier header)
#define IMG(id)
#define TR(id)
Fenetre principale de l'application Tympan (fichier header)
Classe generique pour une fenetre de modeleur (fichier header)
Barre d'outils generale pour les modelers (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)
outil IHM pour un spectre (fichier header)
Barre d'outils topographie (fichier header)
The box class.
Definition: 3d.h:1346
The 3D coordinate class.
Definition: 3d.h:226
Definition: idgen.h:28
virtual void debug(const char *message,...)
Definition: logging.cpp:151
static OMessageManager * get()
Definition: logging.cpp:108
static OPrototype * safeDownCast(OPrototype *pObject)
Definition: TYElement.cpp:71
bool isA(const char *className) const
Definition: TYElement.cpp:65
Gere les undos.
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.
bool isUpToDate() const
Definition: TYAltimetrie.h:176
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.
Definition: TYApplication.h:99
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.
virtual void setEditorMode(int mode)
Barre d'outils Batiment.
void activeButtons(bool active)
Active/Desactive chaque boutons.
bool launchCurrent()
Execute le calcul courant.
void setCurrent(LPTYCalcul pCalcul)
Set du Calcul et Projet courant.
Barre d'outil calcul.
void activeButtons(bool active)
Active/Desactive chaque boutons.
int getState()
Get calculation state.
Definition: TYCalcul.h:416
@ Locked
Definition: TYCalcul.h:62
@ Actif
Definition: TYCalcul.h:63
void setSolverId(const OGenID &iD)
Set solver ID.
Definition: TYCalcul.h:455
void setState(int state)
Set editable attribute.
Definition: TYCalcul.h:406
bool getKeepRays() const
Returns if computation contains rays or not \ returns true if computation contains rays else returns ...
Definition: TYCalcul.cpp:1301
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.
Definit un popup menu, necessaire pour maitriser l'ouverture automtique apres un createPopupMenu.
TYElement * getParent() const
Definition: TYElement.h:697
static void setLogInstances(bool log)
Definition: TYElement.h:822
static void setIsSavedOk(const bool &toSave)
Definition: TYElement.h:905
const TYUUID & getID() const
Definition: TYElement.cpp:176
static void setRegenerateID(const bool &bRegenerate)
Definition: TYElement.h:913
static bool getIsSavedOk()
Definition: TYElement.h:897
static TYElement * getInstance(TYUUID uuid)
Definition: TYElement.cpp:158
Classe Modeler specialisee pour l'edition des faces.
virtual void setEditorMode(int mode)
Barre d'outils Face.
Definition: TYFaceToolbar.h:41
void activeButtons(bool active)
Active/Desactive chaque boutons.
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)
Barre d'outil infastructure.
void activeButtons(bool active)
Classe Modeler specialisee pour l'edition des machines.
void setMachine(LPTYMachine pMachine)
virtual void setEditorMode(int mode)
Barre d'outils Machine.
void activeButtons(bool active)
Main window of the Tympan application.
Definition: TYMainWindow.h:50
void onDestroyed()
Definition: TYMainWindow.h:457
void updateModelersAfterComputation(LPTYProjet &result)
void updateHideOrShowOutputAction(bool visibilityChanged)
QDockWidget * _pOutputDockWnd
Dockable window for feedback messages.
Definition: TYMainWindow.h:608
TYProjetFrame * _pProjetFrame
Frame for project management.
Definition: TYMainWindow.h:596
virtual ~TYMainWindow()
void editCurCalcul()
TYInfraToolbar * _pToolbarInfra
Infrastructure toolbar.
Definition: TYMainWindow.h:570
TYElement * elementToSave()
void updateCurrentAppFile(const QString &dirName, const QString &fileName)
TYFaceToolbar * _pToolbarFace
Face toolbar.
Definition: TYMainWindow.h:586
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.
Definition: TYMainWindow.h:589
void createNewBatiment()
QAction * _pOpenAction
Action to open the library manager.
Definition: TYMainWindow.h:498
QDockWidget * _pSiteDockWnd
Dockable window for site management.
Definition: TYMainWindow.h:603
void updateCurrentFileName(const QString &fileName)
void createNewSite()
void saveCurBatimentMode(int mode)
TYSiteFrame * _pSiteFrame
Frame for site management.
Definition: TYMainWindow.h:601
void saveCurFaceMode(int mode)
TYTopoToolbar * _pToolbarTopo
Topography toolbar.
Definition: TYMainWindow.h:568
void setCurSiteNode(LPTYSiteNode pSiteNode)
QAction * _pCreateNewAction
Action to create a new element.
Definition: TYMainWindow.h:496
void onCourbeNiveauCreated(LPTYCourbeNiveau courbeNiveau)
bool loadSettings(const QString &fileName)
void makeSiteModeler(LPTYSiteNode pSite=NULL)
bool _closeAndQuit
Indicator for canceling the exit command.
Definition: TYMainWindow.h:625
TYCalculToolbar * _pToolbarCalcul
Calculation toolbar.
Definition: TYMainWindow.h:572
void formatFileName(QString &fileName)
Definition: TYMainWindow.h:204
bool backupFile(const QString &fileName)
QAction * _pSaveAsAction
Action to save an element with a specific name.
Definition: TYMainWindow.h:506
void updateUndoRedo(bool undoAvailable, bool redoAvailable, const QString &undoCmd, const QString &redoCmd)
void createNewProjet()
bool makeBatimentModeler(LPTYBatiment pBatiment=NULL)
QAction * _pUndoAction
Action to perform an undo.
Definition: TYMainWindow.h:526
int _curSiteMode
Preserves the current mode of SiteModeler windows.
Definition: TYMainWindow.h:566
QAction * _pPrintAction
Action to print.
Definition: TYMainWindow.h:523
QAction * _pRedoAction
Action to perform a redo.
Definition: TYMainWindow.h:528
void windowsMenuActivated()
QButtonGroup * _pFaceBtnGroup
Button group for face toolbar.
Definition: TYMainWindow.h:582
void showPluginManager()
QAction * _pSaveAction
Action to save an element.
Definition: TYMainWindow.h:503
QAction * _pHideOrShowOutputAction
Shows or hides the output messages window.
Definition: TYMainWindow.h:544
QMdiArea * _pWorkspace
Workspace for MDI management.
Definition: TYMainWindow.h:488
TYProjetFrame * getProjetFrame()
Definition: TYMainWindow.h:73
QAction * _pPasteAction
Action to perform a paste.
Definition: TYMainWindow.h:535
bool makeModeler(TYElement *pElt)
void reloadSlots()
void saveCurMachineMode(int mode)
QAction * _pCloseAction
Action to close the current project or site.
Definition: TYMainWindow.h:500
void createNewGeoProjet()
QButtonGroup * _pMachineBtnGroup
Button group for machine toolbar.
Definition: TYMainWindow.h:575
void closeModelers()
void updateModelers(bool clipping=true, bool axesAndGrid=true, bool displayList=true)
void connectActionManager(TYActionManager *pActionManager)
TYSiteFrame * getSiteFrame()
Definition: TYMainWindow.h:77
TYModelerToolbar * _pToolbarModeler
General toolbar for modelers.
Definition: TYMainWindow.h:561
void showBiblio(bool show)
QAction * _pHideOrShowSpectreMngrAction
Shows or hides the Spectrum Manager.
Definition: TYMainWindow.h:538
int _curFaceMode
Preserves the current mode of FaceModeler windows.
Definition: TYMainWindow.h:584
TYMachineToolbar * _pToolbarMachine
Machine toolbar.
Definition: TYMainWindow.h:579
void createNewMachine()
QMenu * _pWindowsMenu
Spectra manager.
Definition: TYMainWindow.h:619
void refreshWindowTitle()
void showPreferenceDialog()
QAction * _pHideOrShowMaillageMngrAction
Shows or hides the Mesh Manager.
Definition: TYMainWindow.h:540
void showZoneSelectPage()
void makeProjetModeler(LPTYProjet pProjet=NULL)
virtual void closeEvent(QCloseEvent *pEvent)
void launchImporter()
void showMaillageManager(bool show)
bool saveSettings(const QString &fileName)
TYModelerFrame * _pCurrentModeler
Currently displayed modeler.
Definition: TYMainWindow.h:493
void connectDefaultActionManager()
QOpenGLWidget * _pDummyQOpenGLWidget
Definition: TYMainWindow.h:629
QAction * _pGoCurCalculAction
Action to start the current calculation.
Definition: TYMainWindow.h:549
void updateModelersElementGraphic(bool force=false)
QToolBar * _pCalculAcousticToolbar
Toolbar for acoustic calculations.
Definition: TYMainWindow.h:558
QAction * _pCutAction
Action to perform a cut.
Definition: TYMainWindow.h:531
bool makeMachineModeler(LPTYMachine pMachine=NULL)
QAction * _pEditCurCalculAction
Action to edit the preferences of the current calculation.
Definition: TYMainWindow.h:547
void setCurProjet(LPTYProjet pProjet)
QAction * _pSaveAsNoResultAction
Action to save an element with a specific name without calculation results.
Definition: TYMainWindow.h:509
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.
Definition: TYMainWindow.h:622
void saveGeometryToPreferences()
save geometry of windows to preferences
int _curMachineMode
Preserves the current mode of MachineModeler windows.
Definition: TYMainWindow.h:577
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.
Definition: TYMainWindow.h:555
TYOutputFrame * _pOutputFrame
Frame for feedback messages.
Definition: TYMainWindow.h:606
void saveCurSiteMode(int mode)
bool saveAsNoResult()
void closeModeler(const TYElement *pElement)
QButtonGroup * _pSiteBtnGroup
Button group for site toolbars.
Definition: TYMainWindow.h:564
QAction * _pCopyAction
Action to perform a copy.
Definition: TYMainWindow.h:533
QToolBar * _pMainToolbar
Main toolbar.
Definition: TYMainWindow.h:552
QAction * _pShowPluginManagerAction
Action to display the plug-in manager.
Definition: TYMainWindow.h:512
TYBatimentToolbar * _pToolbarBatiment
Building toolbar.
Definition: TYMainWindow.h:593
void subWindowActivated()
int _curBatimentMode
Preserves the current mode of BatimentModeler windows.
Definition: TYMainWindow.h:591
QDockWidget * _pProjetDockWnd
Dockable window for project management.
Definition: TYMainWindow.h:598
void showSpectreManager(bool show)
QAction * _pHideOrShowBiblioAction
Shows or hides the Library of elements.
Definition: TYMainWindow.h:542
void setDefaultCameraMode()
void updateCurCalcul()
Generic class for a modeler window.
void updateElementGraphic(bool force=false)
LPTYElement getElement()
TYRenderWindowInteractor * getView()
void setEditorModeToCamera()
void setKeepRays(bool keepRays)
void editorModeChanged(int mode)
void viewTypeChanged(int)
void aboutToClose()
TYActionManager * getActionManager()
void frameResized()
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
Barre d'outils generale pour les modelers.
void viewTypeChanged(int view)
void activeCameraButtons(int view)
void addToButtonGroup(QButtonGroup *pBtnGroup)
void activeButtons(bool active)
void activeModif(bool active)
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)
Frame pour les messages de retour.
Definition: TYOutputFrame.h:40
classe graphique pour la gestion de la table de correspondanceindice/element pour le picking
Boite de dialogue pour la selection du plugin de calcul.
OGenID current_solver
Boite de dialogue pour la gestion des preferences.
Frame pour la gestion de projet.
Definition: TYProjetFrame.h:41
LPTYProjet getProjet()
Definition: TYProjetFrame.h:57
void changeSite(LPTYSiteNode pSite)
void setProjet(LPTYProjet pProjet)
void changeCurrentCalcul(LPTYCalcul pCalcul)
classe de definition d'un projet.
Definition: TYProjet.h:45
void setStatusSolver(const bool &bStatus)
Definition: TYProjet.h:574
bool getStatusSolver()
Get/Set du statut de disponibilite du solveur du calcul courant.
Definition: TYProjet.h:566
LPTYSiteNode getSite()
Get du site.
Definition: TYProjet.h:169
LPTYCalcul getCurrentCalcul()
Set/Get du pointeur du Calcul courant.
Definition: TYProjet.h:426
static bool gSaveValues
Definition: TYProjet.h:609
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.
Definition: TYSiteFrame.h:40
void updateList()
TYSiteNode * getSiteNodeRoot()
Definition: TYSiteFrame.h:56
void setSiteNodeRoot(LPTYSiteNode pSiteNode)
Definition: TYSiteFrame.cpp:91
void setCurrentCalcul(LPTYCalcul pCalcul)
Definition: TYSiteFrame.h:148
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()
Definition: TYSiteNode.h:149
void setEmprise(TYTabPoint points)
Definition: TYSiteNode.h:362
void setEchelle(float e)
Definition: TYSiteNode.h:288
void setTopoFileName(const QString &name)
Definition: TYSiteNode.h:248
void setUseEmpriseAsCrbNiv(bool b)
Definition: TYSiteNode.h:130
void loadTopoFile(const QString &fileName)
Definition: TYSiteNode.cpp:577
void setUseTopoFile(bool flag)
Definition: TYSiteNode.h:205
Barre d'outils topographie.
Definition: TYTopoToolbar.h:35
void activeButtons(bool active)
bool addCrbNiv(LPTYCourbeNiveauGeoNode pCrbNivGeoNode)
int save(QString fileName)
void createDoc(QString docName, QString version)
int addElement(TYElement *pElt)
static void setSavedFileName(QString savedFileName)
Definition: TYXMLManager.h:131
#define TY_PRODUCT_PLATFORM_
Definition: defines.h:67