feat_pack.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:3k
源码类别:

生物技术

开发平台:

C/C++

  1. /*
  2.  * ===========================================================================
  3.  * PRODUCTION $Log: feat_pack.cpp,v $
  4.  * PRODUCTION Revision 1000.0  2004/06/01 21:20:21  gouriano
  5.  * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.2
  6.  * PRODUCTION
  7.  * ===========================================================================
  8.  */
  9. /*  $Id: feat_pack.cpp,v 1000.0 2004/06/01 21:20:21 gouriano Exp $
  10.  * ===========================================================================
  11.  *
  12.  *                            PUBLIC DOMAIN NOTICE
  13.  *               National Center for Biotechnology Information
  14.  *
  15.  *  This software/database is a "United States Government Work" under the
  16.  *  terms of the United States Copyright Act.  It was written as part of
  17.  *  the author's official duties as a United States Government employee and
  18.  *  thus cannot be copyrighted.  This software/database is freely available
  19.  *  to the public for use. The National Library of Medicine and the U.S.
  20.  *  Government have not placed any restriction on its use or reproduction.
  21.  *
  22.  *  Although all reasonable efforts have been taken to ensure the accuracy
  23.  *  and reliability of the software and data, the NLM and the U.S.
  24.  *  Government do not and cannot warrant the performance or results that
  25.  *  may be obtained by using this software or data. The NLM and the U.S.
  26.  *  Government disclaim all warranties, express or implied, including
  27.  *  warranties of performance, merchantability or fitness for any particular
  28.  *  purpose.
  29.  *
  30.  *  Please cite the author in any work or product based on this material.
  31.  *
  32.  * ===========================================================================
  33.  *
  34.  * Authors:  Vlad Lebedev
  35.  *
  36.  * File Description:
  37.  *    CLayoutFeatPack -- utility class for having sets of features in graphical layouts. 
  38.  *     (multiple features on a single line). Different feature types is fine.
  39.  */
  40. #include <ncbi_pch.hpp>
  41. #include <gui/objutils/feat_pack.hpp>
  42. BEGIN_NCBI_SCOPE
  43. USING_SCOPE(objects);
  44. CLayoutFeatPack::CLayoutFeatPack(const CLayoutFeat::TFeatList& feats)
  45.     : m_Features(feats)
  46. {
  47.     // find out max range of all features
  48.     m_Location.Reset(new CSeq_loc());
  49.     TSeqPos from = INT_MAX;
  50.     TSeqPos to   = 0;
  51.     
  52.     ITERATE (CLayoutFeat::TFeatList, iter, feats) {
  53.         const CLayoutFeat& feat = **iter;
  54.         TSeqRange range = feat.GetMappedFeature().GetLocation().GetTotalRange();
  55.         from = min(from, range.GetFrom());
  56.         to   = max(to,   range.GetTo()  );
  57.     }
  58.     
  59.     m_Location->SetInt().SetFrom(from);
  60.     m_Location->SetInt().SetTo  (to  );
  61. }
  62. END_NCBI_SCOPE
  63. /*
  64.  * ===========================================================================
  65.  * $Log: feat_pack.cpp,v $
  66.  * Revision 1000.0  2004/06/01 21:20:21  gouriano
  67.  * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.2
  68.  *
  69.  * Revision 1.2  2004/05/21 22:27:43  gorelenk
  70.  * Added PCH ncbi_pch.hpp
  71.  *
  72.  * Revision 1.1  2004/04/30 11:48:15  dicuccio
  73.  * Initial commit - split out from src/gui/utils
  74.  *
  75.  * Revision 1.2  2004/03/11 17:49:40  dicuccio
  76.  * Use TSeqRange instead of TRange
  77.  *
  78.  * Revision 1.1  2004/02/24 14:37:41  lebedev
  79.  * Initial revision
  80.  *
  81.  * ===========================================================================
  82.  */