00001 /* 00002 * ColorBar.h 00003 * 00004 * Created on: 17-09-2013 00005 * Author: Paweł Macioł 00006 */ 00007 00008 #ifndef COLORBAR_H_ 00009 #define COLORBAR_H_ 00010 00011 #include "fv_inc.h" 00012 #include "fv_txt_utls.h" 00013 #include "Enums.h" 00014 #include "Log.h" 00015 #include "LegendValue.h" 00016 #include "GLRenderBase.h" 00017 #include <vector> 00018 #include <cassert> 00019 #include <iostream> 00020 #include <GL/gl.h> 00021 00022 namespace FemViewer { 00023 00024 class Legend; 00025 00026 enum { left, up, }; 00027 enum { flat, gradient }; 00028 00029 00030 00031 class ColorBar : public GLRenderBase 00032 { 00033 public: 00034 // Ctr & Dsr 00035 explicit ColorBar (int type = HORIZONTAL); 00036 00037 virtual ~ColorBar (void) { 00038 mfp_log_debug("ColorBar dtr"); 00039 Destroy(); 00040 } 00041 virtual void Draw (void) { 00042 //glCallList(m_dispList); 00043 m_coreGL.renderGLList(m_dispList); 00044 } 00045 virtual void Reset (void) { Destroy(); Create(m_colorMap.get()); } 00046 //virtual void Update (void) {} 00047 virtual bool Create (void* argPtr); 00048 00049 bool IsEnabled() const { return m_dirty; } 00050 00051 protected: 00052 virtual void DoSetup(const GraphicsSettings* settings) {} 00053 virtual void DoRender(RenderParams* rparams) {}; 00054 00055 unsigned int m_dispList; 00056 colorbar_config_t m_cbCfg; 00057 00058 std::shared_ptr<Legend> m_colorMap; 00059 00060 void Destroy (void); 00061 00062 00063 private: 00064 // Not implemented 00065 ColorBar(const ColorBar&); 00066 ColorBar& operator=(const ColorBar&); 00067 00068 static void Defaults(ColorBar& cb); 00069 00070 bool m_dirty; 00071 00072 }; 00073 00074 } 00075 00076 00077 #endif /* COLORBAR_H_ */