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