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 
490 
491 protected:
501  virtual void do_updateAltimetrie(QString resultMeshFilePath);
502 
503 public:
504  /*
505  * Reads a mesh from 'filename' ply file, and puts it in 'points', 'triangles'
506  * and 'materials'.
507  *
508  * @return true if operations succeeds else false
509  */
510  bool readMesh(std::deque<OPoint3D>& points, std::deque<OTriangle>& triangles,
511  std::deque<LPTYSol>& materials, const QString& meshFilePath);
512 
517  virtual void updateAltiInfra();
518 
522  virtual void updateAcoustique(const bool& force = false);
523 
527  void update(const bool& force = false);
528 
533  bool update(TYElement* pElem);
534 
539  // XXX The process is being rewritten and this function removed
540  // virtual TYTabPoint collectPointsForAltimetrie() const;
541 
545  double getDelaunay();
546 
551  void getListFaces(TYTabAcousticSurfaceGeoNode& tabFaces, unsigned int& nbFaceInfra,
552  std::vector<bool>& EstUnIndexDeFaceEcran) const;
553  void getListFacesWithoutFloor(TYTabAcousticSurfaceGeoNode& tabFaces, unsigned int& nbFaceInfra,
554  std::vector<bool>& EstUnIndexDeFaceEcran,
555  std::vector<std::pair<int, int>>& indices, std::vector<int>& etages) const;
556 
564  void getFacesOnGround(std::map<TYUUID, std::deque<TYTabPoint3D>>& contours) const;
565 
571  void groundBasedFaces(const TYTabAcousticVolumeGeoNode& volumes, const OMatrix& global_matrix,
572  std::map<TYUUID, std::deque<TYTabPoint3D>>& contours) const;
573 
576  {
577  return _SIGType;
578  }
579  const int getSIGType() const
580  {
581  return _SIGType;
582  }
583  void setSIGType(int SIGType)
584  {
585  _SIGType = (systemSIG)SIGType;
586  }
587 
589  double getSIG_X()
590  {
591  return _SIG_X;
592  }
593  const double getSIG_X() const
594  {
595  return _SIG_X;
596  }
597  void setSIG_X(const double& SIG_X)
598  {
599  _SIG_X = SIG_X;
600  }
601 
602  double getSIG_Y()
603  {
604  return _SIG_Y;
605  }
606  const double getSIG_Y() const
607  {
608  return _SIG_Y;
609  }
610  void setSIG_Y(const double& SIG_Y)
611  {
612  _SIG_Y = SIG_Y;
613  }
614 
615  double getSIG_OFFSET()
616  {
617  return _SIG_OFFSET;
618  }
619  const double getSIG_OFFSET() const
620  {
621  return _SIG_OFFSET;
622  }
623  void setSIG_OFFSET(const double& SIG_OFFSET)
624  {
625  _SIG_OFFSET = SIG_OFFSET;
626  }
627 
629  virtual void exportCSV(std::ofstream& ofs);
630 
631  /* Return the site altimetry (retrieved from the rootsite of the hierarchy,
632  * which can be the current site node or one of its parents
633  */
635 
636  /* Transform matrix allowing to move the site to a global frame.
637  * If the site is the root site, this matrix should be equal to the identity
638  * matrix.
639  */
640  OMatrix getGlobalMatrix() const;
641 
642 protected:
652  void appendSite(LPTYSiteNode pSiteFrom, const OMatrix& matrix, LPTYSiteNode pSiteTo);
653 
654  // Membres
655 private:
657  static QString _topoFilePath;
658 
659 protected:
662 
665 
667  double _altiEmprise;
668 
671 
674 
677 
679  QString _topoFileName;
680 
682  QString _meshFilePath;
683 
685  QString _topoFile;
686 
689 
691  float _echelle;
696 
698  unsigned int _nbFaceInfra;
699 
700  unsigned int _nbFaces; // Nombre de faces total
701 
703  bool _root;
704 
707 
708  double _SIG_X;
709  double _SIG_Y;
710  double _SIG_OFFSET;
711 
714 
717 };
718 
719 #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:699
classe de definition d'un projet.
Definition: TYProjet.h:45
TYTabSiteNodeGeoNode collectSites(bool include=true) const
const double getSIG_OFFSET() const
Definition: TYSiteNode.h:619
const double getAltiEmprise() const
Definition: TYSiteNode.h:141
double _SIG_Y
Definition: TYSiteNode.h:709
const LPTYInfrastructure getInfrastructure() const
Definition: TYSiteNode.h:181
void selectCourbeNiveauAndPlanEau()
Definition: TYSiteNode.cpp:781
void setProjet(const LPTYProjet pProjet)
Definition: TYSiteNode.cpp:560
double getSIG_X()
Get/Set des coordonnees dans le repere du SIG.
Definition: TYSiteNode.h:589
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:575
virtual void updateCurrentCalcul(TYListID &listID, bool recursif=true)
Definition: TYSiteNode.cpp:544
virtual void setIsGeometryModified(bool isModified)
Definition: TYSiteNode.cpp:501
double getSIG_Y()
Definition: TYSiteNode.h:602
void setOrientation(TYSegment seg)
Definition: TYSiteNode.h:304
double getSIG_OFFSET()
Definition: TYSiteNode.h:615
bool readMesh(std::deque< OPoint3D > &points, std::deque< OTriangle > &triangles, std::deque< LPTYSol > &materials, const QString &meshFilePath)
Definition: TYSiteNode.cpp:733
virtual void do_updateAltimetrie(QString resultMeshFilePath)
Definition: TYSiteNode.cpp:646
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:698
virtual bool remFromCalcul()
Definition: TYSiteNode.cpp:527
LPTYTopographie _pTopographie
Topographie.
Definition: TYSiteNode.h:670
void setEmprise(TYTabPoint points)
Definition: TYSiteNode.h:362
QString _topoFile
Nom du fichier de topographie temporaire.
Definition: TYSiteNode.h:685
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:473
LPTYSiteNode merge()
virtual void reparent()
Definition: TYSiteNode.cpp:569
bool remSiteNode(const LPTYSiteNodeGeoNode pSiteNodeGeoNode)
LPTYInfrastructure getInfrastructure()
Definition: TYSiteNode.h:174
LPTYInfrastructure _pInfrastructure
Infrastructure.
Definition: TYSiteNode.h:673
const double getSIG_X() const
Definition: TYSiteNode.h:593
const double getSIG_Y() const
Definition: TYSiteNode.h:606
void setTopographie(const LPTYTopographie pTopo)
Definition: TYSiteNode.h:164
QString _topoFileName
Nom du fichier de topographie (image de fond)
Definition: TYSiteNode.h:679
void setSIG_X(const double &SIG_X)
Definition: TYSiteNode.h:597
virtual ~TYSiteNode()
Definition: TYSiteNode.cpp:97
double _altiEmprise
Altitude associee a l'emprise (s'il y a lieu)
Definition: TYSiteNode.h:667
float _echelle
Echelle du site.
Definition: TYSiteNode.h:691
virtual int fromXML(DOM_Element domElement)
Definition: TYSiteNode.cpp:324
systemSIG _SIGType
Coordonnees SIG.
Definition: TYSiteNode.h:706
void setSIG_OFFSET(const double &SIG_OFFSET)
Definition: TYSiteNode.h:623
unsigned int _nbFaces
Definition: TYSiteNode.h:700
const QString & getMeshFilePath()
Definition: TYSiteNode.cpp:59
TYTabSiteNodeGeoNode _listSiteNode
Liste des sites.
Definition: TYSiteNode.h:713
void setListSiteNode(const TYTabSiteNodeGeoNode &list)
Definition: TYSiteNode.h:409
TYPoint _position
Position.
Definition: TYSiteNode.h:695
QString _meshFilePath
Chemin vers le fichier PLY d'altimétrie.
Definition: TYSiteNode.h:682
bool _useTopoFile
Flag d'utilisation d'une image de fond.
Definition: TYSiteNode.h:676
QString _topoFileExtension
Extension du fichier de topographie.
Definition: TYSiteNode.h:688
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:760
void update(const bool &force=false)
void setRoot(bool b)
Definition: TYSiteNode.h:329
bool _root
Test si site racine.
Definition: TYSiteNode.h:703
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:610
TYTabSiteNodeGeoNode & getListSiteNode()
Definition: TYSiteNode.h:346
void setSIGType(int SIGType)
Definition: TYSiteNode.h:583
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:661
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:693
bool addSiteNode(LPTYSiteNodeGeoNode pSiteNodeGeoNode)
void loadTopoFile()
Definition: TYSiteNode.cpp:586
virtual TYSiteNode & operator=(const TYSiteNode &other)
Operateur =.
Definition: TYSiteNode.cpp:102
virtual bool updateAltimetrie(QString resultMeshFilePath)
Definition: TYSiteNode.cpp:628
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:838
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:708
virtual bool addToCalcul()
Definition: TYSiteNode.cpp:511
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:664
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:579
bool _isTopoFileModified
Flag de modification de l'image de fond.
Definition: TYSiteNode.h:716
void setUseTopoFile(bool flag)
Definition: TYSiteNode.h:205
double _SIG_OFFSET
Definition: TYSiteNode.h:710
virtual bool operator==(const TYSiteNode &other) const
Operateur ==.
Definition: TYSiteNode.cpp:130
static QString _topoFilePath
Chemin du dossier image temporaire.
Definition: TYSiteNode.h:657
void updateEmpriseAltitude(double empriseAltitude)
Update z ccordinates of emprise points.
void setEmprise(const TYTabPoint &pts, const bool &defTerrain=true)