Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYTopographie.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 #ifndef __TY_TOPOGRAPHIE__
17 #define __TY_TOPOGRAPHIE__
18 
19 #include <memory>
20 
26 
28 typedef struct
29 {
33 
35 typedef std::vector<TYStructSegPtrTer> TYTabStructSegPtrTer;
36 
37 typedef enum
38 {
40  TYPLANEAU
42 typedef struct
43 {
44  LPTYElement pElement; // Pointeur sur l'element
45  OPoint3D* pTabPoints; // Pointeur sur un tableau de points
46  OBox box; // Boite englobante de l'ensemble des points
47  OVector3D normale; // Normale au plan du terrain;
48  typeTerrain ter; // Type de terrain
49  short nbPts; // Nombre de points dans le tableau
51 
55 class TYTopographie : public TYElement
56 {
60 
61  // Methodes
62 
63 public:
67  TYTopographie();
71  TYTopographie(const TYTopographie& other);
75  virtual ~TYTopographie();
76 
78  TYTopographie& operator=(const TYTopographie& other);
80  bool operator==(const TYTopographie& other) const;
82  bool operator!=(const TYTopographie& other) const;
83 
92  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
93 
94  virtual std::string toString() const;
95 
96  virtual DOM_Element toXML(DOM_Element& domElement);
97  virtual int fromXML(DOM_Element domElement);
98 
99  virtual void setIsGeometryModified(bool isModified);
100 
101  virtual void getChilds(LPTYElementArray& childs, bool recursif = true);
102 
104 
109 
118  virtual void updateCurrentCalcul(TYListID& listID, bool recursif = true);
119 
123  virtual void reparent();
124 
128  void purge();
129 
133  void concatTopo(const TYTopographie* pTopo, bool emprise = true);
134 
139  {
140  return _listPlanEau;
141  }
146  {
147  return _listPlanEau;
148  }
153  {
154  _listPlanEau = list;
155  setIsGeometryModified(true);
156  }
160  bool addPlanEau(LPTYPlanEauGeoNode pPlanEauGeoNode);
164  bool addPlanEau(LPTYPlanEau pPlanEau);
168  bool remPlanEau(const LPTYPlanEauGeoNode pPlanEauGeoNode);
172  bool remPlanEau(const LPTYPlanEau pPlanEau);
177  bool remPlanEau(QString idPlanEau);
181  void remAllPlanEau();
186  {
187  return TYPlanEau::safeDownCast(_listPlanEau.at(index)->getElement());
188  }
201 
206  {
207  return _listCrsEau;
208  }
213  {
214  return _listCrsEau;
215  }
220  {
221  _listCrsEau = list;
222  setIsGeometryModified(true);
223  }
227  bool addCrsEau(LPTYCoursEauGeoNode pCoursEauGeoNode);
231  bool addCrsEau(LPTYCoursEau pCoursEau);
235  bool remCrsEau(const LPTYCoursEauGeoNode pCoursEauGeoNode);
239  bool remCrsEau(const LPTYCoursEau pCoursEau);
244  bool remCrsEau(QString idCrsEau);
248  void remAllCrsEau();
253  {
254  return TYCoursEau::safeDownCast(_listCrsEau.at(index)->getElement());
255  }
264 
269  {
270  return _listTerrain;
271  }
276  {
277  return _listTerrain;
278  }
282  void setTerrain(const TYTabTerrainGeoNode& list)
283  {
284  _listTerrain = list;
285  setIsGeometryModified(true);
286  }
290  bool addTerrain(LPTYTerrainGeoNode pTerGeoNode);
294  bool addTerrain(LPTYTerrain pTer);
298  bool remTerrain(const LPTYTerrainGeoNode pTerGeoNode);
302  bool remTerrain(const LPTYTerrain pTer);
307  bool remTerrain(QString idTerrain);
311  void remAllTerrain();
316  {
317  return TYTerrain::safeDownCast(_listTerrain.at(index)->getElement());
318  }
327 
332  {
333  return _listCrbNiv;
334  }
339  {
340  return _listCrbNiv;
341  }
346  {
347  _listCrbNiv = list;
348  setIsGeometryModified(true);
349  }
353  bool addCrbNiv(LPTYCourbeNiveauGeoNode pCrbNivGeoNode);
357  bool addCrbNiv(LPTYCourbeNiveau pCrbNiv);
361  bool remCrbNiv(const LPTYCourbeNiveauGeoNode pCrbNivGeoNode);
365  bool remCrbNiv(const LPTYCourbeNiveau pCrbNiv);
370  bool remCrbNiv(QString idCrbNiv);
374  void remAllCrbNiv();
379  {
380  return TYCourbeNiveau::safeDownCast(_listCrbNiv.at(index)->getElement());
381  }
386 
395 
400  {
401  return _DefTerrainIdx;
402  }
403  void setDefTerrainIdx(const int& defTerrainIdx)
404  {
405  _DefTerrainIdx = defTerrainIdx;
406  }
414  void setDefTerrain(int defTerrainIdx);
415 
420  {
421  return _emprise;
422  }
426  const TYTabPoint& getEmprise() const
427  {
428  return _emprise;
429  }
433  void setEmprise(const TYTabPoint& pts, const bool& defTerrain = true);
438  {
439  _emprise.push_back(pt);
440  setIsGeometryModified(true);
441  }
446  {
447  return _emprise[index];
448  }
452  const TYPoint& getPointEmprise(int index) const
453  {
454  return _emprise[index];
455  }
460  {
461  _emprise.clear();
462  setIsGeometryModified(true);
463  }
464 
469  {
470  return _pAltimetrie;
471  }
476  {
477  return _pAltimetrie;
478  }
482  void setAltimetrie(const LPTYAltimetrie pAltimetrie)
483  {
484  _pAltimetrie = pAltimetrie;
485  _pAltimetrie->setParent(this);
486  setIsGeometryModified(true);
487  }
488 
492  double getTopoSize(OSegment3D& segDiagonale);
493 
497  void sortTerrainsBySurface();
498 
502  void setEmpriseColor(const OColor& color)
503  {
504  _empriseColor = color;
505  };
507  {
508  return _empriseColor;
509  };
510 
516  void updateEmpriseAltitude(double empriseAltitude);
517 
528  void exportMesh(std::deque<OPoint3D>& points, std::deque<OTriangle>& triangles,
529  std::deque<LPTYSol>& materials);
530 
531 private:
532  // Membres
533 protected:
536 
539 
542 
545 
548 
551 
555 
559 
560 private:
561  std::vector<TYStructElemPts> _tabElemPts; // Tableau des terrains
562  short _lastIndice;
563 };
564 
570 typedef std::vector<LPTYTopographieGeoNode> TYTabTopographieGeoNode;
571 
572 #endif // __TY_TOPOGRAPHIE__
All base classes related to 3D manipulation.
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::vector< LPTYCourbeNiveauGeoNode > TYTabCourbeNiveauGeoNode
Collection de noeuds geometriques de type TYCourbeNiveau.
std::vector< LPTYCoursEauGeoNode > TYTabCoursEauGeoNode
Collection de noeuds geometriques de type TYCoursEau.
Definition: TYCoursEau.h:70
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
std::vector< LPTYPlanEauGeoNode > TYTabPlanEauGeoNode
Collection de noeuds geometriques de type TYPlanEau.
Definition: TYPlanEau.h:202
std::vector< LPTYTerrainGeoNode > TYTabTerrainGeoNode
Collection de noeuds geometriques de type TYTerrain.
Definition: TYTerrain.h:181
TYGeometryNode TYTopographieGeoNode
Noeud geometrique de type TYTopographie.
std::vector< LPTYTopographieGeoNode > TYTabTopographieGeoNode
Collection de noeuds geometriques de type TYTopographie.
typeTerrain
Definition: TYTopographie.h:38
@ TYTERRAIN
Definition: TYTopographie.h:39
@ TYPLANEAU
Definition: TYTopographie.h:40
SmartPtr< TYTopographieGeoNode > LPTYTopographieGeoNode
Smart Pointer sur TYTopographieGeoNode.
std::vector< TYStructSegPtrTer > TYTabStructSegPtrTer
Tableau de structures contenant un segment et un terrain.
Definition: TYTopographie.h:35
The box class.
Definition: 3d.h:1346
Definition: color.h:31
The 3D point class.
Definition: 3d.h:487
static OPrototype * safeDownCast(OPrototype *pObject)
Definition: TYElement.cpp:71
Class to define a segment.
Definition: 3d.h:1141
The 3D vector class.
Definition: 3d.h:298
void setParent(TYElement *pParent)
Definition: TYElement.h:699
OColor _empriseColor
TYTerrain * getDefTerrain()
int _DefTerrainIdx
Terrain par default.
const TYTabPoint & getEmprise() const
LPTYCourbeNiveau getCrbNiv(int index)
const TYTabCoursEauGeoNode & getListCrsEau() const
OColor getEmpriseColor() const
virtual void setIsGeometryModified(bool isModified)
LPTYCourbeNiveauGeoNode findCrbNiv(const LPTYCourbeNiveau pCrbNiv)
TYTabPlanEauGeoNode & getListPlanEau()
TYTerrainGeoNode ** _pSortedTerrains
void exportMesh(std::deque< OPoint3D > &points, std::deque< OTriangle > &triangles, std::deque< LPTYSol > &materials)
Export the altimetry as a triangular mesh.
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
const LPTYAltimetrie getAltimetrie() const
LPTYTerrainGeoNode findTerrain(const LPTYTerrain pTerrain)
bool remCrbNiv(const LPTYCourbeNiveauGeoNode pCrbNivGeoNode)
bool addCrsEau(LPTYCoursEauGeoNode pCoursEauGeoNode)
LPTYCoursEau getCrsEau(int index)
virtual std::string toString() const
virtual int fromXML(DOM_Element domElement)
void resetEmprise()
virtual DOM_Element toXML(DOM_Element &domElement)
virtual void reparent()
void addPointEmprise(TYPoint pt)
void setEmpriseColor(const OColor &color)
virtual ~TYTopographie()
bool operator!=(const TYTopographie &other) const
Operateur !=.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
LPTYPlanEauGeoNode findPlanEau(const LPTYPlanEau pPlanEau)
LPTYAltimetrie getAltimetrie()
bool remPlanEau(const LPTYPlanEauGeoNode pPlanEauGeoNode)
TYPoint & getPointEmprise(int index)
bool operator==(const TYTopographie &other) const
Operateur ==.
void setDefTerrain(int defTerrainIdx)
void setListCrbNiv(const TYTabCourbeNiveauGeoNode &list)
int getDefTerrainIdx()
void setDefTerrainIdx(const int &defTerrainIdx)
TYTabCoursEauGeoNode & getListCrsEau()
LPTYCoursEauGeoNode findCrsEau(const LPTYCoursEau pCrsEau)
bool addCrbNiv(LPTYCourbeNiveauGeoNode pCrbNivGeoNode)
double getTopoSize(OSegment3D &segDiagonale)
virtual void updateCurrentCalcul(TYListID &listID, bool recursif=true)
TYTabPlanEauGeoNode _listPlanEau
Liste des plans d'eau.
TYTabCoursEauGeoNode _listCrsEau
Liste des cours d'eau.
const TYTabCourbeNiveauGeoNode getListCrbNivInCurrentCalcul() const
TYTabTerrainGeoNode _listTerrain
Liste des terrains.
TYTabCourbeNiveauGeoNode _listCrbNiv
Liste des courbes de niveau.
bool addPlanEau(LPTYPlanEauGeoNode pPlanEauGeoNode)
void updateEmpriseAltitude(double empriseAltitude)
Update z ccordinates of emprise points.
void setAltimetrie(const LPTYAltimetrie pAltimetrie)
LPTYAltimetrie _pAltimetrie
Altimetrie.
LPTYPlanEau getPlanEau(int index)
LPTYTerrain getTerrain(int index)
void setTerrain(const TYTabTerrainGeoNode &list)
bool remCrsEau(const LPTYCoursEauGeoNode pCoursEauGeoNode)
TYTabPoint & getEmprise()
void setEmprise(const TYTabPoint &pts, const bool &defTerrain=true)
const TYPoint & getPointEmprise(int index) const
TYTopographie & operator=(const TYTopographie &other)
Operateur =.
TYTabCourbeNiveauGeoNode & getListCrbNiv()
bool addTerrain(LPTYTerrainGeoNode pTerGeoNode)
TYTabPoint _emprise
Emprise.
void setListCrsEau(const TYTabCoursEauGeoNode &list)
const TYTabPlanEauGeoNode & getListPlanEau() const
const TYTabPlanEauGeoNode getListPlanEauInCurrentCalcul() const
TYTabTerrainGeoNode & getListTerrain()
void concatTopo(const TYTopographie *pTopo, bool emprise=true)
void sortTerrainsBySurface()
const TYTabTerrainGeoNode & getListTerrain() const
bool remTerrain(const LPTYTerrainGeoNode pTerGeoNode)
std::vector< TYStructElemPts > _tabElemPts
void setListPlanEau(const TYTabPlanEauGeoNode &list)
const TYTabCourbeNiveauGeoNode & getListCrbNiv() const
typeTerrain ter
Definition: TYTopographie.h:48
LPTYElement pElement
Definition: TYTopographie.h:44
OPoint3D * pTabPoints
Definition: TYTopographie.h:45
OVector3D normale
Definition: TYTopographie.h:47
Structure contenant un segment et un terrain.
Definition: TYTopographie.h:29
OSegment3D _segment
Definition: TYTopographie.h:30
TYTerrain * _terrain
Definition: TYTopographie.h:31