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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_SEQ_GRAPHIC___SEGMENT_GLYPH__HPP
2 #define GUI_WIDGETS_SEQ_GRAPHIC___SEGMENT_GLYPH__HPP
3 
4 /* $Id: segment_glyph.hpp 35413 2016-05-04 17:51:26Z evgeniev $
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: Vlad Lebedev, Liangshou Wu, Victor Joukov
30  *
31  * File Description:
32  * CSegmentGlyph -- utility class to layout sequence segments and
33  * hold CSeq_id_Handle objects
34  */
35 
36 
37 #include <corelib/ncbiobj.hpp>
41 #include <gui/objutils/label.hpp>
42 
45 
46 
48 
50  public CSeqGlyph,
51  public IObjectBasedGlyph
52 {
53 public:
54  typedef vector< CRef<CSegmentGlyph> > TSeqMapList;
55 
56  /// @name ctors
57  /// @{
58  CSegmentGlyph(//objects::CScope& scope,
59  const objects::CSeq_id_Handle& component_id,
60  const TSeqRange& range,
61  const objects::CSeq_id_Handle& mapped_id,
62  const TSeqRange& mapped_range,
63  bool component_negative_strand,
64  TSeqPos length = 0);
65  /// @}
66 
67  /// @name CSeqGlyph virtual methods.
68  /// @{
69  virtual bool NeedTooltip(const TModelPoint& p, ITooltipFormatter& tt, string& t_title) const;
70  virtual void GetTooltip(const TModelPoint& p, ITooltipFormatter& tt, string& t_title) const;
71  virtual void GetHTMLActiveAreas(TAreaVector* p_areas) const;
72  virtual TSeqRange GetRange(void) const;
73  virtual void SetHideLabel(bool b);
74  virtual bool HasSideLabel() const;
75  virtual bool IsClickable() const;
76  /// @}
77 
78  /// @name IObjectBasedGlyph interface implement
79  /// @{
80  /// Access the remapped location.
81  const objects::CSeq_loc& GetLocation(void) const;
82  /// Access the data as a CObject.
83  virtual CConstRef<CObject> GetObject(TSeqPos pos) const;
84  virtual void GetObjects(vector<CConstRef<CObject> >& objs) const;
85  virtual bool HasObject(CConstRef<CObject> obj) const;
86  virtual string GetSignature() const;
87  virtual const TIntervals& GetIntervals(void) const;
88  /// @}
89 
91  TSeqPos GetComponentLength() const;
92  const set<TSeqRange>& GetComponentRanges() const;
93  const set<TSeqRange>& GetMappedRanges() const;
94 
95  void SetComponentRanges(const set<TSeqRange>& range);
96  void SetMappedRanges(const set<TSeqRange>& range);
97 
98  CSegmentConfig::TSegMapQuality GetSeqQuality() const;
99  void SetSeqQuality(CSegmentConfig::TSegMapQuality quality);
100 
101  void SetConfig(CRef<CSegmentConfig> config);
102 
103  void GetLabel(string& label, CLabel::ELabelType type) const;
104 
105 protected:
106  virtual void x_Draw() const;
107  virtual void x_UpdateBoundingBox();
108 
109 private:
110  bool x_ShowLabel() const;
111 
112 protected:
113  /// our mapped location
115 
116  /// the seq-id we cover. this is the component seq-id
117  objects::CSeq_id_Handle m_IdHandle;
118  /// range on component sequence
120  /// the seq-id we cover. this is the master seq-id
121  objects::CSeq_id_Handle m_MappedIdHandle;
122  /// range on master (mapped) sequence
125 
126  /// length of the component sequence, independent of the chunk we use
128 
129 
130 
131  /// the range on the component we represent
133 
134  /// the range on the main sequence we represent
136 
138 
139  /// intervals (like for features or alignments).
141 
142  /// rendering configuration for a segment.
144 
145  /// Force to hide label.
146  /// Flag to force hiding the label regardless of the settings
147  /// from CSegmentConfig
149 };
150 
151 
152 ///////////////////////////////////////////////////////////////////////////////
153 /// CSegmentGlyph inline methods
154 ///
155 inline
157 {
158  return m_IdHandle.GetSeqId();
159 }
160 
161 inline
163 {
164  return m_Length;
165 }
166 
167 inline
169 {
170  return m_SeqRanges;
171 }
172 
173 inline
175 {
176  return m_MappedSeqRanges;
177 }
178 
179 inline
181 {
182  m_SeqRanges = range;
183 }
184 
185 inline
187 {
189 }
190 
191 inline
193 {
194  return m_SegMapQuality;
195 }
196 
197 inline
199 {
200  m_SegMapQuality = quality;
201 }
202 
203 inline
205 {
206  m_Config = config;
207 }
208 
209 
211 
212 /* @} */
213 
214 #endif // GUI_WIDGETS_SEQ_GRAPHIC___SEGMENT_GLYPH__HPP
CSegmentConfig::TSegMapQuality GetSeqQuality() const
void SetConfig(CRef< CSegmentConfig > config)
bool m_HideLabel
Force to hide label.
void SetComponentRanges(const set< TSeqRange > &range)
const set< TSeqRange > & GetMappedRanges() const
void SetMappedRanges(const set< TSeqRange > &range)
CSegmentConfig::TSegMapQuality m_SegMapQuality
CConstRef< objects::CSeq_id > GetSeqID(void) const
CSegmentGlyph inline methods.
void SetSeqQuality(CSegmentConfig::TSegMapQuality quality)
TSeqRange m_MappedRange
range on master (mapped) sequence
objects::CSeq_id_Handle m_MappedIdHandle
the seq-id we cover. this is the master seq-id
TSeqRange m_ComponentRange
range on component sequence
TSeqPos GetComponentLength() const
objects::CSeq_id_Handle m_IdHandle
the seq-id we cover. this is the component seq-id
const set< TSeqRange > & GetComponentRanges() const
set< TSeqRange > m_MappedSeqRanges
the range on the main sequence we represent
set< TSeqRange > m_SeqRanges
the range on the component we represent
TIntervals m_Intervals
intervals (like for features or alignments).
CRef< objects::CSeq_loc > m_Location
our mapped location
vector< CRef< CSegmentGlyph > > TSeqMapList
TSeqPos m_Length
length of the component sequence, independent of the chunk we use
CConstRef< CSegmentConfig > m_Config
rendering configuration for a segment.
class CSeqGlyph defines an interface that wraps a rectilinear abstract object.
Definition: seq_glyph.hpp:82
virtual void SetHideLabel(bool)
Force to hide label.
Definition: seq_glyph.hpp:179
virtual bool IsClickable() const
Query if this glyph is clickable.
Definition: seq_glyph.hpp:195
virtual void x_Draw() const =0
The default renderer for this layout object.
virtual void GetTooltip(const TModelPoint &, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
Definition: seq_glyph.cpp:136
virtual bool NeedTooltip(const TModelPoint &, ITooltipFormatter &, string &) const
Check if need to show tooltip.
Definition: seq_glyph.cpp:130
virtual TSeqRange GetRange(void) const
get the total range of this object.
Definition: seq_glyph.hpp:513
virtual bool HasSideLabel() const
Query if there is label and label is on the side.
Definition: seq_glyph.hpp:187
virtual void GetHTMLActiveAreas(TAreaVector *) const
Get html active areas.
Definition: seq_glyph.hpp:148
virtual void x_UpdateBoundingBox()=0
Update the bounding box assuming children's sizes are fixed if any.
vector< CHTMLActiveArea > TAreaVector
Definition: seq_glyph.hpp:84
File Description:
virtual const TIntervals & GetIntervals(void) const =0
access sub-intervals (if any).
virtual CConstRef< CObject > GetObject(TSeqPos pos) const =0
access our core component - we wrap an object(s) of some sort.
virtual const objects::CSeq_loc & GetLocation(void) const =0
access the position of this object.
virtual string GetSignature() const =0
return signature for this glyph.
virtual bool HasObject(CConstRef< CObject > obj) const =0
check if the wrapped object(s) is the one.
vector< TSeqRange > TIntervals
primitive interface to arrange tabular data in the tooltips
Definition: tooltip.hpp:55
Definition: set.hpp:45
struct config config
bool GetSeqID(const CRef< CSeq_align > &seqAlign, CRef< CSeq_id > &SeqID, bool getSlave=true)
Definition: cuAlign.cpp:55
vector< CConstRef< CObject > > GetObjects(CSeq_entry_Handle seh, const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, CConstRef< objects::CSeq_submit > submit, CRef< CEditingActionConstraint > constraint, vector< CSeq_entry_Handle > *descr_context=nullptr)
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
ELabelType
Definition: label.hpp:60
string GetLabel(const CSeq_id &id)
#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_SEQGRAPHIC_EXPORT
Definition: gui_export.h:536
static const char label[]
range(_Ty, _Ty) -> range< _Ty >
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Definition: type.c:6
Modified on Fri Mar 01 10:05:48 2024 by modify_doxy.py rev. 669887