Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSiteFrame.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 #include <qcursor.h>
22 #include <qtreewidget.h>
23 #include <qmenubar.h>
24 #include <qmenu.h>
25 #include <qtoolbutton.h>
26 #include <qlayout.h>
27 #include <qdialog.h>
28 #include <qfiledialog.h>
29 #include <qmessagebox.h>
30 #include <QPixmap>
31 #include <QVBoxLayout>
32 #include <QBoxLayout>
33 #include <QHeaderView>
34 #include <QMdiArea>
35 #include <QMdiSubWindow>
36 #include <qvector3d.h>
37 
53 #include "TYSiteFrame.h"
56 
57 #define TR(id) OLocalizator::getString("TYSiteFrame", (id))
58 #define IMG(id) OLocalizator::getPicture("TYSiteFrame", (id))
59 
60 TYSiteFrame::TYSiteFrame(QWidget* parent, const char* name, Qt::WindowFlags f) : QWidget(parent, f)
61 {
62  setObjectName(name);
63  QBoxLayout* pLayout = new QVBoxLayout(this);
64  pLayout->setContentsMargins(0, 0, 0, 0);
65  setLayout(pLayout);
66 
67  // List view
68  _pListView = new QTreeWidget(this);
69  QStringList stringList;
70  stringList.append(TR("id_column_site"));
71  _pListView->setColumnCount(1);
72  _pListView->setHeaderLabels(stringList);
73  _pListView->resizeColumnToContents(0);
74  _pListView->setSortingEnabled(false);
75 
76  pLayout->addWidget(_pListView);
77 
78  _pSiteNodeRoot = NULL;
79  _pCurrentCalcul = NULL;
80 
81  // Signaux
82  QObject::connect(_pListView, &QTreeWidget::itemClicked, this, &TYSiteFrame::apply);
83  QObject::connect(_pListView, &QTreeWidget::itemDoubleClicked, this, &TYSiteFrame::openModeler);
84 }
85 
87 {
88  _pListView->disconnect();
89 }
90 
92 {
93  clear();
94 
95  if (_pSiteNodeRoot && _pSiteNodeRoot->getGraphicObject())
96  {
97  _pSiteNodeRoot->getGraphicObject()->disconnectUpdateSignal(this, SLOT(updateList()));
98  }
99 
100  _pSiteNodeRoot = pSiteNode;
101 
102  if (_pSiteNodeRoot)
103  {
104  // Ce site est root
105  _pSiteNodeRoot->setRoot(true);
106  updateList();
107 
108  if (_pSiteNodeRoot->getGraphicObject())
109  {
110  _pSiteNodeRoot->getGraphicObject()->connectUpdateSignal(this, SLOT(updateList()));
111  }
112  }
113 }
114 
116 {
117  TYTreeViewState state;
119 
120  clear();
121 
122  if (!_pSiteNodeRoot)
123  {
124  return;
125  }
126 
127  // Le site node root est l'item root de la liste
129 
130  pRootItem->setExpanded(true);
131  _pListView->resizeColumnToContents(0);
132 
134 }
135 
137 {
138  TYElementListItem* pRootItem = NULL;
139  if (pElement->getRoot())
140  {
141  pRootItem = addEltToList(pElement, parent);
142  }
143  else
144  {
145  pRootItem = addEltToList(pElement, parent, true);
146  }
147 
148  pRootItem->setExpanded(true);
149 
150  // Infrastrucure du site
151  addToList(pElement->getInfrastructure(), pRootItem);
152  // Topographie du site
153  addToList(pElement->getTopographie(), pRootItem);
154 
155  // Listes des sites enfants
156  TYElementListItem* pListSitesItem =
157  new TYElementListItem(pRootItem, QStringList(TR("id_list_sites_item")));
158  for (unsigned int i = 0; i < pElement->getListSiteNode().size(); i++)
159  {
160  addToList(TYSiteNode::safeDownCast(pElement->getListSiteNode()[i]->getElement()), pListSitesItem);
161  }
162  pListSitesItem->setExpanded(true);
163 
164  return pRootItem;
165 }
166 
168 {
169  unsigned int i = 0;
170 
171  // Topographie
172  TYElementListItem* pRootItem = addEltToList(pElement, parent);
173  pRootItem->setExpanded(true);
174 
175  // Liste des plans d'eau
176  TYElementListItem* pListPlanEauItem =
177  new TYElementListItem(pRootItem, QStringList(TR("id_list_planeau_item")));
178  for (i = 0; i < pElement->getListPlanEau().size(); i++)
179  {
180  new TYElementListItem(pListPlanEauItem, pElement->getPlanEau(i));
181  }
182  pListPlanEauItem->sortChildren(0, Qt::AscendingOrder);
183 
184  // Liste des cours d'eau
185  TYElementListItem* pListCoursEauItem =
186  new TYElementListItem(pRootItem, QStringList(TR("id_list_crseau_item")));
187  for (i = 0; i < pElement->getListCrsEau().size(); i++)
188  {
189  new TYElementListItem(pListCoursEauItem, pElement->getCrsEau(i));
190  }
191  pListCoursEauItem->sortChildren(0, Qt::AscendingOrder);
192 
193  // Liste des courbes de niveau
194  TYElementListItem* pListCourbeNivItem =
195  new TYElementListItem(pRootItem, QStringList(TR("id_list_courbes_item")));
196  for (i = 0; i < pElement->getListCrbNiv().size(); i++)
197  {
198  new TYElementListItem(pListCourbeNivItem, pElement->getCrbNiv(i));
199  }
200  pListCourbeNivItem->sortChildren(0, Qt::AscendingOrder);
201 
202  // Liste des terrains
203  TYElementListItem* pListTerrainItem =
204  new TYElementListItem(pRootItem, QStringList(TR("id_list_terrains_item")));
205  TYElementListItem* pTerrainItem;
206  for (i = 0; i < pElement->getListTerrain().size(); i++)
207  {
208  pTerrainItem = new TYElementListItem(pListTerrainItem, pElement->getTerrain(i));
209  if (pElement->getTerrain(i) == pElement->getDefTerrain())
210  {
211  pTerrainItem->setIcon(0, QPixmap(IMG("id_icon_check")));
212  }
213  else
214  {
215  pTerrainItem->setIcon(0, QPixmap(IMG("id_icon_no_check")));
216  }
217  }
218  pListTerrainItem->sortChildren(0, Qt::AscendingOrder);
219 
220  return pRootItem;
221 }
222 
224 {
225  unsigned int i = 0;
226 
227  // Infrastructure
228  TYElementListItem* pRootItem = addEltToList(pElement, parent);
229  pRootItem->setExpanded(true);
230 
231  // Liste des sources
232  TYElementListItem* pListSourcesItem =
233  new TYElementListItem(pRootItem, QStringList(TR("id_list_sources_item")));
234  for (i = 0; i < pElement->getSrcs().size(); i++)
235  {
236  LPTYUserSourcePonctuelle pSource =
237  TYUserSourcePonctuelle::safeDownCast(pElement->getSrc(i)->getElement());
238  new TYElementListItem(pListSourcesItem, pSource, _pCurrentCalcul, QStringList(), true);
239  }
240  pListSourcesItem->sortChildren(0, Qt::AscendingOrder);
241 
242  // Liste des batiments
243  TYElementListItem* pListBatimentItem =
244  new TYElementListItem(pRootItem, QStringList(TR("id_list_batiments_item")));
245  for (i = 0; i < pElement->getListBatiment().size(); i++)
246  {
247  LPTYBatiment pBatiment = TYBatiment::safeDownCast(pElement->getBatiment(i)->getElement());
248  addToList(pBatiment, pListBatimentItem); // DT_24-09-03
249  }
250  pListBatimentItem->sortChildren(0, Qt::AscendingOrder);
251 
252  // Liste des machines
253  TYElementListItem* pListMachineItem =
254  new TYElementListItem(pRootItem, QStringList(TR("id_list_machines_item")));
255  for (i = 0; i < pElement->getListMachine().size(); i++)
256  {
257  LPTYMachine pMachine = TYMachine::safeDownCast(pElement->getMachine(i)->getElement());
258  new TYElementListItem(pListMachineItem, pMachine, _pCurrentCalcul, QStringList(), true);
259  }
260  pListMachineItem->sortChildren(0, Qt::AscendingOrder);
261 
262  // Liste des reseaux de transport
263  TYElementListItem* pListResTranspItem =
264  new TYElementListItem(pRootItem, QStringList(TR("id_list_restransps_item")));
265  for (i = 0; i < pElement->getListResTrans().size(); i++)
266  {
267  new TYElementListItem(pListResTranspItem, pElement->getResTrans(i), _pCurrentCalcul, QStringList(),
268  true);
269  }
270  pListResTranspItem->sortChildren(0, Qt::AscendingOrder);
271 
272 #if WITH_NMPB
273  // Liste des routes
274  TYElementListItem* pListRouteItem =
275  new TYElementListItem(pRootItem, QStringList(TR("id_list_routes_item")));
276  for (i = 0; i < pElement->getListRoute().size(); i++)
277  {
278  new TYElementListItem(pListRouteItem, pElement->getRoute(i), _pCurrentCalcul, QStringList(), true);
279  }
280  pListRouteItem->sortChildren(0, Qt::AscendingOrder);
281 #endif
282  return pRootItem;
283 }
284 
286  TYElementListItem* parent /*=NULL*/)
287 {
288  // Materiau de construction
289  TYElementListItem* pRootItem = addEltToList(pElement, parent);
290  new TYElementListItem(pRootItem, &pElement->getSpectreTransm());
291  new TYElementListItem(pRootItem, &pElement->getSpectreAbso());
292  return pRootItem;
293 }
294 
296 {
297  // Spectre
298  TYElementListItem* pRootItem = addEltToList(pElement, parent);
299  return pRootItem;
300 }
301 
303 {
304  // Source ponctuelle
305  TYElementListItem* pRootItem = addEltToList(pElement, parent);
306  return pRootItem;
307 }
308 
310 {
311  int i = 0;
312 
313  // Machine
314  TYElementListItem* pRootItem = addEltToList(pElement, parent);
315 
316  TYElementListItem* pListAccVolItem =
317  new TYElementListItem(pRootItem, QStringList(TR("id_list_accvols_item")));
318  for (i = 0; i < pElement->getTabAcousticVol().size(); i++)
319  {
320  new TYElementListItem(pListAccVolItem, pElement->getAcousticVol(i));
321  }
322 
323  new TYElementListItem(pRootItem, QStringList(TR("id_list_spectres_item")));
324 
325  if (pElement->getUseAtt())
326  {
327  new TYElementListItem(pRootItem, pElement->getAtt());
328  }
329 
330  return pRootItem;
331 }
332 
334 {
335  unsigned int i = 0, j = 0;
336 
337  // batiment
338  TYElementListItem* pRootItem =
339  new TYElementListItem(parent, pElement, _pCurrentCalcul, QStringList(), true);
340  TYElementListItem* pEtageItem;
341  for (i = 0; i < pElement->getTabAcousticVol().size(); i++)
342  {
343  // Etage
344  LPTYEtage pEtage = dynamic_cast<TYEtage*>(pElement->getAcousticVol(i)._pObj);
345  if (pEtage != nullptr)
346  {
347  if (pEtage->getClosed())
348  {
349  // Ferme = etage
350  pEtageItem = new TYElementListItem(pRootItem, pEtage);
351  }
352  else
353  {
354  // Non ferme = ecran
355  pEtageItem = new TYElementListItem(pRootItem, pEtage, NULL, QStringList(TR("id_ecran_item")));
356  }
357 
358  // Machines dans l'etage
359  for (j = 0; j < pEtage->getTabMachine().size(); j++)
360  {
361  new TYElementListItem(pEtageItem, pEtage->getMachine(j));
362  }
363 
364  // Source dans l'etage
365  for (j = 0; j < pEtage->getTabSources().size(); j++)
366  {
367  new TYElementListItem(pEtageItem, pEtage->getSource(j));
368  }
369  pEtageItem->sortChildren(0, Qt::AscendingOrder);
370  }
371  else // Ou Silos
372  {
373  LPTYAcousticVolume pAccVol = pElement->getAcousticVol(i);
374  (void)new TYElementListItem(pRootItem, pAccVol);
375  }
376  }
377 
378  return NULL;
379 }
380 
381 void TYSiteFrame::contextMenuEvent(QContextMenuEvent* e)
382 {
383  // si on trouve un item associe
384  QPoint point = _pListView->mapFrom(this, e->pos());
385  QTreeWidgetItem* item = _pListView->itemAt(point.x(), point.y() - _pListView->header()->height());
386 
387  if (item != NULL)
388  {
389  QMenu* pMenu = new QMenu(this);
390 
391  int editState = QDialog::Rejected;
392 
393  QAction* prop = NULL; // Boite de dialogue de proprietes
394  QAction* showModeler = NULL;
395  QAction* calculer = NULL;
396  QAction* position = NULL;
397  QAction* rotation = NULL;
398  QAction* exportXML = NULL;
399  QAction* exportCSV = NULL;
400  QAction* exportLib = NULL;
401  QAction* importLib = NULL;
402  QAction* del = NULL;
403  QAction* highlight = NULL;
404  QAction* selectAll = NULL;
405  QAction* unselectAll = NULL;
406  QAction* addMachineXML = NULL;
407  QAction* newMachine = NULL;
408  QAction* addSrcXML = NULL;
409  QAction* newSrc = NULL;
410  QAction* addBatimentXML = NULL;
411  QAction* newBatiment = NULL;
412  QAction* addSiteXML = NULL;
413  QAction* newSite = NULL;
414  QAction* resetDMax = NULL;
415 
416  QAction* ret = NULL; // Action selectionnee par l'utilisateur
417 
418  QMenu* pSubMenuAdd = new QMenu(this);
419  pSubMenuAdd->setIcon(QIcon(QPixmap(IMG("id_icon_open"))));
420  pSubMenuAdd->setTitle(TR("id_contextmenu_submenu_add"));
421 
422  QMenu* pSubMenuExport = new QMenu(this);
423  pSubMenuExport->setIcon(QIcon(QPixmap(IMG("id_icon_save"))));
424  pSubMenuExport->setTitle(TR("id_contextmenu_submenu_export"));
425  exportLib =
426  pSubMenuExport->addAction(QIcon(QPixmap(IMG("id_icon_export"))), TR("id_contextmenu_export_lib"));
427  pSubMenuExport->addSeparator();
428  exportXML =
429  pSubMenuExport->addAction(QIcon(QPixmap(IMG("id_icon_export"))), TR("id_contextmenu_export_xml"));
430  pSubMenuExport->addSeparator();
431  exportCSV =
432  pSubMenuExport->addAction(QIcon(QPixmap(IMG("id_icon_export"))), TR("id_contextmenu_export_csv"));
433 
434  TYElement* pElement = NULL;
435  LPTYElementGraphic pGraphicObject = nullptr;
436 
437  TYElementListItem* eltItem = (TYElementListItem*)item;
438 
439  // Composition du menu
440  if (eltItem->isElementItem()) // L'item selectionne est un element du site
441  {
442  pElement = eltItem->getElement().getRealPointer();
443  pGraphicObject = pElement->getGraphicObject();
444 
445  // Composition du menu
446  prop = pMenu->addAction(QIcon(QPixmap(IMG("id_icon_editeelt"))), TR("id_contextmenu_properties"));
447  pMenu->addSeparator();
448 
449  TYSiteNode* pSiteNode = dynamic_cast<TYSiteNode*>(pElement);
450  if (pSiteNode != nullptr)
451  {
452  showModeler =
453  pMenu->addAction(QIcon(QPixmap(IMG("id_icon_modeler"))), TR("id_contextmenu_modeler"));
454 
455  bool bNotSiteRoot = (pSiteNode && !pSiteNode->getRoot());
456 
457  if (bNotSiteRoot) // Actions possibles si ce n'est pas le site racine
458  {
459  pMenu->addSeparator();
460  if (pGraphicObject)
461  {
462  highlight = pMenu->addAction(TR("id_contextmenu_highlight"));
463  highlight->setCheckable(true);
464  highlight->setChecked(pGraphicObject->isBoundingBoxVisible());
465  pMenu->addSeparator();
466  }
467  position = pMenu->addAction(TR("id_context_menu_position"));
468  rotation = pMenu->addAction(TR("id_context_menu_rotation"));
469  pMenu->addSeparator();
470  }
471 
472  // Definition du sous menu d'ajout d'elements
473  addSiteXML = pSubMenuAdd->addAction(TR("id_contextmenu_site_xml"));
474  newSite = pSubMenuAdd->addAction(TR("id_contextmenu_newsite"));
475  pSubMenuAdd->addSeparator();
476  addBatimentXML = pSubMenuAdd->addAction(TR("id_contextmenu_addbatiment_xml"));
477  newBatiment = pSubMenuAdd->addAction(TR("id_contextmenu_newbatiment"));
478  pSubMenuAdd->addSeparator();
479  addMachineXML = pSubMenuAdd->addAction(TR("id_contextmenu_addmachine_xml"));
480  newMachine = pSubMenuAdd->addAction(TR("id_contextmenu_newmachine"));
481  pSubMenuAdd->addSeparator();
482  addSrcXML = pSubMenuAdd->addAction(TR("id_contextmenu_addsource_xml"));
483  newSrc = pSubMenuAdd->addAction(TR("id_contextmenu_newsource"));
484  pSubMenuAdd->addSeparator();
485  importLib = pSubMenuAdd->addAction(QIcon(QPixmap(IMG("id_icon_import_lib"))),
486  TR("id_contextmenu_import_lib"));
487 
488  pMenu->addMenu(pSubMenuAdd);
489 
490  // Ajout du sous-menu d'export
491  pMenu->addSeparator();
492  pMenu->addMenu(pSubMenuExport);
493 
494  // Retour au menu principal
495  if (bNotSiteRoot) // Action possible si ce n'est pas le site racine
496  {
497  pMenu->addSeparator();
498  del = pMenu->addAction(QIcon(QPixmap(IMG("id_icon_del"))), TR("id_contextmenu_delete"));
499  }
500  }
501  else if (dynamic_cast<TYInfrastructure*>(pElement) != nullptr)
502  {
503  // Definition du sous menu d'ajout d'elements
504  addBatimentXML = pSubMenuAdd->addAction(TR("id_contextmenu_addbatiment_xml"));
505  newBatiment = pSubMenuAdd->addAction(TR("id_contextmenu_newbatiment"));
506  pSubMenuAdd->addSeparator();
507  addMachineXML = pSubMenuAdd->addAction(TR("id_contextmenu_addmachine_xml"));
508  newMachine = pSubMenuAdd->addAction(TR("id_contextmenu_newmachine"));
509  pSubMenuAdd->addSeparator();
510 
511  addSrcXML = pSubMenuAdd->addAction(TR("id_contextmenu_addsource_xml"));
512  newSrc = pSubMenuAdd->addAction(TR("id_contextmenu_newsource"));
513  pSubMenuAdd->addSeparator();
514 
515  importLib = pSubMenuAdd->addAction(QIcon(QPixmap(IMG("id_icon_import_lib"))),
516  TR("id_contextmenu_import_lib"));
517 
518  pMenu->addMenu(pSubMenuAdd);
519  }
520  else if (dynamic_cast<TYAcousticVolumeNode*>(pElement) != nullptr)
521  {
522  showModeler =
523  pMenu->addAction(QIcon(QPixmap(IMG("id_icon_modeler"))), TR("id_contextmenu_modeler"));
524  pMenu->addSeparator();
525  if (pGraphicObject)
526  {
527  highlight = pMenu->addAction(TR("id_contextmenu_highlight"));
528  highlight->setCheckable(true);
529  highlight->setChecked(pGraphicObject->isBoundingBoxVisible());
530  pMenu->addSeparator();
531  }
532  calculer =
533  pMenu->addAction(QIcon(QPixmap(IMG("id_icon_calcul"))), TR("id_contextmenu_calculer"));
534  pMenu->addSeparator();
535  position = pMenu->addAction(TR("id_context_menu_position"));
536  rotation = pMenu->addAction(TR("id_context_menu_rotation"));
537  pMenu->addSeparator();
538  pMenu->addMenu(pSubMenuExport);
539  pMenu->addSeparator();
540  del = pMenu->addAction(QIcon(QPixmap(IMG("id_icon_del"))), TR("id_contextmenu_delete"));
541  }
542  else if (dynamic_cast<TYEtage*>(pElement) != nullptr)
543  // Cas de l'etage
544  {
545  // Definition du sous menu d'ajout d'elements
546  addMachineXML = pSubMenuAdd->addAction(TR("id_contextmenu_addmachine_xml"));
547  newMachine = pSubMenuAdd->addAction(TR("id_contextmenu_newmachine"));
548  pSubMenuAdd->addSeparator();
549  addSrcXML = pSubMenuAdd->addAction(TR("id_contextmenu_addsource_xml"));
550  newSrc = pSubMenuAdd->addAction(TR("id_contextmenu_newsource"));
551  pSubMenuAdd->addSeparator();
552 
553  importLib = pSubMenuAdd->addAction(QIcon(QPixmap(IMG("id_icon_import_lib"))),
554  TR("id_contextmenu_import_lib"));
555 
556  pMenu->addMenu(pSubMenuAdd);
557  }
558  else if (dynamic_cast<TYAcousticLine*>(pElement) != nullptr)
559  {
560  if (pGraphicObject)
561  {
562  highlight = pMenu->addAction(TR("id_contextmenu_highlight"));
563  highlight->setCheckable(true);
564  highlight->setChecked(pGraphicObject->isBoundingBoxVisible());
565  pMenu->addSeparator();
566  }
567  }
568  else if (dynamic_cast<TYSourcePonctuelle*>(pElement) != nullptr)
569  {
570  if (pGraphicObject)
571  {
572  highlight = pMenu->addAction(TR("id_contextmenu_highlight"));
573  highlight->setCheckable(true);
574  highlight->setChecked(pGraphicObject->isBoundingBoxVisible());
575  pMenu->addSeparator();
576  }
577 
578  pMenu->addMenu(pSubMenuExport);
579 
580  pMenu->addSeparator();
581  del = pMenu->addAction(QIcon(QPixmap(IMG("id_icon_del"))), TR("id_contextmenu_delete"));
582  }
583  else if (dynamic_cast<TYTopographie*>(pElement->getParent()) != nullptr)
584  // Pour les objets de topo en general
585  {
586  del = pMenu->addAction(QIcon(QPixmap(IMG("id_icon_del"))), TR("id_contextmenu_delete"));
587  }
588  }
589  else // L'item selectionne est un element de decors (liste de ...)
590  {
591  TYElementListItem* pItemParent = (TYElementListItem*)item->parent();
592  pElement = pItemParent->getElement();
593  assert(pElement);
594 
595  if ((item->text(0) == TR("id_list_sources_item")) ||
596  (item->text(0) == TR("id_list_batiments_item")) ||
597  (item->text(0) == TR("id_list_machines_item")) || (item->text(0) == TR("id_list_sites_item")))
598  {
599  selectAll = pMenu->addAction(TR("id_contextmenu_selectall"));
600  unselectAll = pMenu->addAction(TR("id_contextmenu_unselectall"));
601  pMenu->addSeparator();
602  }
603 
604  if ((item->text(0) == TR("id_list_sites_item")))
605  {
606  // Definition du sous menu d'ajout d'elements
607  addSiteXML = pSubMenuAdd->addAction(TR("id_contextmenu_site_xml"));
608  pSubMenuAdd->addSeparator();
609  newSite = pSubMenuAdd->addAction(TR("id_contextmenu_newsite"));
610  pSubMenuAdd->addSeparator();
611  importLib = pSubMenuAdd->addAction(QIcon(QPixmap(IMG("id_icon_import_lib"))),
612  TR("id_contextmenu_import_lib"));
613 
614  pMenu->addMenu(pSubMenuAdd);
615  pMenu->addSeparator();
616  }
617  else if ((item->text(0) == TR("id_list_batiments_item")))
618  {
619  // Definition du sous menu d'ajout d'elements
620  addBatimentXML = pSubMenuAdd->addAction(TR("id_contextmenu_addbatiment_xml"));
621  pSubMenuAdd->addSeparator();
622  newBatiment = pSubMenuAdd->addAction(TR("id_contextmenu_newbatiment"));
623  pSubMenuAdd->addSeparator();
624  importLib = pSubMenuAdd->addAction(QIcon(QPixmap(IMG("id_icon_import_lib"))),
625  TR("id_contextmenu_import_lib"));
626 
627  pMenu->addMenu(pSubMenuAdd);
628  pMenu->addSeparator();
629  }
630  else if ((item->text(0) == TR("id_list_machines_item")))
631  {
632  // Definition du sous menu d'ajout d'elements
633  addMachineXML = pSubMenuAdd->addAction(TR("id_contextmenu_addmachine_xml"));
634  pSubMenuAdd->addSeparator();
635  newMachine = pSubMenuAdd->addAction(TR("id_contextmenu_newmachine"));
636  pSubMenuAdd->addSeparator();
637  importLib = pSubMenuAdd->addAction(QIcon(QPixmap(IMG("id_icon_import_lib"))),
638  TR("id_contextmenu_import_lib"));
639 
640  pMenu->addMenu(pSubMenuAdd);
641  pMenu->addSeparator();
642  }
643  else if ((item->text(0) == TR("id_list_sources_item")))
644  {
645  // Definition du sous menu d'ajout d'elements
646  addSrcXML = pSubMenuAdd->addAction(TR("id_contextmenu_addsource_xml"));
647  pSubMenuAdd->addSeparator();
648  newSrc = pSubMenuAdd->addAction(TR("id_contextmenu_newsource"));
649  pSubMenuAdd->addSeparator();
650  importLib = pSubMenuAdd->addAction(QIcon(QPixmap(IMG("id_icon_import_lib"))),
651  TR("id_contextmenu_import_lib"));
652 
653  pMenu->addMenu(pSubMenuAdd);
654  pMenu->addSeparator();
655  }
656  else if ((item->text(0) == TR("id_list_courbes_item")) ||
657  (item->text(0) == TR("id_list_planeau_item")))
658  {
659  if (item->childCount() > 0)
660  {
661  resetDMax =
662  pMenu->addAction(TR("id_contextmenu_DMax")); // Reinitialisation de la distance max
663  }
664  }
665  }
666 
667  ret = pMenu->exec(_pListView->mapToGlobal(point));
668 
669  // Traitement de la selection
670  if (ret)
671  {
672  if (ret == prop)
673  {
674  editState = pElement->edit(this);
675 
676  if (editState == QDialog::Accepted)
677  {
678  eltItem->updateContent();
679 
680  TYProjet* pProjet = getTYApp()->getCurProjet();
681  if (pProjet)
682  {
683  TYSiteNode* pSite = pProjet->getSite();
684  if (pSite)
685  {
686  pSite->update(pElement);
687  }
688 
689  pProjet->updateGraphicTree();
690  }
691  updateList();
692  }
693 
694  pElement->updateGraphicTree();
695  }
696  // Opening the modeler of an element from the siteframe
697  else if (pElement && ret == showModeler)
698  {
699  // If the element is a site
700  if (dynamic_cast<TYSiteNode*>(pElement) != nullptr)
701  {
702  getTYMainWnd()->makeSiteModeler((TYSiteNode*)pElement);
703  }
704  // If the element is a "Batiment"
705  else if (dynamic_cast<TYBatiment*>(eltItem->getElement()._pObj) != nullptr)
706  {
707  // eltItem is saved before it gets deleted automatically
708  TYElementListItem newItem = *eltItem;
709  // We test if the modeler is empty or not after the user updates the element
710  if (!getTYMainWnd()->makeBatimentModeler((TYBatiment*)pElement))
711  {
712  // If it's empty, we delete the element
713  LPTYElement pElt = pElement->getParent();
714  if (remFromList(&newItem))
715  {
716  // Mise a jour graphique du parent
717  pElt->updateGraphicTree();
719  // Suppression de l'entree dans l'arborescence
720  newItem.remove();
721  // Mise a jour de l'arborescence
722  updateList();
723  }
724  else
725  {
726  QMessageBox::warning(this, "Tympan", TR("id_warning_notsuppr"));
727  }
728  }
729  }
730  // If the element is a "machine"
731  else if (dynamic_cast<TYMachine*>(eltItem->getElement()._pObj) != nullptr)
732  {
733  // Same as with the "Batiment"
734  TYElementListItem newItem = *eltItem;
735  if (!getTYMainWnd()->makeMachineModeler((TYMachine*)pElement))
736  {
737  LPTYElement pElt = pElement->getParent();
738  if (remFromList(&newItem))
739  {
740  // Mise a jour graphique du parent
741  pElt->updateGraphicTree();
743  // Suppression de l'entree dans l'arborescence
744  newItem.remove();
745  // Mise a jour de l'arborescence
746  updateList();
747  }
748  else
749  {
750  QMessageBox::warning(this, "Tympan", TR("id_warning_notsuppr"));
751  }
752  }
753  }
754  }
755  else if (ret == highlight)
756  {
757  localise(pElement, pGraphicObject.getRealPointer());
758  }
759  else if (ret == calculer)
760  {
761  getTYApp()->getCalculManager()->updateAcoustic(pElement);
762  }
763  else if (ret == position)
764  {
765  changePos(pElement);
766  }
767  else if (ret == rotation)
768  {
769  changeRotation(pElement);
770  }
771  else if (ret == exportCSV)
772  {
773  exportEXCEL(pElement);
774  }
775  else if (ret == exportXML)
776  {
777  getTYMainWnd()->saveAs(pElement);
778  }
779  else if (ret == exportLib)
780  {
781  TYAddLibraryDialog* pDlg = new TYAddLibraryDialog(this);
782  pDlg->setElement(pElement);
783  pDlg->exec();
784  }
785  else if (ret == importLib)
786  {
787  unsigned int filter = 0;
788  if (dynamic_cast<TYSiteNode*>(pElement) != nullptr)
789  {
790  filter = eSiteFilter;
791  }
792  else if (dynamic_cast<TYInfrastructure*>(pElement) != nullptr)
793  {
794  filter = eInfraFilter;
795  }
796  else if (dynamic_cast<TYBatiment*>(pElement) != nullptr)
797  {
798  filter = eConstructionFilter;
799  }
800  else if (dynamic_cast<TYEtage*>(pElement) != nullptr)
801  {
802  filter = eEtageFilter;
803  }
804  else if (dynamic_cast<TYMachine*>(pElement) != nullptr)
805  {
806  filter = eMachineFilter;
807  }
808  else if (dynamic_cast<TYSource*>(pElement) != nullptr)
809  {
810  filter = eSourceFilter;
811  }
812 
813  importFromLib(filter, pElement);
814  }
815  else if (ret == addSiteXML)
816  {
817  addEltXML("TYSiteNode", pElement);
818  }
819  else if (ret == newSite)
820  {
821  newElt("TYSiteNode", pElement);
822  }
823  else if (ret == addBatimentXML)
824  {
825  addEltXML("TYBatiment", pElement);
826  }
827  else if (ret == newBatiment)
828  {
829  newElt("TYBatiment", pElement);
830  }
831  else if (ret == addMachineXML)
832  {
833  addEltXML("TYMachine", pElement);
834  }
835  else if (ret == newMachine)
836  {
837  newElt("TYMachine", pElement);
838  }
839  else if (ret == addSrcXML)
840  {
841  addEltXML("TYUserSourcePonctuelle", pElement);
842  }
843  else if (ret == newSrc)
844  {
845  newElt("TYUserSourcePonctuelle", pElement);
846  }
847  else if (ret == del)
848  {
849  if (eltItem && !supprime(eltItem))
850  {
851  QMessageBox::warning(this, "Tympan", TR("id_warning_notsuppr"));
852  }
853  }
854  else if (ret == selectAll)
855  {
856  selectOrUnselectAll(static_cast<TYElementListItem*>(item), true);
857  }
858  else if (ret == unselectAll)
859  {
860  selectOrUnselectAll(static_cast<TYElementListItem*>(item), false);
861  }
862  else if (ret == resetDMax)
863  {
864  setDMaxDefault(static_cast<TYElementListItem*>(item));
865  }
866 
867  if (_pSiteNodeRoot != nullptr)
868  {
869  _pSiteNodeRoot->getGraphicObject()->updateTree();
870  getTYMainWnd()->updateModelers(true, true, true);
871  }
872  }
873  }
874 }
875 
877  const bool& checkable)
878 {
879  TYElementListItem* pItem = NULL;
880 
881  if (parent == NULL)
882  {
883  pItem = new TYElementListItem(_pListView, pElement, _pCurrentCalcul, QStringList(), checkable);
884  }
885  else
886  {
887  pItem = new TYElementListItem(parent, pElement, _pCurrentCalcul, QStringList(), checkable);
888  }
889 
890  return pItem;
891 }
892 
893 bool TYSiteFrame::remInInfra(LPTYSiteNode _siteNode, TYElementListItem* item, const char* className)
894 {
895  bool res = false;
896 
897  TYInfrastructure* infra = (TYInfrastructure*)(item->getElement()->getParent());
898 
899  for (unsigned int i = 0; i < _siteNode->getListSiteNode().size(); i++)
900  {
901  LPTYSiteNode pSiteNode = TYSiteNode::safeDownCast(_siteNode->getListSiteNode()[i]->getElement());
902  TYInfrastructure* pInfraChild = pSiteNode->getInfrastructure();
903 
904  if (pInfraChild == infra)
905  {
906  if (strcmp(className, "TYMachine") == 0)
907  {
908  res = pInfraChild->remMachine((TYMachine*)item->getElement().getRealPointer());
909  }
910  else if (strcmp(className, "TYBatiment") == 0)
911  {
912  res = pInfraChild->remBatiment((TYBatiment*)item->getElement().getRealPointer());
913  }
914 #if WITH_NMPB
915  else if (strcmp(className, "TYRoute") == 0)
916  {
917  res = pInfraChild->remRoute((TYRoute*)item->getElement().getRealPointer());
918  }
919 #endif
920  else if (strcmp(className, "TYReseauTransport") == 0)
921  {
922  res = pInfraChild->remResTrans((TYReseauTransport*)item->getElement().getRealPointer());
923  }
924  else if (strcmp(className, "TYUserSourcePonctuelle") == 0)
925  {
926  res = pInfraChild->remSrc((TYUserSourcePonctuelle*)item->getElement().getRealPointer());
927  }
928 
929  return res;
930  }
931 
932  res = remInInfra(pSiteNode, item, className);
933  if (res)
934  {
935  return true;
936  }
937  }
938 
939  return res;
940 }
941 
942 bool TYSiteFrame::remInTopo(LPTYSiteNode _siteNode, TYElementListItem* item, const char* className)
943 {
944  bool res = false;
945 
946  TYTopographie* topo = (TYTopographie*)(item->getElement()->getParent());
947 
948  for (unsigned int i = 0; i < _siteNode->getListSiteNode().size(); i++)
949  {
950  LPTYSiteNode pSiteNode = TYSiteNode::safeDownCast(_siteNode->getListSiteNode()[i]->getElement());
951  TYTopographie* pTopoChild = pSiteNode->getTopographie();
952 
953  if (pTopoChild == topo)
954  {
955  if (strcmp(className, "TYCourbeNiveau") == 0)
956  {
957  res = pTopoChild->remCrbNiv((TYCourbeNiveau*)item->getElement().getRealPointer());
958  }
959  else if (strcmp(className, "TYCoursEau") == 0)
960  {
961  res = pTopoChild->remCrsEau((TYCoursEau*)item->getElement().getRealPointer());
962  }
963  else if (strcmp(className, "TYPlanEau") == 0)
964  {
965  res = pTopoChild->remPlanEau((TYPlanEau*)item->getElement().getRealPointer());
966  }
967  else if (strcmp(className, "TYTerrain") == 0)
968  {
969  res = pTopoChild->remTerrain((TYTerrain*)item->getElement().getRealPointer());
970  }
971 
972  return res;
973  }
974 
975  res = remInTopo(pSiteNode, item, className);
976  if (res)
977  {
978  return true;
979  }
980  }
981 
982  return res;
983 }
984 
986 {
987  TYElement* pElement = item->getElement();
988  if (!pElement)
989  {
990  return false;
991  }
992 
993  return remFromSite(pElement);
994 }
995 
997 {
998  if (!pElement)
999  {
1000  return false;
1001  }
1002 
1003  bool res = false;
1004 
1005  const char* className = pElement->getClassName();
1006  TYElement* pParent = pElement->getParent();
1007 
1008  if (pParent)
1009  {
1011  TYAction* pAction(NULL);
1012 
1013  // Supression d'un site imbrique
1014  if (strcmp(pParent->getClassName(), "TYSiteNode") == 0)
1015  {
1016  TYSiteNode* pSite = TYSiteNode::safeDownCast(pParent);
1017  if (pSite)
1018  {
1019  pAction = new TYRemSiteNodeToSiteNodeAction((LPTYSiteNode&)pElement, pSite, pModeler,
1020  TR("id_contextmenu_delete"));
1021  res = pSite->remSiteNode((LPTYSiteNode&)pElement);
1022  }
1023  }
1024  // Suppression d'un element d'infrastructure
1025  else if (strcmp(pParent->getClassName(), "TYInfrastructure") == 0)
1026  {
1028 
1029  if (pInfra)
1030  {
1031  pAction =
1032  new TYRemElementToInfraAction(pElement, pInfra, pModeler, TR("id_contextmenu_delete"));
1033  if (strcmp(className, "TYMachine") == 0)
1034  {
1035  res = pInfra->remMachine((LPTYMachine&)pElement);
1036  }
1037  else if (strcmp(className, "TYBatiment") == 0)
1038  {
1039  res = pInfra->remBatiment((LPTYBatiment&)pElement);
1040  }
1041 #if WITH_NMPB
1042  else if (strcmp(className, "TYRoute") == 0)
1043  {
1044  res = pInfra->remRoute((LPTYRoute&)pElement);
1045  }
1046 #endif
1047  else if (strcmp(className, "TYReseauTransport") == 0)
1048  {
1049  res = pInfra->remResTrans((LPTYReseauTransport&)pElement);
1050  }
1051  else if (strcmp(className, "TYUserSourcePonctuelle") == 0)
1052  {
1053  res = pInfra->remSrc((LPTYUserSourcePonctuelle&)pElement);
1054  }
1055  }
1056  else
1057  {
1058  res = false;
1059  }
1060  }
1061  // Suppression d'un element de topographie
1062  else if (strcmp(pParent->getClassName(), "TYTopographie") == 0)
1063  {
1064  TYTopographie* pTopo = TYTopographie::safeDownCast(pParent);
1065 
1066  if (pTopo)
1067  {
1068  pAction =
1069  new TYRemElementToTopoAction(pElement, pTopo, pModeler, TR("id_contextmenu_delete"));
1070 
1071  if (strcmp(className, "TYCourbeNiveau") == 0)
1072  {
1073  res = pTopo->remCrbNiv((LPTYCourbeNiveau&)pElement);
1074  }
1075  else if (strcmp(className, "TYCoursEau") == 0)
1076  {
1077  res = pTopo->remCrsEau((LPTYCoursEau&)pElement);
1078  }
1079  else if (strcmp(className, "TYPlanEau") == 0)
1080  {
1081  res = pTopo->remPlanEau((LPTYPlanEau&)pElement);
1082  }
1083  else if (strcmp(className, "TYTerrain") == 0)
1084  {
1085  res = pTopo->remTerrain((LPTYTerrain&)pElement);
1086  }
1087  }
1088  else
1089  {
1090  res = false;
1091  }
1092  }
1093  // Suppression d'un etage de batiment
1094  else if (strcmp(pParent->getClassName(), "TYBatiment") == 0)
1095  {
1096  TYBatiment* pBatiment = TYBatiment::safeDownCast(pParent);
1097  if (pBatiment)
1098  {
1099  res = pBatiment->remAcousticVol((LPTYAcousticVolume&)pElement);
1100  }
1101  else
1102  {
1103  res = false;
1104  }
1105  }
1106  else if (strcmp(pParent->getClassName(), "TYEtage") == 0)
1107  {
1108  TYEtage* pEtage = dynamic_cast<TYEtage*>(pParent);
1109 
1110  if (pEtage != nullptr)
1111  {
1112  if (dynamic_cast<TYMachine*>(pElement) != nullptr)
1113  {
1114  pAction = new TYRemMachineToEtageAction((LPTYMachine&)pElement, pEtage, pModeler,
1115  TR("id_contextmenu_delete"));
1116  res = pEtage->remMachine((LPTYMachine&)pElement);
1117  }
1118  else if (dynamic_cast<TYSource*>(pElement) != nullptr)
1119  {
1120  pAction = new TYRemElementToEtageAction(pElement, pEtage, pModeler,
1121  TR("id_contextmenu_delete"));
1122  res = pEtage->remSource((LPTYUserSourcePonctuelle&)pElement);
1123  }
1124  }
1125  else
1126  {
1127  res = false;
1128  }
1129  }
1130  if (pAction && res && pModeler)
1131  {
1132  pModeler->getActionManager()->addAction(pAction);
1133  }
1134  }
1135 
1136  return res;
1137 }
1138 
1139 void TYSiteFrame::apply(QTreeWidgetItem* item, int col)
1140 {
1141  if (item)
1142  {
1143  TYElementListItem* pCheckItem = (TYElementListItem*)item;
1144  pCheckItem->setCheckState(0, pCheckItem->checkState(0));
1145  }
1146 }
1147 
1148 void TYSiteFrame::openModeler(QTreeWidgetItem* item, int column)
1149 {
1150  TYElementListItem* eltItem = (TYElementListItem*)item;
1151  if ((eltItem) && (eltItem->isElementItem()))
1152  {
1153  if (dynamic_cast<TYSiteNode*>(eltItem->getElement()._pObj) != nullptr)
1154  {
1156  _pListView->collapseItem(item);
1157  }
1158  else if (dynamic_cast<TYBatiment*>(eltItem->getElement()._pObj) != nullptr)
1159  {
1161  }
1162  else if (dynamic_cast<TYMachine*>(eltItem->getElement()._pObj) != nullptr)
1163  {
1165  }
1166  else // Pour tous les autres, affichage des proprietes
1167  {
1168  LPTYElement pElt = eltItem->getElement();
1169  pElt->edit(this);
1170  eltItem->updateContent();
1171  }
1172  }
1173 }
1174 
1176 {
1177  assert(pElement);
1178 
1179  QString fileName = QFileDialog::getSaveFileName(this, "", getTYApp()->getCurrentDirName(), "CSV (*.csv)");
1180 
1181  if (!fileName.isEmpty())
1182  {
1183  if (!fileName.endsWith(".csv"))
1184  {
1185  fileName += ".csv";
1186  }
1187 
1188  std::ofstream ofs;
1189  ofs.open(fileName.toLatin1().constData(), std::ios_base::out);
1190 
1191  if (ofs.is_open())
1192  {
1193  ofs.setf(std::ios::fixed, std::ios::floatfield);
1194  ofs.precision(2);
1195 
1196  // Sauvegarde
1197  // Adaptation au type
1198  LPTYAcousticVolumeNode pVolNode = dynamic_cast<TYAcousticVolumeNode*>(pElement);
1199  if (pVolNode != nullptr)
1200  {
1201  pVolNode->exportCSV(ofs);
1202  }
1203  else
1204  {
1205  TYAcousticLine* pAcLine = dynamic_cast<TYAcousticLine*>(pElement);
1206  if (pAcLine != nullptr)
1207  {
1208  pAcLine->exportCSV(ofs);
1209  }
1210  else
1211  {
1212  TYUserSourcePonctuelle* pSource = dynamic_cast<TYUserSourcePonctuelle*>(pElement);
1213  if (pSource != nullptr)
1214  {
1215  pSource->exportCSV(ofs);
1216  }
1217  else
1218  {
1219  TYSiteNode* pSite = dynamic_cast<TYSiteNode*>(pElement);
1220  if (pSite != nullptr)
1221  {
1222  pSite->exportCSV(ofs);
1223  }
1224  }
1225  }
1226  }
1227  }
1228 
1229  ofs.close();
1230  }
1231 }
1232 
1234 {
1235  assert(pElement);
1236 
1237  TYGeometryNode* pGeoNode = TYGeometryNode::GetGeoNode(pElement);
1238  if (pGeoNode)
1239  {
1240  TYGeometryNode* pTempNode = new TYGeometryNode();
1241  pTempNode->deepCopy(pGeoNode, true);
1242 
1243  TYPositionDialog* pDlg = new TYPositionDialog(pGeoNode, this);
1244  if (pElement->isA("TYSiteNode"))
1245  {
1246  pDlg->setHauteurEnabled(false);
1247  }
1248 
1249  int ret = pDlg->exec();
1250 
1251  // Applique les modificatins si necessaire
1252  if ((ret == QDialog::Accepted) && !(getTYApp()->getCalculManager()->askForResetResultat()))
1253  {
1254  pGeoNode->deepCopy(pTempNode, true);
1255  }
1256 
1257  pDlg = NULL;
1258  delete pTempNode;
1259  pTempNode = NULL;
1260  }
1261 
1262  // Si la machine est dans un batiment, il faut indiquer au batiment qu'il n'est plus a jour
1263  TYElement* pParent = pElement->getParent();
1264  if (pParent && pParent->isA("TYEtage"))
1265  {
1266  pParent = pParent->getParent();
1267  if (pParent)
1268  {
1269  pParent->setIsAcousticModified(true);
1270  pParent->setIsGeometryModified(true);
1271  }
1272  }
1273 }
1274 
1276 {
1277  assert(pElement);
1278  TYGeometryNode* pGeoNode = TYGeometryNode::GetGeoNode(pElement);
1279  if (pGeoNode)
1280  {
1281  OMatrix oldTyMat = pGeoNode->getMatrix();
1282 
1283  // Get rotations from transform matrix
1284  OPoint3D vec;
1285  vec._x = oldTyMat._m[0][1];
1286  vec._y = oldTyMat._m[1][1];
1287  vec._z = oldTyMat._m[2][1];
1288 
1289  // Get X-vector for roll calculation
1290  OPoint3D xv;
1291  xv._x = oldTyMat._m[0][0];
1292  xv._y = oldTyMat._m[1][0];
1293  xv._z = oldTyMat._m[2][0];
1294 
1295  // Calculate PRH (x = pitch, y = roll, z = heading)
1296  OPoint3D rotTmp(-atan2(vec._z, sqrt(vec._x * vec._x + vec._y * vec._y)), xv._z,
1297  -atan2(-vec._x, vec._y));
1298 
1299  // Set up vars
1300  double pitch = RADTODEG(rotTmp._x); // Pitch
1301  double yaw = -RADTODEG(rotTmp._z); // Heading
1302  double roll = RADTODEG(rotTmp._y); // Roll
1303 
1304  OPoint3D rot(pitch, roll, yaw);
1305 
1306  TYRotationDialog* pDlg = new TYRotationDialog(&rot, this);
1307  int ret = pDlg->exec();
1308 
1309  // Applique les modificatins si necessaire
1310  if (ret == QDialog::Accepted)
1311  {
1312  if (getTYApp()->getCalculManager()->askForResetResultat())
1313  {
1314  ORepere3D Repere = pGeoNode->getORepere3D();
1315  ORepere3D oldRepere = Repere;
1316  OMatrix tyMat;
1317  OMatrix tyMatTmpX;
1318  OMatrix tyMatTmpY;
1319  OMatrix tyMatTmpZ;
1320  OMatrix tyMatTmpConcat;
1321 
1322  // On applique la rotation
1323  double dRotateX = rot._x;
1324  double dRotateY = rot._y;
1325  double dRotateZ = rot._z;
1326  if (pDlg->getConcatenateStatus()) //(!pConcatenateCheckBox->isChecked()) //az++
1327  {
1328  dRotateX -= pitch;
1329  dRotateY -= roll;
1330  dRotateZ -= yaw;
1331  }
1332 
1333  tyMatTmpX.setRotationOx(-M_PI * dRotateX / 180);
1334  tyMatTmpY.setRotationOy(-M_PI * dRotateY / 180);
1335  tyMatTmpZ.setRotationOz(M_PI * dRotateZ / 180);
1336 
1337  if (pDlg->getConcatenateStatus()) // az--
1338  {
1339  tyMat = Repere.asMatrix();
1340  tyMatTmpConcat = tyMat;
1341  }
1342 
1343  tyMat = tyMat * tyMatTmpZ * tyMatTmpY * tyMatTmpX * tyMatTmpConcat;
1344 
1345  OPoint3D org = Repere._origin; // On conserve l'origine de depart
1346  Repere.set(tyMat);
1347  Repere._origin = org;
1348 
1349  pGeoNode->setRepere(Repere);
1350  }
1351  }
1352 
1353  pDlg = NULL;
1354  }
1355 }
1356 void TYSiteFrame::localise(TYElement* pElement, TYElementGraphic* pGraphicObject)
1357 {
1358  if (pGraphicObject && pElement)
1359  {
1360  bool bCenterOnLocate = false;
1361  if (TYPreferenceManager::exists(TYDIRPREFERENCEMANAGER, "CenterOnLocate"))
1362  {
1363  bCenterOnLocate = TYPreferenceManager::getBool(TYDIRPREFERENCEMANAGER, "CenterOnLocate");
1364  }
1365  // Toggle le highlight
1366  pGraphicObject->setBoundingBoxVisible(!pGraphicObject->isBoundingBoxVisible());
1367  if (pGraphicObject->isBoundingBoxVisible())
1368  {
1369  QList<QMdiSubWindow*> windows = getTYMainWnd()->getWorkspace()->subWindowList();
1370 
1371  for (int i = 0; i < int(windows.count()); ++i)
1372  {
1373  QWidget* internal_window = windows.at(i)->widget();
1374 
1375  QString qClassName = internal_window->metaObject()->className();
1376  if (qClassName == QString("TYSiteModelerFrame"))
1377  {
1378  TYRenderWindowInteractor* pView = ((TYModelerFrame*)internal_window)->getView();
1379  pView->getRenderer()->addSelectedElement(pElement);
1380  }
1381  }
1382  }
1383 
1384  if (bCenterOnLocate && pGraphicObject->isBoundingBoxVisible())
1385  {
1386  TYGeometryNode* pGeoNode = TYGeometryNode::GetGeoNode(pElement);
1387  if (pGeoNode)
1388  {
1389  ORepere3D repere = pGeoNode->getORepere3D();
1390  QVector3D repereCenter = QVector3D(repere._origin._x, repere._origin._z, -repere._origin._y);
1391  OBox oBox = pGraphicObject->boundingBox();
1392  QVector3D oBoxMin = QVector3D(oBox._min._x, oBox._min._z, -oBox._min._y);
1393  QVector3D oBoxMax = QVector3D(oBox._max._x, oBox._max._z, -oBox._max._y);
1394  QVector3D oBoxCenter = oBoxMin + ((oBoxMax - oBoxMin) / 2);
1395  QVector3D center = repereCenter + oBoxCenter;
1396 
1397  QList<QMdiSubWindow*> windows = getTYMainWnd()->getWorkspace()->subWindowList();
1398 
1399  for (int i = 0; i < int(windows.count()); ++i)
1400  {
1401  QWidget* internal_window = windows.at(i)->widget();
1402 
1403  if (dynamic_cast<TYModelerFrame*>(internal_window) != nullptr)
1404  {
1405  TYModelerFrame* modelerFrame = ((TYModelerFrame*)internal_window);
1406  TYRenderWindowInteractor* pView = modelerFrame->getView();
1407  pView->getActiveCamera()->setTo(center);
1408 
1409  TYElement* pRootTYElement = ((TYModelerFrame*)internal_window)->getElement();
1410  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootTYElement);
1412  pView->getViewport(), pRootTYElement};
1413  pView->getRenderer()->updateDisplayListOverlay(renderContext, pGeoNode,
1414  pRootGeometryNode);
1415  }
1416  }
1417  }
1418  }
1419 
1420  getTYMainWnd()->updateModelers(); // az++ pour localiser
1421 
1422  // il faut un update avant d'enlever l'etat de "locate" sur l'objet
1423  if (!pGraphicObject->isBoundingBoxVisible())
1424  {
1425  QList<QMdiSubWindow*> windows = getTYMainWnd()->getWorkspace()->subWindowList();
1426 
1427  for (int i = 0; i < int(windows.count()); ++i)
1428  {
1429  QWidget* internal_window = windows.at(i)->widget();
1430 
1431  QString qClassName = internal_window->metaObject()->className();
1432  if (qClassName == QString("TYSiteModelerFrame"))
1433  {
1434  getTYMainWnd()->updateModelers(); // az++ pour localiser
1435  TYRenderWindowInteractor* pView = ((TYModelerFrame*)internal_window)->getView();
1436  pView->getRenderer()->removeSelectedElement(pElement);
1437  }
1438  }
1439  }
1440  }
1441 }
1442 
1444 {
1445  bool ret = false;
1446 
1447  if (getTYApp()->getCalculManager()->askForResetResultat())
1448  {
1449  LPTYElement pElt = eltItem->getElement()->getParent();
1450 
1451  // unlocalise if necessary
1452  TYElement* pElement = eltItem->getElement().getRealPointer();
1453  TYElementGraphic* pGraphicObject = pElement->getGraphicObject().getRealPointer();
1454  if ((pGraphicObject != nullptr) && (pGraphicObject->isBoundingBoxVisible()))
1455  {
1456  localise(pElement, pGraphicObject);
1457  }
1458 
1459  // remove item
1460  if (remFromList(eltItem))
1461  {
1462  // Fermeture des modeleurs ouverts
1463  getTYMainWnd()->closeModeler(eltItem->getElement());
1464 
1465  // Mise a jour graphique du parent
1466  pElt->updateGraphicTree();
1468 
1469  // Suppression de l'entree dans l'arborescence
1470  eltItem->remove();
1471  delete eltItem;
1472  eltItem = NULL;
1473 
1474  // Mise a jour de l'arborescence
1475  updateList();
1476 
1477  ret = true;
1478  }
1479  else
1480  {
1481  // deletion failed so relocalise
1482  localise(pElement, pGraphicObject);
1483  ret = false;
1484  }
1485  }
1486  return ret;
1487 }
1488 void TYSiteFrame::importFromLib(const unsigned int& filter, TYElement* pElement)
1489 {
1490  assert(pElement);
1491  TYGetLibraryDialog* pDlg = new TYGetLibraryDialog(filter, this);
1492  pDlg->exec();
1493  LPTYElementArray elements = pDlg->getElements();
1494 
1495  if (getTYApp()->getCalculManager()->askForResetResultat())
1496  {
1497  LPTYElement pElt = NULL;
1498  for (unsigned int i = 0; i < elements.size(); ++i)
1499  {
1500  pElt = elements[i];
1501  addElt(pElement, pElt);
1502  }
1503  }
1504 }
1505 
1506 void TYSiteFrame::addEltXML(const char* className, TYElement* pElement)
1507 {
1508  assert(pElement);
1509 
1510  if (getTYApp()->getCalculManager()->askForResetResultat())
1511  {
1512  std::vector<LPTYElement> tabElem;
1513  getTYMainWnd()->open(tabElem, true); // Avec regeneration de l'ID de l'element
1514 
1515  if (tabElem.size() > 0)
1516  {
1517  TYElement* pElt = NULL;
1518  for (unsigned int i = 0; i < tabElem.size(); i++)
1519  {
1520  pElt = tabElem[i];
1521  if ((pElt != NULL) && (pElt->isA(className)))
1522  {
1523  addElt(pElement, pElt);
1524  }
1525  }
1526  }
1527 
1528  tabElem.clear();
1529  }
1530 }
1531 
1533 {
1534  assert(pElement);
1535  assert(pElt);
1536 
1537  TYSiteNode* pSiteNode = NULL;
1538  TYInfrastructure* pInfra = NULL;
1539  bool reallyAdd = true; // Eviter qu'une machine dans un batiment soit connue du calcul (fenetre "etats")
1541  TYAction* pAction(NULL);
1542 
1543  if (dynamic_cast<TYSiteNode*>(pElt) != nullptr)
1544  {
1545  TYSiteNode* pSite = dynamic_cast<TYSiteNode*>(pElt);
1546  pSiteNode = TYSiteNode::safeDownCast(pElement);
1547 
1548  pSite->setRoot(false); // Le site ajoute n'est pas racine
1549  // At creation time, landtake altitude is set to parent site landtake altitude
1550  pSite->setAltiEmprise(pSiteNode->getAltiEmprise());
1551 
1552  pSiteNode->addSiteNode(pSite);
1553  if (_pCurrentCalcul)
1554  {
1556  }
1557 
1558  // Action
1559  pAction = new TYAddSiteNodeToSiteNodeAction(pSite, pSiteNode, pModeler, TR("id_contextmenu_newsite"));
1560  pSiteNode->updateGraphicTree();
1561  pSiteNode->setIsGeometryModified(true);
1562  }
1563  else if (dynamic_cast<TYBatiment*>(pElt) != nullptr)
1564  {
1565  TYBatiment* pBatiment = TYBatiment::safeDownCast(pElt);
1566 
1567  if (dynamic_cast<TYSiteNode*>(pElement) != nullptr)
1568  {
1569  pInfra = TYSiteNode::safeDownCast(pElement)->getInfrastructure();
1570  }
1571  else
1572  {
1573  pInfra = TYInfrastructure::safeDownCast(pElement);
1574  }
1575 
1576  if (pInfra)
1577  {
1578  pInfra->addBatiment(pBatiment, getDefaultRepere(pInfra));
1579  // Action
1580  pAction =
1581  new TYAddElementToInfraAction(pBatiment, pInfra, pModeler, TR("id_contextmenu_newbatiment"));
1582  }
1583  }
1584  else if (dynamic_cast<TYMachine*>(pElt) != nullptr)
1585  {
1586  TYMachine* pMachine = TYMachine::safeDownCast(pElt);
1587 
1588  if (dynamic_cast<TYEtage*>(pElement) != nullptr)
1589  {
1590  TYEtage* pEtage = TYEtage::safeDownCast(pElement);
1591  if (pEtage)
1592  {
1593  pEtage->addMachine(pMachine);
1594 
1595  // When adding a machine to a 'Batiment', set this 'Batiment' emissive in the 'Etat' of the
1596  // 'Calcul'
1597  setBatimentParentEmissive(pEtage);
1598 
1599  pEtage->updateGraphicTree();
1600  reallyAdd = false;
1601  // Action
1602  pAction = new TYAddMachineToEtageAction(pMachine, pEtage, pModeler,
1603  TR("id_contextmenu_newmachine"));
1604  }
1605  }
1606  else
1607  {
1608  if (dynamic_cast<TYSiteNode*>(pElement) != nullptr)
1609  {
1610  pInfra = TYSiteNode::safeDownCast(pElement)->getInfrastructure();
1611  }
1612  else
1613  {
1614  pInfra = TYInfrastructure::safeDownCast(pElement);
1615  }
1616 
1617  if (pInfra)
1618  {
1619  pInfra->addMachine(pMachine, getDefaultRepere(pInfra));
1620  // Action
1621  pAction = new TYAddElementToInfraAction(pMachine, pInfra, pModeler,
1622  TR("id_contextmenu_newmachine"));
1623  }
1624  }
1625  }
1626  else if (dynamic_cast<TYUserSourcePonctuelle*>(pElt) != nullptr)
1627  {
1629 
1630  if (dynamic_cast<TYEtage*>(pElement) != nullptr)
1631  {
1632  TYEtage* pEtage = TYEtage::safeDownCast(pElement);
1633  if (pEtage)
1634  {
1635  pEtage->addSource(pSource);
1636 
1637  // When adding a source to a 'Batiment', set this 'Batiment' emissive in the 'Etat' of the
1638  // 'Calcul'
1639  setBatimentParentEmissive(pEtage);
1640 
1641  pEtage->updateGraphicTree();
1642  reallyAdd = false;
1643  // Action
1644  pAction =
1645  new TYAddElementToEtageAction(pSource, pEtage, pModeler, TR("id_contextmenu_newsource"));
1646  }
1647  }
1648  else
1649  {
1650  if (dynamic_cast<TYSiteNode*>(pElement) != nullptr)
1651  {
1652  pInfra = TYSiteNode::safeDownCast(pElement)->getInfrastructure();
1653  }
1654  else
1655  {
1656  pInfra = TYInfrastructure::safeDownCast(pElement);
1657  }
1658 
1659  if (pInfra)
1660  {
1661  pInfra->addSrc(pSource);
1662  // Action
1663  pAction =
1664  new TYAddElementToInfraAction(pSource, pInfra, pModeler, TR("id_contextmenu_newsource"));
1665  }
1666  }
1667  }
1668 
1669  if (pAction && pModeler)
1670  {
1671  pModeler->getActionManager()->addAction(pAction);
1672  }
1673 
1674  if (_pCurrentCalcul)
1675  {
1676  if (reallyAdd)
1677  {
1679  }
1681  _pSiteNodeRoot->getGraphicObject()->update(true);
1682  updateList();
1684  }
1685 }
1686 
1688 {
1689  // By default, set building z coordinate to site altitude
1690  TYSiteNode* pSiteNode = nullptr;
1691  TYRepere repere = TYRepere{};
1692  pSiteNode = dynamic_cast<TYSiteNode*>(pInfra->getParent());
1693  assert(pSiteNode != nullptr);
1694  repere._origin._z = pSiteNode->getAltiEmprise();
1695  return repere;
1696 }
1697 
1698 void TYSiteFrame::newElt(const char* className, TYElement* pElement)
1699 {
1700  TYElement* pElt = NULL;
1701 
1702  try
1703  {
1704  pElt = dynamic_cast<TYElement*>(TYElement::findAndClone(className));
1705  }
1706  catch (tympan::invalid_data&)
1707  {
1708  }
1709 
1710  assert(pElt);
1711 
1712  // If the new element is a site
1713  if ((dynamic_cast<TYSiteNode*>(pElt) != nullptr))
1714  {
1715  // We add a site even if it's empty
1716  if (pElement)
1717  {
1718  addElt(pElement, pElt);
1719  }
1720  getTYMainWnd()->makeModeler(pElt);
1721  if (_pCurrentCalcul)
1722  {
1725  _pSiteNodeRoot->getGraphicObject()->update(true);
1726  updateList();
1728  }
1729  }
1730 
1731  // If the new element is an Acoustic Volume
1732  else if (dynamic_cast<TYAcousticVolumeNode*>(pElt) != nullptr)
1733  {
1734  if (pElement)
1735  {
1736  addElt(pElement, pElt);
1737  }
1738 
1739  // We add the element to the frame only if a volume was created in the modeler
1740  if (!getTYMainWnd()->makeModeler(pElt))
1741  {
1742  // If the modeler is empty, then pElt has already been removed and its parent site is invalid
1743  if (dynamic_cast<TYAcousticVolumeNode*>(pElt)->getNbChild() == 0)
1744  {
1746  updateList();
1747  }
1748  else if (remFromSite(pElt))
1749  {
1750  // Mise a jour graphique du parent
1751  pElement->updateGraphicTree();
1753  // Mise a jour de l'arborescence
1754  updateList();
1755  }
1756  else
1757  {
1758  QMessageBox::warning(this, "Tympan", TR("id_warning_notsuppr"));
1759  }
1760  }
1761  }
1762 
1763  // If the new element is a punctual source
1764  else
1765  { // We add the element to the frame only if its parameters are accepted by the user
1766  if (pElt->edit(this) == QDialog::Accepted)
1767  {
1768  if (pElement)
1769  {
1770  addElt(pElement, pElt);
1771  }
1772  }
1773  }
1774 }
1775 
1776 void TYSiteFrame::selectOrUnselectAll(TYElementListItem* item, const bool& bSelect)
1777 {
1778  if (getTYApp()->getCalculManager()->askForResetResultat())
1779  {
1780  bool on = bSelect;
1781 
1782  for (int i = 0; (i < item->childCount()) && _pCurrentCalcul; i++)
1783  {
1784  static_cast<TYElementListItem*>(item->child(i))->setOn(on, false);
1785  }
1786 
1787  _pSiteNodeRoot->getGraphicObject()->update(true);
1788  getTYMainWnd()->updateModelers(false, false);
1789  }
1790 }
1791 
1793 {
1794  TYElement* pElement = NULL;
1795  TYCourbeNiveau* pCourbe = NULL;
1796  TYPlanEau* pPlanEau = NULL;
1797 
1798  for (int i = 0; i < item->childCount(); i++)
1799  {
1800  pElement = static_cast<TYElementListItem*>(item->child(i))->getElement();
1801 
1802  if (pElement->isA("TYCourbeNiveau"))
1803  {
1804  pCourbe = TYCourbeNiveau::safeDownCast(pElement);
1805  pCourbe->setIsDMaxDefault(false);
1806  }
1807  else if (pElement->isA("TYPlanEau"))
1808  {
1809  pPlanEau = TYPlanEau::safeDownCast(pElement);
1810  pPlanEau->setIsDMaxDefault(false);
1811  }
1812  }
1813 
1814  _pSiteNodeRoot->getGraphicObject()->update(true);
1815  getTYMainWnd()->updateModelers(false, false);
1817 }
1818 
1820 {
1821  TYBatiment* pBatimentParent = TYBatiment::safeDownCast(pEtage->getParent());
1822  if (pBatimentParent)
1823  {
1825  mapEtat[pBatimentParent] = true;
1826  pBatimentParent->setIsRayonnant(true);
1827  }
1828 }
double RADTODEG(double a)
Converts an angle from radians to degrees.
Definition: 3d.h:137
fichier contenant differents types d'actions (fichier header)
Boite de dialogue pour l'ajout d'un element dans la bibliotheque (fichier header)
TYApplication * getTYApp()
Retourne le pointeur sur l'application.
TYMainWindow * getTYMainWnd()
Retourne le pointeur sur la fenetre principale.
pour l'application Tympan (fichier header)
std::map< TYElement *, bool > TYMapPtrElementBool
Etat d'utilisation des elements (utilise par les calculs)
Definition: TYDefines.h:376
Frame pour les messages de retour (fichier header)
std::vector< LPTYElement > LPTYElementArray
Definition: TYElement.h:344
#define TYDIRPREFERENCEMANAGER
Definition: TYElement.h:51
Boite de dialogue pour la lecture d'un element dans la bibliotheque (fichier header)
Widget pour lister les elements de la bibilotheque (fichier header)
@ eMachineFilter
@ eSourceFilter
@ eSiteFilter
@ eConstructionFilter
@ eEtageFilter
@ eInfraFilter
Fenetre principale de l'application Tympan (fichier header)
Classe generique pour une fenetre de modeleur (fichier header)
boite de dialogue pour la gestion de la position selon les modes 'moving', 'rotation',...
@ Display
The current render is intended to be displayed on screen.
@ Overlay
The current render pass is for overlay elements.
Le role de cette classe est limite a emettre des signaux pouvant etre utilise pour interagir sur le r...
Boite de dialogue pour la saisie de la l'angle des objets (fichier header)
const char * name
#define IMG(id)
Definition: TYSiteFrame.cpp:58
#define TR(id)
Definition: TYSiteFrame.cpp:57
Frame pour la gestion de site (fichier header)
Helper pour la gestion des arbres Site et Projet (fichier header)
The box class.
Definition: 3d.h:1346
OPoint3D _min
Minimal coordinates of the OBox.
Definition: 3d.h:1423
OPoint3D _max
Maximal coordinates of the OBox.
Definition: 3d.h:1424
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
void setTo(const QVector3D &_to)
Definition: OGLCamera.cpp:281
The 4x4 matrix class.
Definition: 3d.h:625
int setRotationOz(double a)
Update a rotation matrix (Oz axis).
Definition: 3d.cpp:688
int setRotationOy(double a)
Update a rotation matrix (Oy axis).
Definition: 3d.cpp:676
int setRotationOx(double a)
Update a rotation matrix (Ox axis).
Definition: 3d.cpp:664
double _m[4][4]
The 4x4 matrix array.
Definition: 3d.h:974
The 3D point class.
Definition: 3d.h:487
virtual const char * getClassName() const
Definition: TYElement.h:248
static OPrototype * safeDownCast(OPrototype *pObject)
Definition: TYElement.cpp:71
static OPrototype * findAndClone(const char *className)
Definition: TYElement.cpp:37
bool isA(const char *className) const
Definition: TYElement.cpp:65
3D frame with a point and 3 vectors.
Definition: 3d.h:1263
OPoint3D _origin
The origin point.
Definition: 3d.h:1331
Frame class.
Definition: Repere.h:26
void set(vec3 _U, vec3 _V, vec3 _W, vec3 _O)
Set global coordinates of local axis U,V,W and origin O.
Definition: Repere.h:41
T * getRealPointer()
Definition: smartptr.h:291
T * _pObj
The real pointer, must derived IRefCount.
Definition: smartptr.h:307
LPTYAttenuateur getAtt()
void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
virtual void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
virtual void setIsRayonnant(bool rayonnant=true, bool recursif=true)
LPTYAcousticVolume getAcousticVol(int index)
bool remAcousticVol(const LPTYAcousticVolumeGeoNode pAccVolGeoNode)
TYTabAcousticVolumeGeoNode & getTabAcousticVol()
void addAction(TYAction *pAction)
Ajoute une nouvelle action a l'historique.
Definit une action, necessaire pour la gestion de l'undo.
Definition: TYAction.h:37
ajout d'un element a un etage
Definition: TYActions.h:271
Ajout d'un element a une infrastructure.
Definition: TYActions.h:399
Boite de dialogue pour l'ajout d'un element dans la bibliotheque.
void setElement(LPTYElement element)
Acces a l'element.
ajout d'une machine a un etage
Definition: TYActions.h:209
Action d'ajout d'un site a un ensemble de sites.
Definition: TYActions.h:990
LPTYProjet getCurProjet()
Set/Get du projet courant.
TYMainWindow * getMainWnd()
Get de la fenetre principale.
Definition: TYApplication.h:81
TYCalculManager * getCalculManager()
Get du gestionnaire de calculs.
Definition: TYApplication.h:99
bool updateAcoustic(TYElement *pElement)
Appelle la methode de calcul acoustique du volume node passe.
void getCalculElements(LPTYSiteNode pSite)
Recover all the elements of the scene which take part in the calculation.
Definition: TYCalcul.cpp:1038
TYMapPtrElementBool & getEmitAcVolNode()
Get array containing the state of each volumeNode in transmission.
Definition: TYCalcul.h:304
bool addToSelection(TYUUID id)
Adds the item to the selection of this Calculation.
Definition: TYCalcul.cpp:873
void setIsDMaxDefault(const bool &etat)
classe graphique pour un element de base
OBox boundingBox() const
void setBoundingBoxVisible(bool state=true)
bool isBoundingBoxVisible() const
Frame pour les messages de retour.
bool isElementItem()
Indique si un element est associe a cet item.
void updateContent()
Mets a jour le contenu des colonnes.
LPTYElement getElement()
Retourne l'element associe a cet item.
void remove()
Supprime l'item de la liste.
void setCheckState(int column, Qt::CheckState state)
Reimplementation.
TYElement * getParent() const
Definition: TYElement.h:706
static void setIsSavedOk(const bool &toSave)
Definition: TYElement.h:914
virtual void setIsAcousticModified(bool isModified)
Definition: TYElement.cpp:248
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
TYTabUserSourcePonctuelleGeoNode & getTabSources()
Definition: TYEtage.h:348
TYTabMachineGeoNode & getTabMachine()
Definition: TYEtage.h:281
LPTYUserSourcePonctuelle getSource(int index)
Definition: TYEtage.h:398
bool remSource(const LPTYUserSourcePonctuelleGeoNode pSourceGeoNode)
Definition: TYEtage.cpp:1278
bool addSource(LPTYUserSourcePonctuelleGeoNode pSourceGeoNode)
Definition: TYEtage.cpp:1239
LPTYMachine getMachine(int index)
Definition: TYEtage.h:331
bool addMachine(LPTYMachineGeoNode pMachineGeoNode)
Definition: TYEtage.cpp:1051
bool getClosed()
Definition: TYEtage.h:206
bool remMachine(const LPTYMachineGeoNode pMachineGeoNode)
Definition: TYEtage.cpp:1090
const ORepere3D & getORepere3D() const
TYElement * getElement() const
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
OMatrix getMatrix() const
static TYGeometryNode * GetGeoNode(TYElement *pElement)
void setRepere(const ORepere3D &repere)
Boite de dialogue pour la lecture d'un element dans la bibliotheque.
LPTYElementArray getElements()
TYTabBatimentGeoNode & getListBatiment()
bool remSrc(const LPTYUserSourcePonctuelle pSrc)
LPTYUserSourcePonctuelleGeoNode getSrc(int index)
LPTYMachineGeoNode getMachine(int index)
LPTYReseauTransport getResTrans(int index)
TYTabUserSourcePonctuelleGeoNode & getSrcs()
LPTYBatimentGeoNode getBatiment(int index)
TYTabReseauTransportGeoNode & getListResTrans()
bool addBatiment(LPTYBatimentGeoNode pBatimentGeoNode)
bool addMachine(LPTYMachineGeoNode pMachineGeoNode)
bool addSrc(LPTYUserSourcePonctuelle pSrc)
bool remResTrans(const LPTYReseauTransportGeoNode pResTransGeoNode)
bool remMachine(const LPTYMachine pMachine)
bool remBatiment(const LPTYBatimentGeoNode pBatimentGeoNode)
TYTabMachineGeoNode & getListMachine()
void makeSiteModeler(LPTYSiteNode pSite=NULL)
bool makeBatimentModeler(LPTYBatiment pBatiment=NULL)
bool makeModeler(TYElement *pElt)
void updateModelers(bool clipping=true, bool axesAndGrid=true, bool displayList=true)
bool makeMachineModeler(LPTYMachine pMachine=NULL)
QMdiArea * getWorkspace()
Definition: TYMainWindow.h:63
void closeModeler(const TYElement *pElement)
TYModelerFrame * getCurrentModeler()
Definition: TYMainWindow.h:68
Generic class for a modeler window.
TYRenderWindowInteractor * getView()
TYActionManager * getActionManager()
void removeSelectedElement(TYElement *pElement)
void updateDisplayListOverlay(TYRenderContext &renderContext, TYGeometryNode *pElement, TYGeometryNode *pDansCeRepere)
void addSelectedElement(TYElement *pElement)
void setIsDMaxDefault(const bool &etat)
Definition: TYPlanEau.h:173
boite de dialogue pour la gestion de la position selon les modes 'moving', 'rotation',...
void setHauteurEnabled(const bool &enable)
Get/Set de l'etat de la zone de saisie des hauteurs.
classe de definition d'un projet.
Definition: TYProjet.h:45
LPTYSiteNode getSite()
Get du site.
Definition: TYProjet.h:169
suppression d'un element a un etage
Definition: TYActions.h:303
Suppression d'un element a une infrastructure.
Definition: TYActions.h:431
Suppression d'un element a la topographie.
Definition: TYActions.h:368
suppression d'une machine a un etage
Definition: TYActions.h:239
Action de suppression d'un site a un ensemble de sites.
Definition: TYActions.h:1021
Le role de cette classe est limite a emettre des signaux pouvant etre utilise pour interagir sur le r...
const TYRenderViewport & getViewport() const
TYOpenGLRenderer * getRenderer()
OGLCamera * getActiveCamera()
Boite de dialogue pour la saisie de la l'angle des objets.
bool getConcatenateStatus()
Retourne l'etat du checkbox de concatenation des rotations.
void clear()
Definition: TYSiteFrame.h:64
void newElt(const char *className, TYElement *pElement)
void openModeler(QTreeWidgetItem *item, int column)
void changeRotation(TYElement *pElement)
virtual ~TYSiteFrame()
Definition: TYSiteFrame.cpp:86
bool remFromList(TYElementListItem *item)
void updateList()
void setBatimentParentEmissive(const TYEtage *pEtage)
Rend émissif, dans l'état du calcul courant, le bâtiment parent de l'étage passé en paramètre.
TYSiteFrame(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=QFlag(0))
Definition: TYSiteFrame.cpp:60
void selectOrUnselectAll(TYElementListItem *item, const bool &bSelect)
void addEltXML(const char *className, TYElement *pElement)
LPTYCalcul _pCurrentCalcul
L'Id du calcul courant.
Definition: TYSiteFrame.h:266
TYRepere getDefaultRepere(TYInfrastructure *pInfra)
Returns default repere with z coordinate corresponding to site altitude This method is used when addi...
void setDMaxDefault(TYElementListItem *item)
void changePos(TYElement *pElement)
LPTYSiteNode _pSiteNodeRoot
Le site node root.
Definition: TYSiteFrame.h:263
void localise(TYElement *pElement, TYElementGraphic *pGraphicObject)
void addElt(TYElement *pElement, TYElement *pElt)
bool supprime(TYElementListItem *eltItem)
void setSiteNodeRoot(LPTYSiteNode pSiteNode)
Definition: TYSiteFrame.cpp:91
bool remFromSite(TYElement *pElement)
TYElementListItem * addToList(LPTYSiteNode pElement, TYElementListItem *parent=NULL)
void exportEXCEL(TYElement *pElement)
TYElementListItem * addEltToList(LPTYElement pElement, TYElementListItem *parent=NULL, const bool &chekable=false)
void importFromLib(const unsigned int &filter, TYElement *pElement)
virtual void contextMenuEvent(QContextMenuEvent *e)
QTreeWidget * _pListView
Definition: TYSiteFrame.h:260
bool remInTopo(LPTYSiteNode _siteNode, TYElementListItem *item, const char *className)
bool remInInfra(LPTYSiteNode _siteNode, TYElementListItem *item, const char *className)
void apply(QTreeWidgetItem *item, int col)
const double getAltiEmprise() const
Definition: TYSiteNode.h:141
void setAltiEmprise(const double &altiEmprise)
Get/Set de l'altitude associee a la courbe de niveau.
Definition: TYSiteNode.h:136
LPTYTopographie getTopographie()
Definition: TYSiteNode.h:149
virtual void setIsGeometryModified(bool isModified)
Definition: TYSiteNode.cpp:501
bool remSiteNode(const LPTYSiteNodeGeoNode pSiteNodeGeoNode)
LPTYInfrastructure getInfrastructure()
Definition: TYSiteNode.h:174
virtual void updateAcoustique(const bool &force=false)
void update(const bool &force=false)
void setRoot(bool b)
Definition: TYSiteNode.h:329
TYTabSiteNodeGeoNode & getListSiteNode()
Definition: TYSiteNode.h:346
bool addSiteNode(LPTYSiteNodeGeoNode pSiteNodeGeoNode)
virtual void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
bool getRoot() const
Definition: TYSiteNode.h:321
TYTerrain * getDefTerrain()
LPTYCourbeNiveau getCrbNiv(int index)
TYTabPlanEauGeoNode & getListPlanEau()
bool remCrbNiv(const LPTYCourbeNiveauGeoNode pCrbNivGeoNode)
LPTYCoursEau getCrsEau(int index)
bool remPlanEau(const LPTYPlanEauGeoNode pPlanEauGeoNode)
TYTabCoursEauGeoNode & getListCrsEau()
LPTYPlanEau getPlanEau(int index)
LPTYTerrain getTerrain(int index)
bool remCrsEau(const LPTYCoursEauGeoNode pCoursEauGeoNode)
TYTabCourbeNiveauGeoNode & getListCrbNiv()
TYTabTerrainGeoNode & getListTerrain()
bool remTerrain(const LPTYTerrainGeoNode pTerGeoNode)
static void capture(QTreeWidget *tree, TYTreeViewState &outState)
Capture l'état complet (expansions + scroll) du QTreeWidget.
static void apply(QTreeWidget *tree, const TYTreeViewState &state)
Applique l'état complet (expansions + scroll) au QTreeWidget.
void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
#define M_PI
Pi.
Definition: color.cpp:25
The base exception class for errors due to invalid data.
Definition: exceptions.h:75