Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCoursEau.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 #include "Tympan/core/logging.h"
17 #include "TYCoursEau.h"
18 
19 #if TY_USE_IHM
23 #endif
24 
27 
29 {
31 
32  // Couleur par default
33  float r = 33.0f, g = 147.0f, b = 217.0f;
34 
35 #if TY_USE_IHM
36  if (TYPreferenceManager::exists(TYDIRPREFERENCEMANAGER, "TYCoursEauGraphicColorR"))
37  {
38  TYPreferenceManager::getColor(TYDIRPREFERENCEMANAGER, "TYCoursEauGraphicColor", r, g, b);
39  }
40  else
41  {
42  TYPreferenceManager::setColor(TYDIRPREFERENCEMANAGER, "TYCoursEauGraphicColor", r, g, b);
43  }
44 #endif
45  OColor color;
46  color.r = r / 255;
47  color.g = g / 255;
48  color.b = b / 255;
49 
50  setColor(color);
51 }
52 
54 {
55  *this = other;
56 }
57 
59 
61 {
62  if (this != &other)
63  {
65  }
66  return *this;
67 }
68 
69 bool TYCoursEau::operator==(const TYCoursEau& other) const
70 {
71  if (this != &other)
72  {
73  if (TYAcousticLine::operator!=(other))
74  {
75  return false;
76  }
77  }
78  return true;
79 }
80 
81 bool TYCoursEau::operator!=(const TYCoursEau& other) const
82 {
83  return !operator==(other);
84 }
85 
86 std::string TYCoursEau::toString() const
87 {
88  return "TYCoursEau";
89 }
90 
92 {
93  DOM_Element domNewElem = TYAcousticLine::toXML(domElement);
94  return domNewElem;
95 }
96 
98 {
99  TYAcousticLine::fromXML(domElement);
100 
101  return 1;
102 }
QDomElement DOM_Element
Definition: QT2DOM.h:30
Representation graphique d'un cours d'eau (fichier header)
Outil IHM pour un cours d'eau (fichier header)
TY_EXTENSION_INST(TYCoursEau)
TY_EXT_GRAPHIC_INST(TYCoursEau)
#define TYDIRPREFERENCEMANAGER
Definition: TYElement.h:52
Definition: color.h:31
float b
Definition: color.h:33
float r
Definition: color.h:33
float g
Definition: color.h:33
virtual const char * getClassName() const
Definition: TYElement.h:249
virtual int fromXML(DOM_Element domElement)
TYAcousticLine & operator=(const TYAcousticLine &other)
Operateur =.
virtual DOM_Element toXML(DOM_Element &domElement)
virtual void setColor(const OColor &color)
bool operator==(const TYCoursEau &other) const
Operateur ==.
Definition: TYCoursEau.cpp:69
TYCoursEau & operator=(const TYCoursEau &other)
Operateur =.
Definition: TYCoursEau.cpp:60
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYCoursEau.cpp:91
virtual int fromXML(DOM_Element domElement)
Definition: TYCoursEau.cpp:97
virtual ~TYCoursEau()
Definition: TYCoursEau.cpp:58
virtual std::string toString() const
Definition: TYCoursEau.cpp:86
bool operator!=(const TYCoursEau &other) const
Operateur !=.
Definition: TYCoursEau.cpp:81
QString _name
Nom courant de l'element.
Definition: TYElement.h:966
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.