Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCourbeNiveau.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_COURBENIVEAU__
21 #define __TY_COURBENIVEAU__
22 
25 
30 {
34 
35  // Methodes
36 public:
44  TYCourbeNiveau(const TYCourbeNiveau& other);
48  TYCourbeNiveau(const TYTabPoint& pts, double alt);
52  virtual ~TYCourbeNiveau();
53 
57  bool operator==(const TYCourbeNiveau& other) const;
59  bool operator!=(const TYCourbeNiveau& other) const;
60 
74  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
75 
76  virtual std::string toString() const;
77 
78  virtual DOM_Element toXML(DOM_Element& domElement);
79  virtual int fromXML(DOM_Element domElement);
80 
81  virtual void setIsGeometryModified(bool isModified);
82 
86  void purge()
87  {
88  _listPoints.clear();
90  }
91 
95  void addPoint(const TYPoint& pt)
96  {
97  _listPoints.push_back(pt);
98  }
99 
103  void addPoint(double x, double y, double z = 0.0)
104  {
105  _listPoints.push_back(TYPoint(x, y, z));
106  setIsGeometryModified(true);
107  }
108 
113  {
114  return _listPoints;
115  }
119  const TYTabPoint& getListPoints() const
120  {
121  return _listPoints;
122  }
126  void setListPoints(const TYTabPoint& pts);
127 
131  void close(bool closed);
132 
136  double getAltitude() const
137  {
138  return _altitude;
139  }
143  void setAltitude(double alt);
144 
148  void setDistMax(const double dist)
149  {
150  _distMax = dist;
151  }
152 
156  double getDistMax();
157 
162  {
163  return _isDMaxDefault;
164  }
165  const bool getIsDMaxDefault() const
166  {
167  return _isDMaxDefault;
168  }
169 
173  void setIsDMaxDefault(const bool& etat);
174 
179  void applyAlitudeToPoints();
180 
184  static double setDefaultDistMax();
185 
190  static void setDefaultDistMax(const double& val)
191  {
192  _defaultDistMax = val;
193  }
194 
198  static double getDefaultDistMax()
199  {
200  return _defaultDistMax;
201  }
202 
206  static void updateDefaultDistMax()
207  {
209  }
210 
214  void updateDistMax();
215 
219  virtual void updateColor();
220 
221  bool isClosed() const
222  {
223  return _closed;
224  }
225 
229  TYTabPoint::iterator getPointRef(const TYPoint& pt);
230 
234  LPTYCourbeNiveau split(const TYPoint& pt);
235 
239  void offsetListPoints();
240 
241 private:
242  void restructure(TYTabPoint::iterator itPt);
243 
244  // Membres
245 protected:
246  // Valeur de distance max entre les points qui defini dans les preferences utilisateurs
247  static double _defaultDistMax;
248  // Flag pour indiquer que distance max n'est pas egal a la valeur par defaut (false)
250  // Distance max specifique a la courbe
251  double _distMax;
253  double _altitude;
256 
258  bool _closed;
259 };
260 
266 typedef std::vector<LPTYCourbeNiveauGeoNode> TYTabCourbeNiveauGeoNode;
267 
268 #endif // __TY_COURBENIVEAU__
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::vector< LPTYCourbeNiveauGeoNode > TYTabCourbeNiveauGeoNode
Collection de noeuds geometriques de type TYCourbeNiveau.
TYGeometryNode TYCourbeNiveauGeoNode
Noeud geometrique de type TYCourbeNiveau.
SmartPtr< TYCourbeNiveauGeoNode > LPTYCourbeNiveauGeoNode
Smart Pointer sur TYCourbeNiveauGeoNode.
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
#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
bool operator!=(const TYCourbeNiveau &other) const
Operateur !=.
LPTYCourbeNiveau split(const TYPoint &pt)
return a new level curve by spliting the actual one at indicated point
virtual ~TYCourbeNiveau()
virtual int fromXML(DOM_Element domElement)
virtual DOM_Element toXML(DOM_Element &domElement)
bool isClosed() const
TYCourbeNiveau & operator=(const TYCourbeNiveau &other)
Operateur =.
double _altitude
Altitude.
void setListPoints(const TYTabPoint &pts)
double getAltitude() const
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
const TYTabPoint & getListPoints() const
void addPoint(double x, double y, double z=0.0)
TYTabPoint _listPoints
Liste de points.
void restructure(TYTabPoint::iterator itPt)
static double getDefaultDistMax()
bool getIsDMaxDefault()
virtual void updateColor()
void addPoint(const TYPoint &pt)
virtual std::string toString() const
static void setDefaultDistMax(const double &val)
static double _defaultDistMax
const bool getIsDMaxDefault() const
void setDistMax(const double dist)
TYTabPoint::iterator getPointRef(const TYPoint &pt)
return an iterator to the curve point closest to the point passed
void close(bool closed)
virtual void setIsGeometryModified(bool isModified)
TYTabPoint & getListPoints()
bool _closed
close status
bool operator==(const TYCourbeNiveau &other) const
Operateur ==.
static double setDefaultDistMax()
void setAltitude(double alt)
void applyAlitudeToPoints()
void setIsDMaxDefault(const bool &etat)
static void updateDefaultDistMax()