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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_SEQ_GRAPHIC___CLONE_PLACEMENT_GLYPH__HPP
2 #define GUI_WIDGETS_SEQ_GRAPHIC___CLONE_PLACEMENT_GLYPH__HPP
3 
4 /* $Id: clone_placement_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: Liangshou Wu
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbiobj.hpp>
36 #include <gui/gui.hpp>
37 #include <objmgr/feat_ci.hpp>
38 
39 #include <gui/objutils/label.hpp>
43 
44 #include <list>
45 #include <set>
46 #include <vector>
47 
48 
50 
51 ///////////////////////////////////////////////////////////////////////////////
52 /// CClonePlacementGlyph is similar to CFeatureGlyph, but with different
53 /// rendering style and settings.
54 ///
55 
57  public CSeqGlyph,
58  public IObjectBasedGlyph
59 {
60 public:
61  enum EConcordancy {
64  eCCNotSet
65  };
66 
67  enum EUniqueness {
71  eUniqueNotSet
72  };
73 
74  // Support type for all non-prototype Clone-seqs.
75  enum ESupportType {
76  eNoNonprototypeEnd = 0x0,
77  eSupporting = 0x1,
78  eNonsupporting = 0x2,
79  eMixed = 0x3,
80 
81  };
82 
83  enum EEndStrand {
86  eStrandNotSet
87  };
88 
89  struct SCloneEnd
90  {
92  : m_Uniqueness(eUniqueNotSet)
93  , m_Strand(eStrandNotSet)
94  {}
95 
99  };
100 
101  typedef vector<SCloneEnd> TCloneEnds;
102 
103  /// @name ctors.
104  /// @{
105  CClonePlacementGlyph(const objects::CMappedFeat& feat);
106  CClonePlacementGlyph(const objects::CMappedFeat& feat, const objects::CSeq_loc& loc);
107  /// @}
108 
109  /// @name CSeqGlyph virtual method implementation.
110  /// @{
111  virtual bool NeedTooltip(const TModelPoint& p, ITooltipFormatter& tt, string& t_title) const;
112  virtual void GetTooltip(const TModelPoint& p, ITooltipFormatter& tt, string& t_title) const;
113  virtual void GetHTMLActiveAreas(TAreaVector* p_areas) const;
114  virtual TSeqRange GetRange(void) const;
115  virtual bool IsClickable() const;
116  virtual void SetHideLabel(bool b);
117  virtual bool HasSideLabel() const;
118  /// @}
119 
120  /// @name IObjectBasedGlyph interface implement
121  /// @{
122  /// Access the feature's remapped location.
123  virtual const objects::CSeq_loc& GetLocation(void) const;
124  /// Retrieve the feature as an object.
125  /// For safety's sake, this returns the remapped feature.
126  virtual CConstRef<CObject> GetObject(TSeqPos pos) const;
127  virtual void GetObjects(vector<CConstRef<CObject> >& objs) const;
128  virtual bool HasObject(CConstRef<CObject> obj) const;
129  virtual string GetSignature() const;
130  virtual const TIntervals& GetIntervals(void) const;
131  /// @}
132 
133  TIntervals& SetIntervals();
134 
135  /// Access the original feature.
136  /// The location on this feature may not be correct, as it hasn't
137  /// been remapped
138  const objects::CSeq_feat& GetFeature(void) const;
139 
140  /// Access a new, fully remapped feature.
141  /// This is useful for passing exact features to plugins
142  const objects::CMappedFeat& GetMappedFeature(void) const;
143 
144  CConstRef<CClonePlacementParams> GetConfig() const;
145  void SetConfig(CConstRef<CClonePlacementParams> conf);
146 
147  string GetLabel() const;
148 
149 protected:
151  typedef vector<string> TStrVector;
152 
153  virtual void x_Draw() const;
154  virtual void x_UpdateBoundingBox();
155 
156  void x_SetPolygonStipple(EUniqueness uniqueness) const;
157  ESupportType x_GetSupportTypeForNonPrototypeEnds() const;
158  bool x_MatchIds(const TStrSet &supportingIds, const TStrVector &nonSupportingIds) const;
159 
160 private:
161  bool x_ShowLabel() const;
162  TSeqRange x_GetTotalRange() const;
163  void x_GetCloneEnds(TCloneEnds& clone_ends, TCloneEnds& prototype_ends) const;
164  void x_GetBarSize(TModelUnit& bar_h, TModelUnit& head_h) const;
165 
166 protected:
167  /// we store a mapped feature object which in turn holds the
168  /// original feature.
169  objects::CMappedFeat m_Feature;
170 
171  /// Mapped location in top sequence coordinate.
172  /// Not necessarily the sequence that this feature annoated on.
173  /// For example, the features associated with an aligned sequence need
174  /// to be mapped onto the top sequence to show them in proper positions.
176 
177  /// intervals (like for features or alignments).
179 
180  /// Force to hide the label.
181  /// There is another setting related to showing label in CFeatParams.
182  /// That is global for configuring feature subtype. But m_HideLabel
183  /// is for configureing a single feature glyph. The consquence is
184  /// that we can show labels for all feautres (with a given feature
185  /// subtype) other than those with m_HideLabel set to true.
187 
188  /// All the configs needed for rendering a feature.
190 };
191 
192 
193 ///////////////////////////////////////////////////////////////////////////////
194 /// CClonePlacementGlyph inline implementations
195 ///
196 inline
198 {
199  return m_Intervals;
200 }
201 
202 inline
203 const objects::CSeq_feat& CClonePlacementGlyph::GetFeature(void) const
204 {
205  return m_Feature.GetOriginalFeature();
206 }
207 
208 inline
209 const objects::CMappedFeat& CClonePlacementGlyph::GetMappedFeature(void) const
210 {
211  return m_Feature;
212 }
213 
214 inline
216 {
217  return m_Config;
218 }
219 
220 inline
222 {
223  m_Config = conf;
224 }
225 
226 
228 
229 /* @} */
230 
231 #endif // GUI_WIDGETS_SEQ_GRAPHIC___CLONE_PLACEMENT_GLYPH__HPP
CClonePlacementGlyph is similar to CFeatureGlyph, but with different rendering style and settings.
CClonePlacementGlyph(const objects::CMappedFeat &feat)
CConstRef< CClonePlacementParams > m_Config
All the configs needed for rendering a feature.
CClonePlacementGlyph(const objects::CMappedFeat &feat, const objects::CSeq_loc &loc)
void SetConfig(CConstRef< CClonePlacementParams > conf)
TIntervals & SetIntervals()
CClonePlacementGlyph inline implementations.
const objects::CSeq_feat & GetFeature(void) const
Access the original feature.
objects::CMappedFeat m_Feature
we store a mapped feature object which in turn holds the original feature.
CConstRef< objects::CSeq_loc > m_Location
Mapped location in top sequence coordinate.
const objects::CMappedFeat & GetMappedFeature(void) const
Access a new, fully remapped feature.
CConstRef< CClonePlacementParams > GetConfig() const
bool m_HideLabel
Force to hide the label.
vector< SCloneEnd > TCloneEnds
TIntervals m_Intervals
intervals (like for features or alignments).
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
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
GLdouble TModelUnit
Definition: gltypes.hpp:48
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
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Wed May 15 15:06:25 2024 by modify_doxy.py rev. 669887