⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layout.hpp

📁 ncbi源码
💻 HPP
字号:
/* * =========================================================================== * PRODUCTION $Log: layout.hpp,v $ * PRODUCTION Revision 1000.0  2004/06/01 19:55:27  gouriano * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.3 * PRODUCTION * =========================================================================== */#ifndef GUI_UTILS___LAYOUT_OBJ__HPP#define GUI_UTILS___LAYOUT_OBJ__HPP/*  $Id: layout.hpp,v 1000.0 2004/06/01 19:55:27 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:  Mike DiCuccio * * File Description: * */#include <corelib/ncbiobj.hpp>#include <gui/gui.hpp>#include <objects/seqloc/Seq_loc.hpp>/** @addtogroup GUI_UTILS * * @{ */BEGIN_NCBI_SCOPE//// class CLayoutObject defines an interface that wraps a rectilinear abstract// object.// // CLayoutObject defines how an axis-aligned rectilinear object appears to a// layout algorithm.  The basic concepts supported include://  -- querying rectilnear position or interval as a total range//  -- functors for sorting//  -- Draw() for rendering the object, once it is laid out//class NCBI_GUIOBJUTILS_EXPORT CLayoutObject : public CObject{public:    // type of layout objects currently supported    enum EType {        eAlign,        eAlignPairwise,        eAlignSmear,        eComment,        eFeat,        eFeatLabel,        eFeatPack,        eFeatProtProduct,        eGraph,        eHistogram,        eLabel,        eMatepair,        eSeqMap,        eSequence    };    virtual ~CLayoutObject();    // access the position of this object.    virtual const objects::CSeq_loc& GetLocation(void) const = 0;    // compare this object to another, based on position    virtual bool LessByPos (const CLayoutObject& obj) const = 0;    // compare this object to another, based on size    virtual bool LessBySize(const CLayoutObject& obj) const = 0;    // access our core component - we wrap an object(s) of some sort.    // This returns the object at a given sequence position; this is useful if    // the layout object wraps more than one object    virtual const CObject* GetObject(TSeqPos pos) const = 0;    // check if the wrapped object(s) is the one    virtual bool HasObject(const CObject* obj) const = 0;    // retrieve the type of this object    virtual EType GetType() const = 0;};inlinebool operator< (const CLayoutObject& o1, const CLayoutObject& o2){    return o1.LessByPos(o2);}//// basic sort by position function//struct SLayoutByPos{    bool operator() (const CRef<CLayoutObject>& ref_obj1,                     const CRef<CLayoutObject>& ref_obj2) const    {        return (ref_obj1->LessByPos(*ref_obj2));    }    bool operator() (const CLayoutObject& obj1,                     const CLayoutObject& obj2) const    {        return (obj1.LessByPos(obj2));    }};//// basic sort by size function//struct SLayoutBySize{    bool operator() (const CRef<CLayoutObject>& ref_obj1,                     const CRef<CLayoutObject>& ref_obj2) const    {        return (ref_obj1->LessBySize(*ref_obj2));    }    bool operator() (const CLayoutObject& obj1,                     const CLayoutObject& obj2) const    {        return (obj1.LessBySize(obj2));    }};//// class CLayout is a container of objects laid out in a series of rows or// tracks.  The meaning of each row is left to the user; it is possible, for// example, to create two layout objects and append the layout of one to// another.//class NCBI_GUIOBJUTILS_EXPORT CLayout : public CObject{public:    typedef vector< CRef<CLayoutObject> > TLayoutRow;    typedef vector<TLayoutRow>            TLayout;    // clear opur internal list of objects    void Clear(void);    // access the entire layout    const TLayout&  GetLayout(void) const;    TLayout&        SetLayout(void);    // access a row of the layout    const TLayoutRow& GetRow(size_t row) const;    TLayoutRow&       SetRow(size_t row);    // add a row to the layout    TLayoutRow& AddRow(void);    TLayoutRow& AddRow(const TLayoutRow& row);    // append an entire layout to this one    void Append(const CLayout& layout);private:    // our layout.  This is a nested container - a set of rows.    TLayout m_Layout;};//// class CLayoutEngine defines the abstract interface for a given alyout// algorithm.  This interface imposes little on the actual functioning of the// layout engine, beyond the fact that it takes a list of layout objects and// produced a layout.//class CLayoutEngine : public CObject{public:    typedef list< CRef<CLayoutObject> > TObjects;    // perform our layout functions    virtual void Layout(const TObjects& objects, CLayout& layout) = 0;};//// class C2DLayoutEngine defines the interface for a standard 2D layout engine.// This class can perform layout of a number of objects into a single panel f// multiple rows.//class NCBI_GUIOBJUTILS_EXPORT C2DLayoutEngine : public CLayoutEngine{public:    // access the minimum distance, in bases, that we permit between objects on    // a given row    TSeqPos GetMinDist(void) const;    void    SetMinDist(TSeqPos dist);    void Layout(const TObjects& objects, CLayout& layout);private:    // the minimum distance we permit two items to be within    TSeqPos m_MinDist;};inlineTSeqPos C2DLayoutEngine::GetMinDist(void) const{    return m_MinDist;}inlinevoid C2DLayoutEngine::SetMinDist(TSeqPos dist){    m_MinDist = dist;}END_NCBI_SCOPE/* @} *//* * =========================================================================== * $Log: layout.hpp,v $ * Revision 1000.0  2004/06/01 19:55:27  gouriano * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.3 * * Revision 1.3  2004/05/14 14:24:47  dicuccio * Added new pure virtual requirement on CLayoutObject(): GetType(), returns enum * defined in CLayoutObject * * Revision 1.2  2004/05/03 12:41:35  dicuccio * Fixed #includes and export specifiers * * Revision 1.1  2004/04/30 11:52:53  dicuccio * Split out from gui/utils * * Revision 1.10  2004/04/16 14:27:17  dicuccio * Added doxygen module tag * * Revision 1.9  2004/04/15 12:57:43  lebedev * Changed GetObject to return NULL or const pointer based on given position * * Revision 1.8  2004/03/11 17:20:43  dicuccio * Use gui/gui instead of gui/types * * Revision 1.7  2003/09/29 15:20:08  dicuccio * Deprecated gui/scope.hpp.  Merged gui/core/types.hpp into gui/types.hpp * * Revision 1.6  2003/08/22 15:57:11  dicuccio * Removed 'USING_SCOPE(objects)'.  Removed export specifier from inline structs * * Revision 1.5  2003/07/21 19:24:09  dicuccio * Changed storage mechanism: CLayoutObject::GetObject() is pure virtual.  Also, * CFeature now stores a CMappedFeat object instead of a CSeq_feat / CSeq_loc pair * * Revision 1.4  2003/07/11 12:40:01  dicuccio * Code clean-ups.  Fixed sorting of features to perform correct feature-order * sorting * * Revision 1.3  2003/07/11 11:47:20  dicuccio * Changed member variable binding form private to protected * * Revision 1.2  2003/06/11 13:49:08  dicuccio * Added export specifiers * * Revision 1.1  2003/06/09 19:31:56  dicuccio * Initial revision * * =========================================================================== */#endif  // GUI_UTILS___LAYOUT_OBJ__HPP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -