default_policy.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:72k
- /*
- * ===========================================================================
- * PRODUCTION $Log: default_policy.cpp,v $
- * PRODUCTION Revision 1000.3 2004/06/01 21:12:33 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.41
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: default_policy.cpp,v 1000.3 2004/06/01 21:12:33 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Vlad Lebedev
- *
- * File Description:
- *
- */
- #include <ncbi_pch.hpp>
- #include <corelib/ncbistd.hpp>
- #include <gui/widgets/seq_graphic/default_policy.hpp>
- #include <gui/objutils/label.hpp>
- #include <objects/seqfeat/Cdregion.hpp>
- #include <objects/seqfeat/Gb_qual.hpp>
- #include <objects/seqfeat/Imp_feat.hpp>
- #include <objects/seqres/Byte_graph.hpp>
- #include <objects/seqres/Int_graph.hpp>
- #include <objects/seqres/Real_graph.hpp>
- #include <gui/config/feat_config_list.hpp>
- #include <objmgr/scope.hpp>
- #include <objmgr/util/feature.hpp>
- #include <objmgr/util/sequence.hpp>
- #include <objtools/alnmgr/alnmix.hpp>
- #include <serial/iterator.hpp>
- #include <util/sequtil/sequtil_manip.hpp>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- // temporary, until a method for fast
- // retrieving of annotations is available
- static const int kSeqAnnotCount = 20;
- // size of an alignment row
- static const int kAlnRowHeight = 13;
- // size of a single row in alignment
- static const int kAlnElementHeight = 3;
- // size of a single row in alignment
- static const int kPWAlignHeight = 6;
- // width of a column small
- static const int kLabelsColWidth = 100;
- // width of a feature label small
- static const int kLabelsMaxWidth = 90;
- // at this point sequence will fit
- static const TModelUnit kPixPerBase4Sequence = 8.0f;
- TModelUnit kCommentFontSize = 0.0f;
- // 3 pixels befween layout objects
- static const TModelUnit kSpacerSize = 3.0f;
- // Max number of unique library IDs for mate pairs
- static const float kMaxLibraryIDCount = 8.0f;
- CDefaultPolicy::CDefaultPolicy()
- : m_Font_Bitmap9x15(CGlBitmapFont::eBitmap9x15),
- m_Font_Helv10(CGlBitmapFont::eHelvetica10),
- m_Font_Helv8(CGlBitmapFont::eHelvetica8)
- {
- m_MinLabelWidth = TVPUnit(m_Font_Helv10.TextWidth("AA"));
- m_ColorTable = CGlColorTable(kSeqAnnotCount, 0.5f, 0.75f);
-
-
- kCommentFontSize = m_Font_Helv10.TextHeight();
- }
- void CDefaultPolicy::SetHandle(const CBioseq_Handle& handle)
- {
- m_Handle = handle;
- m_Annots.clear();
- }
- void CDefaultPolicy::SetConfig(CSeqGraphicConfig* config)
- {
- m_ConfigSettings = config;
- }
- void CDefaultPolicy::SetHitPoint(TModelPoint click)
- {
- m_LastClick = click;
- }
- void CDefaultPolicy::SetActiveArea(TAreaVector* p_area)
- {
- m_ActiveAreas = p_area;
- }
-
- // retrieve a set of labels for a given feature
- void CDefaultPolicy::x_GetLabels(const CSeq_feat& feat,
- CScope& scope,
- string* label_type,
- string* label_content,
- string* label_both) const
- {
- if (feat.IsSetProduct()) {
- CLabel::GetLabel(feat.GetProduct(), label_both,
- CLabel::eDefault, &scope);
- *label_both += ": ";
- *label_type = *label_both;
- *label_content = *label_both;
- feature::GetLabel(feat, label_both, feature::eContent, &scope);
- feature::GetLabel(feat, label_type, feature::eType, &scope);
- feature::GetLabel(feat, label_content, feature::eContent, &scope);
- } else {
- feature::GetLabel(feat, label_both, feature::eBoth, &scope);
- feature::GetLabel(feat, label_type, feature::eType, &scope);
- feature::GetLabel(feat, label_content, feature::eContent, &scope);
- }
- }
- void CDefaultPolicy::x_SetFeatureColor(const CLayoutFeat* feat) const
- {
- CGlColor color;
- if (dynamic_cast<const CLayoutProtProd*>(feat)) {
- color = m_ConfigSettings->GetElementColor(CSeqGraphicColorConfig::eFG_ProtProduct);
- } else {
- const CSeqFeatData& data = feat->GetFeature().GetData();
- color = m_ConfigSettings->GetColor(data.Which(), data.GetSubtype());
- }
- glColor4f(color.GetRed(), color.GetGreen(), color.GetBlue(), 0.65f);
- }
- void CDefaultPolicy::x_DrawAlignmentSmear(CGlPane& pane, const CLayoutAlignSmear* layout_smear,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- const TModelRect& rcM = pane.GetModelLimitsRect();
- const CAlignmentSmear& smear = layout_smear->GetAlignSmear();
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- GLfloat th = m_Font_Helv10.TextHeight();
- GLfloat title_y = row_y + th + 1;
- GLfloat line_y1 = title_y + 3;
- GLfloat line_y2 = line_y1 + th + 2;
- GLfloat line_ym = line_y1 + (th + 2) / 2;
- GLfloat strand_y = line_y1 + th;
- GLfloat off = rcM.Top() > 0 ? th - 1 : 0;
- CGlColor minColor("lightblue1"), maxColor("dark blue");
- switch (mode) {
- default:
- break;
- case eDrawObjectLines:
- {{
- CAlignmentSmear::runlen_iterator gap_it = smear.SmearGapBegin();
- for (; gap_it; gap_it.Advance()) {
- float value = gap_it.GetValue();
- if (value == 0)
- continue;
-
- glColor4f(maxColor.GetRed(), maxColor.GetGreen(), maxColor.GetBlue(), 1.0f);
- TModelUnit f = gap_it.GetSeqPosition();
- TModelUnit t = f + gap_it.GetSeqRunLength();
- glVertex2f(f - offsetX, line_ym - offsetY);
- glVertex2f(t - offsetX, line_ym - offsetY);
- }
- }}
- break;
-
- case eDrawObjectQuads:
- {{
- CAlignmentSmear::runlen_iterator seg_it = smear.SmearSegBegin();
- for (; seg_it; seg_it.Advance()) {
- float value = seg_it.GetValue();
- if (value == 0)
- continue;
-
- // set color of segment.
- float score = value/smear.GetMaxValue();
- // CGlColor(1.0f-score, 1.0f-score, 1.0f-score); // shades of grey.
- // glColor4f(1.0f-score, 1.0f-score, 1.0f-score, 0.65);
- CRgbaColor color(CRgbaColor::Interpolate(maxColor, minColor, score));
- glColor4f(color.GetRed(), color.GetGreen(), color.GetBlue(), 1.0f);
-
- // draw segment
- TModelUnit f = seg_it.GetSeqPosition();
- TModelUnit t = f + seg_it.GetSeqRunLength();
- glVertex2f(f - offsetX, line_y1 - offsetY);
- glVertex2f(f - offsetX, line_y2 - offsetY);
- glVertex2f(t - offsetX, line_y2 - offsetY);
- glVertex2f(t - offsetX, line_y1 - offsetY);
- }
- }}
- break;
- case eDrawObjectLabel:
- {{
- string as_label = smear.GetLabel();
-
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelLabel_AlignSmear);
- } else {
- x_Color(CSeqGraphicColorConfig::eLabel_AlignSmear);
- }
-
- m_Font_Helv10.TextOut(rcV.Left() - offsetX + 3, title_y - off - offsetY, as_label.c_str());
- // draw strand indicator if needed.
- if (smear.GetStrandType() != CAlignmentSmear::eSmearStrand_Both) {
- bool neg_strand = smear.GetStrandType() == CAlignmentSmear::eSmearStrand_Neg;
-
- glColor3f(0.0f, 0.0f, 0.0f); // Black
-
- m_Font_Helv10.TextOut(rcV.Left() - offsetX + 3, strand_y - off - offsetY, neg_strand ? "<" : ">");
- }
- }}
- break;
- }
- }
- void CDefaultPolicy::x_DrawAlignment(CGlPane& pane, const CLayoutAlign* align,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- const CAlnVec& aln_mgr = align->GetAlignMgr();
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- TSeqPos from = align->GetLocation().GetTotalRange().GetFrom();
- TSeqPos to = align->GetLocation().GetTotalRange().GetTo();
- TModelRect frc;
- frc.SetLeft(from);
- frc.SetRight(to);
- TModelRect inrc = frc.IntersectWith(rcV);
- GLfloat scaleX = pane.GetScaleX();
- GLfloat yy = row_y + m_Font_Helv10.TextHeight() + 4;
- GLfloat aln_height = x_CalcAlignHeight(align);
- switch (mode) {
- default:
- break;
- case eDrawObjectLines:
- {{
- x_Color(CSeqGraphicColorConfig::eFG_Alignment);
- CAlnMap::TNumrow anchor = aln_mgr.GetAnchor();
- TSeqPos start = aln_mgr.GetSeqStart(anchor);
- TSeqPos stop = aln_mgr.GetSeqStop (anchor);
- CAlnMap::TNumrow row = 0;
- for (row = 0; row < aln_mgr.GetNumRows(); ++row) {
- if (row == anchor) {
- continue; // skip master seq
- }
- glVertex2f(start - offsetX, yy - offsetY + kAlnElementHeight * 0.5f);
- glVertex2f(stop - offsetX + 1, yy - offsetY + kAlnElementHeight * 0.5f);
- // advance to next row: 1 pixel between
- yy += kAlnElementHeight + 1;
- }
- }}
- // Draw selection
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelection_Alignment);
- x_DrawSelection(pane, from, row_y, to, row_y + aln_height);
- }
- break;
- case eDrawObjectQuads:
- {{
- x_Color(CSeqGraphicColorConfig::eFG_Alignment);
- CAlnMap::TNumrow row = 0;
- const CAlnMap::TNumrow anchor = aln_mgr.GetAnchor();
- TSignedSeqRange range(aln_mgr.GetAlnStart(),
- aln_mgr.GetAlnStop());
- for ( ; row < aln_mgr.GetNumRows(); ++row) {
- if (row == anchor) {
- continue; // skip master seq
- }
- CRef<CAlnVec::CAlnChunkVec> aln_chunks
- (aln_mgr.GetAlnChunks(row, range,
- CAlnVec::fSeqOnly |
- CAlnVec::fChunkSameAsSeg));
- for (int i = 0; i < aln_chunks->size(); ++i) {
- CConstRef<CAlnVec::CAlnChunk> chunk((*aln_chunks)[i]);
- TSeqPos start = chunk->GetRange().GetFrom();
- start = aln_mgr.GetSeqPosFromSeqPos(anchor, row, start);
- TSeqPos stop = chunk->GetRange().GetTo();
- stop = aln_mgr.GetSeqPosFromSeqPos(anchor, row, stop);
- if (start > stop) {
- swap(start, stop);
- }
- glVertex2f(start - offsetX, yy - offsetY);
- glVertex2f(stop - offsetX + 1, yy - offsetY);
- glVertex2f(stop - offsetX + 1,
- yy + kAlnElementHeight - offsetY);
- glVertex2f(start - offsetX,
- yy + kAlnElementHeight - offsetY);
- }
- // advance to next row: 1 pixel between
- yy += kAlnElementHeight + 1;
- }
- }}
- break;
- case eDrawObjectLabel:
- if (inrc.Width() < pane.UnProjectWidth(m_MinLabelWidth)) {
- break;
- }
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelLabel_Alignment);
- } else {
- x_Color(CSeqGraphicColorConfig::eLabel_Alignment);
- }
- {{
- string title;
- string out;
- // title = "alignment label"; // TESTING
- x_GetTitle(align, &title);
-
- out = m_Font_Helv10.Truncate(title.c_str(), inrc.Width() / scaleX);
- GLfloat xM = x_CenterText(pane, inrc,
- m_Font_Helv10.TextWidth(out.c_str()));
- GLfloat title_y = row_y + m_Font_Helv10.TextHeight() + 1;
- m_Font_Helv10.TextOut(xM - offsetX, title_y - offsetY, out.c_str());
- }}
- break;
- }
- }
- void CDefaultPolicy::x_DrawSeqGraph(CGlPane& pane, const CLayoutGraph* graph,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- const CMappedGraph& gr = graph->GetGraph();
- const CSeq_graph::C_Graph& gr_data = gr.GetGraph();
-
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- TSeqRange range = graph->GetLocation().GetTotalRange();
- TSeqPos from = range.GetFrom();
- TSeqPos to = range.GetTo();
-
- TModelUnit one_row = x_GetRowHeight(pane, graph, selected);
- TModelRect frc;
- frc.SetLeft(from);
- frc.SetRight(to);
- TModelRect inrc = frc.IntersectWith(rcV);
- GLfloat scaleX = pane.GetScaleX();
- switch (mode) {
- default:
- break;
- case eDrawObjectLines:
- x_Color(CSeqGraphicColorConfig::eFG_SeqGraph);
- switch (gr_data.Which()) {
- case CSeq_graph::TGraph::e_Byte:
- x_PreparePlot(pane, gr_data.GetByte(), range, row_y, one_row);
- break;
- case CSeq_graph::TGraph::e_Real:
- x_PreparePlot(pane, gr_data.GetReal(), range, row_y, one_row);
- break;
- case CSeq_graph::TGraph::e_Int:
- x_PreparePlot(pane, gr_data.GetInt(), range, row_y, one_row);
- break;
- default:
- return;
- }
- // Draw selection (two rows!)
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelection_SeqGraph);
- x_DrawSelection(pane, from, row_y, to, row_y + one_row);
- }
- break;
- case eDrawObjectQuads:
- // blue quad for the graph
- x_Color(CSeqGraphicColorConfig::eBG_SeqGraph);
- x_DrawQuad(pane, from, row_y+1, to + 1, row_y + one_row-2);
- break;
- case eDrawObjectLabel:
- if (gr.IsSetTitle()) {
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelLabel_SeqGraph);
- } else {
- x_Color(CSeqGraphicColorConfig::eLabel_SeqGraph);
- }
- int min_v = 0, max_v = 0;
- switch (gr_data.Which()) {
- case CSeq_graph::TGraph::e_Byte:
- min_v = int(gr_data.GetByte().GetMin());
- max_v = int(gr_data.GetByte().GetMax());
- break;
- case CSeq_graph::TGraph::e_Real:
- min_v = int(gr_data.GetReal().GetMin());
- max_v = int(gr_data.GetReal().GetMax());
- break;
- case CSeq_graph::TGraph::e_Int:
- min_v = int(gr_data.GetInt().GetMin());
- max_v = int(gr_data.GetInt().GetMax());
- break;
- }
- string out;
- string title = gr.GetTitle() + " Min: " +
- NStr::UIntToString(min_v) + " / Max: " +
- NStr::UIntToString(max_v);
- out = m_Font_Helv10.Truncate(title.c_str(), inrc.Width() / scaleX);
- GLfloat xM = x_CenterText(pane, inrc,
- m_Font_Helv10.TextWidth(out.c_str()));
- GLfloat title_y = row_y + m_Font_Helv10.TextHeight() + 1;
- m_Font_Helv10.TextOut(xM - offsetX, title_y - offsetY, out.c_str());
- }
- break;
- }
- }
- void
- CDefaultPolicy::x_DrawHistogram(CGlPane& pane, const CLayoutHistogram* hist,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- //if (mode != eDrawObjectLabel) {
- if (mode == eDrawObjectLines) { // that's temporary, until a new EObj_IterMode model be ready
- const TVPRect& rcP = pane.GetViewport();
- const TModelRect& rcV = pane.GetVisibleRect();
-
- glEnd();
-
- pane.Close();
- pane.OpenPixels();
-
- CGlColor color = m_ConfigSettings->GetColor(hist->Which(),
- hist->Subtype());
- glColor4f(color.GetRed(), color.GetGreen(), color.GetBlue(), 0.65f);
-
- GLfloat one_row = x_GetRowHeight(pane, hist, selected);
- GLfloat height = one_row - 2; // two pixels space
- GLfloat yy2 = rcV.Bottom() + rcP.Bottom() - one_row - row_y + 1;
-
- glBegin(GL_LINES);
- glVertex2f(rcP.Left(), yy2);
- glVertex2f(rcP.Right(), yy2);
- glEnd();
-
- TSeqPos x = 0;
- const CDensityMap<int>& densityMap = hist->GetDensityMap();
- GLfloat max_val = densityMap.GetMax();
-
- glBegin(GL_QUAD_STRIP);
- ITERATE(CDensityMap<int>, dens_it, densityMap) {
- GLfloat xx = x;
- GLfloat yy1 = yy2 + height * (*dens_it) / max_val;
- glVertex2f(xx, yy1);
- glVertex2f(xx, yy2);
- ++x;
- }
- glEnd();
-
- pane.Close();
- pane.OpenOrtho();
- glBegin(GL_LINES);
- }
- }
- void
- CDefaultPolicy::x_DrawSeqSegment(CGlPane& pane, const CLayoutSeqMap* seg,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- TSeqPos from = seg->GetLocation().GetTotalRange().GetFrom();
- TSeqPos to = seg->GetLocation().GetTotalRange().GetTo();
- TSeqPos rfrom = seg->GetRefLocation().GetTotalRange().GetFrom();
- TSeqPos rto = seg->GetRefLocation().GetTotalRange().GetTo();
- GLfloat one_row = x_GetRowHeight(pane, seg, selected);
- GLfloat line_y1 = row_y + 1;
- GLfloat line_y2 = line_y1 + one_row - 2;
- switch (mode) {
- default:
- break;
- case eDrawObjectLines:
- // Draw selection
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelection_SeqSegment);
- x_DrawSelection(pane, from, line_y1, to, line_y2);
- }
- break;
- case eDrawObjectQuads:
- x_Color(CSeqGraphicColorConfig::eFG_SeqSegmentExc);
- x_DrawQuad(pane, from, line_y1, to, line_y2);
- x_Color(CSeqGraphicColorConfig::eFG_SeqSegmentInc);
- x_DrawQuad(pane, rfrom, line_y1, rto, line_y2);
- break;
- case eDrawObjectLabel:
- break;
- }
- }
- void
- CDefaultPolicy::x_DrawSequence(CGlPane& pane, const CLayoutSequence* seqs,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- //const TModelRect& rcM = pane.GetModelLimitsRect();
-
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- TModelUnit left = rcV.Left() - offsetX;
- TModelUnit right = rcV.Right() - offsetX + 1;
- TModelUnit top = row_y - offsetY;
- TModelUnit bottom = row_y + 16 - offsetY;
-
- switch (mode) {
- default:
- break;
- case eDrawObjectLines:
- break;
- case eDrawObjectQuads:
- glColor3f(0.05f, 0.05f, 0.05f);
- glVertex2f(left, top);
- glVertex2f(right, top);
- glVertex2f(right, bottom);
- glVertex2f(left, bottom);
-
- glColor3f(0.5f, 0.5f, 0.5f);
- glVertex2f(left, top + 1);
- glVertex2f(right, top + 1);
- glVertex2f(right, bottom - 1);
- glVertex2f(left, bottom - 1);
- break;
- case eDrawObjectLabel:
- {{
- GLfloat y = row_y + m_Font_Bitmap9x15.TextHeight() + 2 - offsetY;
- string seq = seqs->GetSequence();
- GLfloat x = TSeqPos(rcV.Left()) - offsetX + 0.5;
- x_Color(CSeqGraphicColorConfig::eSeq_SequenceBar);
- m_Font_Bitmap9x15
- .ArrayTextOut(x, y, 1.0f, 0.0f, seq.c_str(),
- (float) pane.GetScaleX(), 0.0f);
- }}
- break;
- }
- }
- void
- CDefaultPolicy::x_DrawComments(CGlPane& pane, const CLayoutComment* comm,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
-
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
-
- GLfloat th = m_Font_Helv10.TextHeight();
- GLfloat title_y = row_y + th + 1;
- GLfloat off = pane.GetModelLimitsRect().Top() > 0 ? th - 1 : 0;
- switch (mode) {
- default:
- break;
- case eDrawObjectLines:
- case eDrawObjectQuads:
- break;
- case eDrawObjectLabel:
- const string& out = comm->GetComment();
- x_Color(CSeqGraphicColorConfig::eFG_Comment);
- m_Font_Helv10.TextOut(rcV.Left() - offsetX, title_y - off - offsetY, out.c_str());
- break;
- }
- }
- void CDefaultPolicy::x_DrawMatePair(CGlPane& pane, const CLayoutMatePair* pr,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- // It's a vector of CRefs
- const CLayoutMatePair::TAlignList& pw_aligns = pr->GetSeqAligns();
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- TSeqPos from = pr->GetLocation().GetTotalRange().GetFrom();
- TSeqPos to = pr->GetLocation().GetTotalRange().GetTo();
- TModelRect frc;
- frc.SetLeft(from);
- frc.SetRight(to);
- TModelRect inrc = frc.IntersectWith(rcV);
- GLfloat scaleX = pane.GetScaleX();
- GLfloat yy;
- if (m_ConfigSettings->GetShowPWAlignLabels()) {
- yy = row_y + m_Font_Helv10.TextHeight() + 4;
- } else {
- yy = row_y + 2;
- }
-
- // Set Colors based on Error code for Mate Pairs
- CSeqGraphicColorConfig::EDisplayElement c_fg, c_seq, c_mis;
- switch (pr->GetError()) {
- case CLayoutMatePair::eError_Orientation:
- c_fg = CSeqGraphicColorConfig::eFG_MatePairOrientation;
- c_seq = CSeqGraphicColorConfig::eSeq_MatePairOrientation;
- c_mis = CSeqGraphicColorConfig::eSeq_MatePairMismatchOrientation;
- break;
- case CLayoutMatePair::eError_NonUnique:
- c_fg = CSeqGraphicColorConfig::eFG_MatePairNonUnique;
- c_seq = CSeqGraphicColorConfig::eSeq_MatePairNonUnique;
- c_mis = CSeqGraphicColorConfig::eSeq_MatePairMismatchNonUnique;
- break;
- case CLayoutMatePair::eError_Distance:
- c_fg = CSeqGraphicColorConfig::eFG_MatePairDistance;
- c_seq = CSeqGraphicColorConfig::eSeq_MatePairDistance;
- c_mis = CSeqGraphicColorConfig::eSeq_MatePairMismatchDistance;
- break;
- default:
- c_fg = CSeqGraphicColorConfig::eFG_MatePairNo;
- c_seq = CSeqGraphicColorConfig::eSeq_MatePairNo;
- c_mis = CSeqGraphicColorConfig::eSeq_MatePairMismatchNo;
- break;
- }
-
- switch (mode) {
- default:
- break;
- case eDrawObjectLines:
- // Draw each Pairwise Alignment inside
- ITERATE(CLayoutMatePair::TAlignList, iter, pw_aligns) {
- bool has_sel = selected ? pr->IsSelected(iter->GetPointer()) :
- selected;
- x_DrawPWAlignElem(pane, iter->GetPointer(), row_y, mode,
- has_sel, c_fg, c_seq, c_mis);
- }
- // draw link between mate pairs
- x_Color(CSeqGraphicColorConfig::eFG_MatePairLink);
- for(size_t i = 0; i != pw_aligns.size() - 1; i++) {
- TSeqRange r1 = pw_aligns[i]->GetLocation().GetTotalRange();
- TSeqRange r2 = pw_aligns[i+1]->GetLocation().GetTotalRange();
- TSeqPos from = r1.GetTo() < r2.GetFrom() ?
- r1.GetTo() : r2.GetTo();
- TSeqPos to = r1.GetTo() < r2.GetFrom() ?
- r2.GetFrom() : r1.GetFrom();
-
- glVertex2f(from - offsetX + 1, yy - offsetY +
- kPWAlignHeight * 0.5f);
- glVertex2f(to - offsetX, yy - offsetY +
- kPWAlignHeight * 0.5f);
- }
- break;
- case eDrawObjectQuads:
- // Highlight background based on Library ID
- if (pr->GetLibraryId() > 0) {
- CGlColor color = m_ColorTable.GetColor(pr->GetLibraryId());
- glColor4f(color.GetRed(), color.GetGreen(), color.GetBlue(), 0.1f);
- TModelUnit h = x_GetRowHeight(pane, pr, selected);
- x_DrawQuad(pane, from, row_y, to, row_y + h);
- }
- case eDrawObjectLabel:
- if (mode == eDrawObjectLabel &&
- inrc.Width() > pane.UnProjectWidth(m_MinLabelWidth) &&
- m_ConfigSettings->GetShowPWAlignLabels() ) {
- string title;
- x_GetTitle(pr, &title);
-
- string out = m_Font_Helv10.Truncate(title.c_str(),
- inrc.Width() / scaleX);
- GLfloat xM = x_CenterText(pane, inrc,
- m_Font_Helv10.TextWidth(out.c_str()));
- x_Color(selected ? CSeqGraphicColorConfig::eSelLabel_MatePair :
- CSeqGraphicColorConfig::eLabel_MatePair);
- GLfloat title_y = row_y + m_Font_Helv10.TextHeight() + 1;
- m_Font_Helv10.TextOut(xM - offsetX, title_y - offsetY, out.c_str());
- }
-
- ITERATE(CLayoutMatePair::TAlignList, iter, pw_aligns) {
- x_DrawPWAlignElem(pane, iter->GetPointer(), row_y, mode,
- selected, c_fg, c_seq, c_mis);
- }
- break;
- }
- }
- // Placeholder. Used in genome-scale view
- void
- CDefaultPolicy::x_DrawFeatPack(CGlPane&, const CLayoutFeatPack*,
- GLfloat, EObj_IterMode, bool) const
- {
- }
- void
- CDefaultPolicy::x_DrawFeatLabel(CGlPane& pane, const CLayoutFeatLabel* feat,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- const TModelRect& rcM = pane.GetModelLimitsRect();
-
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
-
- GLfloat th = m_Font_Helv10.TextHeight();
- GLfloat title_y = row_y + th + 1;
- GLfloat off = rcM.Top() > 0 ? th - 1 : 0;
- switch (mode) {
- default:
- case eDrawObjectLines:
- case eDrawObjectQuads:
- break;
- case eDrawObjectLabel:
- string content;
- feature::GetLabel(feat->GetFeature(), &content,
- feature::eContent, &m_Handle.GetScope());
- if (selected)
- x_Color(CSeqGraphicColorConfig::eSelLabel_Feature);
- else
- x_Color(CSeqGraphicColorConfig::eLabel_Feature);
- TModelUnit col_width = pane.UnProjectWidth(kLabelsColWidth);
-
- TModelUnit col_offset = col_width * feat->GetColumn();
- // Trim label to fit in kLabelsColWidth
- string out;
- out = m_Font_Helv10.Truncate(content.c_str(), kLabelsMaxWidth);
-
- m_Font_Helv10.TextOut(rcV.Left() - offsetX + col_offset,
- title_y - off - offsetY, out.c_str());
- break;
- }
- }
- //
- // draw a given feature in a given mode
- //
- void
- CDefaultPolicy::x_DrawFeature(CGlPane& pane, const CLayoutFeat* feat,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- const TModelRect& rcM = pane.GetModelLimitsRect();
-
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
-
- TSeqPos from = feat->GetLocation().GetTotalRange().GetFrom();
- TSeqPos to = feat->GetLocation().GetTotalRange().GetTo();
- TModelRect frc;
- frc.SetLeft(from);
- frc.SetRight(to);
- TModelRect inrc = frc.IntersectWith(rcV);
- GLfloat scaleX = pane.GetScaleX();
- GLfloat th = m_Font_Helv10.TextHeight();
- GLfloat title_y = row_y + th + 1;
- GLfloat line_y1 = title_y + 3;
- GLfloat line_y2 = line_y1 + th + 2;
- GLfloat line_ym = line_y1 + (th + 2) / 2;
- GLfloat strand_y = line_y1 + th;
- GLfloat off = rcM.Top() > 0 ? th - 1 : 0;
-
- bool neg_strand = (sequence::GetStrand(feat->GetLocation())
- == eNa_strand_minus);
- switch (mode) {
- default:
- break;
- case eDrawObjectLines:
- x_SetFeatureColor(feat);
- if (true/*kShowIntrons*/) { // ^ line
- GLfloat prev_to_x = 0.0f;
- bool first_pass = true;
- ITERATE (vector<TSeqRange>, iter, feat->GetIntervals()) {
- const TSeqRange& curr = *iter;
- TModelUnit from_x, to_x;
- if (neg_strand) {
- from_x = curr.GetTo()+1;
- to_x = curr.GetFrom();
- } else {
- from_x = curr.GetFrom();
- to_x = curr.GetTo()+1;
- }
- if (!first_pass) {
- GLfloat middle_x = prev_to_x + (from_x - prev_to_x) / 2.0f;
- glVertex2f(prev_to_x - offsetX, line_ym - offsetY);
- glVertex2f(middle_x - offsetX, line_y1 - offsetY);
- glVertex2f(middle_x - offsetX, line_y1 - offsetY);
- glVertex2f(from_x - offsetX, line_ym - offsetY);
- }
- prev_to_x = to_x;
- first_pass = false;
- }
- } else { // straight line
- glVertex2f(from - offsetX, line_ym - offsetY);
- glVertex2f(to - offsetX, line_ym - offsetY);
- }
- // Draw selection
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelection_Feature);
- x_DrawSelection(pane, from, line_y1, to, line_y2);
- }
- break;
- case eDrawObjectQuads:
- // Highlight named Seq Annotations
- if (feat->GetMappedFeature().GetAnnot().IsNamed()) {
- CSeq_annot_Handle annot = feat->GetMappedFeature().GetAnnot();
- size_t idx = x_GetSeqAnnotIndex(annot);
-
- TModelUnit h = x_GetRowHeight(pane, feat, selected);// * kOneRowHeight;
- CGlColor color = m_ColorTable.GetColor(idx);
- glColor4f(color.GetRed(), color.GetGreen(), color.GetBlue(), 0.1f);
-
- // add small overhang of 5 pixels (left and right)
- TModelUnit over = pane.UnProjectWidth(5);
- x_DrawQuad(pane, from - over, row_y, to + over + 1, row_y + h);
- }
- x_SetFeatureColor(feat);
-
- // quad for each interval (exon)
- ITERATE (vector<TSeqRange>, iter, feat->GetIntervals()) {
- const TSeqRange& curr = *iter;
- TModelUnit f = curr.GetFrom();
- TModelUnit t = curr.GetTo()+1;// + (neg_strand ? 0.0f : 1.0f);
-
- if (pane.ProjectX(t) - pane.ProjectX(f) <= 1.0f) {
- t = f + pane.UnProjectWidth(1);
- }
- x_DrawQuad(pane, f, line_y1, t, line_y2);
- }
-
- break;
- case eDrawObjectLabel:
- // do not even try to draw labels if less than 1 letter width
- if (inrc.Width() <= pane.UnProjectWidth(m_MinLabelWidth)) {
- break;
- }
- string fl_both;
- string fl_type;
- string fl_content;
- string fl_out;
- x_GetLabels(feat->GetFeature(), m_Handle.GetScope(),
- &fl_type, &fl_content, &fl_both);
- GLfloat widthP = inrc.Width() / scaleX; // width in pixels
- GLfloat lw_type = m_Font_Helv10.TextWidth(fl_type.c_str() );
- if ( lw_type * 3 < widthP) { // 3 widths of eType label width
- fl_out = m_Font_Helv10.Truncate(fl_both.c_str(), widthP);
- } else {
- fl_out = m_Font_Helv10.Truncate(fl_content.c_str(), widthP);
- }
-
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelLabel_Feature);
- } else {
- x_Color(CSeqGraphicColorConfig::eLabel_Feature);
- }
-
- GLfloat xM = x_CenterText(pane, inrc,
- m_Font_Helv10.TextWidth(fl_out.c_str()));
- m_Font_Helv10.TextOut(xM - offsetX, title_y - off - offsetY, fl_out.c_str());
- // draw strand indicator
- xM = x_CenterText(pane, inrc, m_Font_Helv10.TextWidth("<"));
- glColor3f(0.0f, 0.0f, 0.0f); // strand Black
-
- m_Font_Helv10.TextOut(xM - offsetX, strand_y - off - offsetY, neg_strand ? "<" : ">");
- break;
- }
- }
- void CDefaultPolicy::x_DrawPWAlignElem(CGlPane& pane, const CLayoutPWAlign* pw_aln,
- GLfloat row_y, EObj_IterMode mode, bool selected,
- CSeqGraphicColorConfig::EDisplayElement c_fg,
- CSeqGraphicColorConfig::EDisplayElement c_seq,
- CSeqGraphicColorConfig::EDisplayElement c_mis) const
- {
- const CAlnVec& aln_mgr = pw_aln->GetAlignMgr();
- CAlnMap::TNumrow anchor = aln_mgr.GetAnchor();
- TSignedSeqRange range(aln_mgr.GetAlnStart(), aln_mgr.GetAlnStop());
- TSeqPos from = pw_aln->GetLocation().GetTotalRange().GetFrom();
- TSeqPos to = pw_aln->GetLocation().GetTotalRange().GetTo();
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- const TModelRect& rcV = pane.GetVisibleRect();
-
- TModelRect frc;
- frc.SetLeft(from);
- frc.SetRight(to);
- TModelRect inrc = frc.IntersectWith(rcV);
- GLfloat yy;
- if (m_ConfigSettings->GetShowPWAlignLabels()) {
- yy = row_y + m_Font_Helv10.TextHeight() + 4;
- } else {
- yy = row_y + 2;
- }
-
- GLfloat height = x_GetRowHeight(pane, pw_aln, selected);
- GLfloat scaleX = pane.GetScaleX();
- CAlnMap::TNumrow row = 0;
- bool neg_strand = aln_mgr.IsNegativeStrand(anchor == 0 ? 1 : 0);
-
- switch (mode) {
- default:
- break;
- case eDrawObjectLines: {
- TSeqPos f = aln_mgr.GetSeqStart(anchor);
- TSeqPos t = aln_mgr.GetSeqStop(anchor);
- x_Color(c_fg);
- if (scaleX < 2) {
- TModelUnit over8 = pane.UnProjectWidth(7);
- TModelUnit over2 = pane.UnProjectWidth(2);
-
- if (neg_strand) {
- glVertex2f(f - offsetX - over2, yy - offsetY + kPWAlignHeight * 0.5f);
- glVertex2f(t - offsetX + 1, yy - offsetY + kPWAlignHeight * 0.5f);
- } else {
- glVertex2f(f - offsetX, yy - offsetY + kPWAlignHeight * 0.5f);
- glVertex2f(t - offsetX + over2 + 1, yy - offsetY + kPWAlignHeight * 0.5f);
- }
- glEnd();
- glBegin(GL_TRIANGLES);
- if (neg_strand) {
- glVertex2f(f - offsetX - over8, yy - offsetY + kPWAlignHeight * 0.5f);
- glVertex2f(f - offsetX - over2, yy - offsetY - 1);
- glVertex2f(f - offsetX - over2, yy - offsetY + kPWAlignHeight + 1);
- } else {
- glVertex2f(t - offsetX + 1 + over8, yy - offsetY + kPWAlignHeight * 0.5f);
- glVertex2f(t - offsetX + 1 + over2, yy - offsetY - 1);
- glVertex2f(t - offsetX + 1 + over2, yy - offsetY + kPWAlignHeight + 1);
- }
- glEnd();
- glBegin(GL_LINES);
- }
- else {
- glVertex2f(f - offsetX, yy - offsetY + kPWAlignHeight * 0.5f);
- glVertex2f(t - offsetX + 1, yy - offsetY + kPWAlignHeight * 0.5f);
- }
- }
- // Draw selection
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelection_PWAlign);
- x_DrawSelection(pane, from, row_y, to, row_y + height);
- }
- break;
- case eDrawObjectQuads:
- case eDrawObjectLabel:
- // Draw Strand Indicator (do not draw labels if less than 1 letter width)
- // do not draw strand when sequence is shown
- if (mode == eDrawObjectLabel &&
- inrc.Width() > pane.UnProjectWidth(m_MinLabelWidth) &&
- scaleX > 1.0f / 6.0f) {
- GLfloat xM = x_CenterText(pane, inrc, m_Font_Helv10.TextWidth("<"));
- glColor3f(0.0f, 0.0f, 0.0f); // Black
- m_Font_Helv10.TextOut(xM - offsetX, yy +
- m_Font_Helv10.TextHeight() - offsetY - 2,
- neg_strand ? "<" : ">");
- }
-
- // Should we draw sequence?
- if (mode == eDrawObjectLabel && scaleX > 1.0f / 6.0f) {
- return; // sequence would not fit
- }
-
- // Draw Sequence and quads for segments
- for ( ; row < aln_mgr.GetNumRows(); ++row) {
- if (row == anchor) {
- continue; // skip master seq
- }
- CRef<CAlnVec::CAlnChunkVec> aln_chunks
- (aln_mgr.GetAlnChunks(row, range,
- CAlnVec::fSeqOnly |
- CAlnVec::fChunkSameAsSeg));
-
- for (int i = 0; i < aln_chunks->size(); ++i) {
- CConstRef<CAlnVec::CAlnChunk> chunk((*aln_chunks)[i]);
- TSeqPos start = chunk->GetRange().GetFrom();
- start = aln_mgr.GetSeqPosFromSeqPos(anchor, row, start);
- TSeqPos stop = chunk->GetRange().GetTo();
- stop = aln_mgr.GetSeqPosFromSeqPos(anchor, row, stop);
- if (start > stop) {
- swap(start, stop);
- }
- if (mode == eDrawObjectQuads) {
- x_Color(c_fg);
- x_DrawQuad(pane, start, yy, stop, yy + kPWAlignHeight);
- } else if (mode == eDrawObjectLabel) {
- const CBioseq_Handle& mhndl = aln_mgr.GetBioseqHandle(anchor);
- const CBioseq_Handle& hndl = aln_mgr.GetBioseqHandle(row);
-
- CSeqVector ms_vec = mhndl.GetSeqVector(
- CBioseq_Handle::eCoding_Iupac);
- CSeqVector s_vec = hndl.GetSeqVector(
- CBioseq_Handle::eCoding_Iupac);
-
- string seq, mseq, tmp_seq;
- s_vec.GetSeqData (chunk->GetRange().GetFrom(),
- chunk->GetRange().GetTo() + 1, tmp_seq);
- ms_vec.GetSeqData(start, stop + 1, mseq);
-
- if (neg_strand) { // reverse&compiment sequence for negative strand
- CSeqManip::ReverseComplement(tmp_seq, CSeqUtil::e_Iupacna,
- 0, tmp_seq.length(), seq);
- } else {
- seq = tmp_seq;
- }
-
- GLfloat y = yy + m_Font_Helv8.TextHeight() - 1 - offsetY;
- char bases[2];
- bases[1] = ' ';
- for (TSeqPos bp = 0; bp != seq.length(); bp++) {
- if (seq[bp] != mseq[bp]) { // Highlight mismatch
- x_Color(c_mis);
- } else {
- x_Color(c_seq);
- }
-
- bases[0] = seq[bp];
- m_Font_Helv8.ArrayTextOut(start - offsetX + bp + 0.5, y, 1.0f, 0.0f,
- bases, (float) pane.GetScaleX(), 0.0f);
- }
- }
- }
- }
- break;
- }
- }
- void CDefaultPolicy::x_DrawPWAlign(CGlPane& pane, const CLayoutPWAlign* pw_aln,
- GLfloat row_y, EObj_IterMode mode, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- TSeqPos from = pw_aln->GetLocation().GetTotalRange().GetFrom();
- TSeqPos to = pw_aln->GetLocation().GetTotalRange().GetTo();
- TModelRect frc;
- frc.SetLeft(from);
- frc.SetRight(to);
- TModelRect inrc = frc.IntersectWith(rcV);
- GLfloat scaleX = pane.GetScaleX();
- if (mode == eDrawObjectLabel &&
- inrc.Width() > pane.UnProjectWidth(m_MinLabelWidth) &&
- m_ConfigSettings->GetShowPWAlignLabels() ) {
- string title;
- x_GetTitle(pw_aln, &title);
-
- string out = m_Font_Helv10.Truncate(title.c_str(),
- inrc.Width() / scaleX);
-
- GLfloat xM = x_CenterText(pane, inrc,
- m_Font_Helv10.TextWidth(out.c_str()));
- x_Color(selected ? CSeqGraphicColorConfig::eSelLabel_PWAlign :
- CSeqGraphicColorConfig::eLabel_PWAlign);
- GLfloat title_y = row_y + m_Font_Helv10.TextHeight() + 1;
- m_Font_Helv10.TextOut(xM - offsetX, title_y - offsetY, out.c_str());
-
- if (scaleX > 1.0f / 6.0f) {
- return; // sequence would not fit
- }
- }
-
- x_DrawPWAlignElem(pane, pw_aln, row_y, mode, selected,
- CSeqGraphicColorConfig::eFG_PWAlign,
- CSeqGraphicColorConfig::eSeq_PWAlign,
- CSeqGraphicColorConfig::eSeq_PWAlignMismatch);
- }
- // This is exactly as it done in Sequin.
- TSeqPos CDefaultPolicy::x_GetProtOffset(const CLayoutFeat* feat) const
- {
- TSeqPos offset = 1; // translation offset
- const CCdregion& cdr = feat->GetFeature().GetData().GetCdregion();
- if (cdr.IsSetFrame ()) {
- switch (cdr.GetFrame ()) {
- case CCdregion::eFrame_two :
- offset = 2;
- break;
- case CCdregion::eFrame_three :
- offset = 3;
- break;
- default :
- break;
- }
- }
- return offset;
- }
- void
- CDefaultPolicy::x_DrawProteinProduct(CGlPane& pane, const CLayoutFeat* feat,
- GLfloat row_y, EProtSeqType type, bool selected) const
- {
- const TModelRect& rcV = pane.GetVisibleRect();
- const TModelRect& rcM = pane.GetModelLimitsRect();
-
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
-
- TSeqPos from = feat->GetLocation().GetTotalRange().GetFrom();
- TSeqPos to = feat->GetLocation().GetTotalRange().GetTo();
- TModelRect frc;
- frc.SetLeft(from);
- frc.SetRight(to);
- TModelRect inrc = frc.IntersectWith(rcV);
- // do not do anything if there is no spac for even one letter
- if (inrc.Width() < pane.UnProjectWidth(m_MinLabelWidth)) {
- return;
- }
- GLfloat scaleX = pane.GetScaleX();
- GLfloat th = m_Font_Helv10.TextHeight();
- GLfloat title_y = row_y + th + 1;
- GLfloat line_y1 = title_y + 3;
- GLfloat bases_y = line_y1 + th;
- GLfloat off = rcM.Top() > 0 ? th - 1 : 0;
- TSeqPos offset = x_GetProtOffset(feat); // initial translation offset
- // label for original protein only and when product is accessible
- if (type != eTranslatedSeq && feat->GetFeature().IsSetProduct()) {
- const CSeq_loc& product = feat->GetFeature().GetProduct();
- string prot_label;
- CLabel::GetLabel(product, &prot_label,
- CLabel::eDefault, &m_Handle.GetScope());
- string out = m_Font_Helv10.Truncate(prot_label.c_str(),
- inrc.Width() / scaleX);
- GLfloat xM = x_CenterText(pane, inrc, m_Font_Helv10.TextWidth(out.c_str()));
- //x_SetFeatureColor(feat);
- //x_Color(CSeqGraphicColorConfig::eSeq_ProtTranslated); // eSeq_ProtOriginal?
- if (selected) {
- x_Color(CSeqGraphicColorConfig::eSelLabel_ProtProduct);
- } else {
- x_Color(CSeqGraphicColorConfig::eLabel_ProtProduct);
- }
- m_Font_Helv10.TextOut(xM - offsetX, title_y - off - offsetY, out.c_str());
- }
- // // draw actual prot sequence if at the right zoom level
- if (x_IsSeqLettersFit(pane)) {
- string prot_seq, trans_seq;
- CSeqVector vec = m_Handle.GetSeqVector(CBioseq_Handle::eCoding_Iupac);
- const CCdregion& cdr = feat->GetFeature().GetData().GetCdregion();
- CCdregion_translate::TranslateCdregion(trans_seq, m_Handle,
- feat->GetLocation(),
- cdr, true, true);
- if (feat->GetFeature().IsSetProduct()) {
- const CSeq_loc& product = feat->GetFeature().GetProduct();
- CSeqVector prot_vec =
- m_Handle.GetSequenceView(product,
- CBioseq_Handle::eViewConstructed);
- prot_vec.SetCoding(CBioseq_Handle::eCoding_Iupac);
- prot_vec.GetSeqData (0, prot_vec.size(), prot_seq);
- } else {
- prot_seq = trans_seq;
- }
- TSeqPos seq_start;
- size_t idx = 0;
- for (CSeq_loc_CI lit(feat->GetLocation()); lit; ++lit) {
- TSeqPos ifrom = lit.GetRange().GetFrom();
- TSeqPos ito = lit.GetRange().GetTo();
-
- char bases[2];
- bases[1] = ' ';
- bool neg = lit.GetStrand () == eNa_strand_minus;
- for (TSeqPos pos = neg ? ito : ifrom;
- (neg ? (pos - offset >= ifrom) : (pos + offset <= ito)) &&
- idx != prot_seq.length();
- (neg ? pos -= 3 : pos += 3), ++idx)
- {
- seq_start = neg ? pos - offset : pos + offset;
- x_Color( CSeqGraphicColorConfig::eSeq_ProtTranslated );
- if (type == eTranslatedSeq) { // drawing translated sequence
- bases[0] = trans_seq[idx];
- if (prot_seq[idx] != trans_seq[idx]) {
- x_Color(CSeqGraphicColorConfig::eSeq_ProtMismatch); // Mismatch
- }
- } else { // drawing actual sequence
- bases[0] = prot_seq[idx];
- }
- m_Font_Helv10.TextOut(seq_start - offsetX, bases_y - off - offsetY, bases);
-
-
- // for selected feature show original sequence below
- if (selected) {
- x_Color( CSeqGraphicColorConfig::eSeq_ProtOriginal );
-
- string main_seq, tmp_seq;
- vec.GetSeqData(seq_start - 1, seq_start + 2, tmp_seq);
-
- if (neg) { // reverse sequence on negative strand
- CSeqManip::Complement(tmp_seq, CSeqUtil::e_Iupacna,
- 0, tmp_seq.length(), main_seq);
- } else {
- main_seq = tmp_seq;
- }
-
- GLfloat s_start = seq_start - offsetX - 0.8f;
-
- for (TSeqPos bp = 0; bp != main_seq.length(); bp++) {
- bases[0] = main_seq[bp];
- m_Font_Helv8.TextOut(s_start, bases_y + 9 - offsetY, bases);
- s_start += 0.8f;
- }
- }
- }
- // Use correct offset for the next interval
- int diff = neg ? seq_start - ifrom : ito - seq_start;
- if (diff == 2) {
- offset = 0;
- } else if (diff == 1) {
- offset = 1;
- } else if (diff == 0) {
- offset = 2;
- }
- } // for
- } // done with protein sequence
- }
- GLfloat
- CDefaultPolicy::x_CenterText(CGlPane& pane, TModelRect rc, GLfloat width) const
- {
- return rc.Left() + rc.Width() / 2.0f -
- pane.UnProjectWidth(TVPUnit(width)) / 2.0f;
- }
- size_t CDefaultPolicy::x_GetSeqAnnotIndex(const CSeq_annot_Handle& annot) const
- {
- TNamedAnnots::const_iterator iter = m_Annots.find(annot.GetName());
- if (iter == m_Annots.end()) {
- m_Annots[annot.GetName()] = m_Annots.size();
- iter = m_Annots.find(annot.GetName());
- }
- return iter->second;
- }
- void CDefaultPolicy::x_DrawQuad(CGlPane& pane,
- TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2) const
- {
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- glVertex2f(x1 - offsetX, y1 - offsetY);
- glVertex2f(x2 - offsetX + 1, y1 - offsetY);
- glVertex2f(x2 - offsetX + 1, y2 - offsetY);
- glVertex2f(x1 - offsetX, y2 - offsetY);
- }
- void CDefaultPolicy::x_DrawSelection(CGlPane& pane,
- TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2) const
- {
- TModelUnit offsetX = pane.GetOffsetX();
- TModelUnit offsetY = pane.GetOffsetY();
- glVertex2f(x1 - offsetX, y1 - offsetY);
- glVertex2f(x1 - offsetX, y2 - offsetY);
- glVertex2f(x1 - offsetX, y2 - offsetY);
- glVertex2f(x2 - offsetX+1, y2 - offsetY);
- glVertex2f(x2 - offsetX+1, y2 - offsetY);
- glVertex2f(x2 - offsetX+1, y1 - offsetY);
- glVertex2f(x1 - offsetX, y1 - offsetY);
- glVertex2f(x2 - offsetX+1, y1 - offsetY);
- }
- // Is LayoutObject clicked? Uses model coordinates
- bool CDefaultPolicy::x_IsObjectClicked(CGlPane& pane, const CLayoutObject* obj,
- GLfloat row_y, bool selected) const
- {
- TModelUnit height = GetRowHeight(pane, obj, selected);
- if (m_LastClick.Y() >=row_y && m_LastClick.Y() <= row_y + height) {
- return obj->GetObject( TSeqPos(m_LastClick.X()) ) != NULL;
- }
- return false;
- }
- // Is feature label clicked? Uses pixels.
- // Only in overview mode.
- bool CDefaultPolicy::x_IsFeatLabelClicked(CGlPane& pane,
- const CLayoutFeatLabel* lbl, GLfloat row_y) const
- {
- const TModelRect& rc = pane.GetVisibleRect();
- int label_width = kLabelsColWidth;
- TModelUnit width = pane.UnProjectWidth(label_width);
- TModelUnit offset = width * lbl->GetColumn();
- TModelRect rcM(rc.Left() + offset, row_y);
- rcM.SetSize(width, x_GetRowHeight(pane, lbl, false) );
- return rcM.PtInRect(m_LastClick.X(), m_LastClick.Y());
- }
- TModelUnit CDefaultPolicy::x_CalcAlignHeight(const CLayoutAlign* align) const
- {
- const CAlnVec& aln_mgr = align->GetAlignMgr();
- TModelUnit height = m_Font_Helv10.TextHeight() + 4 +
- (kAlnElementHeight + 1) * (aln_mgr.GetNumRows() - 1);
- return height;
- }
- void CDefaultPolicy::x_Color(CSeqGraphicColorConfig::EDisplayElement e) const
- {
- CGlColor color = m_ConfigSettings->GetElementColor(e);
- glColor3f(color.GetRed(), color.GetGreen(), color.GetBlue());
- }
- bool CDefaultPolicy::ProcessObject(CGlPane& pane, const CLayoutObject* obj,
- TModelUnit row, EObj_IterMode mode, bool selected) const
- {
- GLfloat row_y = row;
-
- const CLayoutFeat* feat = dynamic_cast<const CLayoutFeat*> (obj);
- const CLayoutAlign* align = dynamic_cast<const CLayoutAlign*> (obj);
- const CLayoutAlignSmear* smear = dynamic_cast<const CLayoutAlignSmear*>(obj);
- const CLayoutProtProd* prot = dynamic_cast<const CLayoutProtProd*> (obj);
- const CLayoutGraph* graph = dynamic_cast<const CLayoutGraph*> (obj);
- const CLayoutFeatLabel* label = dynamic_cast<const CLayoutFeatLabel*> (obj);
- const CLayoutComment* comm = dynamic_cast<const CLayoutComment*> (obj);
- const CLayoutFeatPack* pack = dynamic_cast<const CLayoutFeatPack*> (obj);
- const CLayoutHistogram* hist = dynamic_cast<const CLayoutHistogram*> (obj);
- const CLayoutSeqMap* seg = dynamic_cast<const CLayoutSeqMap*> (obj);
- const CLayoutSequence* seqs = dynamic_cast<const CLayoutSequence*> (obj);
- const CLayoutMatePair* pair = dynamic_cast<const CLayoutMatePair*> (obj);
- const CLayoutPWAlign* pw_align = dynamic_cast<const CLayoutPWAlign*> (obj);
- switch (mode) {
- case eDrawObjectGrid:
- x_DrawGridLine(pane, obj, row_y);
- break;
- case eDrawObjectLines:
- case eDrawObjectQuads:
- case eDrawObjectLabel:
- if (comm) {
- x_DrawComments(pane, comm, row_y, mode, selected);
- } else if (seg) {
- x_DrawSeqSegment(pane, seg, row_y, mode, selected);
- } else if (pw_align) {
- x_DrawPWAlign(pane, pw_align, row_y, mode, selected);
- } else if (seqs) {
- x_DrawSequence(pane, seqs, row_y, mode, selected);
- } else if (hist) {
- x_DrawHistogram(pane, hist, row_y, mode, selected);
- } else if (label != NULL) {
- x_DrawFeatLabel(pane, label, row_y, mode, selected);
- } else if (prot != NULL) {
- if (mode == eDrawObjectLabel) {
- x_DrawProteinProduct(pane, prot, row_y, eProteinSeq, selected);
- } else {
- x_DrawFeature(pane, prot, row_y, mode, selected);
- }
- } else if (feat != NULL) {
- x_DrawFeature(pane, feat, row_y, mode, selected);
- const CSeqFeatData& data = feat->GetFeature().GetData();
- if (mode == eDrawObjectLabel &&
- data.Which() == CSeqFeatData::e_Cdregion) {
- x_DrawProteinProduct(pane, feat, row_y,
- eTranslatedSeq, selected);
- }
- } else if (align != NULL) {
- x_DrawAlignment(pane, align, row_y, mode, selected);
- } else if (smear != NULL) {
- x_DrawAlignmentSmear(pane, smear, row_y, mode, selected);
- } else if (graph != NULL) {
- x_DrawSeqGraph(pane, graph, row_y, mode, selected);
- } else if (pack != NULL) {
- x_DrawFeatPack(pane, pack, row_y, mode, selected);
- } else if (pair != NULL) {
- x_DrawMatePair(pane, pair, row_y, mode, selected);
- }
- break;
- case eCalcObjectRows:
- break;
- case eGetHTMLAreas:
- x_GetHTMLActiveAreas(pane, obj, row_y, selected);
- break;
- case eObjectHitTest:
- if (label) {
- return x_IsFeatLabelClicked(pane, label, row_y);
- } else {
- return x_IsObjectClicked(pane, obj, row_y, selected);
- }
- break;
- default:
- break;
- }
- return false;
- }
- void CDefaultPolicy::x_GetHTMLActiveAreas(CGlPane& pane,
- const CLayoutObject* obj,
- GLfloat row_y, bool selected) const
- {
- string title, tooltip;
- const CLayoutFeatLabel* label = dynamic_cast<const CLayoutFeatLabel*> (obj);
- const CLayoutMatePair* mpair = dynamic_cast<const CLayoutMatePair*> (obj);
- if (!m_ActiveAreas || label) {
- return;
- }
-
- if (mpair) {
- const CLayoutMatePair::TAlignList& pw_aligns = mpair->GetSeqAligns();
- ITERATE(CLayoutMatePair::TAlignList, iter, pw_aligns) {
- GetTitle(iter->GetPointer(), &title, CLabel::eDefault);
- GetTitle(iter->GetPointer(), &tooltip, CLabel::eTooltipDetailed);
- x_AddGetHTMLActiveElement(title, tooltip, pane,
- iter->GetPointer(), row_y, selected);
- }
- } else {
- GetTitle(obj, &title, CLabel::eDefault);
- GetTitle(obj, &tooltip, CLabel::eTooltipDetailed);
- x_AddGetHTMLActiveElement(title, tooltip, pane, obj, row_y, selected);
- }
- }
- void CDefaultPolicy::x_AddGetHTMLActiveElement(string title, string tooltip,
- CGlPane& pane, const CLayoutObject* obj,
- GLfloat row_y, bool selected) const
- {
- TSeqRange r = obj->GetLocation().GetTotalRange();
- TVPUnit x1 = pane.ProjectX (r.GetFrom());
- TVPUnit x2 = pane.ProjectX (r.GetTo() );
- TVPUnit y1 = TVPUnit(row_y);
- TVPUnit y2 = TVPUnit(row_y + GetRowHeight(pane, obj, selected));
-
- x1 = max(0, x1);
- x2 = min(pane.GetViewport().Right(), x2);
-
- //cout << x1 << "t" << x2 << "t" << y1 << "t" << y2 << endl;
- CHTMLActiveArea area(CHTMLActiveArea::eCheckBox,
- TVPRect(x1, y2, x2, y1),
- title, tooltip, "toggle_select");
- /*pane.OpenPixels();
- glColor3f(0.0f, 0.0f, 0.0f); // Black
- glBegin(GL_LINE_LOOP);
- glVertex2f(rc_bounds.Left(), pane.GetViewport().Height()-rc_bounds.Top()+5);
- glVertex2f(rc_bounds.Right(), pane.GetViewport().Height()-rc_bounds.Top()+5);
- glVertex2f(rc_bounds.Right(), pane.GetViewport().Height()-rc_bounds.Bottom()+5);
- glVertex2f(rc_bounds.Left(), pane.GetViewport().Height()-rc_bounds.Bottom()+5);
- glEnd();
- pane.Close();*/
-
- m_ActiveAreas->push_back(area);
- }
- bool CDefaultPolicy::x_IsSeqLettersFit(CGlPane& pane) const
- {
- return pane.GetScaleX() <= 1.0f / kPixPerBase4Sequence;
- }
- void CDefaultPolicy::x_DrawGridLine(CGlPane& pane,
- const CLayoutObject* obj, GLfloat row_y) const
- {
- const TModelRect& rc = pane.GetModelLimitsRect();
- glVertex2f(rc.Left() - pane.GetOffsetX(), row_y - pane.GetOffsetY() );
- glVertex2f(rc.Right() - pane.GetOffsetX(), row_y - pane.GetOffsetY() );
- }
- TModelUnit CDefaultPolicy::GetRowHeight(CGlPane& pane, const CLayoutObject* obj, bool selected) const
- {
- const CLayoutComment* comm = dynamic_cast<const CLayoutComment*> (obj);
- const CLayoutFeat* feat = dynamic_cast<const CLayoutFeat*> (obj);
- const CLayoutAlign* align = dynamic_cast<const CLayoutAlign*> (obj);
- const CLayoutAlignSmear* smear = dynamic_cast<const CLayoutAlignSmear*> (obj);
- const CLayoutProtProd* prot = dynamic_cast<const CLayoutProtProd*> (obj);
- const CLayoutGraph* graph = dynamic_cast<const CLayoutGraph*> (obj);
- const CLayoutFeatLabel* label = dynamic_cast<const CLayoutFeatLabel*> (obj);
- const CLayoutFeatPack* pack = dynamic_cast<const CLayoutFeatPack*> (obj);
- const CLayoutHistogram* hist = dynamic_cast<const CLayoutHistogram*> (obj);
- const CLayoutSeqMap* seg = dynamic_cast<const CLayoutSeqMap*> (obj);
- const CLayoutSequence* seqs = dynamic_cast<const CLayoutSequence*> (obj);
- const CLayoutMatePair* pair = dynamic_cast<const CLayoutMatePair*> (obj);
- const CLayoutPWAlign* pw_aln = dynamic_cast<const CLayoutPWAlign*> (obj);
-
- if (pw_aln) return x_GetRowHeight(pane, pw_aln,selected);
- if (seqs) return x_GetRowHeight(pane, seqs, selected);
- if (comm) return x_GetRowHeight(pane, comm, selected);
- if (label) return x_GetRowHeight(pane, label, selected);
- if (align) return x_GetRowHeight(pane, align, selected);
- if (smear) return x_GetRowHeight(pane, smear, selected);
- if (prot) return x_GetRowHeight(pane, prot, selected);
- if (graph) return x_GetRowHeight(pane, graph, selected);
- if (feat) return x_GetRowHeight(pane, feat, selected);
- if (pack) return x_GetRowHeight(pane, pack, selected);
- if (hist) return x_GetRowHeight(pane, hist, selected);
- if (seg) return x_GetRowHeight(pane, seg, selected);
- if (pair) return x_GetRowHeight(pane, pair, selected);
-
- return 0;
- }
- void CDefaultPolicy::GetTitle(const CLayoutObject* obj, string* title,
- CLabel::ELabelType type) const
- {
- const CLayoutFeat* feat = dynamic_cast<const CLayoutFeat*> (obj);
- const CLayoutAlign* align = dynamic_cast<const CLayoutAlign*> (obj);
- //const CLayoutProtProd* prot = dynamic_cast<const CLayoutProtProd*> (obj);
- const CLayoutGraph* graph = dynamic_cast<const CLayoutGraph*> (obj);
- //const CLayoutFeatLabel* label = dynamic_cast<const CLayoutFeatLabel*> (obj);
- const CLayoutFeatPack* pack = dynamic_cast<const CLayoutFeatPack*> (obj);
- const CLayoutHistogram* hist = dynamic_cast<const CLayoutHistogram*> (obj);
- const CLayoutSeqMap* seg = dynamic_cast<const CLayoutSeqMap*> (obj);
- const CLayoutSequence* seqs = dynamic_cast<const CLayoutSequence*> (obj);
- const CLayoutMatePair* pair = dynamic_cast<const CLayoutMatePair*> (obj);
- const CLayoutPWAlign* pw_aln = dynamic_cast<const CLayoutPWAlign*> (obj);
-
- if (pw_aln) {
- x_GetTitle(pw_aln, title, type);
- } else if (align) {
- x_GetTitle(align, title, type);
- } else if (graph) {
- x_GetTitle(graph, title, type);
- } else if (feat) {
- x_GetTitle(feat, title, type);
- } else if (pack) {
- x_GetTitle(pack, title, type);
- } else if (hist) {
- x_GetTitle(hist, title, type);
- } else if (seg) {
- x_GetTitle(seg, title, type);
- } else if (seqs) {
- x_GetTitle(seqs, title, type);
- } else if (pair) {
- x_GetTitle(pair, title, type);
- }
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutSeqMap* seg, string* title,
- CLabel::ELabelType type) const
- {
- if (title) {
- title->erase();
- CLabel::GetLabel(seg->GetSeqID(), title,
- type, &m_Handle.GetScope());
- }
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutSequence* seqs, string* title,
- CLabel::ELabelType type) const
- {
- *title = seqs->GetSequence(); //"Sequence Bar";
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutHistogram* hist, string* title,
- CLabel::ELabelType type) const
- {
- *title = "Distribution Histogram for " + GetFeatConfigList()->
- GetDescription(hist->Which(), hist->Subtype()) + "(s)";
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutFeatPack* pack, string* title,
- CLabel::ELabelType type) const
- {
- *title = "";
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutFeat* feat, string* title,
- CLabel::ELabelType type) const
- {
- string tmp_type, tmp_content;
- x_GetLabels(feat->GetFeature(), m_Handle.GetScope(),
- &tmp_type, &tmp_content, title);
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutPWAlign* pw_aln, string* title,
- CLabel::ELabelType type) const
- {
- title->erase();
- const CAlnVec& aln_mgr = pw_aln->GetAlignMgr();
-
- // display the name of the seconds sequence (not the master seq.)
- CAlnMap::TNumrow row = m_Handle.IsSynonym(aln_mgr.GetSeqId(0)) ? 1 : 0;
- CLabel::GetLabel(aln_mgr.GetSeqId(row), title,
- type, &m_Handle.GetScope());
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutAlign* align, string* title,
- CLabel::ELabelType type) const
- {
- const CAlnVec& aln_mgr = align->GetAlignMgr();
- title->erase();
-
- // otherwise display the row count
- *title = "[Alignment] " +
- NStr::UIntToString(aln_mgr.GetNumRows()) + " sequences";
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutGraph* graph, string* title,
- CLabel::ELabelType type) const
- {
- const CMappedGraph& gr = graph->GetGraph();
- *title = gr.IsSetTitle() ? gr.GetTitle() : "";
- }
- void CDefaultPolicy::x_GetTitle(const CLayoutMatePair* pr, string* title,
- CLabel::ELabelType type) const
- {
- // It's a vector of CRefs
- const CLayoutMatePair::TAlignList& pw_aligns = pr->GetSeqAligns();
-
- *title = "Mate Pair: ";
- string tmp = "";
- ITERATE(CLayoutMatePair::TAlignList, iter, pw_aligns) {
- if (tmp.length() > 0) *title = *title + " / ";
- tmp.erase();
- x_GetTitle(iter->GetPointer(), &tmp, type);
- *title = *title + tmp;
- }
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutMatePair* pr,
- bool selected) const
- {
- if (m_ConfigSettings->GetShowPWAlignLabels()) {
- return m_Font_Helv10.TextHeight() + 4 +
- m_Font_Helv8.TextHeight() + kSpacerSize;
- } else {
- return m_Font_Helv8.TextHeight() + kSpacerSize;
- }
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutSequence* seqs,
- bool selected) const
- {
- return 20.0f + kSpacerSize;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutHistogram* hist,
- bool selected) const
- {
- return 20.0f + kSpacerSize;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutSeqMap* seg,
- bool selected) const
- {
- return 3.0f + kSpacerSize;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutComment* comm,
- bool selected) const
- {
- return kCommentFontSize + kSpacerSize;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutFeatPack* pack,
- bool selected) const
- {
- return 20.0f + kSpacerSize;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutFeat* feat,
- bool selected) const
- {
- const CSeqFeatData& data = feat->GetFeature().GetData();
- if (selected && data.Which() == CSeqFeatData::e_Cdregion
- && x_IsSeqLettersFit(pane) ) {
- // one and a half row for selected feature
- return 30.0f + kSpacerSize;
- } else {
- return 20.0f + kSpacerSize;
- }
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutAlign* align,
- bool selected) const
- {
- TModelUnit height = x_CalcAlignHeight(align);
- return height;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutPWAlign* pw_aln,
- bool selected) const
- {
- if (m_ConfigSettings->GetShowPWAlignLabels()) {
- return m_Font_Helv10.TextHeight() + 4 +
- m_Font_Helv8.TextHeight() + kSpacerSize;
- } else {
- return m_Font_Helv8.TextHeight() + kSpacerSize;
- }
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutAlignSmear* align,
- bool selected) const
- {
- return 20.f + kSpacerSize;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutFeatLabel* label,
- bool selected) const
- {
- return kCommentFontSize + kSpacerSize;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutGraph* graph,
- bool selected) const
- {
- return 20.f + kSpacerSize;
- }
- TModelUnit CDefaultPolicy::x_GetRowHeight(CGlPane& pane,
- const CLayoutProtProd* prot,
- bool selected) const
- {
- if (selected && x_IsSeqLettersFit(pane) ) {
- return 30.0f + kSpacerSize;
- } else {
- return 20.0f + kSpacerSize;
- }
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: default_policy.cpp,v $
- * Revision 1000.3 2004/06/01 21:12:33 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.41
- *
- * Revision 1.41 2004/05/21 22:27:55 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.40 2004/05/21 13:51:27 lebedev
- * 2 pixels space between sequence graphs added. Display of min and max values in the graph title.
- *
- * Revision 1.39 2004/05/14 16:00:27 lebedev
- * Respect color defines for Mate Pairs error codes. Draw pair wise alignment strand
- * indicators as arrows. Use CLabel::eTooltipDetailed mode for tooltips.
- *
- * Revision 1.38 2004/05/14 14:13:16 dicuccio
- * Use CLabel instead of manually picking a label
- *
- * Revision 1.37 2004/05/13 18:42:20 lebedev
- * Properly handle sequence for negative strand alignments
- *
- * Revision 1.36 2004/05/11 17:58:54 lebedev
- * Highlight Mate Pairs background based on library ID. Highlight mate pair with errors with shades of red.
- *
- * Revision 1.35 2004/05/07 15:37:13 dicuccio
- * Use CLabel instead of CSeqUtils::GetLabel()
- *
- * Revision 1.34 2004/05/07 11:12:52 lebedev
- * Option to show/hide labels for pairwise alignments and mate pairs added.
- *
- * Revision 1.33 2004/04/22 18:15:04 lebedev
- * Allow Mate Pairs to have separate selection for each alignment inside.
- *
- * Revision 1.32 2004/04/21 16:35:38 lebedev
- * Support for pair-wise alignments added. Rendering of Mate Pairs changed.
- * Return multiple HTML Active areas for Mate Pair objects.
- *
- * Revision 1.31 2004/04/20 19:20:18 dicuccio
- * #ifdef'd mate pair rendering code pending rewrite
- *
- * Revision 1.30 2004/04/19 15:44:23 lebedev
- * Use color form configuration engine for Mate-Pairs. Highlight link between pairs.
- *
- * Revision 1.29 2004/04/16 14:52:01 dicuccio
- * SetConfig() takes pointer, not CRef<>. Formatting changes
- *
- * Revision 1.28 2004/04/15 13:04:51 lebedev
- * Selection for MatePairs added.
- *
- * Revision 1.27 2004/04/14 14:00:41 vasilche
- * MSVC doesn't like templates' names as function arguments' names.
- *
- * Revision 1.26 2004/04/14 11:25:48 lebedev
- * Added rendering of Mate Pairs.
- *
- * Revision 1.25 2004/04/12 18:47:57 dicuccio
- * Adjusted rendering of alignments - fixed rendering of gaps. Formatting changes
- *
- * Revision 1.24 2004/04/07 13:10:56 dicuccio
- * Use CSeq_annot_Handle for proper annotation name handling
- *
- * Revision 1.23 2004/04/06 13:41:32 dicuccio
- * Formatting changes. Replaced if block with switch statement. Changed rendering of HTML active areas to upse CHTMLActiveArea directly
- *
- * Revision 1.22 2004/04/06 11:58:18 lebedev
- * Do not project y coordinate in the x_GetHTMLActiveAreas method.
- *
- * Revision 1.21 2004/03/31 16:08:58 lebedev
- * Methods to get HTML active areas added.
- *
- * Revision 1.20 2004/03/30 13:58:37 lebedev
- * Use elements colors from configuration instead of setting colors directly.
- *
- * Revision 1.19 2004/03/29 15:12:20 dicuccio
- * Changed default height of alignment bars to 5 pixels (was 2). Fixed rendering
- * of - strand alignments (swap start/stop). Fixed rendering of sequence letters
- * - use ArrayTextOut() instead of TextOut
- *
- * Revision 1.18 2004/03/26 15:46:00 lebedev
- * Rendering of SeqGraphs fixed
- *
- * Revision 1.17 2004/03/23 12:33:55 lebedev
- * Made sequence and histograms bars a layout objects in the object panel.
- * Made segment map a number of layout objects. Get rid of fixed size rows in the object panel.
- *
- * Revision 1.16 2004/03/22 16:54:15 rsmith
- * draw alignment smears.
- *
- * Revision 1.15 2004/03/11 17:53:06 dicuccio
- * Deprecated typedefs TPosition, TDimension, TIndex, TColor. Use TSeqRange instead of TRange
- *
- * Revision 1.14 2004/03/05 17:40:57 dicuccio
- * Use CSeqUtil::GetLabel() instead of home-grown solution
- *
- * Revision 1.13 2004/02/24 14:47:31 lebedev
- * Support for new types of layout objects added
- *
- * Revision 1.12 2004/02/05 16:47:10 dicuccio
- * Fixed rendering of alignments: correctly hande discontinuous alignments
- *
- * Revision 1.11 2004/02/03 16:54:06 dicuccio
- * Fixed bug in rendering of alignments - was skipping alignment segments
- *
- * Revision 1.10 2004/02/02 16:35:10 dicuccio
- * Fixed rendering issues in alignments - use proper starting coordinate
- *
- * Revision 1.9 2004/01/30 16:54:39 dicuccio
- * Fixed bugs in rendering of alignments - use correct calculation for start/stop
- * position of aligned segments
- *
- * Revision 1.8 2004/01/20 19:50:58 dicuccio
- * FIxed rendering of alignments - trap case in which trailing segments are gaps
- *
- * Revision 1.7 2004/01/16 18:43:15 dicuccio
- * Fixed issues in accessing invalid bioseq handles. Reformatted some code.
- * Added scoping to catch variables declared inside of switch statements.
- *
- * Revision 1.6 2004/01/16 13:40:14 lebedev
- * Tooltips added
- *
- * Revision 1.5 2004/01/13 20:39:33 dicuccio
- * Minor change to labels: don't include type if product location is shown
- *
- * Revision 1.4 2004/01/05 21:25:05 dicuccio
- * Code clean-up. Corrected issue with protein product features not appearing in
- * the correct color; standardized use of x_SetFeatureColor()
- *
- * Revision 1.3 2004/01/05 19:13:26 dicuccio
- * Code clean-up - fixed bracketing, indentation
- *
- * Revision 1.2 2004/01/05 17:50:19 dicuccio
- * Use x_GetLabels() to reduce code duplication. Changed feature labels to
- * include product accessions where available. Changed protein produc label to be
- * the accession.version
- *
- * Revision 1.1 2003/12/16 18:57:44 lebedev
- * Initial revision
- *
- * ===========================================================================
- */