Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSiteNode.h
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 
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;
139  }
140  const double getAltiEmprise() const
141  {
142  return _altiEmprise;
143  }
144 
149  {
150  return _pTopographie;
151  }
156  {
157  return _pTopographie;
158  }
159 
163  void setTopographie(const LPTYTopographie pTopo)
164  {
165  _pTopographie = pTopo;
166  _pTopographie->setParent(this);
167  setIsGeometryModified(true);
168  }
169 
174  {
175  return _pInfrastructure;
176  }
181  {
182  return _pInfrastructure;
183  }
188  {
189  _pInfrastructure = pInfra;
191  setIsGeometryModified(true);
192  }
193 
197  bool getUseTopoFile() const
198  {
199  return _useTopoFile;
200  }
204  void setUseTopoFile(bool flag)
205  {
206  _useTopoFile = flag;
207  }
208 
212  std::string getTopoFile() const
213  {
214  return _topoFile;
215  }
219  void setTopoFile(std::string fileName)
220  {
221  _topoFile = fileName;
222  }
226  std::string getTopoFileExtension() const
227  {
228  return _topoFileExtension;
229  }
233  void setTopoFileExtension(std::string ext)
234  {
235  _topoFileExtension = ext;
236  }
240  std::string getTopoFileName() const
241  {
242  return _topoFileName;
243  }
247  void setTopoFileName(std::string name)
248  {
250  }
254  static const std::string& getTopoFilePath();
258  static void setTopoFilePath(const std::string& path);
259 
265  void loadTopoFile(std::string fileName);
266  void loadTopoFile();
267 
271  float getEchelle() const
272  {
273  return _echelle;
274  }
278  void setEchelle(float e)
279  {
280  _echelle = e;
281  setIsGeometryModified(true);
282  }
283 
288  {
289  return _orientation;
290  }
295  {
296  _orientation = seg;
297  setIsGeometryModified(true);
298  }
299 
304  {
305  return _position;
306  }
307 
311  bool getRoot() const
312  {
313  return _root;
314  }
315 
319  void setRoot(bool b)
320  {
321  _root = b;
322  }
323 
328  {
329  _position = pt;
330  setIsGeometryModified(true);
331  }
332 
337  {
338  return _listSiteNode;
339  }
340 
345  {
346  return _listSiteNode;
347  }
348 
354  bool addSiteNode(LPTYSiteNodeGeoNode pSiteNodeGeoNode);
355 
361  bool addSiteNode(LPTYSiteNode pSiteNode);
362 
366  bool remSiteNode(const LPTYSiteNodeGeoNode pSiteNodeGeoNode);
367 
371  bool remSiteNode(const LPTYSiteNode pSiteNode);
372 
377  bool remSiteNode(QString idSiteNode);
378 
387 
392  {
393  _listSiteNode = list;
394  setIsGeometryModified(true);
395  }
396 
400  virtual void setChildsNotInCurrentCalcul();
401 
410  TYTabSiteNodeGeoNode collectSites(bool include = true) const;
411 
412  // 3. -ELEMENT PROPRE AU CALCUL
427 
433  virtual void reparent();
434 
443  virtual void updateCurrentCalcul(TYListID& listID, bool recursif = true);
444 
448  virtual bool addToCalcul();
449 
453  virtual bool remFromCalcul();
454 
461  virtual bool updateAltimetrie();
462 
463  void uuid2tysol(const std::deque<std::string>& material_ids, std::deque<LPTYSol>& materials);
464 
465 protected:
472  virtual void do_updateAltimetrie();
473 
474 public:
475  /*
476  * Reads a mesh from 'filename' ply file, and puts it in 'points', 'triangles'
477  * and 'materials'.
478  */
479  void readMesh(std::deque<OPoint3D>& points, std::deque<OTriangle>& triangles,
480  std::deque<LPTYSol>& materials, const QString& filename);
481 
486  virtual void updateAltiInfra();
487 
491  virtual void updateAcoustique(const bool& force = false);
492 
496  void update(const bool& force = false);
497 
502  bool update(TYElement* pElem);
503 
508  // XXX The process is being rewritten and this function removed
509  // virtual TYTabPoint collectPointsForAltimetrie() const;
510 
514  double getDelaunay();
515 
520  void getListFaces(TYTabAcousticSurfaceGeoNode& tabFaces, unsigned int& nbFaceInfra,
521  std::vector<bool>& EstUnIndexDeFaceEcran) const;
522  void getListFacesWithoutFloor(TYTabAcousticSurfaceGeoNode& tabFaces, unsigned int& nbFaceInfra,
523  std::vector<bool>& EstUnIndexDeFaceEcran,
524  std::vector<std::pair<int, int>>& indices, std::vector<int>& etages) const;
525 
533  void getFacesOnGround(std::map<TYUUID, std::deque<TYTabPoint3D>>& contours) const;
534 
540  void groundBasedFaces(const TYTabAcousticVolumeGeoNode& volumes, const OMatrix& global_matrix,
541  std::map<TYUUID, std::deque<TYTabPoint3D>>& contours) const;
542 
545  {
546  return _SIGType;
547  }
548  const int getSIGType() const
549  {
550  return _SIGType;
551  }
552  void setSIGType(int SIGType)
553  {
554  _SIGType = (systemSIG)SIGType;
555  }
556 
558  double getSIG_X()
559  {
560  return _SIG_X;
561  }
562  const double getSIG_X() const
563  {
564  return _SIG_X;
565  }
566  void setSIG_X(const double& SIG_X)
567  {
568  _SIG_X = SIG_X;
569  }
570 
571  double getSIG_Y()
572  {
573  return _SIG_Y;
574  }
575  const double getSIG_Y() const
576  {
577  return _SIG_Y;
578  }
579  void setSIG_Y(const double& SIG_Y)
580  {
581  _SIG_Y = SIG_Y;
582  }
583 
584  double getSIG_OFFSET()
585  {
586  return _SIG_OFFSET;
587  }
588  const double getSIG_OFFSET() const
589  {
590  return _SIG_OFFSET;
591  }
592  void setSIG_OFFSET(const double& SIG_OFFSET)
593  {
594  _SIG_OFFSET = SIG_OFFSET;
595  }
596 
598  virtual void exportCSV(std::ofstream& ofs);
599 
600  /* Return the site altimetry (retrieved from the rootsite of the hierarchy,
601  * which can be the current site node or one of its parents
602  */
604 
605  /* Transform matrix allowing to move the site to a global frame.
606  * If the site is the root site, this matrix should be equal to the identity
607  * matrix.
608  */
609  OMatrix getGlobalMatrix() const;
610 
611 protected:
621  void appendSite(LPTYSiteNode pSiteFrom, const OMatrix& matrix, LPTYSiteNode pSiteTo);
622 
623  // Membres
624 private:
626  static std::string* _topoFilePath;
627 
628 protected:
631 
634 
636  double _altiEmprise;
637 
640 
643 
646 
648  std::string _topoFileName;
649 
651  std::string _topoFile;
652 
654  std::string _topoFileExtension;
655 
657  float _echelle;
662 
664  unsigned int _nbFaceInfra;
665 
666  unsigned int _nbFaces; // Nombre de faces total
667 
669  bool _root;
670 
673 
674  double _SIG_X;
675  double _SIG_Y;
676  double _SIG_OFFSET;
677 
680 
683 };
684 
685 #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::list< TYUUID > TYListID
Collection d'identifiants.
Definition: TYDefines.h:331
#define TY_EXT_GRAPHIC_DECL_ONLY(classname)
Definition: TYElement.h:432
std::vector< LPTYElement > LPTYElementArray
Definition: TYElement.h:345
#define OPROTODECL(classname)
Definition: TYElement.h:65
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:386
const char * name
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:692
classe de definition d'un projet.
Definition: TYProjet.h:45
TYTabSiteNodeGeoNode collectSites(bool include=true) const
const double getSIG_OFFSET() const
Definition: TYSiteNode.h:588
const double getAltiEmprise() const
Definition: TYSiteNode.h:140
double _SIG_Y
Definition: TYSiteNode.h:675
const LPTYInfrastructure getInfrastructure() const
Definition: TYSiteNode.h:180
void setProjet(const LPTYProjet pProjet)
Definition: TYSiteNode.cpp:478
double getSIG_X()
Get/Set des coordonnees dans le repere du SIG.
Definition: TYSiteNode.h:558
std::string _topoFileName
Nom du fichier de topographie.
Definition: TYSiteNode.h:648
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYSiteNode.cpp:221
const TYTabSiteNodeGeoNode & getListSiteNode() const
Definition: TYSiteNode.h:344
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:148
std::string getTopoFile() const
Definition: TYSiteNode.h:212
int getSIGType()
Get/Set du choix du systeme de repere du SIG.
Definition: TYSiteNode.h:544
virtual void updateCurrentCalcul(TYListID &listID, bool recursif=true)
Definition: TYSiteNode.cpp:462
virtual void setIsGeometryModified(bool isModified)
Definition: TYSiteNode.cpp:419
double getSIG_Y()
Definition: TYSiteNode.h:571
void setOrientation(TYSegment seg)
Definition: TYSiteNode.h:294
double getSIG_OFFSET()
Definition: TYSiteNode.h:584
std::string getTopoFileExtension() const
Definition: TYSiteNode.h:226
unsigned int _nbFaceInfra
Nombre de faces de l'infrastructure (machines, bâtiments, etc ...)
Definition: TYSiteNode.h:664
virtual bool remFromCalcul()
Definition: TYSiteNode.cpp:445
LPTYTopographie _pTopographie
Topographie.
Definition: TYSiteNode.h:639
std::string getTopoFileName() const
Definition: TYSiteNode.h:240
void setTopoFile(std::string fileName)
Definition: TYSiteNode.h:219
void setPosition(TYPoint pt)
Definition: TYSiteNode.h:327
void setEchelle(float e)
Definition: TYSiteNode.h:278
std::string _topoFile
Nom du fichier de topographie temporaire.
Definition: TYSiteNode.h:651
virtual void setChildsNotInCurrentCalcul()
TYProjet * getProjet()
Accesseurs.
Definition: TYSiteNode.h:106
void setUseEmpriseAsCrbNiv(bool b)
Definition: TYSiteNode.h:130
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
Definition: TYSiteNode.cpp:391
LPTYSiteNode merge()
virtual void reparent()
Definition: TYSiteNode.cpp:487
bool remSiteNode(const LPTYSiteNodeGeoNode pSiteNodeGeoNode)
LPTYInfrastructure getInfrastructure()
Definition: TYSiteNode.h:173
LPTYInfrastructure _pInfrastructure
Infrastructure.
Definition: TYSiteNode.h:642
const double getSIG_X() const
Definition: TYSiteNode.h:562
const double getSIG_Y() const
Definition: TYSiteNode.h:575
void setTopographie(const LPTYTopographie pTopo)
Definition: TYSiteNode.h:163
void setSIG_X(const double &SIG_X)
Definition: TYSiteNode.h:566
virtual ~TYSiteNode()
Definition: TYSiteNode.cpp:100
double _altiEmprise
Altitude associee a l'emprise (s'il y a lieu)
Definition: TYSiteNode.h:636
float _echelle
Echelle du site.
Definition: TYSiteNode.h:657
virtual int fromXML(DOM_Element domElement)
Definition: TYSiteNode.cpp:318
systemSIG _SIGType
Coordonnees SIG.
Definition: TYSiteNode.h:672
void setSIG_OFFSET(const double &SIG_OFFSET)
Definition: TYSiteNode.h:592
unsigned int _nbFaces
Definition: TYSiteNode.h:666
void setTopoFileExtension(std::string ext)
Definition: TYSiteNode.h:233
static std::string * _topoFilePath
Chemin du dossier image temporaire.
Definition: TYSiteNode.h:626
TYTabSiteNodeGeoNode _listSiteNode
Liste des sites.
Definition: TYSiteNode.h:679
void setListSiteNode(const TYTabSiteNodeGeoNode &list)
Definition: TYSiteNode.h:391
TYPoint _position
Position.
Definition: TYSiteNode.h:661
bool _useTopoFile
Flag d'utilisation d'une image de fond.
Definition: TYSiteNode.h:645
virtual void updateAcoustique(const bool &force=false)
const LPTYTopographie getTopographie() const
Definition: TYSiteNode.h:155
static void setTopoFilePath(const std::string &path)
Definition: TYSiteNode.cpp:60
static const std::string & getTopoFilePath()
Definition: TYSiteNode.cpp:47
void uuid2tysol(const std::deque< std::string > &material_ids, std::deque< LPTYSol > &materials)
Definition: TYSiteNode.cpp:692
void update(const bool &force=false)
void setRoot(bool b)
Definition: TYSiteNode.h:319
bool _root
Test si site racine.
Definition: TYSiteNode.h:669
void getListFaces(TYTabAcousticSurfaceGeoNode &tabFaces, unsigned int &nbFaceInfra, std::vector< bool > &EstUnIndexDeFaceEcran) const
double getDelaunay()
const TYProjet * getProjet() const
Definition: TYSiteNode.h:110
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYSiteNode.cpp:268
void setInfrastructure(const LPTYInfrastructure &pInfra)
Definition: TYSiteNode.h:187
void setSIG_Y(const double &SIG_Y)
Definition: TYSiteNode.h:579
TYTabSiteNodeGeoNode & getListSiteNode()
Definition: TYSiteNode.h:336
void setSIGType(int SIGType)
Definition: TYSiteNode.h:552
virtual std::string toString() const
Definition: TYSiteNode.cpp:263
float getEchelle() const
Definition: TYSiteNode.h:271
LPTYSiteNodeGeoNode findSiteNode(const LPTYSiteNode pSiteNode)
LPTYProjet _pProjet
Projet auquel appartient (eventuellement) le site.
Definition: TYSiteNode.h:630
TYSegment getOrientation() const
Definition: TYSiteNode.h:287
std::string _topoFileExtension
Extension du fichier de topographie.
Definition: TYSiteNode.h:654
virtual bool updateAltimetrie()
Definition: TYSiteNode.cpp:567
TYSegment _orientation
Orientation du Nord.
Definition: TYSiteNode.h:659
bool addSiteNode(LPTYSiteNodeGeoNode pSiteNodeGeoNode)
void loadTopoFile()
Definition: TYSiteNode.cpp:504
virtual TYSiteNode & operator=(const TYSiteNode &other)
Operateur =.
Definition: TYSiteNode.cpp:105
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
void setTopoFileName(std::string name)
Definition: TYSiteNode.h:247
bool getUseEmpriseAsCrbNiv() const
Definition: TYSiteNode.h:123
virtual void updateAltiInfra()
Definition: TYSiteNode.cpp:715
void groundBasedFaces(const TYTabAcousticVolumeGeoNode &volumes, const OMatrix &global_matrix, std::map< TYUUID, std::deque< TYTabPoint3D >> &contours) const
bool getRoot() const
Definition: TYSiteNode.h:311
void readMesh(std::deque< OPoint3D > &points, std::deque< OTriangle > &triangles, std::deque< LPTYSol > &materials, const QString &filename)
Definition: TYSiteNode.cpp:674
double _SIG_X
Definition: TYSiteNode.h:674
virtual bool addToCalcul()
Definition: TYSiteNode.cpp:429
void getFacesOnGround(std::map< TYUUID, std::deque< TYTabPoint3D >> &contours) const
TYPoint getPosition() const
Definition: TYSiteNode.h:303
bool _bEmpriseAsCrbNiv
Utilisation de l'emprise comme courbe de niveau.
Definition: TYSiteNode.h:633
bool getUseTopoFile() const
Definition: TYSiteNode.h:197
virtual bool operator!=(const TYSiteNode &other) const
Operateur !=.
Definition: TYSiteNode.cpp:216
const int getSIGType() const
Definition: TYSiteNode.h:548
bool _isTopoFileModified
Flag de modification de l'image de fond.
Definition: TYSiteNode.h:682
void setUseTopoFile(bool flag)
Definition: TYSiteNode.h:204
double _SIG_OFFSET
Definition: TYSiteNode.h:676
virtual bool operator==(const TYSiteNode &other) const
Operateur ==.
Definition: TYSiteNode.cpp:132
virtual void do_updateAltimetrie()
Definition: TYSiteNode.cpp:585