72 (*iter)->
Update(layout_only);
73 min_l =
min(min_l, (*iter)->GetLeft());
74 max_w =
max(max_w, (*iter)->GetWidth());
109 bool cont = visitor->
Visit(
this);
110 TObjectList::iterator iter =
SetChildren().begin();
114 cont = (*iter)->Accept(visitor);
127 if (!linked_feats && !group && !child1->IsSelected()) {
132 GetChild(0)->GetHTMLActiveAreas(p_areas);
133 GetChild(0)->GetHTMLActiveAreas(p_areas);
134 child1->GetHTMLActiveAreas(p_areas);
136 TAreaVector::reverse_iterator it_gene = p_areas->rbegin();
138 it_gene->m_Bounds = p_areas->back().m_Bounds;
142 <<
"CGeneGroup::GetHTMLActiveAreas() failure on getting HTML active areas, error: "
239 #ifdef DEBUG_INFO_ON_SCREEN
249 TObjectList::const_iterator iter =
GetChildren().begin();
250 bool gene_highlighted =
false;
253 dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
264 if (gl.
TextWidth(&font, gene_label.c_str()) > width) {
265 gene_label = font.
Truncate(gene_label.c_str(), width);
280 color.SetAlpha(0.1f);
291 color.SetAlpha(0.18f);
308 if (gene_highlighted) {
328 if (gl.
TextWidth(&font, gene_label.c_str()) > width) {
329 gene_label = font.
Truncate(gene_label.c_str(), width);
330 if (gene_label ==
"...")
347 feat =
dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
360 : m_LabelType(fLabel_ParentLabel)
361 , m_FirstIsParent(
false)
423 if (
nullptr == parent_feat) {
437 bool first_feat =
true;
447 CIRef<IGuiObjectInfo> gui_info(CreateObjectInterface<IGuiObjectInfo>(scoped_obj, &feat_group_params));
450 gui_info->GetToolTip(tt, t_title, at_p);
451 gui_info->GetLinks(tt,
false);
456 tt.
AddRow(
"Click to show individual features.");
462 bool RmtBased{
false};
493 merged_feature_height += 2.0;
494 bound.SetBottom(
bound.Top() + merged_feature_height);
500 bool count_set =
false;
501 size_t count_limit = 3;
535 range.CombineWith(*it);
554 bool cont = visitor->
Visit(
this);
583 dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
587 LOG_POST(
"Something is woring about linked feature group!");
598 dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
653 base += bar_height * 0.5;
680 r.SetRight(visible_range.
GetTo());
712 int curr_idx = num > 1 && neg_strand ? 1 : 0;
730 curr_idx = 1 - curr_idx;
815 int curr_idx = num > 1 && neg_strand ? 1 : 0;
820 curr_idx = 1 - curr_idx;
837 if ( !label_l.empty() && draw_left ) {
839 if (label_w_l > max_w) {
841 label_l = font.
Truncate(label_l.c_str(), label_w_l);
858 vis_r.
GetFrom() + label_w_l, base - height * 0.5);
871 if ( !label_r.empty() && draw_right ) {
874 if (label_w_r > max_w) {
876 label_r = font.
Truncate(label_r.c_str(), label_w_r);
911 dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
960 TModelUnit line_y1 = line_ym - bar_height * 0.5f;
961 TModelUnit line_y2 = line_ym + bar_height * 0.5f;
966 bool show_strand_indicator =
971 bool is_parent =
true;
993 if (show_strand_indicator) {
1028 TModelUnit line_y1 = line_ym - bar_height * 0.5f;
1029 TModelUnit line_y2 = line_ym + bar_height * 0.5f;
1045 bool two_colors =
false;
1050 dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
1065 if (
range.GetLength() > pix_size) {
1068 bool show_strand_indicator =
1076 max_c = max<float>(max_c, *iter - 1);
1079 if (max_c == 0.0f) {
1082 max_c = 1.0f / max_c;
1089 color_lite2 = color2;
1093 bool first_pass =
true;
1102 bool is_bar_visible = visible_range.
NotEmpty();
1103 if (is_bar_visible) {
1105 t = visible_range.
GetTo() + 1;
1109 if (!first_pass && pre_to <
f) {
1110 glPushAttrib(GL_LINE_BIT);
1114 gl.
Enable(GL_LINE_STIPPLE);
1118 gl.
Enable(GL_LINE_STIPPLE);
1122 gl.
Enable(GL_LINE_STIPPLE);
1126 gl.
Enable(GL_LINE_STIPPLE);
1137 bool is_intron_visible = visible_range.
NotEmpty();
1138 if (is_intron_visible) {
1139 pre_to = visible_range.
GetFrom();
1140 f = visible_range.
GetTo();
1146 pre_to + (
f - pre_to) * 0.5;
1177 f - pre_to, apart, bar_height,
1183 if (is_bar_visible) {
1219 TIntervalCounts int_counts;
1275 dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
1281 TIntervalCounts::iterator at_iter = int_counts.find(
f);
1282 if (at_iter != int_counts.end()) {
1283 at_iter->second += 1;
1287 at_iter = int_counts.find(
t);
1288 if (at_iter != int_counts.end()) {
1289 at_iter->second -= 1;
1297 _ASSERT(int_counts.size() > 1);
1298 TIntervalCounts::const_iterator s_iter = int_counts.begin();
1299 TIntervalCounts::const_iterator e_iter = s_iter;
1301 int cnt = s_iter->second;
1302 while (e_iter != int_counts.end()) {
1309 cnt += s_iter->second;
1345 feat =
dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
1356 for (CLayoutGroup::TObjectList::const_reverse_iterator iter =
GetChildren().rbegin();
1358 feat =
dynamic_cast<const CFeatGlyph*
>(iter->GetPointer());
1383 if (merged_feats_count) {
1395 tooltip->SetTrustedData(
false);
1397 s = tooltip->Render();
1402 p_areas->push_back(area);
1409 if (children.size() <= 1)
1412 CLayoutGroup::TObjectList::const_iterator feat_it = children.begin();
1418 while (++feat_it != children.end()) {
void Add(const CConstRef< objects::CSeq_feat > &feat, const CSeqUtils::TMappingInfo &mapping_info=CSeqUtils::TMappingInfo())
bool IsLabelHided() const
bool GetCustomColor(CRgbaColor &color) const
Get the customized color for a given feature.
virtual string GetSignature() const
return signature for this glyph.
virtual void GetTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
const TMappingInfo & GetMappingInfo() const
virtual bool HasObject(CConstRef< CObject > obj) const
check if the wrapped object(s) is the one.
virtual void GetObjects(vector< CConstRef< CObject > > &objs) const
retrieve CObjects corresponding to this CSeqGlyph.
virtual CConstRef< CObject > GetObject(TSeqPos pos) const
Retrieve the feature as an object.
virtual const objects::CSeq_loc & GetLocation(void) const
access the position of this object.
CConstRef< CFeatureParams > GetConfig() const
static bool IsDbVar(const objects::CSeq_feat &feat)
Utility to check if a feature is a structural variation.
const objects::CMappedFeat & GetMappedFeature(void) const
Access a new, fully remapped feature.
virtual TSeqRange GetRange(void) const
get the total range of this object.
virtual const TIntervals & GetIntervals(void) const
access sub-intervals (if any).
const objects::CSeq_feat & GetFeature(void) const
Access the original feature.
static size_t GetCustomColorIdx(const objects::CSeq_feat &feat)
Get the customized color idx for a given feature.
void GetLabel(string &label, CLabel::ELabelType type) const
retrieve feature label for a given type
EConnection m_Connections
TModelUnit m_LineWidth
absolute value (in pixel)
CGlTextureFont m_LabelFont
TModelUnit GetBarHeight(bool overview) const
ELabelPosition m_LabelPos
TModelUnit m_BarHeight
absolute size (in pixel)
@ ePos_Side
always on 5' side
@ ePos_Inside
inside the rendered bar
@ ePos_Above
above the rendered bar
bool m_ShowStrandIndicator
virtual string GetSignature() const
return signature for this glyph.
bool x_ShowGeneLabel() const
virtual const TIntervals & GetIntervals() const
access sub-intervals (if any).
@ eGene_Shown
show gene bar
@ eGene_ShowLabelOnly
hide gene bar, but show label with bar space
@ eGene_Hidden
hide gene bar and gene label completely
virtual CConstRef< CObject > GetObject(TSeqPos pos) const
access our core component - we wrap an object(s) of some sort.
virtual bool Accept(IGlyphVisitor *visitor)
Interface for accepting an IGlyphVisitor.
virtual void GetObjects(vector< CConstRef< CObject > > &objs) const
retrieve CObjects corresponding to this CSeqGlyph.
void SetShowGene(bool flag)
virtual const objects::CSeq_loc & GetLocation() const
access the position of this object.
virtual bool HasObject(CConstRef< CObject > obj) const
check if the wrapped object(s) is the one.
virtual TSeqRange GetRange(void) const
Get gene feature range instead.
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
virtual void Update(bool layout_only)
CGeneGroup implementations.
virtual void x_Draw() const
The default renderer for this layout object.
TModelUnit x_GetLabelHeight() const
Returns the height of the label with margin included.
const CFeatGlyph * x_GetFirstFeat() const
string m_Descr
description that can be used as label or tooltip
@ fNoCaching
The tooltip for this feature should not be cached.
int m_Flags
area flags, will need to replace m_Type
unsigned m_MergedFeatsCount
bool m_PositiveStrand
the default is true
CLayoutGroup is a container of CSeqGlyphs (layout objects).
void HideMaster(bool hidden=true)
TObjectList & SetChildren()
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
const TObjectList & GetChildren() const
CLayoutGroup inline methods.
void SetAsMaster(CRef< CSeqGlyph > master)
master glyph has some special meaning (e.g.
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
CConstRef< CSeqGlyph > GetChild(int idx) const
Get the layout object at index 'idx'.
void x_DrawBoundary() const
virtual void Update(bool layout_only)
Update content and layout including the bounding box.
size_t GetChildrenNum() const
Get total number of children.
bool x_isDrawn() const
determines whether the glyph should be drawn or not at all (currently children of unselected parents ...
virtual CRef< CSeqGlyph > HitTest(const TModelPoint &p)
Hit testing.
ILayoutPolicy::TObjectList TObjectList
CLinkedFeatsGroup is a container class contains related features.
virtual void GetObjects(vector< CConstRef< CObject > > &objs) const
retrieve CObjects corresponding to this CSeqGlyph.
virtual void x_Draw() const
The default renderer for this layout object.
CRef< objects::CSeq_loc > m_Location
just for satisfy IObjectBasedGlyph interface.
TCounts m_IntCounts
Shall have the same size as m_Intervals.
virtual bool Intersects(const TModelRect &rect, TConstObjects &objs) const
Intersect testing.
virtual bool NeedTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Check if need to show tooltip.
void x_DrawChildrenOnParent(TModelUnit &base) const
draw the merged feature bar with children on top of parent.
CConstRef< CFeatGlyph > m_ParentFeat
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
virtual bool Accept(IGlyphVisitor *visitor)
Interface for accepting an IGlyphVisitor.
void x_DrawLabels(TModelUnit &base, bool draw_left=true, bool draw_right=true) const
draw the labels for merged features.
void x_CalcIntervals()
calculate the merged feature bar intervals and overlapping counts.
virtual bool IsClickable() const
Query if this glyph is clickable.
CLinkedFeatsGroup()
CLinkedFeatsGroup implementations.
virtual string GetSignature() const
return signature for this glyph.
const ILayoutPolicy::TObjectList & GetChildren() const
CLinkedFeatsGroup inline methods.
bool x_LabelFirst() const
check to see if label needs to be drawn before (above) feature bar.
bool x_AreAllFeaturesOnSameStrand() const
const CFeatGlyph * x_GetFirstFeat() const
get the first feature glyph in the group.
void x_GetUniqueLabel(string &label) const
utility method for generating a unique label for the merged bar.
bool x_ShowLabel() const
Check if need to show label.
const CFeatGlyph * x_GetLastFeat() const
get the last feature glyph in the group.
virtual bool SetSelected(bool f)
Select or deselect this glyph.
void x_AddFeatHTMLActiveArea(TAreaVector *p_areas, const CFeatGlyph *feat, unsigned merged_feats_count=0) const
virtual void Update(bool layout_only)
Update content and layout including the bounding box.
TModelUnit x_GetLabelHeight() const
Returns the height of the label with margin included.
bool m_FirstIsParent
The first feature is the parent feature.
virtual const objects::CSeq_loc & GetLocation() const
access the position of this object.
virtual void GetTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
void x_DrawFeatureBar(TModelUnit &base) const
draw the merged feature bar.
virtual bool HasObject(CConstRef< CObject > obj) const
check if the wrapped object(s) is the one.
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
virtual CRef< CSeqGlyph > HitTest(const TModelPoint &p)
Hit testing.
virtual CConstRef< CObject > GetObject(TSeqPos pos) const
access our core component - we wrap an object(s) of some sort.
virtual TSeqRange GetRange(void) const
get the total range of this object.
virtual const TIntervals & GetIntervals() const
access sub-intervals (if any).
CConstRef< CFeatureParams > m_Config
settings for rendering merged feature bar.
void TextOut(const CGlTextureFont *font, const char *text, TModelUnit x, TModelUnit y, bool center, bool adjust_flip=true) const
void DrawPseudoBar(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2, const CRgbaColor &light_color, const CRgbaColor &dark_color) const
CRef< CSGSequenceDS > GetSeqDS() const
TModelRange IntersectVisible(const CSeqGlyph *obj) const
void DrawLine(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2) const
void DrawQuad(const TModelRect &rc, bool border=false) const
void DrawSelection(const TModelRect &rc) const
bool IsSkipFrames() const
TModelUnit SeqToScreen(const TModelUnit &size) const
convert from sequence positions to screen pixels
TModelUnit GetMaxLabelWidth(const CGlBitmapFont &font) const
In screen pixel..
TModelUnit ScreenToSeq(const TModelUnit &size) const
convert from screen pixels to sequence positions
const CRgbaColor & GetSelLabelColor() const
bool WillLabelFit(const TModelRect &rc) const
void Draw3DQuad(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2, const CRgbaColor &color, bool border=false) const
void DrawBackground(const TModelRect &rcm, TModelUnit border) const
void DrawStrandIndicators(const TModelPoint &start, TModelUnit length, TModelUnit apart, TModelUnit size, const CRgbaColor &color, bool neg_strand, bool avoid_center=false, bool single_indicator_center=false, const vector< TModelRange > *labels_ranges=nullptr) const
class CRgbaColor provides a simple abstraction for managing colors.
TSeqPos GetSequenceLength() const
void x_InitHTMLActiveArea(CHTMLActiveArea &area) const
initialize the basic information for a given active area.
CRenderingContext * m_Context
the rendering context
virtual void x_OnLayoutChanged()
update the layout.
void x_Parent2Local(TModelPoint &pnt) const
Transform the coordiante from parent coord. to local coord.
virtual void SetHeight(TModelUnit h)
virtual TModelUnit GetRight() const
void x_DrawInnerLabels(TModelUnit base, const string &label, const CRgbaColor &color, const CGlTextureFont &font, bool side_label_visible, bool inside_only, vector< TModelRange > *labels_ranges=nullptr, TSeqRange *interval=nullptr, bool XOR_mode=false) const
void x_DrawException() const
Draw a shading background to indicate exception.
void SetParent(CSeqGlyph *p)
bool IsIn(const TModelPoint &p) const
Hit test for points in PARENT COORD.
virtual void SetWidth(TModelUnit w)
virtual void SetLeft(TModelUnit l)
virtual TModelUnit GetTop() const
virtual TModelUnit GetHeight() const
virtual void Update(bool)
Update content and layout including the bounding box.
virtual void SetTop(TModelUnit b)
void Draw() const
render the layout.
virtual bool SetSelected(bool flag)
Select or deselect this glyph.
virtual void x_DrawHighlight() const
virtual TModelUnit GetWidth() const
virtual TModelUnit GetLeft() const
TModelRect GetModelRect() const
get the bounding box.
vector< CHTMLActiveArea > TAreaVector
list< CConstRef< CSeqGlyph > > TConstObjects
bool IsHighlighted() const
Visitor interface for applying any potential actions or algorithms.
virtual bool Visit(CSeqGlyph *glyph)=0
list< CRef< CSeqGlyph > > TObjectList
vector< TSeqRange > TIntervals
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
bool Empty(const CNcbiOstrstream &src)
static const int kLabelSpace
static const int kVertSpace
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
static bool IsException(const objects::CSeq_feat &feat)
virtual void Translated(GLdouble x, GLdouble y, GLdouble z)=0
virtual void Translatef(GLfloat x, GLfloat y, GLfloat z)=0
virtual void Enable(GLenum glstate)=0
virtual void LineStipple(GLint factor, GLushort pattern)=0
Set line stipple pattern: glLineStipple(). Deprecated in gl 3.2+.
IRender & GetGl()
convenience function for getting current render manager
virtual TModelUnit TextHeight(const CGlTextureFont *font) const =0
virtual TModelUnit TextWidth(const CGlTextureFont *font, const char *text) const =0
virtual void PopMatrix()=0
void SetFontFace(EFontFace face, bool use_bitmap_overrides=true)
CRange< TModelUnit > TModelRange
void SetFontSize(unsigned int size)
Set/get font size in points.
virtual void Disable(GLenum glstate)=0
glDisable()
virtual void LineWidth(GLfloat w)=0
Set line width for drawing: glLineWidth()
static EFontFace FaceFromString(const string &str)
Selects a font face given a string or eFontFace_LastFont on failure.
CGlPoint< TModelUnit > TModelPoint
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
bool Intersects(const CGlRect &R) const
virtual void PushMatrix()=0
string Truncate(const char *text, TModelUnit w, ETruncate trunc=eTruncate_Ellipsis) const
Truncate text to the secified width.
CRgbaColor ContrastingColor(bool onlyBW=true) const
Return a color guaranteed to contrast nicely with this color.
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
static CIRef< ITooltipFormatter > CreateTooltipFormatter(ETooltipFormatters)
factory for requested tooltip formatter creation
void Lighten(float scale)
static CRgbaColor Interpolate(const CRgbaColor &color1, const CRgbaColor &color2, float alpha)
Interpolate two colors.
@ eTooltipFormatter_CSSTable
generated table is CSS based, generated NCBI URLs are paths (recommended for SViewer)
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
const CSeq_feat & GetMappedFeature(void) const
Feature mapped to the master sequence.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
position_type GetLength(void) const
bool NotEmpty(void) const
position_type GetToOpen(void) const
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
static string LongToString(long value, TNumToStringFlags flags=0, int base=10)
Convert Int to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static const char label[]
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
@ eNa_strand_both_rev
in reverse orientation
@ eNa_strand_both
in forward orientation
unsigned int
A callback function used to compare two keys in a database.
if(yy_accept[yy_current_state])
static void text(MDB_val *v)
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
T bound(T x_, T xlo_, T xhi_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)