Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYBoundaryNoiseMap.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  *
21  */
22 
23 #ifndef __TY_BOUNDARY_NOISE_MAP__
24 #define __TY_BOUNDARY_NOISE_MAP__
25 
27 #include "TYMaillage.h"
28 
39 {
43 
44  // Methods
45 public:
51 
57 
62  virtual ~TYBoundaryNoiseMap();
63 
66 
68  bool operator==(const TYBoundaryNoiseMap& other) const;
69 
71  bool operator!=(const TYBoundaryNoiseMap& other) const;
72 
86  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
87 
88  virtual std::string toString() const;
89 
90  virtual DOM_Element toXML(DOM_Element& domElement);
91  virtual int fromXML(DOM_Element domElement);
92 
93  bool toXML(const std::string& sFilePath);
94 
95  bool fromXML(const std::string& sFilePath);
96 
97  std::string toXMLString();
98 
99  bool fromXMLString(const std::string& sXMLString);
100 
104  virtual void clearResult();
105 
114  virtual void make(const TYTabPoint& tabPoints, double thickness, bool closed,
115  double density = TY_MAILLAGE_DEFAULT_DENSITE);
116 
125  void computeBoundingBox(double& box_x_min, double& box_x_max, double& box_y_min, double& box_y_max) const;
126 
135  void computePoints(double box_x_min, double box_x_max, double box_y_min, double box_y_max);
136 
142  double getDensity() const
143  {
144  return _density;
145  }
146 
151  void setDensity(double density)
152  {
153  _density = density;
154  if (density != 0.0)
155  {
156  _distancePointsCalcul = std::round(100.0f / _density) / 100.0f;
157  }
158  }
159 
165  double getDistance() const
166  {
167  return _distancePointsCalcul;
168  }
169 
175  double getThickness() const
176  {
177  return _thickness;
178  }
179 
181 
184  bool isClosed() const
185  {
186  return _closed;
187  }
188 
194  {
195  return _posLabel;
196  }
197 
202  const TYTabPoint& getTabPoint() const
203  {
204  return _tabPoint;
205  }
206 
212  {
213  return _tabPoint;
214  }
215 
220  const std::vector<int>& getPtsIndices() const
221  {
222  return _ptsIndices;
223  }
224 
229  std::vector<int>& getPtsIndices()
230  {
231  return _ptsIndices;
232  }
233 
238  int getNbPointsY() const
239  {
240  return _nbPointsY;
241  }
242 
248  static double computeMinimumDensity(double thickness);
249 
256  virtual int getIndexPtCalcul(int x, int y) const;
257 
263  virtual void getDimensions(int& x, int& y) const;
264 
269  bool getCanBeClosed() const
270  {
271  return _canBeClosed;
272  }
273 
278  void setCanBeClosed(bool canBeClosed)
279  {
280  _canBeClosed = canBeClosed;
281  }
282 
283  // Members
284 protected:
287 
289  double _density;
290 
293 
295  double _thickness;
296 
298  bool _closed;
299 
302 
304  std::vector<int> _ptsIndices;
305 
308 
311 };
312 
315 
318 
321 
323 typedef std::vector<LPTYBoundaryNoiseMapGeoNode> TYTabBoundaryNoiseMapGeoNode;
324 
325 #endif // __TY_BOUNDARY_NOISE_MAP__
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::vector< LPTYBoundaryNoiseMapGeoNode > TYTabBoundaryNoiseMapGeoNode
Vector of geometry nodes of TYBoundaryNoiseMap.
SmartPtr< TYBoundaryNoiseMapGeoNode > LPTYBoundaryNoiseMapGeoNode
Smart Pointer on TYBoundaryNoiseMapGeoNode.
TYGeometryNode TYBoundaryNoiseMapGeoNode
TYBoundaryNoiseMap geometry node.
SmartPtr< TYBoundaryNoiseMap > LPTYTYBoundaryNoiseMap
Smart Pointer on TYBoundaryNoiseMap.
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
#define TY_EXT_GRAPHIC_DECL_ONLY(classname)
Definition: TYElement.h:430
#define OPROTODECL(classname)
Definition: TYElement.h:64
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:385
This class represents a polyline with a thickness. Acoustic receptors are sampled inside this region.
virtual DOM_Element toXML(DOM_Element &domElement)
std::vector< int > _ptsIndices
Array of points indices : -1 means the point doesn't exist.
void computePoints(double box_x_min, double box_x_max, double box_y_min, double box_y_max)
Compute the calcul points.
bool fromXMLString(const std::string &sXMLString)
double getDistance() const
Return distance between 2 computation points.
bool isClosed() const
Is polyline closed?
std::vector< int > & getPtsIndices()
Return the indices of calcul points.
virtual void clearResult()
Clear result.
TYTabPoint _tabPoint
The tab point defining the polyline.
const TYTabPoint & getTabPoint() const
Return the points defining the polyline.
bool _canBeClosed
If the polyline can be closed.
bool operator!=(const TYBoundaryNoiseMap &other) const
Operator !=.
static double computeMinimumDensity(double thickness)
Return the minimum density to get a correct sampling.
double _distancePointsCalcul
Distance between two consecutive points.
double getThickness() const
Return the thickness of the polyline.
int _nbPointsY
Number of points in column y (rectangular bounding box).
double getDensity() const
Return the density of points.
virtual void make(const TYTabPoint &tabPoints, double thickness, bool closed, double density=TY_MAILLAGE_DEFAULT_DENSITE)
Build the table of TYPointCalcul around the polyline.
void setDensity(double density)
Set density of computation points.
void computeBoundingBox(double &box_x_min, double &box_x_max, double &box_y_min, double &box_y_max) const
Compute the bounding box of the polyline.
double _density
Density of points (number of points per meter).
const std::vector< int > & getPtsIndices() const
Return the indices of calcul points.
bool getCanBeClosed() const
Getter of _canBeClosed.
virtual int getIndexPtCalcul(int x, int y) const
Return the index.
virtual std::string toString() const
int getNbPointsY() const
Return number of points in column, for the 2D array.
TYTabPoint & getTabPoint()
Return the points defining the polyline.
TYPoint _posLabel
The position of the label.
virtual int fromXML(DOM_Element domElement)
virtual void getDimensions(int &x, int &y) const
Return the dimensions in x and y.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
bool _closed
If the polyline is closed.
double _thickness
Thickness of the polyline (in meters).
bool operator==(const TYBoundaryNoiseMap &other) const
Operator ==.
const TYPoint & getPosLabel()
Return the position that will be used for the legend/label display.
virtual ~TYBoundaryNoiseMap()
Destructor. TYBoundaryNoiseMap destructor.
TYBoundaryNoiseMap & operator=(const TYBoundaryNoiseMap &other)
Operator =.
void setCanBeClosed(bool canBeClosed)
Setter of _canBeClosed.
TYBoundaryNoiseMap()
Constructor. TYBoundaryNoiseMap constructor.
Classe de definition d'un maillage.
Definition: TYMaillage.h:51