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