NCBI C++ ToolKit
bins_track.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_PACKAGES_SNP_BINS_TRACK__BINS_TRACK__HPP
2 #define GUI_PACKAGES_SNP_BINS_TRACK__BINS_TRACK__HPP
3 
4 /* $Id: bins_track.hpp 36620 2016-10-14 20:34:56Z katargir $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Melvin Quintos
30  *
31  * File Description:
32  * This file contains class declarations for CBinsTrack and CBinsTrackFactory
33  *
34  */
35 
36 #include <corelib/ncbiobj.hpp>
37 #include <gui/utils/extension.hpp>
41 
45 
46 
48 
49 ///////////////////////////////////////////////////////////////////////////////
50 // CBinsTrack
51 ///////////////////////////////////////////////////////////////////////////////
53  public CDataTrack
54 {
55  friend class CBinsTrackFactory;
56 
57 public:
58  CBinsTrack(CBinsDS* ds, CRenderingContext* r_cntx);
59  virtual ~CBinsTrack();
60 
61  /// @name CDataTrack reimplemented methods.
62  /// @{
64  virtual CConstRef<CSGGenBankDS> GetDataSource() const;
65  /// @}
66 
67  virtual void GetHTMLActiveAreas(TAreaVector* p_areas) const;
68  virtual CHTMLActiveArea* InitHTMLActiveArea(TAreaVector* p_areas) const;
69 
70  /// @name CLayoutTrack reimplemented methods.
71  /// @{
72  virtual const CTrackTypeInfo& GetTypeInfo() const;
73  virtual string GetFullTitle() const;
74  /// @}
75  void SetAnnot(const string& name);
76 
77  /// expose global configuration
78  ///
79  /// needed to get color scheme
81 
82 protected:
83  virtual void x_LoadSettings(const string& preset_style,
84  const TKeyValuePairs& settings);
85  virtual void x_OnIconClicked(TIconID id);
86 
87  /// @name CDataTrack pure virtual interfaces
88  /// @{
89  virtual void x_UpdateData();
90  virtual void x_OnJobCompleted(CAppJobNotification& notify);
91  /// @}
92 
93  void x_ProcessBinsJobResult(const SBinsJobResult& result);
94 
95 private:
96  /// @name prohibited copy constructor and assignment operator.
97  /// @{
100  /// @}
101 
102  bool x_IsOverviewMode() const;
103 
104 private:
105 
106  objects::NSnpBins::TBinType m_BinType;
107 
108  enum ELayout {
109  eLayout_Adaptive = 260, ///< All SNPs drawn in one line
110  eLayout_Density, ///< Always show density
111  eLayout_Features, ///< Show features whenever possible
112  eLayout_Labels ///< Show labels and cascade features (CLayeredLayoutPolicy)
113  };
114 
116 
118  objects::SAnnotSelector m_FeatSel;
119 
122  string m_AnnotName;
124 
126 
127 
128 };
129 
130 ///////////////////////////////////////////////////////////////////////////////
131 // CBinsTrackFactory
132 ///////////////////////////////////////////////////////////////////////////////
134  public CObject,
135  public ILayoutTrackFactory,
136  public ITrackConfigurable,
137  public IExtension
138 {
139 public:
141 
142  static const CTrackTypeInfo& GetTypeInfo()
143  { return CBinsTrack::m_TypeInfo; }
144 
145  /// @name ILayoutTrackFactory interface implementation
146  /// @{
147  virtual TTrackMap CreateTracks(
148  SConstScopedObject& object,
149  ISGDataSourceContext* ds_context,
150  CRenderingContext* r_cntx,
151  const SExtraParams& params = SExtraParams(),
152  const TAnnotMetaDataList& src_annots = TAnnotMetaDataList()) const;
153 
154  virtual void GetMatchedAnnots(
155  const TAnnotMetaDataList& src_annots,
156  const ILayoutTrackFactory::SExtraParams& params,
157  TAnnotNameTitleMap& out_annots) const;
158 
159  virtual bool UnderstandLevel() const
160  { return true; }
161 
162  virtual bool NeedBackgroundInit() const
163  { return true; }
164 
165  virtual const CTrackTypeInfo& GetThisTypeInfo() const
166  { return GetTypeInfo(); }
167  /// @}
168 
169  /// @name ITrackConfigurable reimplemented methods.
170  /// @{
172  GetSettings(const string& profile,
173  const TKeyValuePairs& settings,
174  const CTempTrackProxy* track_proxy) const;
175  /// @}
176 
177  /// @name IExtension interface implementation
178  /// @{
179  virtual string GetExtensionIdentifier() const;
180  virtual string GetExtensionLabel() const;
181  /// @}
182 };
183 
184 ///////////////////////////////////////////////////////////////////////////////
185 /// CBinsTrack inline methods
186 ///////////////////////////////////////////////////////////////////////////////
187 inline /*virtual*/
189 {
191 }
192 
193 inline /*virtual*/
195 {
197 }
198 
199 
201 
202 #endif // GUI_PACKAGES_SNP_BINS_TRACK__BINS_TRACK__HPP
CAppJobNotification Notification send by CAppJobEventTranslator.
static const CTrackTypeInfo & GetTypeInfo()
Definition: bins_track.hpp:142
virtual bool NeedBackgroundInit() const
Background track initialization.
Definition: bins_track.hpp:162
virtual bool UnderstandLevel() const
Have any concept of level.
Definition: bins_track.hpp:159
virtual const CTrackTypeInfo & GetThisTypeInfo() const
Definition: bins_track.hpp:165
CRef< CBinsDS > m_DS
Definition: bins_track.hpp:117
objects::SAnnotSelector m_FeatSel
Definition: bins_track.hpp:118
CConstRef< CSeqGraphicConfig > GetGlobalConfig() const
expose global configuration
Definition: bins_track.hpp:80
CBinsTrack(const CBinsTrack &)
SIconInfo m_IconLayout
Definition: bins_track.hpp:120
@ eLayout_Features
Show features whenever possible.
Definition: bins_track.hpp:111
@ eLayout_Density
Always show density.
Definition: bins_track.hpp:110
static CTrackTypeInfo m_TypeInfo
CBinsTrack.
Definition: bins_track.hpp:125
CBinsTrack & operator=(const CBinsTrack &)
string m_PreferredTitle
Definition: bins_track.hpp:123
CRef< SBinsJobResult > m_JobResult
Definition: bins_track.hpp:121
virtual CRef< CSGGenBankDS > GetDataSource()
CBinsTrack inline methods.
Definition: bins_track.hpp:188
string m_AnnotName
Definition: bins_track.hpp:122
objects::NSnpBins::TBinType m_BinType
Definition: bins_track.hpp:106
CConstRef –.
Definition: ncbiobj.hpp:1266
CDataTrack - a abstract base class for layout tracks which need to deal with background data retrieva...
Definition: data_track.hpp:55
virtual CRef< CSGGenBankDS > GetDataSource()=0
Method for accessing the data source.
virtual void x_UpdateData()=0
update track content.
virtual void x_OnJobCompleted(CAppJobNotification &notify)=0
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
virtual const CTrackTypeInfo & GetTypeInfo() const
virtual void x_LoadSettings(const string &preset_style, const TKeyValuePairs &settings)
load the track settings.
virtual void x_OnIconClicked(TIconID id)
Mouse left-click event handler on an icon.
CConstRef< CSeqGraphicConfig > x_GetGlobalConfig() const
Method for getting global configuration from rendering context.
virtual string GetFullTitle() const
get a more meaningful title.
virtual CHTMLActiveArea * InitHTMLActiveArea(TAreaVector *p_areas) const
Initialize the HTML active area for a track.
CObject –.
Definition: ncbiobj.hpp:180
CRef –.
Definition: ncbiobj.hpp:618
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
vector< CHTMLActiveArea > TAreaVector
Definition: seq_glyph.hpp:84
File Description:
CTrackTypeInfo - holds description of a layout track type.
IExtension IExtension interface represents an abstract pluggable component.
Definition: extension.hpp:57
ILayoutTrackFactory.
ISGDSManager is seqgraphic data source manage that serves as an data source context.
ITrackConfigurable interface for tracks that are configurable.
map< string, string > TKeyValuePairs
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIWIDGETS_SNP_EXPORT
Definition: gui_export.h:540
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
A help struct for storing information about a icon.
extra parameter for initializing a track.
SBinsJobResult.
Definition: bins_ds.hpp:108
else result
Definition: token2.c:20
Modified on Wed Dec 06 07:13:24 2023 by modify_doxy.py rev. 669887