25 #include <boost/foreach.hpp>
26 #include <boost/tuple/tuple.hpp>
27 #include <boost/math/special_functions/fpclassify.hpp>
37 #define IMG(id) OLocalizator::getPicture("TYPaletteGraphic", (id))
62 assert(pPalette &&
"How the hell pPalette could be NULL ?!?");
72 GLdouble polygonMode[2];
73 glGetDoublev(GL_POLYGON_MODE, polygonMode);
76 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
79 glMatrixMode(GL_PROJECTION);
85 glMatrixMode(GL_MODELVIEW);
90 const double relBoundSize = 0.2;
95 const double width_but_bounds = (
_width * (1.0 - 2 * relBoundSize));
105 BOOST_FOREACH (boost::tie(value, color), pPalette->
getColorMap())
109 boost::math::isinf(value - prev_value)
115 glVertex2d(x, y - dy);
116 glVertex2d(x + dx, y - dy);
117 glVertex2d(x + dx, y);
125 std::ostringstream minValue;
128 std::ostringstream midValue;
131 std::ostringstream maxValue;
174 glMatrixMode(GL_PROJECTION);
178 glMatrixMode(GL_MODELVIEW);
182 glPolygonMode(GL_FRONT_AND_BACK, polygonMode[0]);
Representation d'une palette graphique (fichier header)
static const OColor BLACK
bool load(const char *filename)
void drawText(const std::string &msg, const OColor &color, double x, double y) const
static LPOSizeManager get()
classe graphique pour un element de base
bool _visible
Inique si l'element est visible.
virtual void update(bool force=false)
virtual void update(bool force=false)
TYPaletteGraphic(TYPalette *pElement)
virtual ~TYPaletteGraphic()
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
Classe de definition d'une palette.
const color_map_type & getColorMap() const
Get de la lookup table.
size_t getNbColors() const
Getter for the number of colors.
values_type getValueMax() const
Get de la valeur max.
float values_type
The real number type used to store values (typically double or float)
values_type normalize(values_type value) const
Normalize a value, ie convert a value between min and max to a percentage.
values_type getValueMin() const
Get de la valeur min.