feature.cpp

来自「ncbi源码」· C++ 代码 · 共 212 行

CPP
212
字号
/* * =========================================================================== * PRODUCTION $Log: feature.cpp,v $ * PRODUCTION Revision 1000.0  2004/06/01 21:20:26  gouriano * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.2 * PRODUCTION * =========================================================================== *//*  $Id: feature.cpp,v 1000.0 2004/06/01 21:20:26 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: *    CLayoutFeat -- utility class to arrange CSeq_feat objects in hierarchical *                (tree) order. */#include <ncbi_pch.hpp>#include <gui/objutils/feature.hpp>#include <gui/objutils/utils.hpp>#include <algorithm>#include <objects/seqfeat/Seq_feat.hpp>#include <objects/seqfeat/SeqFeatData.hpp>#include <objects/seqloc/Seq_loc.hpp>#include <objects/seqloc/Seq_interval.hpp>#include <objmgr/util/sequence.hpp>#include <objmgr/util/feature.hpp>#include <serial/iterator.hpp>BEGIN_NCBI_SCOPEUSING_SCOPE(objects);//// simple functor for sorting CRange<> objects//template <class T>struct SRangeSorter{    bool operator() (const CRange<T>& r0, const CRange<T>& r1) const    {        if (r0.GetFrom() < r1.GetFrom()) {            return true;        }        if (r0.GetFrom() > r1.GetFrom()) {            return false;        }        if (r0.GetTo() < r1.GetTo()) {            return true;        }        return false;    }};//// CLayoutFeat::CLayoutFeat()//CLayoutFeat::CLayoutFeat(const CMappedFeat& f)    : m_Feature(f),      m_Parent(NULL){    m_HideLabel = false; // always show labels by default    // ...and we precompute the label for this feature    //feature::GetLabel(m_Feature.GetOriginalFeature(), &m_TextId, feature::eBoth);}// Access the sub-intervals in this featurevoid CLayoutFeat::x_CalcIntervals(void) const{    m_Intervals.clear();    CSeq_loc_CI iter(GetLocation());    for ( ;  iter;  ++iter) {        m_Intervals.push_back(iter.GetRange());    }}END_NCBI_SCOPE/* * =========================================================================== * $Log: feature.cpp,v $ * Revision 1000.0  2004/06/01 21:20:26  gouriano * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.2 * * Revision 1.2  2004/05/21 22:27:43  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.1  2004/04/30 11:48:15  dicuccio * Initial commit - split out from src/gui/utils * * Revision 1.17  2004/02/24 14:35:04  lebedev * Option to hide feature label added * * Revision 1.16  2003/08/22 15:48:12  dicuccio * Added 'USING_SCOPE(objects)' * * Revision 1.15  2003/08/18 14:47:08  dicuccio * Changed nales: CFeature -> CLayoutFeat; CAlignment -> CLayoutAlign; CGraph -> * CLayoutGraph; CProtProduct -> CLayoutProtProd. * * Revision 1.14  2003/07/21 19:35:21  dicuccio * Changed storage mechanism - CLayoutObject::GetObject() is now pure virtual. * Changed CFeature to wrap a CMappedFeat instead of a CSeq_feat / CSeq_loc pair * * Revision 1.13  2003/07/11 11:43:11  dicuccio * Fixed thinko in retrieving intervals - use the *real* location... * * Revision 1.12  2003/06/10 13:34:42  dicuccio * Reworked CFeature to inherit from CLayoutObject.  Removed lots of dead code * * Revision 1.11  2003/06/02 16:06:25  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/07 17:28:40  dicuccio * Removed operator<< for CFeature.  Added missing link to xobjutil * * Revision 1.9  2003/05/07 13:07:29  dicuccio * Code clean-up.  Removed dead functions. * * Revision 1.8  2003/05/07 12:33:38  dicuccio * Code clean-up.  Deprecated old feature matching code in favor of library * function * * Revision 1.7  2003/03/11 15:25:12  kuznets * iterate -> ITERATE * * Revision 1.6  2003/02/10 18:10:59  dicuccio * Fixed compilation errors relating to change in CFeat_CI API * * Revision 1.5  2003/01/15 21:15:03  dicuccio * Dropped private sort mechanism in favor of standard Seq-feat sort * * Revision 1.4  2003/01/13 13:10:11  dicuccio * Namespace clean-up.  Retired namespace gui -> converted all to namespace * ncbi.  Moved all FLUID-generated code into namespace ncbi. * * Revision 1.3  2002/12/11 19:08:53  dicuccio * Added member variables to handle selection a bit more intelligently. * * Revision 1.2  2002/12/06 14:08:18  dicuccio * Moved feature sorting predicates into feature.[h,c]pp * * Revision 1.1  2002/11/29 15:30:38  dicuccio * Initial revision - split out from gui/core/view/graphic * * Revision 1.5  2002/11/25 20:57:08  dicuccio * Minor formatting changes.  Changed resolver to resolve based on the top-level * seq-entry. * * Revision 1.4  2002/11/09 20:57:08  dicuccio * Performance improvements:  Implemented smarter widget update (use update * flags to specify update conditions); use a more intuitive (and flexible) * mechanism to obtain features from the object manager. * * Revision 1.3  2002/11/08 02:14:42  dicuccio * Minor code clean-ups (reformat text, eliminate dead variables, favor NCBI * macros) * * Revision 1.2  2002/11/07 18:48:39  dicuccio * Formatting changes: added early escapes for functions containing long if/else * clauses. * * Revision 1.1  2002/11/07 16:27:25  dicuccio * Initial revision * * =========================================================================== */

⌨️ 快捷键说明

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