Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYBoundaryNoiseMap.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  *
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 
152  double getThickness() const
153  {
154  return _thickness;
155  }
156 
158 
161  bool isClosed() const
162  {
163  return _closed;
164  }
165 
171  {
172  return _posLabel;
173  }
174 
179  const TYTabPoint& getTabPoint() const
180  {
181  return _tabPoint;
182  }
183 
189  {
190  return _tabPoint;
191  }
192 
197  const std::vector<int>& getPtsIndices() const
198  {
199  return _ptsIndices;
200  }
201 
206  std::vector<int>& getPtsIndices()
207  {
208  return _ptsIndices;
209  }
210 
215  int getNbPointsY() const
216  {
217  return _nbPointsY;
218  }
219 
225  static double computeMinimumDensity(double thickness);
226 
233  virtual int getIndexPtCalcul(int x, int y) const;
234 
240  virtual void getDimensions(int& x, int& y) const;
241 
246  bool getCanBeClosed() const
247  {
248  return _canBeClosed;
249  }
250 
255  void setCanBeClosed(bool canBeClosed)
256  {
257  _canBeClosed = canBeClosed;
258  }
259 
260  // Members
261 protected:
264 
266  double _density;
267 
269  double _thickness;
270 
272  bool _closed;
273 
276 
278  std::vector<int> _ptsIndices;
279 
282 
285 };
286 
289 
292 
295 
297 typedef std::vector<LPTYBoundaryNoiseMapGeoNode> TYTabBoundaryNoiseMapGeoNode;
298 
299 #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:432
#define OPROTODECL(classname)
Definition: TYElement.h:65
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:386
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)
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 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 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