25 #include <boost/foreach.hpp>
26 #include <boost/tuple/tuple.hpp>
27 #include <boost/math/special_functions/fpclassify.hpp>
38 #define IMG(id) OLocalizator::getPicture("TYPaletteGraphic", (id))
63 assert(pPalette &&
"How the hell pPalette could be NULL ?!?");
74 glGetIntegerv(GL_VIEWPORT, viewport);
75 unsigned int width = viewport[2];
76 unsigned int height = viewport[3];
78 GLdouble polygonMode[2];
79 glGetDoublev(GL_POLYGON_MODE, polygonMode);
82 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
85 glMatrixMode(GL_PROJECTION);
88 glOrtho(0, width, 0.0, height, 0.0, 1.0);
91 glMatrixMode(GL_MODELVIEW);
96 const double relBoundSize = 0.2;
101 const double width_but_bounds = (
_width * (1.0 - 2 * relBoundSize));
111 BOOST_FOREACH (boost::tie(value, color), pPalette->
getColorMap())
115 boost::math::isinf(value - prev_value)
121 glVertex2d(x, y - dy);
122 glVertex2d(x + dx, y - dy);
123 glVertex2d(x + dx, y);
131 std::ostringstream minValue;
134 std::ostringstream midValue;
137 std::ostringstream maxValue;
180 glMatrixMode(GL_PROJECTION);
184 glMatrixMode(GL_MODELVIEW);
188 glPolygonMode(GL_FRONT_AND_BACK, polygonMode[0]);
Representation d'une palette graphique (fichier header)
Contexte de rendu utilisé par les fonctions d'affichage.
static const OColor BLACK
bool load(const char *filename)
void drawText(const std::string &msg, const OColor &color, double x, double y) const
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)
virtual void display(TYRenderContext &renderContext)
TYPaletteGraphic(TYPalette *pElement)
virtual ~TYPaletteGraphic()
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.