23 #ifndef __TY_PALETTE__
24 #define __TY_PALETTE__
86 virtual bool deepCopy(
const TYElement* pOther,
bool copyId =
true,
bool pUseCopyTag =
false);
88 virtual std::string
toString()
const;
171 return _colorMap.rbegin()->second = color;
204 const std::vector<OColor>& lookupTable);
289 void makeLinearPalette(
unsigned int nb_colors,
float value_min,
float value_max);
#define TY_EXT_GRAPHIC_DECL_ONLY(classname)
#define OPROTODECL(classname)
#define TY_EXTENSION_DECL_ONLY(classname)
Classe de definition d'une palette.
virtual std::string toString() const
size_t getNbValues() const
Getter for the number of values.
bool removeValue(values_type value)
Removes an existing bound.
void makeLinearPalette(unsigned int nb_colors, float value_min, float value_max)
Make a linear palette from a min/max couple.
const OColor & getColorFromValue(values_type value) const
Set de la lookup table.
bool resetFromPreferences()
Reset the colormap from the preferences XXX.
const OColor & getInfColor() const
Get de la couleur pour la borne inf.
const color_map_type & getColorMap() const
Get de la lookup table.
size_t getNbColors() const
Getter for the number of colors.
void resetToDefault()
Reset the colormap to a hard-coded default.
const OColor & getSupColor() const
Get/Set de la couleur pour la borne sup.
bool operator!=(const TYPalette &other) const
const OColor & getColorFromIndex(unsigned i) const
Get de la couleur par index.
DOM_Element save_legacy_XML(DOM_Element &domElement)
implement loading legacy (pre v4.6) XML format for TYPalettes
TYPalette()
A TYPalette represents a mapping from values to colors.
static LPTYPalette loadPaletteFromFile(const QString &qFileName)
Create a new TYPalette from an XML file Holding only one Palette.
bool operator==(const TYPalette &other) const
bool savePaletteToFile(const QString &qFileName)
Save the Palette into a file with the name given.
values_type getValueMax() const
Get de la valeur max.
TYPalette & operator=(const TYPalette &other)
color_map_type::const_iterator color_map_const_iter
TYPalette::values_type getValueFromIndex(unsigned i) const
Get de la valeur par index.
virtual DOM_Element toXML(DOM_Element &domElement)
bool moveValue(values_type old_value, values_type new_value)
Moves an existing bound,.
float values_type
The real number type used to store values (typically double or float)
void saveToPreferences()
Saves the colormap to the preferences XXX.
void setSupColor(const OColor &color)
Set de la couleur pour la borne sup.
virtual ~TYPalette()
Destructeur. Destructeur de la classe TYPalette.
color_map_type::value_type color_map_item
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.
values_type normalize(values_type value) const
Normalize a value, ie convert a value between min and max to a percentage.
static const values_type infinity
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
std::map< values_type, OColor > color_map_type
virtual int fromXML(DOM_Element domElement)
values_type denormalize(values_type percent) const
Set de la couleur pour une valeur.
void setInfColor(const OColor &color)
Set de la couleur pour la borne inf.
values_type getValueMin() const
Get de la valeur min.
bool insertColor(values_type value, const OColor &color)
Insert a new color or update an existing one.
color_map_type::iterator color_map_iter
int load_legacy_XML(const DOM_Element &domElement)
implement loading legacy (pre v4.6) XML format for TYPalettes