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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_SEQ_GRAPHIC___GLYPH_CONTAINER_TRACK__HPP
2 #define GUI_WIDGETS_SEQ_GRAPHIC___GLYPH_CONTAINER_TRACK__HPP
3 
4 /* $Id: glyph_container_track.hpp 44204 2019-11-14 20:16:52Z filippov $
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  * Author: Liangshou Wu
30  *
31  */
32 
33  /**
34  * File Description:
35  */
36 
42 
43 
45 
46 ///////////////////////////////////////////////////////////////////////////////
47 /// CGlyphContainer - a glyph container in the form of layout track.
48 /// An object of CGlyphContainer, itself, is a layout track. It contains a
49 /// set of CSeqGlyphs. The track container is not resposible of creating
50 /// any contained glyphs. The purpose of CGlyphContainer to form a
51 /// group of glyphs to make them behave like a single track: movable,
52 /// collapsible, and closible.
53 
55 {
56 public:
57  typedef vector< CRef<CCommentGlyph> > TComments;
60 
62  virtual ~CGlyphContainer();
63 
64  /// @name CLayoutTrack interface implementation.
65  /// @{
66  //virtual void UpdateConfig();
67  /// @}
68 
69  /// @name CSeqGlyph interface implementation
70  /// @{
71  virtual CRef<CSeqGlyph> HitTest(const TModelPoint& p);
72  virtual bool HitTestHor(TSeqPos x, const CObject *obj);
73  virtual bool Intersects(const TModelRect& rect, TConstObjects& objs) const;
74  virtual void GetHTMLActiveAreas(TAreaVector* p_areas) const;
75  virtual void Update(bool layout_only);
76  virtual bool Accept(IGlyphVisitor* visitor);
77  /// @}
78 
79 
80 
81 
82  /// Append a layout object to the end.
83  void Add(CSeqGlyph* obj);
84  void SetObjects(const CLayoutGroup::TObjectList& objs);
85 
86  /// set comments.
87  /// @param comment_str is a string consisting of one or more
88  /// comments in the form of: comment1|pos1|comment2|pos2...
89  /// Each comment has to come with a position, and the comment
90  /// and position alternate in the comment_str separated by '|'.
91  virtual void SetComments(const string& comment_str);
92  /// set a list of 'object' need to be highlighted.
93  /// @param hl_str is a string consisting of one or more
94  /// labels (track-specific) representing objects
95  virtual void SetHighlights(const string& hl_str);
96 
97  void SetCommentGlyphs(const CSeqGlyph::TObjects& objs, CRef<CCommentConfig> config);
98  void ResetCommentGlyph() { m_Comments.clear(); }
99 
100  void SetLabelGlyphs(const CSeqGlyph::TObjects& objs, CRef<CCommentConfig> config);
101  void ResetLabelGlyph() { m_Labels.clear(); }
102 
103  const THighlights& GetHighlights() const;
104  const TKeyHighlights& GetHighlightsByKey() const;
105 
106  CLayoutGroup& SetGroup();
107  const CLayoutGroup& GetGroup() const;
108  CLayoutGroup::TObjectList& SetChildren();
109  const CLayoutGroup::TObjectList& GetChildren() const;
110 
111  bool Empty() const;
112 
113  /// Set policy on how to deploy the layout of its children.
114  void SetLayoutPolicy(ILayoutPolicy* policy);
115 
116  /// @name CLayoutTrack public methods.
117  /// @{
118  virtual const CTrackTypeInfo& GetTypeInfo() const;
119  /// @}
120 
121 protected:
122  virtual void x_UpdateBoundingBox();
123 
124  // Get message associated with contained histogram glyph (if any). This is a message
125  // that describes current configuration (linear, log etc) and does not overlap with
126  // m_Msg so we can't use that.
127  virtual string x_GetHistMsg() const;
128 
129  /// @name CLayoutTrack pure virtual method implementation.
130  /// @{
131  virtual void x_RenderContent() const;
132  virtual bool x_Empty() const;
133  virtual void x_ClearContent();
134  /// @}
135 
136 private:
137  /// prohibited copy constructor and assignment operator.
140 
141  void x_UpdateComments(TComments& comments);
142  void x_UpdateCommentTargetPos(TComments& comments);
143 
144 protected:
149 
150 private:
152  /// object labels shown at any arbitrary position.
153  /// Currently only used in Gene Model track.
158 };
159 
160 ///////////////////////////////////////////////////////////////////////////////
161 // CLayoutTrack inline method implmentation
162 ///////////////////////////////////////////////////////////////////////////////
163 inline
165 { m_Group.PushBack(obj); }
166 
167 inline
169 { m_Group.Set(objs); }
170 
171 inline
173 { return m_Highlights; }
174 
175 inline
177 {
178  return m_KeyHighlights;
179 }
180 
181 inline
183 { return m_Group; }
184 
185 inline
187 { return m_Group; }
188 
189 inline
191 { return m_Group.SetChildren(); }
192 
193 inline
195 { return m_Group.GetChildren(); }
196 
197 inline
199 { return x_Empty(); }
200 
201 inline
203 {
204  m_Group.SetLayoutPolicy(policy);
205 }
206 
208 
209 #endif // GUI_WIDGETS_SEQ_GRAPHIC___GLYPH_CONTAINER_TRACK__HPP
File Description:
virtual bool x_Empty() const
map< string, THighlights > TKeyHighlights
void Add(CSeqGlyph *obj)
Append a layout object to the end.
CGlyphContainer(const CGlyphContainer &)
prohibited copy constructor and assignment operator.
const TKeyHighlights & GetHighlightsByKey() const
CGlyphContainer & operator=(const CGlyphContainer &)
void SetObjects(const CLayoutGroup::TObjectList &objs)
const THighlights & GetHighlights() const
CLayoutGroup & SetGroup()
TKeyHighlights m_KeyHighlights
CRef< CInlineLayout > m_Inline
TComments m_Labels
object labels shown at any arbitrary position.
vector< CRef< CCommentGlyph > > TComments
const CLayoutGroup::TObjectList & GetChildren() const
const CLayoutGroup & GetGroup() const
CLayoutGroup::TObjectList & SetChildren()
static CTrackTypeInfo m_TypeInfo
CRef< CLayeredLayout > m_Layered
CRef< CSimpleLayout > m_Simple
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
CLayoutGroup is a container of CSeqGlyphs (layout objects).
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
void PushBack(CSeqGlyph *obj)
Append a layout object to the end.
TObjectList & SetChildren()
const TObjectList & GetChildren() const
CLayoutGroup inline methods.
void Set(const TObjectList &objs)
ILayoutPolicy::TObjectList TObjectList
File Description:
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
virtual void x_RenderContent() const =0
The content rendering must be implemented in the derived layout tracks.
virtual void SetComments(const string &)
set comments.
virtual string x_GetHistMsg() const
Histogram configuration (linear, log, etc) is also on the title bar but multiple track types can have...
virtual void x_ClearContent()
virtual bool x_Empty() const =0
virtual const CTrackTypeInfo & GetTypeInfo() const =0
virtual void SetHighlights(const string &)
CObject –.
Definition: ncbiobj.hpp:180
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
class CSeqGlyph defines an interface that wraps a rectilinear abstract object.
Definition: seq_glyph.hpp:82
virtual bool HitTestHor(TSeqPos x, const CObject *obj)
Definition: seq_glyph.cpp:115
virtual CRef< CSeqGlyph > HitTest(const TModelPoint &p)
Hit testing.
Definition: seq_glyph.cpp:106
virtual void Update(bool)
Update content and layout including the bounding box.
Definition: seq_glyph.cpp:86
virtual bool Accept(IGlyphVisitor *visitor)
Interface for accepting an IGlyphVisitor.
Definition: seq_glyph.hpp:519
virtual bool Intersects(const TModelRect &rect, TConstObjects &objs) const
Intersect testing.
Definition: seq_glyph.cpp:120
virtual void GetHTMLActiveAreas(TAreaVector *) const
Get html active areas.
Definition: seq_glyph.hpp:148
vector< CHTMLActiveArea > TAreaVector
Definition: seq_glyph.hpp:84
list< CRef< CSeqGlyph > > TObjects
Definition: seq_glyph.hpp:85
list< CConstRef< CSeqGlyph > > TConstObjects
Definition: seq_glyph.hpp:86
CTrackTypeInfo - holds description of a layout track type.
Visitor interface for applying any potential actions or algorithms.
Definition: seq_glyph.hpp:384
class ILayoutPolicy defines the abstract interface required for generating layout based on a set of g...
bool Empty(const CNcbiOstrstream &src)
Definition: fileutil.cpp:523
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#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
Modified on Fri Sep 20 14:57:49 2024 by modify_doxy.py rev. 669887