default_layoutpolicy.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: default_layoutpolicy.hpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 19:53:13 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_SEQ_GRAPHIC___DEFAULT_LAYOUTPOLICY__HPP
- #define GUI_WIDGETS_SEQ_GRAPHIC___DEFAULT_LAYOUTPOLICY__HPP
- /* $Id: default_layoutpolicy.hpp,v 1000.2 2004/06/01 19:53:13 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/opengl/glpane.hpp>
- #include <gui/widgets/seq_graphic/ilayoutpolicy.hpp>
- #include <gui/objutils/feat_label.hpp>
- #include <gui/objutils/layout.hpp>
- #include <objmgr/util/feature.hpp>
- BEGIN_NCBI_SCOPE
- ///////////////////////////////////////////////////////////////////////////////
- /// CDefaultLayoutPolicy is a default layout policy for retrieving and
- /// packing, linking layout objects used in feature panel of seq_graphic widget.
- ///////////////////////////////////////////////////////////////////////////////
- class NCBI_GUIWIDGETS_SEQGRAPHIC_EXPORT CDefaultLayoutPolicy : public ILayoutPolicy
- {
- public:
- CDefaultLayoutPolicy();
- virtual ~CDefaultLayoutPolicy() { };
- // ILayoutPolicy interfaces
- virtual void PrepareData(CGlPane& pane, CLayout& lay_objects);
- virtual void SetHandle(const objects::CBioseq_Handle& handle);
- virtual void SetConfig(CSeqGraphicConfig* config);
- protected:
- objects::CBioseq_Handle m_Handle;
- CRef<CSeqGraphicConfig> m_ConfigSettings;
-
- // Prepares data for full view mode
- void x_PrepareDetailedView(CGlPane& pane, CLayout& lay_objects);
- // Prepares data for overview mode
- void x_PrepareGenesOverview(CGlPane& pane, CLayout& lay_objects);
- bool x_IsOverviewMode(CGlPane& pane) const;
- // Retrieve a measure of the minimum spacing in base pairs
- TSeqPos x_GetMinSpacing(CGlPane& pane) const;
-
- void x_AddFeatureLabelsOverview(CLayoutFeatLabel::TFeatLabelList& labels,
- CGlPane& pane, CLayout& lay_objects);
- void x_AddSeqSegmentMap(CGlPane& pane, CLayout& lay_objects, TSeqRange range);
- void x_AddSequenceBar(CGlPane& pane, CLayout& lay_objects, TSeqRange range);
- void x_AddHistograms(CGlPane& pane, CLayout& lay_objects, TSeqRange range);
-
- // Perform a grid layout
- void x_LayoutLabels(const CLayoutEngine::TObjects& objects,
- CLayout& layout, int col_count);
- // Segments
- void GetSeqMaps(CLayoutEngine::TObjects& maps,
- const TSeqRange& visible_sequence);
- };
- // comparator to sort a list of features by their labels
- struct SFeatureByName
- {
- bool operator() (CRef<CLayoutFeatLabel> f1, CRef<CLayoutFeatLabel> f2)
- {
- string label1;
- objects::feature::GetLabel(f1->GetFeature(), &label1,
- objects::feature::eContent);
-
- string label2;
- objects::feature::GetLabel(f2->GetFeature(), &label2,
- objects::feature::eContent);
-
- return label1 < label2;
- }
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: default_layoutpolicy.hpp,v $
- * Revision 1000.2 2004/06/01 19:53:13 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- *
- * Revision 1.5 2004/05/03 12:46:32 dicuccio
- * gui/utils ->gui/objutils where needed
- *
- * Revision 1.4 2004/04/16 14:34:36 dicuccio
- * Use raw pointer for SetConfig() instead of CRef<>
- *
- * Revision 1.3 2004/03/23 12:33:57 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.2 2004/03/02 15:29:16 lebedev
- * Switch to detailed mode if reached certain number of
- * genes in visible range.
- *
- * Revision 1.1 2004/02/13 18:00:29 lebedev
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_WIDGETS_SEQ_GRAPHIC___DEFAULT_LAYOUTPOLICY__HPP