54 m_ResizableColumnIndex(-1),
94 const char *v = (
const char *)glGetString(GL_VERSION);
168 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
192 catch (std::exception &e)
267 return row.NotNull();
275 return row.NotNull();
308 int row_top_y = vp_top - model_y;
322 int vp_y = vp_top - y;
336 row_top_y = vp_top1 - model_y;
344 stringstream statistics;
361 rcV.
SetVert(rc_vp.Height() - 1, 0);
380 row->PrepareRendering(pane, vp_top_y, 0);
385 row->GetTooltip(pt,
type, pane, *formatter);
388 return formatter->Render();
397 row->GetStringAtPos(base, pos);
399 return formatter->Render();
402 if (!formatter->IsEmpty())
403 formatter->AddDividerRow();
409 else if (!(symbol = base[0]))
414 if (
row->UsesAATranslation())
416 string colstat =
string(1, symbol);
425 formatter->AddRow(
"Amino acid:", colstat);
429 string colstat =
string(1, symbol);
437 formatter->AddRow(
"Base:", colstat);
440 auto base_width =
row->UsesAATranslation() &&
row->IsNucProtAlignment() ? 3 : 1;
446 for (
int i = -1;
i < num_rows;
i++)
452 if (itrow ==
NULL || itrow == consensus_row)
463 else if (!(symbol = base[0]))
479 ITERATE(MapCharInt, itr, counters)
481 char sym = itr->first;
482 int num = itr->second;
492 else if (sym == symbol)
512 row->GetRowStatistics(*formatter);
514 return formatter->Render();
527 for (
int i = 0;
i < n_col;
i++)
589 bool align_visible =
false;
632 h += (
row->GetHeightPixels() - 1);
684 "Ruler",
"Ruler",
"");
685 p_areas->push_back(area);
732 iFirst =
max(iFirst, 0);
769 for (
int i = iFirst;
i <= iLast;
i++)
776 int state = base_state;
803 row->PrepareRendering(pane, row_top,
state);
806 for (
int i_col = 0; i_col < col_n; i_col++)
817 row->GetHTMLActiveAreas(
type, pane, *areas);
825 catch (std::exception &e)
838 vector<string> col_text;
840 col_text.resize(col_n);
842 for (
auto i = 0;
i < num_rows; ++
i) {
844 for (
int i_col = 0; i_col < col_n; i_col++) {
851 if (col_text[i_col].length() <
text.length())
852 col_text[i_col] =
text;
857 for (
size_t i = 0;
i < col_text.size(); ++
i) {
910 if (vp_y < top && vp_y > limit)
933 int model_y = offset_y - vp_y;
971 master_row->
Update(port, layout_only);
975 iFirst =
max(iFirst, 0);
979 for (
int i = iFirst;
i <= iLast;
i++)
982 p_row->
Update(port, layout_only);
1017 return (
int)m_Columns.size();
1022 _ASSERT(index >= 0 && index < (
int)m_Columns.size());
1023 return m_Columns[index];
1028 _ASSERT(index >= 0 && index < (
int)m_Columns.size());
1029 return m_Columns[index];
1040 return InsertColumn(index, width,
label,
data);
1046 _ASSERT(index >= 0 && index <= (
int)m_Columns.size());
1054 TColumnVector::const_iterator it =
1055 m_Columns.insert(m_Columns.begin() + index, col);
1056 int i =
int(it - m_Columns.begin());
1059 if (m_ResizableColumnIndex >= 0 && m_ResizableColumnIndex < (
int)m_Columns.size())
1061 if (m_ResizableColumnIndex >=
i)
1063 m_ResizableColumnIndex++;
1068 m_ResizableColumnIndex =
i;
1075 if (index >= 0 && index < (
int)m_Columns.size())
1077 m_ResizableColumnIndex = index;
1088 SetResizableColumn(resizable_index);
1096 width =
max(width, 0);
1098 m_Columns[index].m_Width = width;
1103 m_Columns[index].m_Pos = pos;
1108 _ASSERT(index >= 0 && index < (
int)m_Columns.size());
1109 m_Columns[index].m_UserData =
data;
1114 _ASSERT(index >= 0 && index < (
int)m_Columns.size());
1116 SColumn &col = m_Columns[index];
1125 for (
int i = index + 1;
delta != 0 &&
i < (
int)m_Columns.size();
i++)
1127 m_Columns[
i].m_Pos +=
delta;
1137 _ASSERT(index >= 0 && index < (
int)m_Columns.size());
1139 return m_Columns[index].m_Visible;
1148 _ASSERT(rs_index < m_Columns.size());
1149 string rs_name = m_Columns[rs_index].m_Name;
1151 vector<SColumn> new_columns;
1158 for (
size_t i = 0;
i < m_Columns.size();
i++)
1160 if (m_Columns[
i].m_Name == col.
m_Name)
1165 new_columns.push_back(m_Columns[
i]);
1167 m_Columns.erase(m_Columns.begin() +
i);
1174 new_columns.insert(new_columns.end(), m_Columns.begin(), m_Columns.end());
1176 m_Columns = new_columns;
1179 for (
size_t j = 0; j < m_Columns.size(); j++)
1181 if (m_Columns[j].m_Name == rs_name)
1189 SetResizableColumn((
int)rs_index);
1251 names.push_back(it->m_Name);
1260 if (it->m_Visible && x >= it->m_Pos && x < it->m_Pos + it->m_Width)
1261 return int(it - m_Columns.begin());
1268 return m_ResizableColumnIndex;
1278 int w = m_rcBounds.Width();
1279 int n_col = (
int)m_Columns.size();
1281 if (w > 0 && n_col > 0)
1284 for (
int j = 0; j < n_col; j++)
1287 if (col.
m_Visible && j != m_ResizableColumnIndex)
1294 for (
int j = 0; j < n_col; j++)
1300 if (j == m_ResizableColumnIndex)
1302 int w_rest = w - total_w;
1303 col.
m_Width = w_rest > 0 ? w_rest : 0;
User-defined methods of the data storage class.
const int kDefColumnWidth
static const int kRulerSpace
static const int kMasterRowSpace
int m_ResizableColumnIndex
void x_RenderRuler(TAreaVector *p_areas)
void x_RenderRow(IAlignRow *row, CGlPane &pane, int state, TVPUnit row_top, TAreaVector *areas)
TVPPoint m_TooltipVPPos
is it invoked by alnmulti.cgi
CAlnMultiHeader & GetHeader()
int x_GetLineByVPY(int vp_y) const
virtual void UpdateOnDataChanged()
bool IsColumnVisible(int index) const
virtual void Resize(const TVPRect &rc)
TColumnType GetColumnTypeByX(int vp_x) const
void SetContext(IAlnMultiRendererContext *pContext)
void SetColumnsByStyle(CWidgetDisplayStyle &style)
virtual int GetColumnsCount() const
virtual void SetupColumns(const TVPRect &rc)
Adds default columns for the renderer, allows custom setup (column icon override, etc)
int InsertColumn(int pos, int width, const string &label, int data)
bool m_bCgiMode
indicate whether it shoulde be rendered using "focused" color or not
TColumnType x_GetColumnType(const SColumn &C)
virtual int GetColumnIndexByX(int x) const
void x_AddStatisticsRow(ITooltipFormatter &formatter, const string &tag, int part, int total)
void x_RenderAlignAreaTopLine()
virtual bool NeedTooltip(int vp_x, int vp_y)
vector< SColumn > TColumnVector
void x_RenderHeader(TAreaVector *p_areas)
TVPRect GetMasterArea() const
virtual const SColumn & GetColumn(int index) const
void SetColumnUserData(int index, int data)
virtual int GetResizableColumnIndex() const
void x_RenderItems(TAreaVector *p_areas)
void x_RenderMasterRow(TAreaVector *p_areas)
IAlignRow::TColumnType TColumnType
virtual ~CAlnMultiRenderer()
void x_RenderItemsRange(int iFisrt, int iLast, TAreaVector *p_areas)
void AutoFitColumns(const CGlTextureFont &font, bool for_printer)
void GetVisibleColumns(vector< string > &labels)
CRgbaColor m_MasterBackColor
CAlnMultiRenderer()
Empty object constructor – for two-phase construction call SetupColums() to finish the class construc...
IAlnMultiRendererContext * m_Context
IAlnMultiRendererContext * x_GetContext()
void x_InvalidateRows(bool layout_only=false)
TVPRect GetColumnRectByType(TColumnType type, bool include_header) const
void SetColumns(const vector< SColumn > &columns, int resizable_index)
virtual int HitTest(int vp_x, int vp_y, int &col)
void SetColumnPos(int index, int pos)
int GetColumnIndexByType(TColumnType type) const
const CRgbaColor & GetBackColor() const
void SetColumnWidth(int index, int width)
void SetBackColor(const CRgbaColor Color)
void x_PrepareMasterPane(CGlPane &pane)
CWeakIRef< IAlignRow > m_TooltipRow
virtual string GetTooltip()
string x_GetRowTooltip(const TVPPoint &pt, IAlignRow *p_row, int i_col, int vp_top_y)
void SetColumnVisible(int index, bool b_visible)
virtual string GetAlignmentTooltip(int x, int y, IAlignRow *row, bool master)
virtual void Render()
renders OpenGL graphics
int GetVPListTop() const
return OpenGL viewport coordinate of the top pixel in the list area
const CRgbaColor & GetMasterBackColor() const
void x_Render(TAreaVector *p_areas)
TVPRect GetColumnRect(int i_col, bool include_header) const
virtual void Update(bool layout_only=false)
void SetMasterBackColor(const CRgbaColor Color)
virtual TVPRect GetRect() const
void SetupPaneForColumn(CGlPane &pane, int i_col) const
void SetResizableColumn(int index)
vector< CHTMLActiveArea > TAreaVector
TVPRect x_GetLineRect(int Index)
TColumnType GetColumnTypeByIndex(int i_col) const
int x_GetLineByWindowY(int WinY) const
int GetListTop() const
protected members
virtual void SetVPRect(const TVPRect &rc)
class CRgbaColor provides a simple abstraction for managing colors.
CRowDisplayStyle is a base class representing a display style for IAlignRow.
virtual const CRgbaColor & GetColor(TColorType type) const
bool IsWebRendering() const
CRuler is a renderable object drawing a scale with position labels.
void SetFont(CGlTextureFont::EFontFace font_type, unsigned int font_size=12)
virtual void SetVPRect(const TVPRect &rect)
TVPPoint GetPreferredSize(int max_num=0) const
void SetHorizontal(bool b_horz, ELabelPlacement place=eDefault, ELabelAlign aln=eAln_Center)
virtual void Render(CGlPane &pane)
static const string & GetName(CSeq_data::E_Choice code_type, TIndex idx)
static TIndex GetIndex(CSeq_data::E_Choice code_type, const string &code)
Interface IAlignRow - abstracts row rendering in Multiple Alignment Widget.
virtual string & GetColumnText(TColumnType col_type, string &text, bool for_printer=false) const =0
virtual string & GetAlnSeqString(string &buffer, const IAlnExplorer::TSignedRange &aln_rng) const =0
@ fWidgetFocused
it isn'e exactly a row state;
virtual int GetRowState() const =0
Returns row state (combination of EState flags)
virtual int GetHeightPixels() const =0
Returns height of the row in pixels.
virtual void Update(const CGlPane &pane, bool layout_only=false)
@ eIcons
Strand + Expand icons.
IAlnMultiRendererContext - this interface represents context in which CAlnMultiRenderer lives.
virtual IAlignRow * GetConsensusRow()=0
virtual int GetLineByRowNum(TNumrow row) const =0
virtual int GetShownElements()=0
virtual bool IsRendererFocused()=0
virtual const CGlPane & GetAlignPort() const =0
virtual int GetFocusedItemIndex() const =0
virtual IAlignRow * GetRowByLine(int index)=0
all Y coordinates are OpenGL Viewport coordinates (not widget coords) "index" is a line index (not ro...
virtual int GetLinePosY(int index) const =0
virtual int GetLineHeight(int index) const =0
@ fShownElement_MasterRow
@ fShownElement_Alignment
virtual IAlignRow * GetMasterRow()=0
virtual int GetLineByModelY(int y) const =0
virtual TNumrow GetLinesCount() const =0
container_type::iterator iterator
const_iterator begin() const
const_iterator end() const
static const struct name_t names[]
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const column_t columns[]
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void SetModelLimitsRect(const TModelRect &R)
void SetClipRect(const TVPRect *rc_clip=NULL)
set clipping rect that will be used by glScissor, NULL for reset
void SetViewport(const TVPRect &R)
virtual void Begin(GLenum mode)=0
Start rendering.
void Color3f(GLfloat r, GLfloat g, GLfloat b)
IRender & GetGl()
convenience function for getting current render manager
void Vertex2d(GLdouble x, GLdouble y)
TVPRect & GetViewport(void)
CGlRect< TVPUnit > TVPRect
TModelUnit UnProjectX(TVPUnit m_x) const
TModelRect & GetModelLimitsRect(void)
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.
void SetVert(T bottom, T top)
void SetVisibleRect(const TModelRect &R)
virtual TModelUnit GetMetric(EMetric metric, const char *text=NULL, int len=-1) const
TModelRect & GetVisibleRect(void)
void SetExactOrthoProjection(bool exact_projection)
void SetHorz(T left, T right)
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)
void EnableOffset(bool b_en=true)
Offset is used as a workaround for OpenGL precision problems emerging when size of visible range is s...
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
float GetBlue(void) const
float GetGreen(void) const
float GetAlpha(void) const
static CIRef< ITooltipFormatter > CreateTooltipFormatter()
float GetRed(void) const
Get specific channels in floating point values.
TRefType Lock(void) const
Lock the object and return reference to it.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
@ fWithCommas
Use commas as thousands separator.
static const char label[]
@ eSeq_code_type_iupacaa
IUPAC 1 letter amino acid code.
@ eSeq_code_type_iupacna
IUPAC 1 letter nuc acid code.
unsigned int
A callback function used to compare two keys in a database.
static void text(MDB_val *v)
constexpr bool empty(list< Ts... >) noexcept
The NCBI C++/STL use hints.
Defines: CTimeFormat - storage class for time format.
Int4 delta(size_t dimension_, const Int4 *score_)
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
#define row(bind, expected)
SColumn describes a single column.
int m_Width
horizontal position in viewport
int m_UserData
width in pixels
bool m_Visible
can be used to identify column
static CS_CONTEXT * context