feat_table.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: feat_table.hpp,v $
- * PRODUCTION Revision 1000.3 2004/06/01 21:00:34 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.25
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_CORE_VIEW_TABLE___FEAT_TABLE__HPP
- #define GUI_CORE_VIEW_TABLE___FEAT_TABLE__HPP
- /* $Id: feat_table.hpp,v 1000.3 2004/06/01 21:00:34 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:
- * CFeatTable -- extends CListPanel to provide feature-specific options.
- */
- #include <gui/types.hpp>
- #include <gui/widgets/fl/table_panel.hpp>
- #include <gui/objutils/filter.hpp>
- #include <objmgr/bioseq_handle.hpp>
- #include <objmgr/feat_ci.hpp>
- #include <vector>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- class CFeatTable : public CTablePanel<CMappedFeat>
- {
- public:
- // a list of the available column types we can show
- enum EColumns {
- eNone = -1,
- eTitle = 0,
- eType,
- eFrom,
- eTo,
- //eIntervals,
- eStrand,
- // this must be last!
- eMaxCols
- };
- enum EVisibleRangeMethod {
- eScrollTo,
- eEntirelyContained,
- eIntersection
- };
- CFeatTable(int x, int y, int w, int h, const char* label = NULL);
- virtual ~CFeatTable();
- // Update our data relative to a given bioseq
- void Update(const CBioseq_Handle& handle);
- // Set the item to be shown in a given column. If the indicated column
- // index is greater than the current number of columns, the index will be
- // expanded to fit.
- void SetColType(int col, EColumns type);
- // Access the filters active for this table
- const CFilterSet& GetFilters() const { return m_Filters; }
- CFilterSet& GetFilters() { return m_Filters; }
- // access our statistical info
- int GetTotalFeats(void) const { return m_TotalFeats; }
- int GetFilteredFeats(void) const { return m_FilteredFeats; }
- // set the visible range for the widget. this is merely a hint; the table
- // is free to ignore this
- void SetVisibleRange(const objects::CSeq_loc& loc);
- // clear all selections
- void ClearSelections(void);
- // select a given feature. This will not clear other selections.
- void SelectFeature(const CSeq_feat& feat);
- void SetVisibleRangeMethod(EVisibleRangeMethod method);
- EVisibleRangeMethod GetVisibleRangeMethod() const;
- private:
- // our set of filters
- CFilterSet m_Filters;
- // visible range
- TSeqRange m_VisibleRange;
- EVisibleRangeMethod m_VisibleRangeMethod;
- bool x_InVisibleRange(TSeqRange range);
- void x_ScrollToVisibleRange();
- void x_ScrollDownToVisibleRange();
- void x_ScrollUpToVisibleRange();
- // some statistics for our parent view
- int m_TotalFeats;
- int m_FilteredFeats;
- // we also maintain an inverse map from feature -> row for easy look-up
- typedef map<CConstRef<CSeq_feat>, int> TInvFeatMap;
- TInvFeatMap m_InvFeats;
- // FLTK overload: event handler
- int handle(int event);
- };
- inline
- void CFeatTable::SetVisibleRangeMethod(EVisibleRangeMethod method)
- {
- m_VisibleRangeMethod = method;
- }
- inline
- CFeatTable::EVisibleRangeMethod CFeatTable::GetVisibleRangeMethod() const
- {
- return m_VisibleRangeMethod;
- }
- END_NCBI_SCOPE
- #endif // GUI_CORE_VIEW_TABLE___FEAT_TABLE__HPP
- /*
- * ===========================================================================
- * $Log: feat_table.hpp,v $
- * Revision 1000.3 2004/06/01 21:00:34 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.25
- *
- * Revision 1.25 2004/05/03 13:31:11 dicuccio
- * gui/utils --> gui/objutils where needed
- *
- * Revision 1.24 2004/03/11 17:47:22 dicuccio
- * Use TSeqRange instead of TRange
- *
- * Revision 1.23 2004/01/06 20:16:19 dicuccio
- * Dropped intervals list (temporarily) - it crowds the view
- *
- * Revision 1.22 2003/12/30 15:03:55 dicuccio
- * Added ability to pass selections into feature table
- *
- * Revision 1.21 2003/12/22 19:32:23 dicuccio
- * Lots of code clean-up. Changed to match new APIs in IView. Added first pass
- * at processing selections (not entirely working)
- *
- * Revision 1.20 2003/12/22 18:15:07 friedman
- * Added various visible range methods and the selection of a method
- * through the preference menu selection and dialog.
- *
- * Revision 1.19 2003/12/09 15:51:27 dicuccio
- * Deprecated Fl_Toggle_Tree - replaced with Flu_Tree_Browser. Added CTreeBrowser
- * as a standard tree interface
- *
- * Revision 1.18 2003/11/19 20:45:28 friedman
- * Added handling a visible range change event
- *
- * Revision 1.17 2003/09/29 15:41:09 dicuccio
- * Deprecated gui/scope.hpp. Merged gui/core/types.hpp into gui/types.hpp. Made
- * all menu bars flat (used FL_FLAT_BOX)
- *
- * Revision 1.16 2003/09/04 14:54:23 dicuccio
- * Use IDocument instead of CDocument. Changed APIs to match changes in IView
- *
- * Revision 1.15 2003/07/31 17:04:34 dicuccio
- * Changed type stored by feature table view - use CMappedFeat instead of CFeature
- * (less memory consumption)
- *
- * Revision 1.14 2003/07/28 11:51:49 dicuccio
- * Rewrote CTablePanel<> to be more flexible and better contained. Added standard
- * multicolumn list dialog. Deprecated use of COutputDlg.
- *
- * Revision 1.13 2003/07/25 13:44:48 dicuccio
- * Replaced Flv_Table with Fl_Table
- *
- * Revision 1.12 2003/07/11 12:38:45 dicuccio
- * Altered feature table to use smarter feature retrieval
- *
- * Revision 1.11 2003/06/02 16:06:24 dicuccio
- * Rearranged src/objects/ subtree. This includes the following shifts:
- * - src/objects/asn2asn --> arc/app/asn2asn
- * - src/objects/testmedline --> src/objects/ncbimime/test
- * - src/objects/objmgr --> src/objmgr
- * - src/objects/util --> src/objmgr/util
- * - src/objects/alnmgr --> src/objtools/alnmgr
- * - src/objects/flat --> src/objtools/flat
- * - src/objects/validator --> src/objtools/validator
- * - src/objects/cddalignview --> src/objtools/cddalignview
- * In addition, libseq now includes six of the objects/seq... libs, and libmmdb
- * replaces the three libmmdb? libs.
- *
- * Revision 1.10 2003/05/16 18:50:34 dicuccio
- * Added smarter retrieval of features
- *
- * Revision 1.9 2003/03/03 14:58:56 dicuccio
- * Changed to use visible range from the base class. Added an explicit setter for
- * the visible range
- *
- * Revision 1.8 2003/02/20 19:50:00 dicuccio
- * Created new plugin architecture, based on ASN.1 spec. Moved GBENCH frameowrk
- * over to use new plugin architecture.
- *
- * Revision 1.7 2003/01/13 13:10:09 dicuccio
- * Namespace clean-up. Retired namespace gui -> converted all to namespace ncbi.
- * Moved all FLUID-generated code into namespace ncbi.
- *
- * Revision 1.6 2003/01/09 14:50:42 dicuccio
- * Use 'const CBioseq_Handle&' instead of 'CBioseq_Handle&'
- *
- * Revision 1.5 2003/01/08 15:33:33 dicuccio
- * Fixed compilation error in MSVC
- *
- * Revision 1.4 2003/01/08 14:58:47 dicuccio
- * Major overhaul. Added column selection dialog to base class - moved out of
- * this class. Added ability to sort columns based on menu selections. Added
- * ability to filter features based on a wide range of criteria.
- *
- * Revision 1.3 2003/01/03 17:27:44 dicuccio
- * Added ability to select columns for viewing and sorting
- *
- * Revision 1.2 2002/12/30 20:51:10 dicuccio
- * WTweaks for compiling on Windows
- *
- * Revision 1.1 2002/12/30 18:49:41 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */