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 =
1517  fileInfo.path().replace("\\", "/") + "/" + fileInfo.completeBaseName() + "." + "png";
1518  bool retImageSave = TYIGNGeoProvider::getInstance()->saveImageToFile(imageFilePath);
1519  if (!retImageSave)
1520  {
1521  qInfo() << "Impossible to save image file to " << imageFilePath;
1522  TYElement::setIsSavedOk(false);
1523  close();
1524  return;
1525  }
1526 
1527  mainSite->setUseTopoFile(true);
1528 #if MOCK_IGN
1529  imageFilePath = "C:/projects/tympan/issues/530 - Mock IGN/image.png";
1530  mainSite->setTopoFileName(imageFilePath);
1532 #else
1533  mainSite->setTopoFileName(imageFilePath);
1534 #endif
1535 
1536  // Set current working directory of the application to folder containing background image to ensure
1537  // correct loading of topographic file.
1538  QString dirName = QFileInfo(imageFilePath).absolutePath();
1539  QDir::setCurrent(dirName);
1540 
1541  // Build level curves from geo provider
1542  std::shared_ptr<TYIGNLevelCurvesParser> parser = TYIGNGeoProvider::getInstance()->_parser;
1543  // Build coordinate system to build level curves
1544 
1545  QString coord = TYIGNGeoProvider::getInstance()->getLandtakeCoord().trimmed();
1546  if (coord.isEmpty())
1547  {
1548  qDebug() << "Error getting selected zone coords, aborting project creation";
1549  TYElement::setIsSavedOk(false);
1550  close();
1551  return;
1552  }
1553  QStringList listCoords = coord.split(",");
1554  const int len = listCoords.size();
1555  if (len != 4)
1556  {
1557  qDebug() << "The zone must be a box, aborting project creation";
1558  TYElement::setIsSavedOk(false);
1559  close();
1560  return;
1561  }
1562 
1563  std::vector<double> coordsDouble = TYIGNGeoProvider::getInstance()->coordinatesToDouble(coord);
1564  OBox selectedZone{coordsDouble[0], coordsDouble[1], 0.0, coordsDouble[2], coordsDouble[3], 0.0};
1565  OCoord3D SIGCoords{(selectedZone._min._x + selectedZone._max._x) * 0.5,
1566  (selectedZone._min._y + selectedZone._max._y) * 0.5, 0.0};
1567  // Temporary scale set
1568  QString imageWidthString = TYIGNGeoProvider::getInstance()->getImageWidth();
1569  double imageWidth = imageWidthString.toDouble();
1570  QString scaleFactorString = TYIGNGeoProvider::getInstance()->getScaleFactor();
1571  qInfo() << "scaleFactorString : " << scaleFactorString;
1572  double scaleFactor = scaleFactorString.toDouble();
1573  qInfo() << "scaleFactor : " << scaleFactor;
1574  mainSite->setEchelle(abs(coordsDouble[2] - coordsDouble[0]) * scaleFactor / imageWidth);
1575  connect(parser.get(), &TYIGNLevelCurvesParser::courbeNiveauCreated, this,
1577  TYIGNGeoProvider::getInstance()->buildLevelCurves(SIGCoords, selectedZone, scaleFactor);
1578 
1579  // Landtake creation
1580  std::vector<TYPoint> coords(4);
1581  double demiX = abs(coordsDouble[2] - coordsDouble[0]) * scaleFactor / 2;
1582  double demiY = abs(coordsDouble[3] - coordsDouble[1]) * scaleFactor / 2;
1583  coords[0] = TYPoint(demiX, demiY, 0, false);
1584  coords[1] = TYPoint(demiX, -demiY, 0, false);
1585  coords[2] = TYPoint(-demiX, -demiY, 0, false);
1586  coords[3] = TYPoint(-demiX, demiY, 0, false);
1587  mainSite->setEmprise(coords);
1588  mainSite->setUseEmpriseAsCrbNiv(false);
1589 
1590  mainSite->loadTopoFile();
1591 
1593 
1594  ret = save();
1595  if (!ret)
1596  {
1597  qInfo() << "Impossible to save project file to " << getTYApp()->getCurrentFileName();
1598  TYElement::setIsSavedOk(false);
1599  close();
1600  return;
1601  }
1602 
1603  // Update
1604  getSiteFrame()->updateList();
1605  updateModelers(false, false);
1606 }
1607 
1609 {
1610  close(); // Fermeture de l'lement precedemment actif
1611  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1612  pDlg->createElement("TYSiteNode");
1614 }
1615 
1617 {
1618  close(); // Fermeture de l'lement precedemment actif
1619  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1620  pDlg->createElement("TYBatiment");
1622 }
1623 
1625 {
1626  close(); // Fermeture de l'lement precedemment actif
1627  TYCreateElementDialog* pDlg = new TYCreateElementDialog(this);
1628  pDlg->createElement("TYMachine");
1630 }
1631 
1633 {
1634  close(); // Ferme l'element en cours en demandant la sauvegarde si necessaire
1635  if (!_closeAndQuit) // L'utilisateur ne souhaite pas fermer son projet
1636  {
1637  _closeAndQuit = true;
1638  return;
1639  }
1640 
1641  TYOpenElementDialog* pDlg = new TYOpenElementDialog(this);
1642  pDlg->setMultiSelect(false); // Un seul element peut etre selectionne
1643  pDlg->setDirName(getTYApp()->getCurrentDirName());
1644  pDlg->open();
1645 
1646  if (pDlg->result() == QDialog::Accepted) // si le choix du fichier XML est OK
1647  {
1648  // CLM-NT33 - Choix automatique
1649  if (pDlg->getAvailableElements().size() == 1)
1650  {
1651  pDlg->openElement(pDlg->getAvailableElements()[0]);
1652  }
1653  else
1654  {
1655  pDlg->exec();
1656  }
1657 
1658  TYApplication::setOverrideCursor(Qt::WaitCursor);
1659 
1660  QString strExtend = "";
1661  if (pDlg->isFileReadOnly())
1662  {
1663  strExtend = TR("id_status_file_ro");
1664  _pSaveAction->setEnabled(false); // Desactivation de la fnction de sauvegarde
1665  }
1666 
1667  QString fileName = pDlg->getFileName(); // Nom du fichier lu
1668  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ +
1669  ") : " + fileName + ' ' + strExtend);
1670 
1673 
1674  TYElement::setIsSavedOk(false); // Tous les elements sont up to date apres le chargement
1675 
1676  TYApplication::restoreOverrideCursor();
1677  }
1678 }
1679 
1680 void TYMainWindow::open(std::vector<LPTYElement>& tabElem, const bool& bRegenerate /*=false*/)
1681 {
1682  TYElement::setRegenerateID(bRegenerate);
1683 
1684  TYOpenElementDialog* pDlg = new TYOpenElementDialog(this);
1685  pDlg->setMultiSelect(true); // Plusieurs elements peuvent etre selectionnes
1686  pDlg->setDirName(getTYApp()->getCurrentDirName());
1687  pDlg->open();
1688 
1689  if (pDlg->result() == QDialog::Accepted)
1690  {
1691  if (pDlg->getAvailableElements().size() == 1)
1692  {
1693  tabElem.push_back(pDlg->getAvailableElements()[0]);
1694  }
1695  else
1696  {
1697  pDlg->exec();
1698  tabElem = pDlg->getTabElem();
1699  }
1700  }
1701 
1703 }
1704 
1706 {
1707  if (TYElement::getIsSavedOk() == true) // Si un element a ete modifie, il faut sauvegarder
1708  {
1709  auto ret = QMessageBox::warning(this, "Attention", TR("id_file_not_saved"),
1710  QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
1711  QMessageBox::Cancel);
1712  switch (ret)
1713  {
1714  case QMessageBox::Yes:
1715  if (_pSaveAction->isEnabled())
1716  {
1717  _closeAndQuit = save();
1718  }
1719  else
1720  {
1721  _closeAndQuit = saveAs();
1722  }
1723 
1724  break;
1725 
1726  case QMessageBox::No:
1727  _closeAndQuit = true;
1728  break;
1729 
1730  case QMessageBox::Cancel:
1731  _closeAndQuit = false;
1732  break;
1733  }
1734  }
1735 
1736  if (_closeAndQuit)
1737  {
1738  // Fermeture de toutes les fenetres
1739  QList<QMdiSubWindow*> windows = _pWorkspace->subWindowList();
1740 
1741  for (int i = 0; i < int(windows.count()); ++i)
1742  {
1743  windows.at(i)->close();
1744  }
1745 
1746  // On reinitialise le projet et le site courant
1747  getTYApp()->setCurProjet(NULL);
1748  getTYApp()->setCurSiteNode(NULL);
1749  // Par securite, on inhibe le calcul courant connu du calculManager (pourrait expliquer des plantages
1750  // ...)
1751  getTYApp()->getCalculManager()->setCurrent(NULL);
1752 
1753  // On efface le nom de fichier en cours
1754  QString fileName = "";
1755  updateCurrentFileName(fileName);
1756 
1757  _pSaveAction->setEnabled(true); // Plus de fichier ouvert, remise en etat de save
1758 
1759  // plus rien en memoire (theoriquement) donc rien a sauvegarder
1760  TYElement::setIsSavedOk(false);
1761  }
1762 }
1763 
1765 {
1766  _closeAndQuit = true; // A priori
1767 
1768  // Ferme le projet courant et demande si necessaire la sauvegarde du fichier.
1769  close();
1770 
1771  // Ferme l'application
1772  if (_closeAndQuit)
1773  {
1774  // Sauvegarde la geometrie des fenetres dans les preferences
1776  // Sauvegarde des settings
1777  saveSettings(QDir::toNativeSeparators(getTYApp()->getSettingsDir() + "/Settings"));
1778  // Fermeture de toutes les fenetres
1779  closeModelers();
1780  // Quitte l'application
1781  getTYApp()->quit();
1782  }
1783 }
1784 
1786 {
1787  TYElement* pElement = NULL;
1788 
1789  if (_pProjetFrame->getProjet()) // Si on est dans un projet, on le sauve (avec son site)
1790  {
1791  pElement = (TYElement*)_pProjetFrame->getProjet();
1792  }
1793  else if (_pSiteFrame->getSiteNodeRoot()) // On sauve que le site si pas de projet mais un site
1794  {
1795  pElement = (TYElement*)_pSiteFrame->getSiteNodeRoot();
1796  }
1797  else // Sinon on sauve ce qu'on peut, l'element actif
1798  {
1799  QWidget* pW = this->focusWidget();
1800  if (pW && (dynamic_cast<TYModelerFrame*>(pW) != nullptr))
1801  {
1802  pElement = ((TYModelerFrame*)pW)->getElement();
1803 
1804  if (pElement && (dynamic_cast<TYAcousticVolume*>(pElement) != nullptr))
1805  {
1806  return pElement;
1807  }
1808 
1809  // Recherche d'un parent de type "acousticVolume"
1810  TYElement* pParent = pElement->getParent();
1811  while (pParent && (dynamic_cast<TYAcousticVolumeNode*>(pParent) == nullptr))
1812  {
1813  pParent = pParent->getParent();
1814  };
1815 
1816  if (pParent && (dynamic_cast<TYAcousticVolumeNode*>(pParent) != nullptr))
1817  {
1818  return pParent;
1819  }
1820  }
1821  }
1822 
1823  return pElement;
1824 }
1825 
1827 {
1828  bool bRet = false;
1829 
1830  TYElement* pElement = elementToSave();
1831 
1832  if (!pElement)
1833  {
1834  QMessageBox::warning(this, "Tympan", TR("id_nothingtoexport"));
1835  return false;
1836  }
1837 
1838  QString dirName;
1839  QString fileName = getFileName("XML (*.xml)", dirName); // Recuperation du nom du fichier courant
1840 
1841  bRet = save(dirName, fileName, pElement); // Sauvegarde effective de l'objet
1842 
1843  if (bRet)
1844  {
1845  QMessageBox::information(this, "Tympan", TR("id_export_ok").arg(fileName));
1846  updateCurrentAppFile(dirName, fileName);
1847 
1848  // Indique que les TYElement sont ok (rien a sauvegarder)
1849  TYElement::setIsSavedOk(false);
1850  }
1851  else
1852  {
1853  QMessageBox::warning(this, "Tympan", TR("id_export_failed").arg(fileName));
1854  }
1855 
1856  return bRet;
1857 }
1858 
1859 bool TYMainWindow::save(QString dirName, QString& fileName, TYElement* pElement)
1860 {
1861  // Controle des parametres
1862  if (!pElement || fileName.isEmpty())
1863  {
1864  return false;
1865  }
1866  if (dirName.isEmpty())
1867  {
1868  dirName = getTYApp()->getCurrentDirName();
1869  }
1870 
1871  bool bRet = false;
1872 
1873  formatFileName(fileName); // Ajoute l'extension si necessaire
1874 
1875  // Creation du fichier XML
1876  TYXMLManager xmlManager;
1877 
1878  QString version(TY_CURRENT_RELEASE_);
1879  QString tiret(" - ");
1880  QString licencie(TY_CUSTOMER_);
1881  QString licenceNumber(TY_LICENCE_NUMBER_);
1882 
1883  QString messageVersion = version + tiret + licencie + tiret + licenceNumber;
1885 
1886  xmlManager.createDoc(TY_PRODUCT_XMLTAG_, messageVersion); // TY_PRODUCT_VERSION_);
1887  xmlManager.addElement(pElement);
1888 
1889  if (xmlManager.save(fileName) == 0)
1890  {
1891  return true;
1892  }
1893 
1894  return bRet;
1895 }
1896 
1898 {
1899  bool bRet = false;
1900 
1901  TYElement* pElement = elementToSave();
1902 
1903  if (!pElement)
1904  {
1905  QMessageBox::warning(this, "Tympan", TR("id_nothingtoexport"));
1906  return false;
1907  }
1908 
1909  QString dirName;
1910  QString fileName = getFileName("XML (*.xml)", dirName, true);
1911 
1912  if (testFile(fileName))
1913  {
1914  bRet = save(dirName, fileName, pElement); // On fait la sauvegarde en ecrasant l'ancienne version
1915 
1916  if (bRet)
1917  {
1918  QMessageBox::information(this, "Tympan", TR("id_export_ok").arg(fileName));
1919  updateCurrentAppFile(dirName, fileName);
1920 
1921  // Indique que les TYElement sont ok (rien a sauvegarder)
1922  TYElement::setIsSavedOk(false);
1923  }
1924  else
1925  {
1926  QMessageBox::warning(this, "Tympan", TR("id_export_failed").arg(fileName));
1927  }
1928  }
1929 
1930  return bRet;
1931 }
1932 
1934 {
1935  bool bRet = false;
1936 
1937  TYProjet* pProjet = getTYApp()->getCurProjet();
1938 
1939  if (!pProjet)
1940  {
1941  QMessageBox::warning(this, "Tympan", TR("id_nothingtoexport"));
1942  return false;
1943  }
1944 
1945  QString dirName;
1946  QString fileName = getFileName("XML (*.xml)", dirName, true);
1947 
1948  TYProjet::gSaveValues = false;
1949  if (testFile(fileName))
1950  {
1951  bRet = save(dirName, fileName, pProjet); // On fait la sauvegarde en ecrasant l'ancienne version
1952 
1953  if (bRet)
1954  {
1955  QMessageBox::information(this, "Tympan", TR("id_export_ok").arg(fileName));
1956  }
1957  else
1958  {
1959  QMessageBox::warning(this, "Tympan", TR("id_export_failed").arg(fileName));
1960  }
1961  }
1962 
1963  TYProjet::gSaveValues = true;
1964 
1965  return bRet;
1966 }
1967 
1969 {
1970  bool bRet = false;
1971 
1972  if (pElement == NULL)
1973  {
1974  return bRet;
1975  }
1976 
1977  QString dirName;
1978  QString fileName = getFileName("XML (*.xml)", dirName, true);
1979 
1980  if (testFile(fileName))
1981  {
1982  bRet = save(dirName, fileName, pElement);
1983 
1984  if (bRet)
1985  {
1986  QMessageBox::information(this, "Tympan", TR("id_export_ok").arg(fileName));
1987  }
1988  else
1989  {
1990  QMessageBox::warning(this, "Tympan", TR("id_export_failed").arg(fileName));
1991  }
1992  }
1993 
1994  return bRet;
1995 }
1996 
1997 void TYMainWindow::updateCurrentAppFile(const QString& dirName, const QString& fileName)
1998 {
1999  getTYApp()->setCurrentDirName(dirName);
2000  getTYApp()->setCurrentFileName(fileName);
2001 
2002  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ +
2003  ") : " + fileName);
2004 }
2005 
2006 bool TYMainWindow::backupFile(const QString& fileName)
2007 {
2008  // Creation du nom du fichier
2009  QFileInfo fi(fileName);
2010 
2011  QString nomFichier = fi.absolutePath() + '/' + fi.completeBaseName() + ".bak";
2012 
2013  // Ouverture du fichier d'origine
2014  QFile fileToSave(fileName);
2015  bool bOpen = fileToSave.open(QIODevice::ReadOnly);
2016 
2017  if (!bOpen)
2018  {
2019  return false;
2020  }
2021 
2022  // Ouverture du fichier backup
2023  QFile backupFile(nomFichier);
2024  bOpen = backupFile.open(QIODevice::WriteOnly);
2025 
2026  if (!bOpen)
2027  {
2028  fileToSave.close();
2029  return false;
2030  }
2031 
2032  // Copie en bloc de l'un dans l'autre
2033  backupFile.write(fileToSave.readAll());
2034 
2035  // Fermeture des fichier
2036  fileToSave.close();
2037  backupFile.close();
2038 
2039  return true;
2040 }
2041 
2043 {
2044  TYPluginDialog* pDlg = new TYPluginDialog(this);
2045  pDlg->exec();
2046 
2047  // Mise a jour du solveur pour le calcul courant si calcul pas bloque
2048  if (_pProjetFrame->getProjet())
2051  {
2053  }
2054 }
2055 
2056 bool TYMainWindow::testFile(const QString& fileName)
2057 {
2058  // Verification de l'etat du fichier
2059  QFileInfo fi(fileName);
2060  // Si le fichier existe , on demande confirmation a l'utilisateur
2061  if (fi.exists())
2062  {
2063  // On ecrase le fichier, puis on sauve
2064  QFile* file = new QFile(fileName);
2065  switch (
2066  QMessageBox::warning(this, "Attention", TR("id_file_exist"), QMessageBox::Yes, QMessageBox::No))
2067  {
2068  case QMessageBox::Yes:
2069  if (!file->remove())
2070  {
2071  QMessageBox::warning(this, "Attention", TR("id_file_cannot_be_clear"));
2072  return false;
2073  }
2074 
2075  break;
2076  case QMessageBox::No:
2077  return false; // On sort sans sauvegarder
2078  break;
2079  }
2080 
2081  delete file;
2082  file = NULL;
2083  }
2084 
2085  return true;
2086 }
2087 
2088 QString TYMainWindow::getFileName(const QString& filter, QString& dirName,
2089  const bool& forceNewName /*=false*/)
2090 {
2091  QString fileName = getTYApp()->getCurrentFileName(); // Recuperation du nom du fichier courant
2092  // NOUVELLE VERSION POUR RECUPERER LE REPERTOIRE
2093  dirName = getTYApp()->getCurrentDirName();
2094 
2095  if (!forceNewName && !fileName.isEmpty())
2096  {
2097  return fileName;
2098  }
2099 
2100  // Recuperation de la terminaison de fichier a creer
2101  short index = filter.indexOf(".");
2102  QString end = filter.mid(index, 4);
2103 
2104  QFileDialog* pDialog = new QFileDialog(parentWidget(), "Choose a file", dirName, filter);
2105  pDialog->setFileMode(QFileDialog::AnyFile);
2106  pDialog->setAcceptMode(QFileDialog::AcceptSave);
2107  pDialog->setWindowModality(Qt::WindowModal); // Set window modality
2108  pDialog->exec();
2109 
2110  QStringList list = pDialog->selectedFiles();
2111  if ((pDialog->result() == QDialog::Accepted) && (!list.isEmpty()))
2112  {
2113  fileName = list.first();
2114 
2115  QDir dir = pDialog->directory();
2116  dirName = dir.absolutePath();
2117 
2118  pDialog = NULL;
2119 
2120  if (!fileName.endsWith(end))
2121  {
2122  fileName += end;
2123  }
2124  }
2125  else
2126  {
2127  fileName = "";
2128  }
2129 
2130  return fileName;
2131 }
2132 
2134 {
2135  QWidget* pW = this->focusWidget();
2136 
2137  if (pW && (dynamic_cast<TYModelerFrame*>(pW) != nullptr))
2138  {
2139  ((TYModelerFrame*)pW)->print();
2140  }
2141 }
2142 
2144 {
2145  emit onUndo();
2146 }
2147 
2149 {
2150  emit onRedo();
2151 }
2152 
2154 {
2155  about();
2156 }
2157 
2159 {
2160  about();
2161 }
2162 
2164 {
2165  about();
2166 }
2167 
2169 
2171 
2172 void TYMainWindow::showBiblio(bool show) {}
2173 
2175 {
2176  TYPreferenceDialog* pDlg = new TYPreferenceDialog(this);
2177  pDlg->exec();
2178 }
2179 
2181 {
2182  _pOutputDockWnd->setVisible(show);
2183 }
2184 
2186 {
2187  _pHideOrShowOutputAction->setChecked(_pOutputDockWnd->isVisible());
2188 }
2189 
2191 {
2192  QProcess* pImporterLauncher = new QProcess(this);
2193 
2194  // On travail dans le repertoire utilisateur
2195  pImporterLauncher->setWorkingDirectory(TYApplication::tympanUserDir());
2196 
2197  // Le nom de l'executable
2198  // pImporterLauncher->addArgument("Importer");
2199 
2200  // Lancement
2201  pImporterLauncher->start("Importer", QStringList(""));
2202 
2203  if (pImporterLauncher->state() == QProcess::Running)
2204  {
2205  writeOutputMsg(TR("id_msg_importer_ok"));
2206  }
2207  else
2208  {
2209  writeOutputMsg(TR("id_msg_importer_fail"));
2210  }
2211 }
2212 
2213 void TYMainWindow::closeEvent(QCloseEvent* pEvent)
2214 {
2215  // Evite les boucles de fermeture si quit() redéclenche des closeEvent
2216  if (_handlingCloseEvent)
2217  {
2218  pEvent->accept();
2219  return;
2220  }
2221  _handlingCloseEvent = true;
2222 
2223  // Même intention que menu Quitter : on décide nous-même si on quitte ou non
2224  _closeAndQuit = true;
2225 
2226  // Ferme le projet courant (avec demande de sauvegarde si nécessaire)
2227  close();
2228 
2229  if (_closeAndQuit)
2230  {
2231  // Comportement identique à la méthode quitte()
2233  saveSettings(QDir::toNativeSeparators(getTYApp()->getSettingsDir() + "/Settings"));
2234  closeModelers();
2235 
2236  pEvent->accept();
2237  getTYApp()->quit();
2238  }
2239  else
2240  {
2241  pEvent->ignore();
2242  }
2243 
2244  _handlingCloseEvent = false;
2245 }
2246 
2247 void TYMainWindow::updateCurrentFileName(const QString& fileName)
2248 {
2249  // Informe l'application du nom du fichier courant
2251 
2252  // Change le titre de la fenetre pour afficher le nom du fichier
2253  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ +
2254  ") : " + fileName);
2255 }
2256 
2257 // CLM-NT33 : Raffraichissement du nom de fichier en vue modeleur
2259 {
2260  // Change le titre de la fenetre pour afficher le nom du fichier
2261  setWindowTitle(TR("id_caption") + "-" + TY_CURRENT_RELEASE_ + " (" + TY_PRODUCT_PLATFORM_ +
2263 }
2264 
2265 // 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:706
static void setLogInstances(bool log)
Definition: TYElement.h:831
static void setIsSavedOk(const bool &toSave)
Definition: TYElement.h:914
const TYUUID & getID() const
Definition: TYElement.cpp:176
static void setRegenerateID(const bool &bRegenerate)
Definition: TYElement.h:922
static bool getIsSavedOk()
Definition: TYElement.h:906
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:463
void updateModelersAfterComputation(LPTYProjet &result)
void updateHideOrShowOutputAction(bool visibilityChanged)
QDockWidget * _pOutputDockWnd
Dockable window for feedback messages.
Definition: TYMainWindow.h:614
TYProjetFrame * _pProjetFrame
Frame for project management.
Definition: TYMainWindow.h:602
virtual ~TYMainWindow()
void editCurCalcul()
TYInfraToolbar * _pToolbarInfra
Infrastructure toolbar.
Definition: TYMainWindow.h:576
TYElement * elementToSave()
void updateCurrentAppFile(const QString &dirName, const QString &fileName)
TYFaceToolbar * _pToolbarFace
Face toolbar.
Definition: TYMainWindow.h:592
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:595
void createNewBatiment()
QAction * _pOpenAction
Action to open the library manager.
Definition: TYMainWindow.h:504
QDockWidget * _pSiteDockWnd
Dockable window for site management.
Definition: TYMainWindow.h:609
void updateCurrentFileName(const QString &fileName)
void createNewSite()
void saveCurBatimentMode(int mode)
TYSiteFrame * _pSiteFrame
Frame for site management.
Definition: TYMainWindow.h:607
void saveCurFaceMode(int mode)
TYTopoToolbar * _pToolbarTopo
Topography toolbar.
Definition: TYMainWindow.h:574
void setCurSiteNode(LPTYSiteNode pSiteNode)
QAction * _pCreateNewAction
Action to create a new element.
Definition: TYMainWindow.h:502
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:631
TYCalculToolbar * _pToolbarCalcul
Calculation toolbar.
Definition: TYMainWindow.h:578
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:512
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:532
int _curSiteMode
Preserves the current mode of SiteModeler windows.
Definition: TYMainWindow.h:572
QAction * _pPrintAction
Action to print.
Definition: TYMainWindow.h:529
QAction * _pRedoAction
Action to perform a redo.
Definition: TYMainWindow.h:534
void windowsMenuActivated()
QButtonGroup * _pFaceBtnGroup
Button group for face toolbar.
Definition: TYMainWindow.h:588
void showPluginManager()
QAction * _pSaveAction
Action to save an element.
Definition: TYMainWindow.h:509
QAction * _pHideOrShowOutputAction
Shows or hides the output messages window.
Definition: TYMainWindow.h:550
QMdiArea * _pWorkspace
Workspace for MDI management.
Definition: TYMainWindow.h:494
TYProjetFrame * getProjetFrame()
Definition: TYMainWindow.h:73
QAction * _pPasteAction
Action to perform a paste.
Definition: TYMainWindow.h:541
bool makeModeler(TYElement *pElt)
void reloadSlots()
void saveCurMachineMode(int mode)
QAction * _pCloseAction
Action to close the current project or site.
Definition: TYMainWindow.h:506
void createNewGeoProjet()
QButtonGroup * _pMachineBtnGroup
Button group for machine toolbar.
Definition: TYMainWindow.h:581
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:567
void showBiblio(bool show)
QAction * _pHideOrShowSpectreMngrAction
Shows or hides the Spectrum Manager.
Definition: TYMainWindow.h:544
int _curFaceMode
Preserves the current mode of FaceModeler windows.
Definition: TYMainWindow.h:590
TYMachineToolbar * _pToolbarMachine
Machine toolbar.
Definition: TYMainWindow.h:585
void createNewMachine()
QMenu * _pWindowsMenu
Spectra manager.
Definition: TYMainWindow.h:625
void refreshWindowTitle()
void showPreferenceDialog()
QAction * _pHideOrShowMaillageMngrAction
Shows or hides the Mesh Manager.
Definition: TYMainWindow.h:546
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:499
void connectDefaultActionManager()
QOpenGLWidget * _pDummyQOpenGLWidget
Definition: TYMainWindow.h:635
QAction * _pGoCurCalculAction
Action to start the current calculation.
Definition: TYMainWindow.h:555
void updateModelersElementGraphic(bool force=false)
QToolBar * _pCalculAcousticToolbar
Toolbar for acoustic calculations.
Definition: TYMainWindow.h:564
QAction * _pCutAction
Action to perform a cut.
Definition: TYMainWindow.h:537
bool makeMachineModeler(LPTYMachine pMachine=NULL)
QAction * _pEditCurCalculAction
Action to edit the preferences of the current calculation.
Definition: TYMainWindow.h:553
void setCurProjet(LPTYProjet pProjet)
QAction * _pSaveAsNoResultAction
Action to save an element with a specific name without calculation results.
Definition: TYMainWindow.h:515
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:628
void saveGeometryToPreferences()
save geometry of windows to preferences
int _curMachineMode
Preserves the current mode of MachineModeler windows.
Definition: TYMainWindow.h:583
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:561
TYOutputFrame * _pOutputFrame
Frame for feedback messages.
Definition: TYMainWindow.h:612
void saveCurSiteMode(int mode)
bool saveAsNoResult()
void closeModeler(const TYElement *pElement)
QButtonGroup * _pSiteBtnGroup
Button group for site toolbars.
Definition: TYMainWindow.h:570
QAction * _pCopyAction
Action to perform a copy.
Definition: TYMainWindow.h:539
QToolBar * _pMainToolbar
Main toolbar.
Definition: TYMainWindow.h:558
QAction * _pShowPluginManagerAction
Action to display the plug-in manager.
Definition: TYMainWindow.h:518
TYBatimentToolbar * _pToolbarBatiment
Building toolbar.
Definition: TYMainWindow.h:599
void subWindowActivated()
bool _handlingCloseEvent
Definition: TYMainWindow.h:421
int _curBatimentMode
Preserves the current mode of BatimentModeler windows.
Definition: TYMainWindow.h:597
QDockWidget * _pProjetDockWnd
Dockable window for project management.
Definition: TYMainWindow.h:604
void showSpectreManager(bool show)
QAction * _pHideOrShowBiblioAction
Shows or hides the Library of elements.
Definition: TYMainWindow.h:548
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:624
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:580
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