Code_TYMPAN
4.2.0
Industrial site acoustic simulation
|
Classe de definition d'une palette. More...
#include <TYPalette.h>
Public Types | |
typedef float | values_type |
The real number type used to store values (typically double or float) More... | |
typedef std::map< values_type, OColor > | color_map_type |
typedef color_map_type::iterator | color_map_iter |
typedef color_map_type::const_iterator | color_map_const_iter |
typedef color_map_type::value_type | color_map_item |
Public Member Functions | |
TYPalette () | |
A TYPalette represents a mapping from values to colors. More... | |
TYPalette (const TYPalette &other) | |
Constructeur par copie. Constructeur par copie de la classe TYPalette. More... | |
virtual | ~TYPalette () |
Destructeur. Destructeur de la classe TYPalette. More... | |
TYPalette & | operator= (const TYPalette &other) |
bool | operator== (const TYPalette &other) const |
bool | operator!= (const TYPalette &other) const |
virtual bool | deepCopy (const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false) |
virtual std::string | toString () const |
virtual DOM_Element | toXML (DOM_Element &domElement) |
virtual int | fromXML (DOM_Element domElement) |
void | clear () |
values_type | getValueMin () const |
Get de la valeur min. More... | |
values_type | getValueMax () const |
Get de la valeur max. More... | |
size_t | getNbColors () const |
Getter for the number of colors. More... | |
size_t | getNbValues () const |
Getter for the number of values. More... | |
const OColor & | getInfColor () const |
Get de la couleur pour la borne inf. More... | |
void | setInfColor (const OColor &color) |
Set de la couleur pour la borne inf. More... | |
const OColor & | getSupColor () const |
Get/Set de la couleur pour la borne sup. More... | |
void | setSupColor (const OColor &color) |
Set de la couleur pour la borne sup. More... | |
bool | insertColor (values_type value, const OColor &color) |
Insert a new color or update an existing one. More... | |
bool | moveValue (values_type old_value, values_type new_value) |
Moves an existing bound,. More... | |
bool | removeValue (values_type value) |
Removes an existing bound. More... | |
void | resetcolorMapFromColors (values_type valueMin, values_type valueMax, const std::vector< OColor > &lookupTable) |
Reset the colormap as a linear scale with the given colors between minValue and maxValue. More... | |
void | resetToDefault () |
Reset the colormap to a hard-coded default. More... | |
bool | resetFromPreferences () |
Reset the colormap from the preferences XXX. More... | |
void | saveToPreferences () |
Saves the colormap to the preferences XXX. More... | |
const color_map_type & | getColorMap () const |
Get de la lookup table. More... | |
const OColor & | getColorFromValue (values_type value) const |
Set de la lookup table. More... | |
const OColor & | getColorFromIndex (unsigned i) const |
Get de la couleur par index. More... | |
TYPalette::values_type | getValueFromIndex (unsigned i) const |
Get de la valeur par index. More... | |
values_type | denormalize (values_type percent) const |
Set de la couleur pour une valeur. More... | |
values_type | normalize (values_type value) const |
Normalize a value, ie convert a value between min and max to a percentage. More... | |
bool | savePaletteToFile (const QString &qFileName) |
Save the Palette into a file with the name given. More... | |
void | makeLinearPalette (size_t nb_colors, float value_min, float value_max) |
Make a linear palette from a min/max couple. More... | |
Public Member Functions inherited from TYElement | |
void * | getAllUses () |
void | setAllUses (void *allUses) |
void | cleanAllUses () |
TYElement () | |
TYElement (TYElement *pParent, bool PutInInstanceList=true) | |
TYElement (const TYElement &other, bool PutInInstanceList=true) | |
virtual | ~TYElement () |
void | setID (TYUUID id) |
void | setID (const QString &str_id) |
const TYUUID & | getID () const |
QString | getStringID () const |
bool | hasNullID () const |
void | regenerateID () |
void | setName (QString name) |
void | setName (std::string name) |
virtual QString | getName () const |
void | setParent (TYElement *pParent) |
TYElement * | getParent () const |
virtual void | setIsAcousticModified (bool isModified) |
bool | getIsAcousticModified () |
virtual void | setIsGeometryModified (bool isModified) |
bool | getIsGeometryModified () |
TYElement & | operator= (const TYElement &other) |
bool | operator== (const TYElement &other) const |
bool | operator!= (const TYElement &other) const |
bool | callFromXMLIfEqual (DOM_Element &domElement, int *pRetVal=NULL) |
std::string | getMetierName () |
virtual void | updateCurrentCalcul (TYListID &listID, bool recursif=true) |
virtual void | getChilds (LPTYElementArray &childs, bool recursif=true) |
virtual void | setInCurrentCalcul (bool state, bool recurschild=true, bool recursparent=true) |
virtual bool | isInCurrentCalcul () |
void | addCopy () |
Increment le compteur de nombre de copies. More... | |
void | setCopyCount (const unsigned int copyCount) |
Modifie la vaeur du compteur. More... | |
Public Member Functions inherited from IRefCount | |
IRefCount () | |
virtual | ~IRefCount () |
virtual int | incRef () |
virtual int | decRef () |
int | getRefCount () const |
Public Member Functions inherited from OPrototype | |
virtual | ~OPrototype () |
virtual OPrototype * | clone () const =0 |
virtual const char * | getClassName () const |
bool | isA (const char *className) const |
Static Public Member Functions | |
static LPTYPalette | loadPaletteFromFile (const QString &qFileName) |
Create a new TYPalette from an XML file Holding only one Palette. More... | |
Static Public Member Functions inherited from TYElement | |
static LPTYElementArray | findTypeCollectionAndCallFromXML (DOM_Element parentElem, const char *type) |
static void | setLogInstances (bool log) |
static bool | getLogInstances () |
static TYElement * | getInstance (TYUUID uuid) |
static void | purgeInstances () |
static bool | testId (const TYUUID &id, const TYElement *pElem) |
static TYUUID | newID () |
static TYUUID | fromString (QString id) |
static QString | toString (TYUUID &uuid) |
static uint64 | getConstructorCount () |
static uint64 | getDestructorCount () |
static uint64 | getIdGenerationCount () |
static bool | getIsSavedOk () |
static void | setIsSavedOk (const bool &toSave) |
static void | setRegenerateID (const bool &bRegenerate) |
static bool | getRegenerateID () |
Static Public Member Functions inherited from OPrototype | |
static OPrototype * | findAndClone (const char *className) |
static int | findPrototype (const char *className) |
static OPrototype * | safeDownCast (OPrototype *pObject) |
static void | add_factory (const char *, IOProtoFactory::ptr_type factory) |
Static Public Attributes | |
static const values_type | infinity = std::numeric_limits<values_type>::infinity() |
Protected Member Functions | |
int | load_legacy_XML (const DOM_Element &domElement) |
implement loading legacy (pre v4.6) XML format for TYPalettes More... | |
DOM_Element | save_legacy_XML (DOM_Element &domElement) |
implement loading legacy (pre v4.6) XML format for TYPalettes More... | |
Protected Member Functions inherited from OPrototype | |
OPrototype () | |
Protected Attributes | |
color_map_type | _colorMap |
Protected Attributes inherited from TYElement | |
QString | _name |
Nom courant de l'element. More... | |
TYElement * | _pParent |
Reference sur l'element parent. More... | |
bool | _bPutInInstanceList |
unsigned int | _copyCount |
bool | _inCurrentCalcul |
Indique si cet element est actif dans le Calcul courant. More... | |
bool | _isAcousticModified |
Indicateur de modification acoustique. More... | |
bool | _isGeometryModified |
Indicateur de modification de la geometrie. More... | |
LPTYElementGraphic | _pGraphicObject |
L'object graphique metier associe a cet element. More... | |
void * | _allUses |
Multi purpose void pointer (use for compatibility actually) More... | |
Protected Attributes inherited from IRefCount | |
int | m_refCount |
The reference counter. More... | |
Classe de definition d'une palette.
Definition at line 40 of file TYPalette.h.
typedef color_map_type::const_iterator TYPalette::color_map_const_iter |
Definition at line 54 of file TYPalette.h.
typedef color_map_type::value_type TYPalette::color_map_item |
Definition at line 55 of file TYPalette.h.
typedef color_map_type::iterator TYPalette::color_map_iter |
Definition at line 53 of file TYPalette.h.
typedef std::map<values_type, OColor> TYPalette::color_map_type |
Definition at line 52 of file TYPalette.h.
typedef float TYPalette::values_type |
The real number type used to store values (typically double or float)
Definition at line 50 of file TYPalette.h.
TYPalette::TYPalette | ( | ) |
A TYPalette represents a mapping from values to colors.
Definition at line 42 of file TYPalette.cpp.
TYPalette::TYPalette | ( | const TYPalette & | other | ) |
Constructeur par copie. Constructeur par copie de la classe TYPalette.
Definition at line 151 of file TYPalette.cpp.
|
virtual |
Destructeur. Destructeur de la classe TYPalette.
Definition at line 157 of file TYPalette.cpp.
void TYPalette::clear | ( | ) |
|
virtual |
Effectue une copie en allouant de la memoire (deep copy) et non pas en copiant seulement les pointeurs (shallow copy). Cette methode s'utilise comme l'operateur egal. L'ID peut ne pas etre copie, le parent n'est jamais copie.
pOther | L'element a copier. |
copyId | Copie l'identifiant unique ou pas. |
true
si la copie est possible; false
sinon. Reimplemented from TYElement.
Definition at line 185 of file TYPalette.cpp.
|
inline |
Set de la couleur pour une valeur.
Denormalize a value, ie convert a percentage to a value between min and max
Definition at line 227 of file TYPalette.h.
|
virtual |
Extrait les informations a partir du noeud DOM passe afin de recuperer les parametres de la classe.
domElement | Le noeud DOM a partir duquel les parametres doivent etre recuperes. |
Reimplemented from TYElement.
Definition at line 381 of file TYPalette.cpp.
const OColor & TYPalette::getColorFromIndex | ( | unsigned | i | ) | const |
Get de la couleur par index.
Definition at line 479 of file TYPalette.cpp.
const OColor & TYPalette::getColorFromValue | ( | values_type | value | ) | const |
Set de la lookup table.
Set de la couleur pour un pourcentage Get de la couleur pour une valeur
Definition at line 470 of file TYPalette.cpp.
|
inline |
Get de la lookup table.
Definition at line 191 of file TYPalette.h.
|
inline |
Get de la couleur pour la borne inf.
Definition at line 121 of file TYPalette.h.
|
inline |
Getter for the number of colors.
Definition at line 109 of file TYPalette.h.
|
inline |
Getter for the number of values.
Definition at line 115 of file TYPalette.h.
|
inline |
Get/Set de la couleur pour la borne sup.
Definition at line 132 of file TYPalette.h.
TYPalette::values_type TYPalette::getValueFromIndex | ( | unsigned | i | ) | const |
Get de la valeur par index.
Definition at line 491 of file TYPalette.cpp.
|
inline |
Get de la valeur max.
Definition at line 103 of file TYPalette.h.
|
inline |
Get de la valeur min.
Definition at line 97 of file TYPalette.h.
bool TYPalette::insertColor | ( | values_type | value, |
const OColor & | color | ||
) |
Insert a new color or update an existing one.
value | the upper-bound to insert or update |
color | values up to value will be associated to |
Definition at line 198 of file TYPalette.cpp.
|
protected |
implement loading legacy (pre v4.6) XML format for TYPalettes
Definition at line 328 of file TYPalette.cpp.
|
static |
Create a new TYPalette from an XML file Holding only one Palette.
Definition at line 504 of file TYPalette.cpp.
void TYPalette::makeLinearPalette | ( | size_t | nb_colors, |
float | value_min, | ||
float | value_max | ||
) |
Make a linear palette from a min/max couple.
Definition at line 532 of file TYPalette.cpp.
bool TYPalette::moveValue | ( | values_type | old_value, |
values_type | new_value | ||
) |
Moves an existing bound,.
The new value must lie within the interval occupied by the old one. You can move the upper bound by giving a greater value as well.
Definition at line 210 of file TYPalette.cpp.
TYPalette::values_type TYPalette::normalize | ( | values_type | value | ) | const |
Normalize a value, ie convert a value between min and max to a percentage.
Definition at line 462 of file TYPalette.cpp.
bool TYPalette::operator!= | ( | const TYPalette & | other | ) | const |
bool TYPalette::operator== | ( | const TYPalette & | other | ) | const |
Definition at line 172 of file TYPalette.cpp.
bool TYPalette::removeValue | ( | values_type | value | ) |
Removes an existing bound.
Definition at line 245 of file TYPalette.cpp.
void TYPalette::resetcolorMapFromColors | ( | values_type | valueMin, |
values_type | valueMax, | ||
const std::vector< OColor > & | lookupTable | ||
) |
Reset the colormap as a linear scale with the given colors between minValue and maxValue.
Definition at line 125 of file TYPalette.cpp.
bool TYPalette::resetFromPreferences | ( | ) |
Reset the colormap from the preferences XXX.
Definition at line 73 of file TYPalette.cpp.
void TYPalette::resetToDefault | ( | ) |
Reset the colormap to a hard-coded default.
Definition at line 49 of file TYPalette.cpp.
|
protected |
implement loading legacy (pre v4.6) XML format for TYPalettes
Definition at line 293 of file TYPalette.cpp.
bool TYPalette::savePaletteToFile | ( | const QString & | qFileName | ) |
Save the Palette into a file with the name given.
Definition at line 521 of file TYPalette.cpp.
void TYPalette::saveToPreferences | ( | ) |
Saves the colormap to the preferences XXX.
Definition at line 103 of file TYPalette.cpp.
|
inline |
Set de la couleur pour la borne inf.
Definition at line 126 of file TYPalette.h.
|
inline |
Set de la couleur pour la borne sup.
Definition at line 137 of file TYPalette.h.
|
virtual |
Retourne une chaine de caractere donnant des informations sur cet objet (utile pour le debugage).
Reimplemented from TYElement.
Definition at line 193 of file TYPalette.cpp.
|
virtual |
Construit une arborescence DOM a partir du noeud passe afin de sauvegarder les parametres au format XML.
domElement | Le noeud DOM parent a partir duquel l'arborescence doit etre creee. |
Reimplemented from TYElement.
Definition at line 264 of file TYPalette.cpp.
|
protected |
Definition at line 253 of file TYPalette.h.
|
static |
Definition at line 91 of file TYPalette.h.