Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSpectre.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_SPECTRE__
21 #define __TY_SPECTRE__
22 
25 
28 
32 class TYSpectre : public TYElement, public OSpectre
33 {
34 
37 
38  // Methodes
39 public:
43  TYSpectre(const double& defaultValue = TY_SPECTRE_DEFAULT_VALUE);
44 
48  TYSpectre(const OSpectre& spectre);
49 
53  TYSpectre(OSpectreAbstract& spectreAbstract);
54 
56  TYSpectre(const OSpectreComplex& spectre);
57 
61  TYSpectre(const TYSpectre& other);
62 
66  virtual ~TYSpectre();
67 
69  virtual TYSpectre& operator=(const TYSpectre& other);
70 
72  virtual TYSpectre& operator=(const OSpectre& other);
73 
75  virtual TYSpectre& operator=(const OSpectreAbstract& other);
76 
78  virtual bool operator==(const TYSpectre& other) const;
79 
81  virtual bool operator!=(const TYSpectre& otehr) const;
82 
91  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
92 
93  // void copyFromStruct(spectre a, MysqlQuery *query);
94 
95  virtual std::string toString() const;
96 
97  virtual DOM_Element toXML(DOM_Element& domElement);
98  virtual int fromXML(DOM_Element domElement);
99 
100  virtual bool toXML(const std::string& sFilePath);
101  virtual bool fromXML(const std::string& sFilePath);
102 
103  virtual std::string toXMLString();
104  virtual bool fromXMLString(const std::string& sXMLString);
105 
108  {
109  return _form;
110  }
111  virtual void setForm(const TYSpectreForm& form)
112  {
113  _form = form;
114  }
115 
117  virtual QString getRemarque() const
118  {
119  return _remarque;
120  }
121 
123  virtual void setRemarque(QString rq)
124  {
125  _remarque = rq;
126  }
127 
129  // bool getKeepInBDD() { return _keepInBDD; }
130 
132  // void setKeepInBDD(bool flag) { _keepInBDD = flag; }
133 
135  virtual bool getIsReadOnly()
136  {
137  return _isReadOnly;
138  }
139 
141  virtual void setIsReadOnly(bool flag)
142  {
143  _isReadOnly = flag;
144  }
145 
147  virtual void exportCSV(const std::string& filename);
148 
150  virtual void exportCSV(std::ofstream& ofs);
151 
153  static TYSpectre getEmptyLinSpectre(const double& valInit = 1.0E-20);
154 
156  static TYSpectre pondA();
157 
159  static TYSpectre pondB();
160 
162  static TYSpectre pondC();
163 
169  static TYSpectre getLambda(const double& c);
170 
171  // ======= METHODES STATIQUES
172 
174  static void setXMLPrecision(const int precision = 2)
175  {
176  _XMLprecision = precision;
177  }
178 
180  static int getXMLPrecision()
181  {
182  return _XMLprecision;
183  }
184 
193 
197  static const float getFreqNorm(int freqIndex);
198 
203  {
204  return dynamic_cast<OSpectre*>(this);
205  }
206  // Membres
207 public:
208 protected:
209  // ==== MEMBRES STATIQUES
210 
212  static int _XMLprecision;
213 
216 
218  QString _remarque;
219 };
220 
221 #endif // __TY_SPECTRE__
NxReal c
Definition: NxVec3.cpp:317
QDomElement DOM_Element
Definition: QT2DOM.h:30
#define OPROTODECL(classname)
Definition: TYElement.h:65
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:386
OTabFreq TYTabFreq
Collection des frequences.
Definition: TYSpectre.h:27
Store acoustic power values for different frequencies.
Definition: spectre.h:82
TYSpectreForm _form
Representation of the spectrum: one-third Octave, Octave, constant delta f, unstructured.
Definition: spectre.h:321
virtual bool fromXMLString(const std::string &sXMLString)
Definition: TYSpectre.cpp:362
virtual ~TYSpectre()
Definition: TYSpectre.cpp:71
QString _remarque
Remarques.
Definition: TYSpectre.h:218
static TYSpectre pondA()
Construit un spectre de ponderation A.
Definition: TYSpectre.cpp:457
virtual void setForm(const TYSpectreForm &form)
Definition: TYSpectre.h:111
static TYSpectre pondB()
Construit un spectre de ponderation B.
Definition: TYSpectre.cpp:463
virtual void exportCSV(const std::string &filename)
Export du spectre au format csv en creant le fichier.
Definition: TYSpectre.cpp:385
virtual bool operator!=(const TYSpectre &otehr) const
Operateur d'inegalite.
Definition: TYSpectre.cpp:137
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYSpectre.cpp:164
virtual TYSpectre & operator=(const TYSpectre &other)
Operateur d'affectation.
Definition: TYSpectre.cpp:73
virtual std::string toString() const
Definition: TYSpectre.cpp:159
static int _XMLprecision
Precision de stockage des resultats.
Definition: TYSpectre.h:212
TYSpectre(const double &defaultValue=TY_SPECTRE_DEFAULT_VALUE)
Definition: TYSpectre.cpp:32
static int getXMLPrecision()
Get/Set de la precision de stockage des resultats (XML)
Definition: TYSpectre.h:180
static const float getFreqNorm(int freqIndex)
Definition: TYSpectre.cpp:441
bool _isReadOnly
Indique si la widget du spectre est read-only.
Definition: TYSpectre.h:215
virtual TYSpectreForm getForm()
Set/Get de la forme du spectre.
Definition: TYSpectre.h:107
static void setXMLPrecision(const int precision=2)
Get/Set de la precision de stockage des resultats (XML)
Definition: TYSpectre.h:174
virtual bool getIsReadOnly()
Set/Get du flag de conservation en BDD.
Definition: TYSpectre.h:135
virtual std::string toXMLString()
Definition: TYSpectre.cpp:350
virtual QString getRemarque() const
Set/Get des remarques.
Definition: TYSpectre.h:117
static TYSpectre getEmptyLinSpectre(const double &valInit=1.0E-20)
Cree un spectre en lin.
Definition: TYSpectre.cpp:451
virtual bool operator==(const TYSpectre &other) const
Operateur d'egalite.
Definition: TYSpectre.cpp:108
static TYSpectre getLambda(const double &c)
Definition: TYSpectre.cpp:479
virtual void setRemarque(QString rq)
Set/Get des remarques.
Definition: TYSpectre.h:123
virtual void setIsReadOnly(bool flag)
Set/Get du flag _isReadOnly.
Definition: TYSpectre.h:141
virtual int fromXML(DOM_Element domElement)
Definition: TYSpectre.cpp:204
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYSpectre.cpp:142
OSpectre * downcast_ospectre()
: return spectrum casted as OSpectre
Definition: TYSpectre.h:202
static const TYTabFreq getTabFreqNorm(TYSpectreForm form=SPECTRE_FORM_TIERS)
Definition: TYSpectre.cpp:419
static TYSpectre pondC()
Construit un spectre de ponderation C.
Definition: TYSpectre.cpp:469
std::vector< double > OTabFreq
Frequencies collection.
Definition: spectre.h:59
TYSpectreForm
Spectrum representation.
Definition: spectre.h:36
@ SPECTRE_FORM_TIERS
Definition: spectre.h:37