Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSiteNode.h
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 
16 /*
17  *
18  */
19 
20 #ifndef __TY_SITENODE__
21 #define __TY_SITENODE__
22 
26 
28 typedef enum
29 {
32  GPS
34 
40 typedef std::vector<LPTYSiteNodeGeoNode> TYTabSiteNodeGeoNode;
41 
42 class TYSiteNode : public TYElement
43 {
47 
48 
51  TYSiteNode();
55  TYSiteNode(const TYSiteNode& other);
59  virtual ~TYSiteNode();
60 
62  virtual TYSiteNode& operator=(const TYSiteNode& other);
64  virtual bool operator==(const TYSiteNode& other) const;
66  virtual bool operator!=(const TYSiteNode& other) const;
67 
76  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
77 
78  virtual std::string toString() const;
79 
80  virtual DOM_Element toXML(DOM_Element& domElement);
81  virtual int fromXML(DOM_Element domElement);
82 
90  virtual void getChilds(LPTYElementArray& childs, bool recursif = true);
91 
92  virtual void setIsGeometryModified(bool isModified);
93 
97  void purge()
98  {
99  _listSiteNode.clear();
100  }
101 
103 
107  {
108  return _pProjet;
109  }
110  const TYProjet* getProjet() const
111  {
112  return _pProjet;
113  }
114 
118  void setProjet(const LPTYProjet pProjet);
119 
124  {
125  return _bEmpriseAsCrbNiv;
126  }
131  {
132  _bEmpriseAsCrbNiv = b;
133  }
134 
136  void setAltiEmprise(const double& altiEmprise)
137  {
138  _altiEmprise = altiEmprise;
140  }
141  const double getAltiEmprise() const
142  {
143  return _altiEmprise;
144  }
145 
150  {
151  return _pTopographie;
152  }
157  {
158  return _pTopographie;
159  }
160 
164  void setTopographie(const LPTYTopographie pTopo)
165  {
166  _pTopographie = pTopo;
167  _pTopographie->setParent(this);
168  setIsGeometryModified(true);
169  }
170 
175  {
176  return _pInfrastructure;
177  }
182  {
183  return _pInfrastructure;
184  }
189  {
190  _pInfrastructure = pInfra;
192  setIsGeometryModified(true);
193  }
194 
198  bool getUseTopoFile() const
199  {
200  return _useTopoFile;
201  }
205  void setUseTopoFile(bool flag)
206  {
207  _useTopoFile = flag;
208  }
209 
213  QString getTopoFile() const
214  {
215  return _topoFile;
216  }
220  void setTopoFile(const QString& fileName)
221  {
222  _topoFile = fileName;
223  }
227  QString getTopoFileExtension() const
228  {
229  return _topoFileExtension;
230  }
234  void setTopoFileExtension(const QString& ext)
235  {
236  _topoFileExtension = ext;
237  }
241  QString getTopoFileName() const
242  {
243  return _topoFileName;
244  }
248  void setTopoFileName(const QString& name)
249  {
251  }
255  static const QString& getTopoFilePath();
259  static void setTopoFilePath(const QString& path);
260 
266  void loadTopoFile(const QString& fileName);
267  void loadTopoFile();
268 
272  const QString& getMeshFilePath();
276  void setMeshFilePath(const QString& path);
277 
281  float getEchelle() const
282  {
283  return _echelle;
284  }
288  void setEchelle(float e)
289  {
290  _echelle = e;
291  setIsGeometryModified(true);
292  }
293 
298  {
299  return _orientation;
300  }
305  {
306  _orientation = seg;
307  setIsGeometryModified(true);
308  }
309 
314  {
315  return _position;
316  }
317 
321  bool getRoot() const
322  {
323  return _root;
324  }
325 
329  void setRoot(bool b)
330  {
331  _root = b;
332  }
333 
338  {
339  _position = pt;
340  setIsGeometryModified(true);
341  }
342 
347  {
348  return _listSiteNode;
349  }
350 
355  {
356  return _listSiteNode;
357  }
358 
362  void setEmprise(TYTabPoint points)
363  {
364  _pTopographie->setEmprise(points);
365  }
366 
372  bool addSiteNode(LPTYSiteNodeGeoNode pSiteNodeGeoNode);
373 
379  bool addSiteNode(LPTYSiteNode pSiteNode);
380 
384  bool remSiteNode(const LPTYSiteNodeGeoNode pSiteNodeGeoNode);
385 
389  bool remSiteNode(const LPTYSiteNode pSiteNode);
390 
395  bool remSiteNode(QString idSiteNode);
396 
405 
410  {
411  _listSiteNode = list;
412  setIsGeometryModified(true);
413  }
414 
418  virtual void setChildsNotInCurrentCalcul();
419 
428  TYTabSiteNodeGeoNode collectSites(bool include = true) const;
429 
430  // 3. -ELEMENT PROPRE AU CALCUL
445 
451  virtual void reparent();
452 
461  virtual void updateCurrentCalcul(TYListID& listID, bool recursif = true);
462 
466  virtual bool addToCalcul();
467 
471  virtual bool remFromCalcul();
472 
481  virtual bool updateAltimetrie(QString resultMeshFilePath);
482 
483  void uuid2tysol(const std::deque<std::string>& material_ids, std::deque<LPTYSol>& materials);
484 
485 protected:
495  virtual void do_updateAltimetrie(QString resultMeshFilePath);
496 
497 public:
498  /*
499  * Reads a mesh from 'filename' ply file, and puts it in 'points', 'triangles'
500  * and 'materials'.
501  *
502  * @return true if operations succeeds else false
503  */
504  bool readMesh(std::deque<OPoint3D>& points, std::deque<OTriangle>& triangles,
505  std::deque<LPTYSol>& materials, const QString& meshFilePath);
506 
511  virtual void updateAltiInfra();
512 
516  virtual void updateAcoustique(const bool& force = false);
517 
521  void update(const bool& force = false);
522 
527  bool update(TYElement* pElem);
528 
533  // XXX The process is being rewritten and this function removed
534  // virtual TYTabPoint collectPointsForAltimetrie() const;
535 
539  double getDelaunay();
540 
545  void getListFaces(TYTabAcousticSurfaceGeoNode& tabFaces, unsigned int& nbFaceInfra,
546  std::vector<bool>& EstUnIndexDeFaceEcran) const;
547  void getListFacesWithoutFloor(TYTabAcousticSurfaceGeoNode& tabFaces, unsigned int& nbFaceInfra,
548  std::vector<bool>& EstUnIndexDeFaceEcran,
549  std::vector<std::pair<int, int>>& indices, std::vector<int>& etages) const;
550 
558  void getFacesOnGround(std::map<TYUUID, std::deque<TYTabPoint3D>>& contours) const;
559 
565  void groundBasedFaces(const TYTabAcousticVolumeGeoNode& volumes, const OMatrix& global_matrix,
566  std::map<TYUUID, std::deque<TYTabPoint3D>>& contours) const;
567 
570  {
571  return _SIGType;
572  }
573  const int getSIGType() const
574  {
575  return _SIGType;
576  }
577  void setSIGType(int SIGType)
578  {
579  _SIGType = (systemSIG)SIGType;
580  }
581 
583  double getSIG_X()
584  {
585  return _SIG_X;
586  }
587  const double getSIG_X() const
588  {
589  return _SIG_X;
590  }
591  void setSIG_X(const double& SIG_X)
592  {
593  _SIG_X = SIG_X;
594  }
595 
596  double getSIG_Y()
597  {
598  return _SIG_Y;
599  }
600  const double getSIG_Y() const
601  {
602  return _SIG_Y;
603  }
604  void setSIG_Y(const double& SIG_Y)
605  {
606  _SIG_Y = SIG_Y;
607  }
608 
609  double getSIG_OFFSET()
610  {
611  return _SIG_OFFSET;
612  }
613  const double getSIG_OFFSET() const
614  {
615  return _SIG_OFFSET;
616  }
617  void setSIG_OFFSET(const double& SIG_OFFSET)
618  {
619  _SIG_OFFSET = SIG_OFFSET;
620  }
621 
623  virtual void exportCSV(std::ofstream& ofs);
624 
625  /* Return the site altimetry (retrieved from the rootsite of the hierarchy,
626  * which can be the current site node or one of its parents
627  */
629 
630  /* Transform matrix allowing to move the site to a global frame.
631  * If the site is the root site, this matrix should be equal to the identity
632  * matrix.
633  */
634  OMatrix getGlobalMatrix() const;
635 
636 protected:
646  void appendSite(LPTYSiteNode pSiteFrom, const OMatrix& matrix, LPTYSiteNode pSiteTo);
647 
648  // Membres
649 private:
651  static QString _topoFilePath;
652 
653 protected:
656 
659 
661  double _altiEmprise;
662 
665 
668 
671 
673  QString _topoFileName;
674 
676  QString _meshFilePath;
677 
679  QString _topoFile;
680 
683 
685  float _echelle;
690 
692  unsigned int _nbFaceInfra;
693 
694  unsigned int _nbFaces; // Nombre de faces total
695 
697  bool _root;
698 
701 
702  double _SIG_X;
703  double _SIG_Y;
704  double _SIG_OFFSET;
705 
708 
711 };
712 
713 #endif // __TY_SITENODE__
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::vector< LPTYAcousticFaceSetGeoNode > TYTabAcousticVolumeGeoNode
Collection de noeuds geometriques de type TYAcousticFaceSet.
std::vector< LPTYAcousticSurfaceGeoNode > TYTabAcousticSurfaceGeoNode
Collection de noeuds geometriques de type TYAcousticSurface.
class OGenID TYUUID
Definition: TYDefines.h:59
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
std::list< TYUUID > TYListID
Collection d'identifiants.
Definition: TYDefines.h:331
#define TY_EXT_GRAPHIC_DECL_ONLY(classname)
Definition: TYElement.h:430
std::vector< LPTYElement > LPTYElementArray
Definition: TYElement.h:344
#define OPROTODECL(classname)
Definition: TYElement.h:64
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:385
const char * name
std::vector< bool > EstUnIndexDeFaceEcran
systemSIG
Systeme SIG.
Definition: TYSiteNode.h:29
@ GPS
Definition: TYSiteNode.h:32
@ TYMPAN
Definition: TYSiteNode.h:30
@ LAMBERTIIe
Definition: TYSiteNode.h:31
TYGeometryNode TYSiteNodeGeoNode
Noeud geometrique de type TYSiteNode.
Definition: TYSiteNode.h:36
std::vector< LPTYSiteNodeGeoNode > TYTabSiteNodeGeoNode
Collection de noeuds geometriques de type TYSiteNode.
Definition: TYSiteNode.h:40
SmartPtr< TYSiteNodeGeoNode > LPTYSiteNodeGeoNode
Smart Pointer sur TYSiteNodeGeoNode.
Definition: TYSiteNode.h:38
The 4x4 matrix class.
Definition: 3d.h:625
void setParent(TYElement *pParent)
Definition: TYElement.h:690
classe de definition d'un projet.
Definition: TYProjet.h:45
TYTabSiteNodeGeoNode collectSites(bool include=true) const
const double getSIG_OFFSET() const
Definition: TYSiteNode.h:613
const double getAltiEmprise() const
Definition: TYSiteNode.h:141
double _SIG_Y
Definition: TYSiteNode.h:703
const LPTYInfrastructure getInfrastructure() const
Definition: TYSiteNode.h:181
void setProjet(const LPTYProjet pProjet)
Definition: TYSiteNode.cpp:557
double getSIG_X()
Get/Set des coordonnees dans le repere du SIG.
Definition: TYSiteNode.h:583
QString getTopoFile() const
Definition: TYSiteNode.h:213
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYSiteNode.cpp:223
const TYTabSiteNodeGeoNode & getListSiteNode() const
Definition: TYSiteNode.h:354
void purge()
Definition: TYSiteNode.h:97
LPTYAltimetrie getAltimetry() const
void setAltiEmprise(const double &altiEmprise)
Get/Set de l'altitude associee a la courbe de niveau.
Definition: TYSiteNode.h:136
void appendSite(LPTYSiteNode pSiteFrom, const OMatrix &matrix, LPTYSiteNode pSiteTo)
OMatrix getGlobalMatrix() const
LPTYTopographie getTopographie()
Definition: TYSiteNode.h:149
int getSIGType()
Get/Set du choix du systeme de repere du SIG.
Definition: TYSiteNode.h:569
virtual void updateCurrentCalcul(TYListID &listID, bool recursif=true)
Definition: TYSiteNode.cpp:541
virtual void setIsGeometryModified(bool isModified)
Definition: TYSiteNode.cpp:498
double getSIG_Y()
Definition: TYSiteNode.h:596
void setOrientation(TYSegment seg)
Definition: TYSiteNode.h:304
double getSIG_OFFSET()
Definition: TYSiteNode.h:609
bool readMesh(std::deque< OPoint3D > &points, std::deque< OTriangle > &triangles, std::deque< LPTYSol > &materials, const QString &meshFilePath)
Definition: TYSiteNode.cpp:731
virtual void do_updateAltimetrie(QString resultMeshFilePath)
Definition: TYSiteNode.cpp:643
void setTopoFileExtension(const QString &ext)
Definition: TYSiteNode.h:234
unsigned int _nbFaceInfra
Nombre de faces de l'infrastructure (machines, bâtiments, etc ...)
Definition: TYSiteNode.h:692
virtual bool remFromCalcul()
Definition: TYSiteNode.cpp:524
LPTYTopographie _pTopographie
Topographie.
Definition: TYSiteNode.h:664
void setEmprise(TYTabPoint points)
Definition: TYSiteNode.h:362
QString _topoFile
Nom du fichier de topographie temporaire.
Definition: TYSiteNode.h:679
void setPosition(TYPoint pt)
Definition: TYSiteNode.h:337
void setEchelle(float e)
Definition: TYSiteNode.h:288
virtual void setChildsNotInCurrentCalcul()
TYProjet * getProjet()
Accesseurs.
Definition: TYSiteNode.h:106
void setTopoFileName(const QString &name)
Definition: TYSiteNode.h:248
void setUseEmpriseAsCrbNiv(bool b)
Definition: TYSiteNode.h:130
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
Definition: TYSiteNode.cpp:470
LPTYSiteNode merge()
virtual void reparent()
Definition: TYSiteNode.cpp:566
bool remSiteNode(const LPTYSiteNodeGeoNode pSiteNodeGeoNode)
LPTYInfrastructure getInfrastructure()
Definition: TYSiteNode.h:174
LPTYInfrastructure _pInfrastructure
Infrastructure.
Definition: TYSiteNode.h:667
const double getSIG_X() const
Definition: TYSiteNode.h:587
const double getSIG_Y() const
Definition: TYSiteNode.h:600
void setTopographie(const LPTYTopographie pTopo)
Definition: TYSiteNode.h:164
QString _topoFileName
Nom du fichier de topographie (image de fond)
Definition: TYSiteNode.h:673
void setSIG_X(const double &SIG_X)
Definition: TYSiteNode.h:591
virtual ~TYSiteNode()
Definition: TYSiteNode.cpp:97
double _altiEmprise
Altitude associee a l'emprise (s'il y a lieu)
Definition: TYSiteNode.h:661
float _echelle
Echelle du site.
Definition: TYSiteNode.h:685
virtual int fromXML(DOM_Element domElement)
Definition: TYSiteNode.cpp:324
systemSIG _SIGType
Coordonnees SIG.
Definition: TYSiteNode.h:700
void setSIG_OFFSET(const double &SIG_OFFSET)
Definition: TYSiteNode.h:617
unsigned int _nbFaces
Definition: TYSiteNode.h:694
const QString & getMeshFilePath()
Definition: TYSiteNode.cpp:59
TYTabSiteNodeGeoNode _listSiteNode
Liste des sites.
Definition: TYSiteNode.h:707
void setListSiteNode(const TYTabSiteNodeGeoNode &list)
Definition: TYSiteNode.h:409
TYPoint _position
Position.
Definition: TYSiteNode.h:689
QString _meshFilePath
Chemin vers le fichier PLY d'altimétrie.
Definition: TYSiteNode.h:676
bool _useTopoFile
Flag d'utilisation d'une image de fond.
Definition: TYSiteNode.h:670
QString _topoFileExtension
Extension du fichier de topographie.
Definition: TYSiteNode.h:682
virtual void updateAcoustique(const bool &force=false)
const LPTYTopographie getTopographie() const
Definition: TYSiteNode.h:156
void setMeshFilePath(const QString &path)
Definition: TYSiteNode.cpp:64
void uuid2tysol(const std::deque< std::string > &material_ids, std::deque< LPTYSol > &materials)
Definition: TYSiteNode.cpp:758
void update(const bool &force=false)
void setRoot(bool b)
Definition: TYSiteNode.h:329
bool _root
Test si site racine.
Definition: TYSiteNode.h:697
void getListFaces(TYTabAcousticSurfaceGeoNode &tabFaces, unsigned int &nbFaceInfra, std::vector< bool > &EstUnIndexDeFaceEcran) const
static const QString & getTopoFilePath()
Definition: TYSiteNode.cpp:49
double getDelaunay()
const TYProjet * getProjet() const
Definition: TYSiteNode.h:110
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYSiteNode.cpp:271
void setInfrastructure(const LPTYInfrastructure &pInfra)
Definition: TYSiteNode.h:188
void setSIG_Y(const double &SIG_Y)
Definition: TYSiteNode.h:604
TYTabSiteNodeGeoNode & getListSiteNode()
Definition: TYSiteNode.h:346
void setSIGType(int SIGType)
Definition: TYSiteNode.h:577
virtual std::string toString() const
Definition: TYSiteNode.cpp:266
float getEchelle() const
Definition: TYSiteNode.h:281
LPTYSiteNodeGeoNode findSiteNode(const LPTYSiteNode pSiteNode)
LPTYProjet _pProjet
Projet auquel appartient (eventuellement) le site.
Definition: TYSiteNode.h:655
TYSegment getOrientation() const
Definition: TYSiteNode.h:297
QString getTopoFileExtension() const
Definition: TYSiteNode.h:227
void setTopoFile(const QString &fileName)
Definition: TYSiteNode.h:220
TYSegment _orientation
Orientation du Nord.
Definition: TYSiteNode.h:687
bool addSiteNode(LPTYSiteNodeGeoNode pSiteNodeGeoNode)
void loadTopoFile()
Definition: TYSiteNode.cpp:583
virtual TYSiteNode & operator=(const TYSiteNode &other)
Operateur =.
Definition: TYSiteNode.cpp:102
virtual bool updateAltimetrie(QString resultMeshFilePath)
Definition: TYSiteNode.cpp:625
static void setTopoFilePath(const QString &path)
Definition: TYSiteNode.cpp:54
virtual void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
void getListFacesWithoutFloor(TYTabAcousticSurfaceGeoNode &tabFaces, unsigned int &nbFaceInfra, std::vector< bool > &EstUnIndexDeFaceEcran, std::vector< std::pair< int, int >> &indices, std::vector< int > &etages) const
bool getUseEmpriseAsCrbNiv() const
Definition: TYSiteNode.h:123
virtual void updateAltiInfra()
Definition: TYSiteNode.cpp:781
void groundBasedFaces(const TYTabAcousticVolumeGeoNode &volumes, const OMatrix &global_matrix, std::map< TYUUID, std::deque< TYTabPoint3D >> &contours) const
bool getRoot() const
Definition: TYSiteNode.h:321
double _SIG_X
Definition: TYSiteNode.h:702
virtual bool addToCalcul()
Definition: TYSiteNode.cpp:508
void getFacesOnGround(std::map< TYUUID, std::deque< TYTabPoint3D >> &contours) const
TYPoint getPosition() const
Definition: TYSiteNode.h:313
bool _bEmpriseAsCrbNiv
Utilisation de l'emprise comme courbe de niveau.
Definition: TYSiteNode.h:658
QString getTopoFileName() const
Definition: TYSiteNode.h:241
bool getUseTopoFile() const
Definition: TYSiteNode.h:198
virtual bool operator!=(const TYSiteNode &other) const
Operateur !=.
Definition: TYSiteNode.cpp:218
const int getSIGType() const
Definition: TYSiteNode.h:573
bool _isTopoFileModified
Flag de modification de l'image de fond.
Definition: TYSiteNode.h:710
void setUseTopoFile(bool flag)
Definition: TYSiteNode.h:205
double _SIG_OFFSET
Definition: TYSiteNode.h:704
virtual bool operator==(const TYSiteNode &other) const
Operateur ==.
Definition: TYSiteNode.cpp:130
static QString _topoFilePath
Chemin du dossier image temporaire.
Definition: TYSiteNode.h:651
void updateEmpriseAltitude(double empriseAltitude)
Update z ccordinates of emprise points.
void setEmprise(const TYTabPoint &pts, const bool &defTerrain=true)