NCBI C++ ToolKit
seqgraphic_render.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: seqgraphic_render.cpp 45881 2021-01-05 03:10:02Z rudnev $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Vlad Lebedev, Liangshou Wu
27  *
28  */
29 
30 #include <ncbi_pch.hpp>
35 #include <gui/opengl/glutils.hpp>
36 #include <gui/opengl/irender.hpp>
37 #include <gui/objutils/tooltip.hpp>
38 #include <objmgr/util/sequence.hpp>
39 
40 #include <math.h>
41 
42 
45 
49 const TModelUnit kEpsilon = 0.0000001;
50 
51 
53  : m_FeatPanel(new CFeaturePanel(&m_RenderingCtx, cgi_mode))
54  , m_MinZoomSeq(log(1.0f / kMaxPixelsBase))
55  , m_LensZoom(0.0, 0.0)
56  , m_NeedLensZoom(false)
57  , m_From(0.0)
58  , m_To(0.0)
59  , m_Horz(true)
60  , m_Flipped(false)
61  , m_NeedUpdateContent(false)
62  , m_NeedUpdateLayout(true)
63  , m_NeedUpdateSelection(false)
64 {
65  m_FP.EnableOffset(true);
66  m_RP.EnableOffset(true);
68 
71 
72 #if 0
73  // Create a greyscale shader to make sure everything is drawn monochrome when
74  // user selects greyscale mode. Note that the shader will retain colors that are
75  // arlready greyscale, but other colors will be converted to greyscale using NTSC
76  // conversion weights
77  string vertex_shader_gs = "#version 120\n"
78  "varying vec4 color;\n"
79  "void main(void)\n"
80  "{\n"
81  "color = gl_Color;\n"
82  "if (abs(gl_Color.r-gl_Color.g) > 0.01 || abs(gl_Color.g-gl_Color.b) > 0.01) {\n"
83  "float c = dot(gl_Color.rgb, vec3(0.299, 0.587, 0.114));\n"
84  "color = vec4(c, c, c, gl_Color.a);\n"
85  "}\n"
86  "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
87  "}";
88 
89  string fragment_shader = "#version 120\n"
90  "varying vec4 color\n;"
91  "void main(void)\n"
92  "{\n"
93  "gl_FragColor = color;\n"
94  "}";
95  m_MonochromeShader.CreateShader(vertex_shader_gs, fragment_shader);
96 #endif
97 }
98 
99 
101 {
102 }
103 
104 
106 {
107  CIRef<ISGDataSource> ds = m_DSContext->GetDS(
108  typeid(CSGSequenceDSType).name(), obj);
109  m_DS.Reset(dynamic_cast<CSGSequenceDS*>(ds.GetPointer()));
110 
111  CScope& scope = m_DS->GetScope();
112  m_SelManager.SetScope(&scope);
114 
116 
120  m_NeedUpdateSelection = true;
121 
122  /*string ruler_label;
123  CLabel::GetLabel(*m_DS->GetBioseqHandle().GetSeqId(), &ruler_label,
124  CLabel::eDefault, &scope);
125  ruler_label += ": ";
126  ruler_label += sequence::CDeflineGenerator().GenerateDefline(m_DS->GetBioseqHandle());
127  m_RulerPanel.SetTextLabel(ruler_label);*/
128 }
129 
130 
132 {
135 }
136 
137 
139 {
140  //TIME_ME("CSeqGraphicRenderer::UpdateConfig()");
141 
143  m_RenderingCtx.SetOverviewCutoff(config->GetOverviewCutoff());
144  m_RenderingCtx.SetSelectionColor(config->GetSelectionColor());
145  m_RenderingCtx.SetSelLabelColor(config->GetSelLabelColor());
146 
148 
150  m_FeatPanel->LoadProfile(config->GetTrackProfile());
151  m_NeedUpdateSelection = true;
152 }
153 
154 
155 void CSeqGraphicRenderer::SetHorizontal(bool b_horz, bool b_flip,
156  const TVPRect& rc, bool reset_model_limit /* = false*/)
157 {
158  if ( !m_DS ) {
159  return;
160  }
161  //TIME_ME("CSeqGraphicRenderer::SetHorizontal()");
162 
163  m_Horz = b_horz;
164  m_Flipped = b_flip;
165 
168 
171 
172  x_SetupViewPorts(rc);
173  x_SetupModelLimits(reset_model_limit);
174 
175  // update some global settings
177 
179 
180  m_NeedUpdateLayout = true;
181 }
182 
183 
184 void CSeqGraphicRenderer::ZoomOnRange(const TModelRange& range, bool round_to_base)
185 {
186  //TIME_ME("CSeqGraphicRenderer::ZoomOnRange()");
187 
188  TModelUnit from = range.GetFrom();
189  TModelUnit to = range.GetTo();
190  if (fabs(m_From - from) < kEpsilon && fabs(m_To - to) < kEpsilon ) {
191  return;
192  }
193  m_From = from;
194  m_To = to;
195 
196  if (m_Flipped) {
197  swap(from, to);
198  }
200  if (m_Horz) {
201  rc.SetHorz(from, to);
202  } else {
203  rc.SetVert(from, to);
204  }
205 
206  m_FP.ZoomRect(rc);
207  x_AdjustToMinScale(round_to_base);
208 
210  m_NeedUpdateContent = true;
211 }
212 
213 
215 {
216  x_SetupViewPorts(rc);
217  x_SetupModelLimits(false);
218  m_NeedUpdateLayout = true;
219 }
220 
221 
223 {
225 }
226 
227 
229 {
230  TVPRect& rcFP = m_FP.GetViewport();
231 
232  if (rcFP.PtInRect(x, y)) {
233  m_NeedLensZoom = true;
235  m_LensZoom = m_FP.UnProject(x, y);
236  } else {
237  m_NeedLensZoom = false;
238  }
239 }
240 
241 
242 // for CGI use
244 {
246 
247  TModelUnit height = m_FeatPanel->GetHeight() +
248  m_RulerPanel.GetSize().Y();
249 
250  _TRACE("height: " << height << " fp: " << m_FeatPanel->GetHeight() <<
251  " ruler: " << m_RulerPanel.GetSize().Y());
252 
253  return height;
254 }
255 
256 
257 // this function takes an absolute mouse coordinate and determines if any
258 // features lie underneath the mouse position
259 // x & y are GL coordinates
261 {
262  //m_FP.GetViewport().PtInRect(x, y);
263  TModelPoint p = m_FP.UnProject(x, y);
264  return m_FeatPanel->HitTest(p);
265 }
266 
267 
268 void CSeqGraphicRenderer::GetTooltip(int x, int y, string& tt, string& t_title)
269 {
270  tt = "";
271 
272  CRef<CSeqGlyph> obj = HitTest(x, y);
273  if (obj) {
275  TModelPoint pos = m_FP.UnProject(x, y);
276  obj->GetTooltip(pos, *tooltip, t_title);
277  tt = tooltip->Render();
278  }
279 }
280 
281 
283 {
284  TModelRect sel_rc;
285  {{
287  TModelUnit left = m_FP.UnProjectX(rc.Left());
288  TModelUnit right = m_FP.UnProjectX(rc.Right());
289  TModelUnit top = m_FP.UnProjectY(rc.Top());
290  TModelUnit bottom = m_FP.UnProjectY(rc.Bottom());
291 
292  sel_rc = TModelRect(left, bottom, right, top);
293  }}
294 
295  CSeqGlyph::TConstObjects sel_glyphs;
296  m_FeatPanel->Intersects(sel_rc, sel_glyphs);
297  m_SelManager.SelectSelection(sel_glyphs);
298  m_NeedUpdateSelection = true;
299 }
300 
301 
302 //static CStopWatch timer_sw;
304 {
305  if ( !m_DS ) {
306  return;
307  }
308 
309 #if 0
310  IRender& gl = GetGl();
311 
312  if (m_ConfigSettings->GetColorTheme() == "Greyscale") {
313  m_MonochromeShader.MakeCurrent();
314  }
315  else {
316  gl.UseProgram(0);
317  }
318 #endif
319 
320  //TIME_ME("CSeqGraphicRenderer::x_Draw()");
321  try {
322  const CRgbaColor& bg = m_ConfigSettings->GetBkColor();
323  glClearColor(bg.GetRed(), bg.GetGreen(), bg.GetBlue(), 0.0f);
324  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
325 
328 
329  // update the data
330  if (m_NeedUpdateContent) {
331  //TIME_ME("x_Draw feture panel Update content");
332  m_FeatPanel->Update(false);
333  m_NeedUpdateContent = false;
334  // update selection
335  } else if (m_NeedUpdateLayout) {
336  //TIME_ME("x_Draw feture panel Update layout");
337  m_FeatPanel->Update(true);
338  }
339  m_NeedUpdateLayout = false;
340 
341  if (m_NeedUpdateSelection) {
342  //TIME_ME("x_Draw Update selection");
344  m_NeedUpdateSelection = false;
345  }
346 
347  TModelUnit height = m_FeatPanel->GetHeight();
348 
349  // We have a "floating" model space. So, adjust the limits
350  // Adjust visible rect if model space "shrinked" less than visible range
351 
354  if (m_Horz) {
355  rcM.SetBottom(height - 1);
356  TModelUnit off = rcV.Bottom() - (height - 1);
357  off = min(off, rcV.Top());
358  if (off > 0.0) {
359  rcV.Offset(0.0f, -off);
360  }
361  } else {
362  rcM.SetLeft(height);
363  TModelUnit off = rcV.Left() - height;
364  off = min(off, rcV.Right());
365  if (off > 0.0) {
366  rcV.Offset(-off, 0.0);
367  }
368  }
370  m_FP.SetVisibleRect(rcV);
371 
372  // Adjust ruler bar to master
373  if (m_Horz) {
374  rcV.SetBottom(0);
375  rcV.SetTop(m_RP.GetViewport().Height() - 1);
376  } else {
377  rcV.SetLeft(0);
378  rcV.SetRight(m_RP.GetViewport().Width() - 1);
379  }
380  m_RP.SetVisibleRect(rcV);
382 
383  // sync the grid step with the ruler label step to align
384  // vertical grid lines with ruler tick labels
386 
387  // now, main panel
388  {
389  //TIME_ME("x_Draw feture panel draw content");
390  m_FeatPanel->SetImageInfo(p_areas);
391  m_FeatPanel->Draw();
392  }
393 
394  // collect HTML active areas
395  if (p_areas) {
396  //TIME_ME("x_Draw Active Areas");
399 
400  // Offset by the height of Ruler Panel
401  if (m_RulerPanel.IsShown()) {
402  auto iter = p_areas->m_ActiveAreas.begin();
403  while (++iter != p_areas->m_ActiveAreas.end()) {
404  (*iter).m_Bounds.Offset(0, m_RP.GetViewport().Height());
405  }
406  }
407  }
408 
409  //This collects and draws html active areas for debugging only
410  /*{
411  CSeqGlyph::TAreaVector areas;
412  m_FeatPanel->GetHTMLActiveAreas(&areas);
413  NON_CONST_ITERATE(CSeqGlyph::TAreaVector, iter, areas) {
414  (*iter).m_Bounds.Offset(0, m_RP.GetViewport().Height());
415  }
416 
417  m_FP.OpenPixels();
418  IRender& gl = GetGl();
419  gl.Disable(GL_LINE_SMOOTH);
420  gl.Color3f(1.0f, 0.0f, 0.0f);
421  TModelUnit height = m_RP.GetViewport().Height() + m_FP.GetViewport().Height();
422  for (size_t i = 0; i < areas.size(); ++i) {
423 
424  gl.Begin(GL_LINE_LOOP);
425  gl.Vertex2d(areas[i].m_Bounds.Left(), height - areas[i].m_Bounds.Bottom());
426  gl.Vertex2d(areas[i].m_Bounds.Left(), height - areas[i].m_Bounds.Top());
427  gl.Vertex2d(areas[i].m_Bounds.Right(), height - areas[i].m_Bounds.Top());
428  gl.Vertex2d(areas[i].m_Bounds.Right(), height - areas[i].m_Bounds.Bottom());
429  gl.End();
430 
431  if (areas[i].m_Flags && CHTMLActiveArea::eHtmlArea_Track)
432  continue;
433  _TRACE('(' << areas[i].m_Bounds.Left() << ',' << height - areas[i].m_Bounds.Top() << ',' << areas[i].m_Bounds.Right() << ',' << height - areas[i].m_Bounds.Bottom() << ')');
434  }
435  m_FP.Close();
436  }*/
437 
438 
439  if (m_NeedLensZoom) { // Draw Zoomed view
440  x_DoLensZoom();
441  }
442 
443  } NCBI_CATCH("CSeqGraphicRender::Render()");
444 
445 #if 0
446  if (m_ConfigSettings->GetColorTheme() == "Greyscale") {
447  m_MonochromeShader.Release();
448  }
449 #endif
451 }
452 
454 {
455  if ( !m_DS ) {
456  return;
457  }
458 
459  //TIME_ME("CSeqGraphicRenderer::x_Draw()");
460  try {
463 
464  // update the data
465  if (m_NeedUpdateContent) {
466  //TIME_ME("x_Draw feture panel Update content");
467  m_FeatPanel->Update(false);
468  m_NeedUpdateContent = false;
469  // update selection
470  } else if (m_NeedUpdateLayout) {
471  //TIME_ME("x_Draw feture panel Update layout");
472  m_FeatPanel->Update(true);
473  }
474  m_NeedUpdateLayout = false;
475 
476  if (m_NeedUpdateSelection) {
477  //TIME_ME("x_Draw Update selection");
479  m_NeedUpdateSelection = false;
480  }
481 
482  TModelUnit height;// = m_FeatPanel->GetHeight();
483  height = m_FP.GetViewport().Height();
484 
485  // We have a "floating" model space. So, adjust the limits
486  // Adjust visible rect if model space "shrinked" less than visible range
487 
488 
491  rcM.SetBottom(height);
492  rcV.SetBottom(height);
494  m_FP.SetVisibleRect(rcV);
495  // Adjust ruler bar to master
496  if (m_Horz) {
497  rcV.SetBottom(0);
498  rcV.SetTop(m_RP.GetViewport().Height() - 1);
499  }
500  m_RP.SetVisibleRect(rcV);
502 
503  // sync the grid step with the ruler label step to align
504  // vertical grid lines with ruler tick labels
506 
507  // now, main panel
508  {
509  //TIME_ME("x_Draw feture panel draw content");
510  if (nullptr != p_areas) {
511  m_FeatPanel->SetImageInfo(p_areas);
512  }
513  m_FeatPanel->Draw();
514  }
515 
516  // collect HTML active areas
517  if (p_areas) {
518  //TIME_ME("x_Draw Active Areas");
521 
522  // Offset by the height of Ruler Panel
523  if (m_RulerPanel.IsShown()) {
524  auto iter = p_areas->m_ActiveAreas.begin();
525  while (++iter != p_areas->m_ActiveAreas.end()) {
526  (*iter).m_Bounds.Offset(0, m_RP.GetViewport().Height());
527  }
528  }
529  }
530 
531  } NCBI_CATCH("CSeqGraphicRender::Render()");
532 
533  //CGlUtils::CheckGlError();
534 }
535 
536 
538 {
539  IRender& gl = GetGl();
540 
541  gl.Enable(GL_BLEND);
542  gl.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
543  gl.Color4f(1.0f, 1.0f, 1.0f, 0.9f);
544 
545  TVPRect rc_r = m_RP.GetViewport();
546  TVPRect rc_f = m_FP.GetViewport();
547 
548  {{
550  gl.Rectf((float)rc_r.Left(), (float)rc_r.Bottom(),
551  (float)rc_r.Right() + 1.0f, (float)rc_r.Top());
552  }}
553 
554  {{
556  gl.Rectf((float)rc_f.Left(), (float)rc_f.Bottom(),
557  (float)rc_f.Right() + 1.0f, (float)rc_f.Top());
558  }}
559  gl.Disable(GL_BLEND);
560 }
561 
562 
564 {
565  x_DimDisplay();
569 
570  //m_FeatPanel->PrepareLayout(m_FP, CFeaturesPanelIR::eFetchSync);
571  //m_FeatPanel->GetLayoutHeight(m_FP);
572  //x_AdjustToMaster(true);
573  //m_FeatPanel->Render(m_FP);
576  m_FP.SetVisibleRect(rc);
577 }
578 
579 
580 // make sure that we do not exeed or min. scale.
581 // With the flipped model space SetMinScaleX() method of
582 // CGlPane no longer works. We have to do it manually.
584 {
585  TModelUnit min_scale = (m_Flipped ? -1.0 : 1.0) / kMaxPixelsBase;
587 
588  // horizontal mode, flipped model space
589  if (m_Horz && m_Flipped && m_FP.GetScaleX() > min_scale) {
590  m_FP.SetScale(min_scale, m_FP.GetScaleY());
591  if (round_to_base) {
592  rc = m_FP.GetVisibleRect();
593  rc.SetLeft(ceil(rc.Left()));
594  rc.SetRight(floor(rc.Right()));
595  }
596  }
597 
598  // horizontal mode, normal model space
599  if (m_Horz && !m_Flipped && m_FP.GetScaleX() < min_scale) {
600  m_FP.SetScale(min_scale, m_FP.GetScaleY());
601  if (round_to_base) {
602  rc = m_FP.GetVisibleRect();
603  rc.SetLeft(floor(rc.Left()));
604  rc.SetRight(ceil(rc.Right()));
605  }
606  }
607 
608  // vertical mode, flipped model space
609  if (!m_Horz && m_Flipped && m_FP.GetScaleY() > min_scale) {
610  m_FP.SetScale(m_FP.GetScaleX(), min_scale);
611  if (round_to_base) {
612  rc = m_FP.GetVisibleRect();
613  rc.SetTop(floor(rc.Top()));
614  rc.SetBottom(ceil(rc.Bottom()));
615  }
616  }
617 
618  // vertical mode, normal model space
619  if (!m_Horz && !m_Flipped && m_FP.GetScaleY() < min_scale) {
620  m_FP.SetScale(m_FP.GetScaleX(), min_scale);
621  if (round_to_base) {
622  rc = m_FP.GetVisibleRect();
623  rc.SetTop(ceil(rc.Top()));
624  rc.SetBottom(floor(rc.Bottom()));
625  }
626  }
627 
628  m_FP.ZoomRect(rc);
629 }
630 
631 
633 {
636  return TSeqPos(seq);
637 }
638 
639 
641 {
643  TModelUnit seq = m_Horz ? m_FP.UnProjectWidth(vp) :
644  m_FP.UnProjectHeight(vp);
645  return TSeqPos(seq);
646 }
647 
648 
650 {
651  TVPRect ruler_viewport = m_RP.GetViewport();
652  TVPRect feat_viewport = m_FP.GetViewport();
653  if (m_Horz) {
654  TVPUnit ruler_b = ruler_viewport.Top() - m_RulerPanel.GetSize().Y();
655  ruler_viewport.SetBottom(ruler_b);
656  feat_viewport.SetTop(ruler_b);
657  } else {
658  // extra space for minus sign
659  TVPUnit ruler_l = ruler_viewport.Right() -
661  ruler_viewport.SetLeft(ruler_l);
662  feat_viewport.SetRight(ruler_l);
663  }
664  m_RP.SetViewport(ruler_viewport);
665  m_FP.SetViewport(feat_viewport);
666 }
667 
668 
670 {
671  //cout << "CSeqGraphicRenderer::x_SetupViewPorts" << endl;
672  TVPRect ruler_viewport, feat_viewport;
673  if (m_Horz) {
674  TVPUnit ruler = m_RulerPanel.GetSize().Y();
675 
676  ruler_viewport = TVPRect(rc.Left(), rc.Top() - (ruler - 1), rc.Right(), rc.Top());
677  feat_viewport = TVPRect(rc.Left(), rc.Bottom(), rc.Right(), rc.Top() - ruler);
678  } else {
679  // extra space for minus sign
681 
682  ruler_viewport = TVPRect(rc.Right() - ruler, rc.Bottom(), rc.Right(), rc.Top() - 1);
683  feat_viewport = TVPRect(rc.Left(), rc.Bottom(), rc.Right() - ruler, rc.Top() - 1);
684  }
685 
686  m_RP.SetViewport(ruler_viewport);
687  m_FP.SetViewport(feat_viewport);
688 }
689 
690 // todo: need more work here to make flipping and vertical work
691 void CSeqGraphicRenderer::x_SetupModelLimits(bool reset_model_limit)
692 {
693  TModelRect rc_fp;
694  TModelRange vis_r(0, m_DS->GetSequenceLength() - 1);
695 
696  if (m_Horz) {
697  if (m_Flipped) {
698  rc_fp = TModelRect(vis_r.GetToOpen(), m_FP.GetViewport().Height() - 1,
699  vis_r.GetFrom(), 0);
700  } else {
701  rc_fp = TModelRect(vis_r.GetFrom(), m_FP.GetViewport().Height() - 1,
702  vis_r.GetToOpen(), 0);
703  }
704  } else {
705  if (m_Flipped) {
706  rc_fp = TModelRect(m_FP.GetViewport().Height(), vis_r.GetToOpen(),
707  0, vis_r.GetFrom());
708  } else {
709  rc_fp = TModelRect(m_FP.GetViewport().Height(), vis_r.GetFrom(),
710  0, vis_r.GetToOpen());
711  }
712  }
713  m_FP.SetModelLimitsRect(rc_fp);
714  m_RP.SetModelLimitsRect(rc_fp);
715 
716  if ( !reset_model_limit ) {
718  if (m_Horz) {
719  if (m_Flipped) {
720  rc_fp = TModelRect(vis_r.GetTo(), m_FP.GetViewport().Height() - 1,
721  vis_r.GetFrom(), 0);
722  } else {
723  rc_fp = TModelRect(vis_r.GetFrom(), m_FP.GetViewport().Height() - 1,
724  vis_r.GetTo(), 0);
725  }
726  } else {
727  if (m_Flipped) {
728  rc_fp = TModelRect(m_FP.GetViewport().Height(), vis_r.GetTo(),
729  0, vis_r.GetFrom());
730  } else {
731  rc_fp = TModelRect(m_FP.GetViewport().Height(), vis_r.GetFrom(),
732  0, vis_r.GetTo());
733  }
734  }
735  }
736 
737  m_FP.SetVisibleRect (rc_fp);
738  m_RP.SetVisibleRect (rc_fp);
739 }
740 
742 {
743  m_RenderingCtx.SetViewWidth(view_width);
744 }
745 
746 
void SetImageInfo(TImageInfo *info)
Optional image info structure to return data to (cgi) caller.
void SetSelectedFeats(const TSelectedGlyphs &feats)
void SetInputObject(SConstScopedObject &obj)
virtual void Update(bool layout_only)
Update content and layout including the bounding box.
virtual CRef< CSeqGlyph > HitTest(const TModelPoint &p)
Hit testing.
void UpdateGridStep(int step)
void SetExternalGlyphs(const CSeqGlyph::TObjects &objs)
void SetSelectedCDSFeats(const TSelectedGlyphs &cds_feats)
void SetNonAsnInput(const INonAsnTrackData &data)
virtual bool Intersects(const TModelRect &rect, TConstObjects &objs) const
Intersect testing.
void SetConfig(CRef< CSeqGraphicConfig > conf)
void LoadProfile(const string &profile_str)
set track profile and load settings.
void PrepareContext(CGlPane &pane, bool horz, bool flipped)
void SetOverviewCutoff(int cutoff)
void SetSeqDS(CSGSequenceDS *ds)
CGlPane * GetGlPane()
inline method implementations
const TModelRange & GetVisibleRange() const
void SetSelectionColor(const CRgbaColor &c)
void SetViewWidth(TSeqPos view_width)
void SetSelLabelColor(const CRgbaColor &c)
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
void Render(CGlPane &pane)
void GetHTMLActiveAreas(CSeqGlyph::TAreaVector *p_areas) const
void LoadSettings(const CSeqGraphicConfig &g_config)
int GetMainRulerLabelStep() const
TVPPoint GetSize(int max_num=0) const
Definition: ruler_panel.cpp:93
void SetSeqLength(TSeqPos len)
CRulerPanel inline methods.
void SetOrientation(bool horz, bool flip)
Definition: ruler_panel.cpp:76
bool IsShown() const
Definition: ruler_panel.hpp:57
objects::CScope & GetScope(void) const
Get the scope from the handle.
TSeqPos GetSequenceLength() const
CScope –.
Definition: scope.hpp:92
void UpdateSelection(CSeqGlyph *glyph)
const TSelectedGlyphs & GetSelectedCDSFeats() const
const TSelectedGlyphs & GetSelectedFeats() const
void SelectSelection(const CSeqGlyph::TConstObjects &glyphs)
void SetScope(objects::CScope *scope)
virtual void GetTooltip(const TModelPoint &, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
Definition: seq_glyph.cpp:136
virtual TModelUnit GetHeight() const
Definition: seq_glyph.hpp:587
void Draw() const
render the layout.
Definition: seq_glyph.cpp:92
list< CRef< CSeqGlyph > > TObjects
Definition: seq_glyph.hpp:85
list< CConstRef< CSeqGlyph > > TConstObjects
Definition: seq_glyph.hpp:86
const CRgbaColor & GetBkColor() const
CRef< CGlTextureFont > GetCommentFont() const
const string & GetColorTheme() const
CSelectionVisitor m_SelManager
CRef< CSeqGlyph > HitTest(int x, int y)
CIRef< ISGDataSourceContext > m_DSContext
void GetTooltip(int x, int y, string &tt, string &t_title)
CRef< CSGSequenceDS > m_DS
void SelectObjByRect(const TVPRect &rc)
void SetViewWidth(TSeqPos view_width)
void x_AdjustToMinScale(bool round_to_base)
CRef< CFeaturePanel > m_FeatPanel
void SetNonAsnInput(const INonAsnTrackData &data)
void SetExternalGlyphs(const CSeqGlyph::TObjects &objs)
void SetLensZoom(int x, int y)
zoom 10x at the given screen coordinates.
void Resize(const TVPRect &rc)
void UpdateConfig(CRef< CSeqGraphicConfig > config)
void SetHorizontal(bool b_horz, bool b_flip, const TVPRect &rc, bool reset_model_limit=false)
CSeqGraphicRenderer(bool cgi_mode)
void x_SetupModelLimits(bool reset_model_limit)
void SetInputObject(SConstScopedObject &obj)
TSeqPos Screen2Seq(TVPUnit x, TVPUnit y)
pixels to sequence translation.
void x_Draw(TImageInfo *p_areas)
TSeqPos Screen2SeqWidth(TVPUnit vp)
CRef< CSeqGraphicConfig > m_ConfigSettings
CRenderingContext m_RenderingCtx
void x_DrawVectorGraphics(TImageInfo *p_areas)
void ZoomOnRange(const TModelRange &range, bool round_to_base=false)
zoom to the given range.
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
struct config config
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
char data[12]
Definition: iconv.c:80
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
Definition: ncbimisc.hpp:1508
#define _TRACE(message)
Definition: ncbidbg.hpp:122
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
Definition: ncbiexpt.hpp:580
GLdouble TModelUnit
Definition: gltypes.hpp:48
void SetModelLimitsRect(const TModelRect &R)
Definition: glpane.hpp:342
void SetRight(T right)
Definition: glrect.hpp:114
T X() const
Definition: glpoint.hpp:59
T Height() const
Definition: glrect.hpp:90
void SetViewport(const TVPRect &R)
Definition: glpane.cpp:96
virtual void Enable(GLenum glstate)=0
virtual void UseProgram(GLuint program)=0
For shaders. Only works with OpenGL 2.0+.
void SetBottom(T bottom)
Definition: glrect.hpp:113
T Top() const
Definition: glrect.hpp:84
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)=0
Options to be used when GL_BLEND is enabled.
T Bottom() const
Definition: glrect.hpp:82
TModelUnit UnProjectWidth(TVPUnit vp_w) const
Definition: glpane.cpp:755
TModelPoint UnProject(TVPUnit m_x, TVPUnit m_y) const
Definition: glpane.cpp:738
void Offset(T d_x, T d_y)
Definition: glrect.hpp:186
T Width() const
Definition: glrect.hpp:86
IRender & GetGl()
convenience function for getting current render manager
T Right() const
Definition: glrect.hpp:83
TVPRect & GetViewport(void)
Definition: glpane.hpp:332
CGlRect< TVPUnit > TVPRect
Definition: gltypes.hpp:53
void SetScale(TModelUnit scale_x, TModelUnit scale_y, TModelPoint p_center)
Definition: glpane.cpp:361
TModelUnit UnProjectX(TVPUnit m_x) const
Definition: glpane.cpp:706
void ZoomRect(const TModelRect &r)
Definition: glpane.cpp:348
TModelRect & GetModelLimitsRect(void)
Definition: glpane.hpp:347
T Left() const
Definition: glrect.hpp:81
void SetZoomFactor(TModelUnit factor=2.0)
Definition: glpane.hpp:473
T Y() const
Definition: glpoint.hpp:60
bool PtInRect(T x, T y) const
Definition: glrect.hpp:154
static bool CheckGlError()
Check if there are any OpenGL errors.
Definition: glutils.cpp:166
TModelUnit UnProjectHeight(TVPUnit vp_h) const
Definition: glpane.cpp:768
TModelUnit UnProjectY(TVPUnit m_y) const
Definition: glpane.cpp:722
void EnableZoom(bool en_x, bool en_y)
Definition: glpane.hpp:462
int TVPUnit
Definition: gltypes.hpp:47
void Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
Definition: irender.hpp:97
void SetVert(T bottom, T top)
Definition: glrect.hpp:123
void SetVisibleRect(const TModelRect &R)
Definition: glpane.cpp:113
void ZoomIn(TModelUnit x, TModelUnit y, int options=fZoomXY)
Definition: glpane.hpp:484
void SetAdjustToLimits(bool adjust_x, bool adjust_y)
Definition: glpane.hpp:389
void SetLeft(T left)
Definition: glrect.hpp:112
TModelRect & GetVisibleRect(void)
Definition: glpane.hpp:357
CGlRect< TModelUnit > TModelRect
Definition: gltypes.hpp:54
virtual void Disable(GLenum glstate)=0
glDisable()
TModelUnit GetScaleX(void) const
Definition: glpane.cpp:118
TModelUnit GetScaleY(void) const
Definition: glpane.cpp:123
void SetExactOrthoProjection(bool exact_projection)
Definition: glpane.hpp:509
void SetHorz(T left, T right)
Definition: glrect.hpp:117
virtual void Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)=0
Rect() functions also do Begin() and End() (as in OpenGL)
void SetTop(T top)
Definition: glrect.hpp:115
void EnableOffset(bool b_en=true)
Offset is used as a workaround for OpenGL precision problems emerging when size of visible range is s...
Definition: glpane.hpp:405
@ ePixels
Definition: glpane.hpp:67
@ eOrtho
Definition: glpane.hpp:66
float GetBlue(void) const
Definition: rgba_color.hpp:333
float GetGreen(void) const
Definition: rgba_color.hpp:327
static CIRef< ITooltipFormatter > CreateTooltipFormatter(ETooltipFormatters)
factory for requested tooltip formatter creation
Definition: tooltip.cpp:40
float GetRed(void) const
Get specific channels in floating point values.
Definition: rgba_color.hpp:321
@ eTooltipFormatter_Html
generated table is HTML attributes (no CSS) based, generate NCBI URLs are absolute (recommended for G...
Definition: tooltip.hpp:60
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
position_type GetToOpen(void) const
Definition: range.hpp:138
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
TTo GetTo(void) const
Get the To member data.
Definition: Range_.hpp:269
TFrom GetFrom(void) const
Get the From member data.
Definition: Range_.hpp:222
range(_Ty, _Ty) -> range< _Ty >
#define fabs(v)
Definition: ncbi_dispd.c:46
T min(T x_, T y_)
USING_SCOPE(objects)
const TModelUnit kEpsilon
Small constant to test against 0.
const TModelUnit kLenseZoomFactor
const TModelUnit kZoomFactorX
const TVPUnit kMaxPixelsBase
#define _ASSERT
Modified on Fri Sep 20 14:56:59 2024 by modify_doxy.py rev. 669887