📄 default_policy.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: default_policy.hpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 19:53:16 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.18 * PRODUCTION * =========================================================================== */#ifndef GUI_WIDGETS_SEQ_GRAPHIC___DEFAULT_POLICY__HPP#define GUI_WIDGETS_SEQ_GRAPHIC___DEFAULT_POLICY__HPP/* $Id: default_policy.hpp,v 1000.2 2004/06/01 19:53:16 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 <gui/gui.hpp>#include <gui/widgets/gl/ipolicy.hpp>#include <gui/objutils/feat_label.hpp>#include <gui/opengl/glbitmapfont.hpp>#include <gui/objutils/feature.hpp>#include <gui/objutils/alignment.hpp>#include <gui/objutils/pw_alignment.hpp>#include <gui/objutils/alignment_smear_layout.hpp>#include <gui/objutils/graph.hpp>#include <gui/objutils/comment.hpp>#include <gui/objutils/seq_map.hpp>#include <gui/objutils/histogram.hpp>#include <gui/objutils/feat_pack.hpp>#include <gui/objutils/prot_product.hpp>#include <gui/objutils/mate_pair.hpp>#include <gui/objutils/sequence.hpp>#include <gui/objutils/utils.hpp>#include <gui/objutils/label.hpp>#include <gui/opengl/glcolortable.hpp>#include <gui/widgets/seq_graphic/seqgraphic_conf.hpp>#include <objmgr/util/feature.hpp>#include <objects/seq/Seq_annot.hpp>BEGIN_NCBI_SCOPE////////////////////////////////////////////////////////////////////////////////// CDefaultPolicy is a default policy for rendering layout objects in // feature panel of seq_graphic widget.///////////////////////////////////////////////////////////////////////////////class NCBI_GUIWIDGETS_SEQGRAPHIC_EXPORT CDefaultPolicy : public IPolicy{public: CDefaultPolicy(); virtual ~CDefaultPolicy() { }; // IPolicy interfaces virtual TModelUnit GetRowHeight(CGlPane& pane, const CLayoutObject* obj, bool selected) const; virtual bool ProcessObject(CGlPane& pane, const CLayoutObject* obj, TModelUnit row, EObj_IterMode mode, bool selected) const; virtual void SetHandle(const objects::CBioseq_Handle& handle); virtual void SetConfig(CSeqGraphicConfig* config); virtual void SetHitPoint(TModelPoint click); virtual void SetActiveArea(TAreaVector* p_area); virtual void GetTitle(const CLayoutObject* obj, string* title, CLabel::ELabelType) const;protected: CGlColorTable m_ColorTable; TVPUnit m_MinLabelWidth; // minimum label that will fit // fonts CGlBitmapFont m_Font_Bitmap9x15; CGlBitmapFont m_Font_Helv10; CGlBitmapFont m_Font_Helv8; enum EProtSeqType { eProteinSeq, eTranslatedSeq }; TModelPoint m_LastClick; TAreaVector* m_ActiveAreas; // map of named annotations, with their indices typedef map<string, int> TNamedAnnots; mutable TNamedAnnots m_Annots; objects::CBioseq_Handle m_Handle; CRef<CSeqGraphicConfig> m_ConfigSettings; // returns offset from the begining of feature, // based on frame for protein translation TSeqPos x_GetProtOffset(const CLayoutFeat* feat) const; // is it enougth space to sequence letters? bool x_IsSeqLettersFit(CGlPane& pane) const; // center label in model coordinates GLfloat x_CenterText(CGlPane& pane, TModelRect rc, GLfloat width) const; // selected objects virtual bool x_IsObjectClicked(CGlPane& pane, const CLayoutObject* obj, GLfloat row_y, bool selected) const; virtual bool x_IsFeatLabelClicked(CGlPane& pane, const CLayoutFeatLabel* lbl, GLfloat row_y) const; TModelUnit x_CalcAlignHeight(const CLayoutAlign* align) const; // set feature color based on config virtual void x_SetFeatureColor(const CLayoutFeat* feat) const; // Internal incremental pool of CSeq_annots (for higlighting // of the named seq. annots.) size_t x_GetSeqAnnotIndex(const objects::CSeq_annot_Handle& annot) const; // draw functions for particular layout objects virtual void x_DrawAlignment(CGlPane& pane, const CLayoutAlign* align, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawAlignmentSmear(CGlPane& pane, const CLayoutAlignSmear* smear, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawFeature(CGlPane& pane, const CLayoutFeat* feat, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawFeatLabel(CGlPane& pane, const CLayoutFeatLabel* feat, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawProteinProduct(CGlPane& pane, const CLayoutFeat* feat, GLfloat row_y, EProtSeqType type, bool selected) const; virtual void x_DrawSeqGraph(CGlPane& pane, const CLayoutGraph* graph, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawComments(CGlPane& pane, const CLayoutComment* comm, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawSequence(CGlPane& pane, const CLayoutSequence* seqs, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawSeqSegment(CGlPane& pane, const CLayoutSeqMap* seg, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawFeatPack(CGlPane& pane, const CLayoutFeatPack* pack, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawHistogram(CGlPane& pane, const CLayoutHistogram* hist, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawMatePair(CGlPane& pane, const CLayoutMatePair* pair, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawPWAlign(CGlPane& pane, const CLayoutPWAlign* pw_aln, GLfloat row_y, EObj_IterMode mode, bool selected) const; virtual void x_DrawPWAlignElem(CGlPane& pane, const CLayoutPWAlign* pw_aln, GLfloat row_y, EObj_IterMode mode, bool selected,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -