Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYTopographie.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 #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 
102 
107 
116  virtual void updateCurrentCalcul(TYListID& listID, bool recursif = true);
117 
121  virtual void reparent();
122 
126  void purge();
127 
131  void concatTopo(const TYTopographie* pTopo, bool emprise = true);
132 
137  {
138  return _listPlanEau;
139  }
144  {
145  return _listPlanEau;
146  }
151  {
152  _listPlanEau = list;
153  setIsGeometryModified(true);
154  }
158  bool addPlanEau(LPTYPlanEauGeoNode pPlanEauGeoNode);
162  bool addPlanEau(LPTYPlanEau pPlanEau);
166  bool remPlanEau(const LPTYPlanEauGeoNode pPlanEauGeoNode);
170  bool remPlanEau(const LPTYPlanEau pPlanEau);
175  bool remPlanEau(QString idPlanEau);
179  void remAllPlanEau();
184  {
185  return TYPlanEau::safeDownCast(_listPlanEau.at(index)->getElement());
186  }
195 
200  {
201  return _listCrsEau;
202  }
207  {
208  return _listCrsEau;
209  }
214  {
215  _listCrsEau = list;
216  setIsGeometryModified(true);
217  }
221  bool addCrsEau(LPTYCoursEauGeoNode pCoursEauGeoNode);
225  bool addCrsEau(LPTYCoursEau pCoursEau);
229  bool remCrsEau(const LPTYCoursEauGeoNode pCoursEauGeoNode);
233  bool remCrsEau(const LPTYCoursEau pCoursEau);
238  bool remCrsEau(QString idCrsEau);
242  void remAllCrsEau();
247  {
248  return TYCoursEau::safeDownCast(_listCrsEau.at(index)->getElement());
249  }
258 
263  {
264  return _listTerrain;
265  }
270  {
271  return _listTerrain;
272  }
276  void setTerrain(const TYTabTerrainGeoNode& list)
277  {
278  _listTerrain = list;
279  setIsGeometryModified(true);
280  }
284  bool addTerrain(LPTYTerrainGeoNode pTerGeoNode);
288  bool addTerrain(LPTYTerrain pTer);
292  bool remTerrain(const LPTYTerrainGeoNode pTerGeoNode);
296  bool remTerrain(const LPTYTerrain pTer);
301  bool remTerrain(QString idTerrain);
305  void remAllTerrain();
310  {
311  return TYTerrain::safeDownCast(_listTerrain.at(index)->getElement());
312  }
321 
326  {
327  return _listCrbNiv;
328  }
333  {
334  return _listCrbNiv;
335  }
340  {
341  _listCrbNiv = list;
342  setIsGeometryModified(true);
343  }
347  bool addCrbNiv(LPTYCourbeNiveauGeoNode pCrbNivGeoNode);
351  bool addCrbNiv(LPTYCourbeNiveau pCrbNiv);
355  bool remCrbNiv(const LPTYCourbeNiveauGeoNode pCrbNivGeoNode);
359  bool remCrbNiv(const LPTYCourbeNiveau pCrbNiv);
364  bool remCrbNiv(QString idCrbNiv);
368  void remAllCrbNiv();
373  {
374  return TYCourbeNiveau::safeDownCast(_listCrbNiv.at(index)->getElement());
375  }
384 
389  {
390  return _DefTerrainIdx;
391  }
392  void setDefTerrainIdx(const int& defTerrainIdx)
393  {
394  _DefTerrainIdx = defTerrainIdx;
395  }
403  void setDefTerrain(int defTerrainIdx);
404 
409  {
410  return _emprise;
411  }
415  const TYTabPoint& getEmprise() const
416  {
417  return _emprise;
418  }
422  void setEmprise(const TYTabPoint& pts, const bool& defTerrain = true);
427  {
428  _emprise.push_back(pt);
429  setIsGeometryModified(true);
430  }
435  {
436  return _emprise[index];
437  }
441  const TYPoint& getPointEmprise(int index) const
442  {
443  return _emprise[index];
444  }
449  {
450  _emprise.clear();
451  setIsGeometryModified(true);
452  }
453 
458  {
459  return _pAltimetrie;
460  }
465  {
466  return _pAltimetrie;
467  }
471  void setAltimetrie(const LPTYAltimetrie pAltimetrie)
472  {
473  _pAltimetrie = pAltimetrie;
474  _pAltimetrie->setParent(this);
475  setIsGeometryModified(true);
476  }
477 
481  double getTopoSize(OSegment3D& segDiagonale);
482 
486  void sortTerrainsBySurface();
487 
491  void setEmpriseColor(const OColor& color)
492  {
493  _empriseColor = color;
494  };
496  {
497  return _empriseColor;
498  };
499 
510  void exportMesh(std::deque<OPoint3D>& points, std::deque<OTriangle>& triangles,
511  std::deque<LPTYSol>& materials);
512 
513 private:
514  // Membres
515 protected:
518 
521 
524 
527 
530 
533 
537 
541 
542 private:
543  std::vector<TYStructElemPts> _tabElemPts; // Tableau des terrains
544  short _lastIndice;
545 };
546 
552 typedef std::vector<LPTYTopographieGeoNode> TYTabTopographieGeoNode;
553 
554 #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:432
#define OPROTODECL(classname)
Definition: TYElement.h:65
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:386
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:1294
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:1089
The 3D vector class.
Definition: 3d.h:298
void setParent(TYElement *pParent)
Definition: TYElement.h:692
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.
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.
TYTabTerrainGeoNode _listTerrain
Liste des terrains.
TYTabCourbeNiveauGeoNode _listCrbNiv
Liste des courbes de niveau.
bool addPlanEau(LPTYPlanEauGeoNode pPlanEauGeoNode)
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
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