m_FontRotateDegrees(0),
55m_DisplayOptions(fDefaultDisplayOptions),
57m_TextColor(0.1f, 0.2f, 0.1f),
58m_RulerColor(0.2f, 0.2f, 0.2f),
59m_BackColor(0.95f, 0.95f, 0.95f),
63m_OppMajorTickSize(0),
64m_OppMinorTickSize(0),
65m_OppLabelTickSize(6),
146 unsigned intfont_size)
184 int len= end - start + 1;
238 return m_Horz== horz_text;
2572 * text_space + (
int) ceil(text_v);
290 intv = text_v + metric_v;
298 return TVPRect(0, 0, pt.
X(), pt.
Y());
360 intmax_int =
max(mod_start, mod_end);
361total_max =
max(total_max, max_int);
384 doublemax_label_sym = 0;
393 double log= (max_label_sym >= 1.0) ?
log10(max_label_sym) : 0;
396 doublebase_step = step;
409groups_n = (
int) (
log/ 3);
411 intd_digits = 3 * groups_n - 2;
412max_label_w =
m_MaxLabelW- d_digits * char_w + groups_n * comma_w;
413max_label_sym = scale * max_label_w;
415}
while(groups_n && step > max_label_sym * 10);
422 if(step > max_label_sym * 5) {
423base_step = step / 10;
426 else if(step > max_label_sym * 2) {
427base_step = step / 10;
448 intar_K[] = { 10, 5 ,2 };
449 for(
int i= 0;
i< 3;
i++ ) {
492pair<TAlignColl::const_iterator, bool> res =
m_Mapping.
find_2(last_elem);
528 boolupdate =
false;
537update = (from != old_from_1 || from != old_from_2 || to != old_to_1 || to != old_to_2);
554b_update = b_scale_changed || ! (
m_rcLimits== rc_lim);
598 returnprg >= 0 ? (prg + 1) : prg;
605 TModelUnitprg = (display > 0) ? (display - 1) : display;
637rc_back.
Offset(-offset_x, -offset_y);
650 if(start_pos < stop_pos) {
655from_offset = from_offset > 0 ? from_offset * 0.5 :
m_BaseOffset;
658 if(start_pos < stop_pos) {
664to_offset = to_offset > 0 ? to_offset * 0.5 :
m_BaseOffset;
671 intclip_from = clip_r.
GetFrom();
672 intclip_to = clip_r.
GetTo();
674 if( ! clip_r.
Empty()) {
681 doubleMaxU = to + 1;
690 doubleu1 =
max(MinU, (
double) clip_from);
691 doubleu2 =
min(MaxU, (
double) clip_to + 1);
693 TModelUnitv0 = 0.0, v1 = 0.0,
v2= 0.0, v3 = 0.0, v4 = 0.0;
733gl.
Begin(GL_LINES);
737gl.
Vertex2d(u1 - offset_x, v0 - offset_y);
738gl.
Vertex2d(u2 - offset_x, v0 - offset_y);
740gl.
Vertex2d(v0 - offset_x, u1 - offset_y);
741gl.
Vertex2d(v0 - offset_x, u2 - offset_y);
749 if(i_last_disp < i_first_disp)
750 swap(i_last_disp, i_first_disp);
752 for(
int i= i_first_disp;
i<= i_last_disp;
i+=
m_TickSpace) {
754 doublev_f = major ? v4 :
v2;
755 doublev_t = major ? v3 : v1;
758 if(model >= u1 && model < u2) {
759 doubleu = model + 0.5;
762gl.
Vertex2d(u - offset_x, v_f - offset_y);
763gl.
Vertex2d(u - offset_x, v_t - offset_y);
765gl.
Vertex2d(v_f - offset_x, u - offset_y);
766gl.
Vertex2d(v_t - offset_x, u - offset_y);
779 intfirst_elem,
intlast_elem, vector<TModelUnit>& vElemPos)
784 inti_first_disp = (
x_ToDisplay(range, first_elem) / step ) * step;
785 inti_last_disp = (
x_ToDisplay(range, last_elem) / step) * step;
788 if(i_last_disp < i_first_disp) {
789 for(
int i= i_first_disp;
i>= i_last_disp;
i-= step) {
791 if(model >= first_elem && model <= last_elem) {
792vElemPos.push_back(model);
796 for(
int i= i_first_disp;
i<= i_last_disp;
i+= step) {
798 if(model >= first_elem && model <= last_elem) {
799vElemPos.push_back(model);
834vector<TModelUnit> vLabelsPos;
838 doublelabel_size = 0;
839 doublelabel_size_scaled = 0.;
842 doublelow_limit = clip_r.
GetFrom();
843 doublehigh_limit = clip_r.
GetToOpen();
853low_limit = pos + label_size;
864 doublelabel_u = from_offset + from;
875label_size = label_size_scaled + sep_pix * scale;
877 doublelabel_right = label_u + label_size;
878 if(label_u > low_limit) {
879 if(label_right > high_limit || label_size_scaled >= range.
GetLength()) {
882low_limit = label_u + label_size + sep_pix * scale;
889label_u = (to + 1) - to_offset;
896 if(label_u - label_size < low_limit
897|| label_u > high_limit
901high_limit = label_u - (label_size + sep_pix * scale);
907 intlabels_n = (
int)vLabelsPos.size();
908 for(
inti_label = labels_n - 1; i_label >= 0; i_label-- ) {
915 doubleshift = -label_size * 0.5;
922 boolb_draw_text = (label_u + shift + label_size < high_limit)
923&& (label_u + shift > low_limit);
925high_limit = label_u + shift;
930 if( !
S.empty() || (label_u < high_limit && label_u > low_limit)) {
956 TVPUnitclip_vp_len = clip_vp_right - clip_vp_left + 1;
959 inttext_h = (
int) ceil(t_h);
967 intorigin_right = clip_vp_left;
986 TModelUnittext_y = (float) (top_label ? y : (y - text_h));
988gl.
WriteText(x, text_y, x + or_text_w, text_y + text_h, s.c_str());
991origin_right += (x + or_text_w);
1002 intpix_l = (
int) ceil(step / scale_x);
1007 intmetric_w =
max(pix_l, text_w);
1013 TModelUnityc = y + (top_label ? half_h : -half_h);
1018gl.
Begin(GL_LINES);
1031gl.
WriteText(x1, y1, x, y2, s.c_str(),
1044 doubleu_label_offset,
const string& s_text,
1057 doubleu_label_offset,
const string& s_text,
1076label_bottom = tick_bottom -
kTextSpaceY- text_v;
1078label_bottom = tick_bottom - text_v;
1084label_bottom = tick_bottom + tick_h +
kTextSpaceY;
1113 if(!s_text.empty()) {
1125gl.
WriteText(x1, y1, text_u, text_v, s_text.c_str(), text_align,
1135gl.
Begin(GL_LINES);
1136gl.
Vertex2d(pos_u - offset_x, tick_bottom - offset_y);
1137gl.
Vertex2d(pos_u - offset_x, tick_bottom + tick_h - offset_y);
1144 doubleu_label_offset,
const string& s_text,
1162label_left = tick_left - text_v;
1210gl.
WriteText(x1, y1, text_u, text_v, s_text.c_str(), text_align,
1219gl.
Begin(GL_LINES);
1220gl.
Vertex2d(tick_left - offset_x, pos_u - offset_y);
1221gl.
Vertex2d(tick_left + tick_w - offset_x, pos_u - offset_y);
TAlignRangeVector::const_iterator const_iterator
const_iterator insert(const TAlignRange &r)
pair< const_iterator, bool > find_2(position_type pos) const
returns an iterator pointing to a range containing "pos"; if such a range does not exists an iterator...
const_iterator begin() const
CAlignRange Represents an element of pairwise alignment of two sequences.
CGlAttrGuard - guard class for restoring OpenGL attributes.
class CRgbaColor provides a simple abstraction for managing colors.
void SetColor(EColorType type, const CRgbaColor &color)
TModelPoint x_GetLabelSizeUnscaled(CGlPane &pane, const string &label)
CAlignRange< TPos > TAlignRange
void SetRange(int start, int end, int seq_start, bool reverse)
SetRange() activates "manual" mode; in this mode ruler's range in model space is explicitly limited t...
void x_RenderVertPosLabel(CGlPane &pane, double pos_u, double label_offset_u, const string &text, bool draw_tick=true)
virtual string GetTooltip()
void SetTextLabel(const string &label)
void x_CalcStartStopOffsets(const TAlignRange &range, TModelUnit &from_offset, TModelUnit &to_offset)
virtual void SetModelRect(const TModelRect &rc)
void SetFont(CGlTextureFont::EFontFace font_type, unsigned int font_size=12)
TModelRect m_rcLimits
"true" if parameters affecting layout have been changed
virtual TModelRect GetModelRect() const
void x_RenderPosLabel(CGlPane &pane, double pos_u, double label_offset_u, const string &text, bool draw_tick=true)
void x_RenderOriginAndMetric(CGlPane &pane, const TRange &clip_r)
virtual void SetVPRect(const TVPRect &rect)
CGlTextureFont::EFontRotateFlags m_FontRotate
Font rotation flags (rotate around base or cap)
virtual TVPRect GetVPRect() const
void x_RenderBackground(CGlPane &pane, const TModelRect &rc, const TRange &clip_r)
int x_GetOriginMetricSizeV() const
int m_FontRotateDegrees
Use degrees as int for safe comparison to 0, 90, 180 etc.
string x_GetPositionLabel(const TAlignRange &range, int iElem)
TVPPoint GetPreferredSize(int max_num=0) const
CRuler(bool horz=true)
Origin specifies the position in the model space that is represented as "1" in the Ruler's display sp...
EGeometryParam
Ticks and labels placement.
@ eOppLabelTickHeight
tick size at label position (opposite)
@ eOppMajorTickHeight
major tick on the opposite side
@ eOppMinorTickHeight
minor tick on the opposite side
@ eLabelTickHeight
tick size at label position
void x_RenderRange(CGlPane &pane, const TAlignRange &range, const TRange &clip_r)
virtual void SetVisible(bool set)
void SetHorizontal(bool b_horz, ELabelPlacement place=eDefault, ELabelAlign aln=eAln_Center)
int x_GetTicksLabelsSizeV(int max_num) const
Ruler contains two layers.
void SetAutoRange()
SetAutoRange() activates automatic mode; in this mode ruler's range is equal to the provided model li...
void SetLabelOrientation(CGlTextureFont::EFontRotateFlags rotate, int rotate_degrees)
ELabelPlacement m_LabelPlace
void x_UpdatePosLabelsStep(CGlPane &pane)
void SetDisplayOptions(int options)
void x_RenderScale(CGlPane &pane, const TAlignRange &range, const TRange &clip_r)
ELabelAlign
How labels align around ticks.
@ eAln_Bottom
valid for vertical mode only (mapped to eAln_Left for horizontal mode)
@ eAln_Top
valid for vertical mode only (mapped to eAln_Right for horizontal mode)
@ eAln_Right
valid for horizontal mode only (mapped to eAln_Top for vertical mode)
@ eAln_Left
valid for horizontal mode only (mapped to eAln_Bottom for vertical mode)
void x_RenderAllPosLabels(CGlPane &pane, const TAlignRange &range, const TRange &clip_r)
void x_ChooseTickSpace(double scale)
void x_RenderHorzPosLabel(CGlPane &pane, double pos_u, double label_offset_u, const string &text, bool draw_tick=true)
void x_GenerateLabelPositions(const TAlignRange &range, int first_elem, int last_elem, vector< TModelUnit > &vElemPos)
virtual TVPPoint PreferredSize()
virtual void Render(CGlPane &pane)
void x_CalculatePosLabelsStep(CGlPane &Pane)
int x_ToDisplay(const TAlignRange &range, int model) const
TModelUnit x_ToModel(const TAlignRange &range, int display) const
virtual bool NeedTooltip(CGlPane &pane, int vp_x, int vp_y)
void SetGeometryParam(EGeometryParam geom, int value)
TModelPoint x_GetLabelSize(CGlPane &pane, const string &label)
void SetMapping(const TAlignColl &coll)
TAlignColl m_Mapping
range displayed is [m_Start + m_Offset, m_End + m_Offset]
void x_UpdateMappingByPane(CGlPane &pane)
bool x_TextAlongAxis() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
void SetSnapToPixel(bool xpix, bool ypix)
If true (the default) text output position is rounded to nearest pixel coordinate,...
virtual void Begin(GLenum mode)=0
Start rendering.
CGlPoint< TVPUnit > TVPPoint
void SetFontRotate(TFontRotateFlags rot)
Set rotation flags (for center of rotation and re-orienting)
virtual void BeginClippingRect(GLint x, GLint y, GLsizei width, GLsizei height)=0
void Offset(T d_x, T d_y)
EFontRotateFlags
Font rotate options.
TVPUnit ProjectX(TModelUnit m_x) const
IRender & GetGl()
convenience function for getting current render manager
void RectC(const TVPRect &rc)
void Vertex2d(GLdouble x, GLdouble y)
TVPRect & GetViewport(void)
virtual TModelUnit TextHeight(const CGlTextureFont *font) const =0
CGlRect< TVPUnit > TVPRect
virtual void BeginText(const CGlTextureFont *font, const CRgbaColor &color)=0
Text is drawn is pixel coordinates.
virtual TModelUnit TextWidth(const CGlTextureFont *font, const char *text) const =0
TModelUnit GetOffsetY() const
static string FormatSeparatedNumber(int number, bool b_postfix=false)
virtual void EndText()=0
Pops matrices and attributes after writing text.
virtual TModelUnit GetMaxWidth(const CGlTextureFont *font, int max_num) const =0
TModelRect & GetModelLimitsRect(void)
void SetFontFace(EFontFace face, bool use_bitmap_overrides=true)
virtual void EndClippingRect()=0
virtual bool IsPrinterFriendly() const =0
virtual void End()=0
Finish rendering (create buffer and send to renderer)
virtual void PolygonMode(GLenum face, GLenum mode)=0
Set the polygon rasterization mode.
EFontFace
Set of pre-defined fonts for which we know we have valid font files.
virtual void WriteText(TModelUnit x, TModelUnit y, const char *text, TModelUnit rotate_degrees=0.0)=0
Write text at specified model coords.
void SetFontSize(unsigned int size)
Set/get font size in points.
TModelRect & GetVisibleRect(void)
CGlRect< TModelUnit > TModelRect
virtual void Disable(GLenum glstate)=0
glDisable()
virtual TModelUnit GetMetric(const CGlTextureFont *font, IGlFont::EMetric metric, const char *text=NULL, int len=-1) const =0
Calls the standard font metric functions except for pdf in which case it first replaces any bitmap fo...
virtual void LineWidth(GLfloat w)=0
Set line width for drawing: glLineWidth()
TModelUnit GetScaleX(void) const
TModelUnit GetScaleY(void) const
TModelUnit GetOffsetX() const
CGlPoint< TModelUnit > TModelPoint
unsigned int GetFontSize() const
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
position_type GetFirstPosBySecondPos(position_type pos) const
TRange GetFirstRange() const
position_type GetToOpen(void) const
position_type GetFirstTo(void) const
position_type GetSecondFrom(void) const
position_type GetSecondTo(void) const
position_type GetFirstFrom(void) const
position_type GetLength(void) const
position_type GetSecondPosByFirstPos(position_type pos) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
void SetTo(TTo value)
Assign a value to To data member.
unsigned int
A callback function used to compare two keys in a database.
constexpr auto rotate(list< Ts... >) -> decltype((list<>{}+...+rotate_item< Ts >{}))
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static const GLdouble origin[]
static int kTextSpaceX
spacing between text and borders or between text and other graphics
static const int kMinMetricPix
minimal size of the metric in pixels
static const int kLabelSepPixY
static const int kOriginOffsetX
distance in pixels between left side of the ruler and origin labels
static const int kLabelSepPixX
static const int kMinTickStepPixels
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4