Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYMachine.cpp
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 #if TY_USE_IHM
23 #endif
24 
25 #include "TYMachine.h"
26 #include "Tympan/core/logging.h"
27 
30 
32 {
34 
35  _categorie = 1;
36  _constructeur = "Constructeur";
37  _modele = "Modele";
38  _commentaire = "Commentaire";
39 }
40 
42 {
43  *this = other;
44 }
45 
47 
49 {
50  if (this != &other)
51  {
53  _categorie = other._categorie;
55  _modele = other._modele;
56  _commentaire = other._commentaire;
57  }
58  return *this;
59 }
60 
61 bool TYMachine::operator==(const TYMachine& other) const
62 {
63  if (this != &other)
64  {
65  if (TYAcousticVolumeNode::operator!=(other))
66  {
67  return false;
68  }
69  if (_categorie != other._categorie)
70  {
71  return false;
72  }
73  if (_constructeur != other._constructeur)
74  {
75  return false;
76  }
77  if (_modele != other._modele)
78  {
79  return false;
80  }
81  if (_commentaire != other._commentaire)
82  {
83  return false;
84  }
85  }
86  return true;
87 }
88 
89 bool TYMachine::operator!=(const TYMachine& other) const
90 {
91  return !operator==(other);
92 }
93 
94 bool TYMachine::deepCopy(const TYElement* pOther, bool copyId /*=true*/, bool pUseCopyTag /*=false*/)
95 {
96  if (!TYAcousticVolumeNode::deepCopy(pOther, copyId, pUseCopyTag))
97  {
98  return false;
99  }
100 
101  TYMachine* pOtherMachine = (TYMachine*)pOther;
102 
103  _categorie = pOtherMachine->_categorie;
104  _constructeur = pOtherMachine->_constructeur;
105  _modele = pOtherMachine->_modele;
106  _commentaire = pOtherMachine->_commentaire;
107 
108  return true;
109 }
110 
111 std::string TYMachine::toString() const
112 {
113  return "TYMachine";
114 }
115 
117 {
118  DOM_Element domNewElem = TYAcousticVolumeNode::toXML(domElement);
119 
120  TYXMLTools::addElementIntValue(domNewElem, "categorie", _categorie);
121  TYXMLTools::addElementStringValue(domNewElem, "constructeur", _constructeur);
122  TYXMLTools::addElementStringValue(domNewElem, "modele", _modele);
123  TYXMLTools::addElementStringValue(domNewElem, "commentaire", _commentaire);
124 
125  return domNewElem;
126 }
127 
129 {
130  DOM_Element elemCur;
131 
132  QDomNodeList childs = domElement.childNodes();
133  for (unsigned int i = 0; i < childs.length(); i++)
134  {
135  elemCur = childs.item(i).toElement();
136  TYXMLTools::getElementIntValue(elemCur, "categorie", _categorie);
137  TYXMLTools::getElementStringValue(elemCur, "constructeur", _constructeur);
138  TYXMLTools::getElementStringValue(elemCur, "modele", _modele);
139  TYXMLTools::getElementStringValue(elemCur, "commentaire", _commentaire);
140  }
141 
142  return TYAcousticVolumeNode::fromXML(domElement);
143 }
144 
146 {
148 }
149 
151 {
153 }
154 
156 {
158 }
159 
161 {
163 }
164 
165 bool TYMachine::updateAcoustic(const bool& force) // force=false
166 {
168 }
169 
170 double TYMachine::volume() const
171 {
173 }
174 
175 double TYMachine::surface() const
176 {
178 }
179 
181 {
183 }
184 
186 {
188 }
189 
191 {
193 }
194 
196 {
198 }
199 
201 {
203 }
204 
205 int TYMachine::intersects(const OSegment3D& seg, TYTabPoint& ptList) const
206 {
207  return TYAcousticVolumeNode::intersects(seg, ptList);
208 }
209 
210 int TYMachine::isInside(const TYPoint& pt) const
211 {
213 }
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
std::vector< OVector3D > TYTabVector
Collection de OVector3D.
Definition: TYDefines.h:398
std::vector< LPTYPolygon > TYTabLPPolygon
Collection de pointeurs de TYPolygon.
Definition: TYDefines.h:349
Representation graphique d'une machine (fichier header)
outil IHM pour une machine (fichier header)
TY_EXTENSION_INST(TYMachine)
TY_EXT_GRAPHIC_INST(TYMachine)
std::vector< LPTYSourcePonctuelleGeoNode > TYTabSourcePonctuelleGeoNode
Collection de noeuds geometriques de type TYSourcePonctuelle.
virtual const char * getClassName() const
Definition: TYElement.h:249
Class to define a segment.
Definition: 3d.h:1089
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual TYTabVector normals() const
virtual int fromXML(DOM_Element domElement)
virtual TYPoint centreGravite() const
virtual bool updateAcoustic(const bool &force=false)
virtual int isInside(const TYPoint &pt) const
virtual TYBox volEnglob() const
virtual TYTabPoint sommets() const
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
virtual DOM_Element toXML(DOM_Element &domElement)
TYAcousticVolumeNode & operator=(const TYAcousticVolumeNode &other)
Operateur =.
virtual double surface() const
virtual TYTabLPPolygon faces() const
virtual double volume() const
virtual int intersects(const OSegment3D &seg, TYTabPoint &ptList) const
virtual TYSourcePonctuelle srcPonctEquiv() const
Definition: TYBox.h:34
QString _name
Nom courant de l'element.
Definition: TYElement.h:966
virtual ~TYMachine()
Definition: TYMachine.cpp:46
virtual TYBox volEnglob() const
Definition: TYMachine.cpp:195
QString _modele
Nom du modele.
Definition: TYMachine.h:158
virtual TYPoint centreGravite() const
Definition: TYMachine.cpp:200
TYMachine & operator=(const TYMachine &other)
Operateur =.
Definition: TYMachine.cpp:48
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYMachine.cpp:94
virtual TYTabPoint sommets() const
Definition: TYMachine.cpp:185
virtual bool setSrcsLw()
Definition: TYMachine.cpp:160
virtual double surface() const
Definition: TYMachine.cpp:175
virtual TYTabLPPolygon faces() const
Definition: TYMachine.cpp:190
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
Definition: TYMachine.cpp:145
virtual int isInside(const TYPoint &pt) const
Definition: TYMachine.cpp:210
virtual TYSourcePonctuelle srcPonctEquiv() const
Definition: TYMachine.cpp:150
virtual TYTabVector normals() const
Definition: TYMachine.cpp:180
virtual void distriSrcs()
Definition: TYMachine.cpp:155
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYMachine.cpp:116
QString _constructeur
Nom du constructeur.
Definition: TYMachine.h:156
virtual int intersects(const OSegment3D &seg, TYTabPoint &ptList) const
Definition: TYMachine.cpp:205
QString _commentaire
Commentaires.
Definition: TYMachine.h:160
bool operator!=(const TYMachine &other) const
Operateur !=.
Definition: TYMachine.cpp:89
bool operator==(const TYMachine &other) const
Operateur ==.
Definition: TYMachine.cpp:61
virtual bool updateAcoustic(const bool &force=false)
Definition: TYMachine.cpp:165
int _categorie
Categorie.
Definition: TYMachine.h:154
virtual double volume() const
Definition: TYMachine.cpp:170
virtual std::string toString() const
Definition: TYMachine.cpp:111
virtual int fromXML(DOM_Element domElement)
Definition: TYMachine.cpp:128
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
static bool getElementStringValue(DOM_Element parentElem, DOMString nodeName, QString &nodeValue)
Definition: TYXMLTools.cpp:93
static void addElementIntValue(DOM_Element &parentElem, DOMString nodeName, int nodeValue)
Definition: TYXMLTools.cpp:72
static bool getElementIntValue(DOM_Element parentElem, DOMString nodeName, int &nodeValue)
Definition: TYXMLTools.cpp:129
static void addElementStringValue(DOM_Element &parentElem, DOMString nodeName, DOMString nodeValue)
Definition: TYXMLTools.cpp:24