43 : m_MinColor(1.0f, 1.0f, 1.0f),
44 m_MaxColor(0.0f, 0.0f, 0.0f),
97 const static double kMaxRatio = 4.0;
98 const static double kRatio = 2.0;
109 bool outside = vis_start < start || vis_stop > (stop + 1);
111 TModelUnit ratio = (vis_stop - vis_start) / (stop - start + 1);
112 bool bad_scale = ratio > kMaxRatio || ratio < (1 / kMaxRatio);
114 if(outside || bad_scale) {
116 TModelUnit center = (vis_start + vis_stop) / 2;
122 new_start = center -
range / 2;
123 new_stop = new_start +
range;
126 new_stop = new_start +
range;
127 }
else if(new_stop > max_pos) {
129 new_start = new_stop -
range;
144 CGlAttrGuard guard(GL_LINE_BIT | GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT );
148 gl.
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
171 for(
auto i = 0;
i < count;
i++ ) {
173 double norm = (max_v > 0.00001) ? (
value / max_v) : 0;
178 double pos = start +
i * d;
181 gl.
Rectd(x1, z1, x1 + d, z2);
184 gl.
Rectd(z1, y1, z2, y1 + d);
196 static const int kGraphSize = 12;
197 return TVPPoint(kGraphSize, kGraphSize);
CGlAttrGuard - guard class for restoring OpenGL attributes.
virtual ~CHistogramGraph()
CHistogramGraph(bool b_horz)
virtual bool NeedTooltip(CGlPane &pane, int vp_x, int vp_y)
void SetProperties(const SProperties &props)
virtual IHistogramGraphDS * GetDataSource()
CIRef< IHistogramGraphDS > m_DataSource
virtual string GetTooltip()
CRgbaGradColorTable m_ColorTable
virtual TVPPoint PreferredSize()
virtual void x_RenderHistogram(CGlPane &pane)
virtual void SetDataSource(IHistogramGraphDS *ds)
virtual void Render(CGlPane &pane)
const SProperties & GetProperties() const
class CRgbaColor provides a simple abstraction for managing colors.
IHistogramGraphDS interface.
virtual void Enable(GLenum glstate)=0
CGlPoint< TVPUnit > TVPPoint
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)=0
Options to be used when GL_BLEND is enabled.
IRender & GetGl()
convenience function for getting current render manager
void RectC(const TVPRect &rc)
TModelUnit GetOffsetY() const
void SetSize(size_t size)
void FillGradient(const CRgbaColor &start_c, const CRgbaColor &end_c)
initialize the whole table with gradient colors in [start_c, end_c] range
bool PtInRect(T x, T y) const
virtual void PolygonMode(GLenum face, GLenum mode)=0
Set the polygon rasterization mode.
int GetIndex(double norm) const
returns color index by the normalized value; normalized values is a value in the [0....
TModelRect & GetVisibleRect(void)
virtual void Disable(GLenum glstate)=0
glDisable()
TModelUnit GetOffsetX() const
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
void Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
CRgbaColor & GetColor(size_t i)
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
range(_Ty, _Ty) -> range< _Ty >