Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSourceBafflee.cpp
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 
21 
22 #include "Tympan/core/logging.h"
23 
24 #include "TYSourceBafflee.h"
26 {
28 
29  _type = TypeBouche;
30 
32 }
33 
35 {
36  *this = other;
37 }
38 
40 
42 {
43  if (this != &other)
44  {
47  }
48  return *this;
49 }
50 
52 {
53  if (this != &other)
54  {
55  if (TYSourcePonctuelle::operator!=(other))
56  {
57  return false;
58  }
60  {
61  return false;
62  }
63  }
64  return true;
65 }
66 
68 {
69  return !operator==(other);
70 }
71 
72 bool TYSourceBafflee::deepCopy(const TYElement* pOther, bool copyId /*=true*/, bool pUseCopyTag /*=false*/)
73 {
74  if (!TYSource::deepCopy(pOther, copyId))
75  {
76  return false;
77  }
78 
79  TYSourceBafflee* pOtherSrc = (TYSourceBafflee*)pOther;
80 
81  if (_pAcousticRectangle && pOtherSrc->_pAcousticRectangle)
82  {
84  }
85  else
86  {
87  _pAcousticRectangle = NULL;
88  }
89 
90  return true;
91 }
92 
93 std::string TYSourceBafflee::toString() const
94 {
95  return "TYSourceBafflee";
96 }
97 
99 {
100  DOM_Element domNewElem = TYSourcePonctuelle::toXML(domElement);
101 
103  {
104  // Mise en commentaire DT20061228 - car cette ligne devrait etre inutile
105  // TYXMLTools::addElementStringValue(domNewElem, "accRectId",
106  // _pAcousticRectangle->getID().toString().c_str());
107  }
108 
109  return domNewElem;
110 }
111 
113 {
114  TYSourcePonctuelle::fromXML(domElement);
115 
116  _pAcousticRectangle = NULL;
117 
118  QString id;
119  DOM_Element elemCur;
120 
121  QDomNodeList childs = domElement.childNodes();
122 
123  for (unsigned int i = 0; i < childs.length(); i++)
124  {
125  elemCur = childs.item(i).toElement();
126 
127  if (TYXMLTools::getElementStringValue(elemCur, "accRectId", id))
128  {
130  }
131  }
132 
133  return 1;
134 }
135 
137 {
138 
139  _pAcousticRectangle = pAcousticRectangle;
141  setIsAcousticModified(true);
142 }
All base classes related to 3D manipulation.
QDomElement DOM_Element
Definition: QT2DOM.h:30
int id
virtual const char * getClassName() const
Definition: TYElement.h:248
static OPrototype * safeDownCast(OPrototype *pObject)
Definition: TYElement.cpp:71
QString _name
Nom courant de l'element.
Definition: TYElement.h:956
void setParent(TYElement *pParent)
Definition: TYElement.h:690
virtual void setIsAcousticModified(bool isModified)
Definition: TYElement.cpp:248
static TYElement * getInstance(TYUUID uuid)
Definition: TYElement.cpp:158
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
void setAcousticRectangle(LPTYRectangle pAcousticRectangle)
LPTYRectangle _pAcousticRectangle
Le rectangle acoustique associe a cette source.
virtual std::string toString() const
virtual ~TYSourceBafflee()
TYSourceBafflee & operator=(const TYSourceBafflee &other)
Operateur =.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
bool operator==(const TYSourceBafflee &other) const
Operateur ==.
virtual DOM_Element toXML(DOM_Element &domElement)
bool operator!=(const TYSourceBafflee &other) const
Operateur !=.
virtual int fromXML(DOM_Element domElement)
int _type
Type de cette source.
virtual int fromXML(DOM_Element domElement)
virtual DOM_Element toXML(DOM_Element &domElement)
TYSourcePonctuelle & operator=(const TYSourcePonctuelle &other)
Operateur =.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYSource.cpp:71
static bool getElementStringValue(DOM_Element parentElem, DOMString nodeName, QString &nodeValue)
Definition: TYXMLTools.cpp:93