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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_PHY_TREE___PHYLO_TREE_LABEL__HPP
2 #define GUI_WIDGETS_PHY_TREE___PHYLO_TREE_LABEL__HPP
3 
4 /* $Id: phylo_tree_label.hpp 36053 2016-08-02 14:06:39Z 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: Vladimir Tereshkov
30  *
31  * File Description:
32  *
33  */
34 
35 #include <memory>
36 #include <gui/opengl.h>
37 #include <gui/opengl/glrect.hpp>
39 #include <gui/opengl/glpane.hpp>
44 
47 
48 
50 
52 {
53 public:
56  m_SL = src.m_SL;
57  m_Format = src.m_Format;
58  if (src.m_LabelFormat.get())
59  m_LabelFormat.reset(new CBioTreeFormatLabel(*src.m_LabelFormat.get()));
60  }
61 
63  {
64  m_SL = src.m_SL;
65  m_Format = src.m_Format;
66  if (src.m_LabelFormat.get())
67  m_LabelFormat.reset(new CBioTreeFormatLabel(*src.m_LabelFormat.get()));
68  else
69  m_LabelFormat.reset();
70  return *this;
71  }
72 
73  /// Get label rectangle
74  CVect2<float> GetNodeLabelOffset(const string& label,
75  CPhyloTreeNode* node,
76  IPhyloTreeLOD* lod,
77  CVect2<float>& pixel_offset) const;
78  /// Get label rectangle using the label_size parameter for width and height
79  /// instead of computing it (computing text width can be slow)
80  CVect2<float> GetNodeLabelOffset(const string& label,
81  CPhyloTreeNode* node,
82  IPhyloTreeLOD* lod,
83  const CVect2<float>& label_size,
84  CVect2<float>& pixel_offset) const;
85  TVPUnit GetMinVerticalSeparation() const;
86  bool IsVisible(IPhyloTreeLOD* lod) const;
87 
88  string GetLabelForNode(const CPhyloTree &tree, const CPhyloTreeNode &node, const string& format);
89  string GetToolTipForNode(const CPhyloTree &tree,
90  const CPhyloTreeNode &node,
91  const string &format,
92  const string &line_break);
93 
94  void SetLabelFormat(const string &fmt, const CPhyloTree *tree);
95  void SetScheme(CPhyloTreeScheme & sl, const CPhyloTree *tree);
96 
97  string GetLabel(const CPhyloTree &tree, const CPhyloTreeNode &node) const;
98 private:
99  // reference to style
101 
102  // label formatting string
103  string m_Format;
104 
105  // labels generation
106  string x_GenerateAutoLabel(const CPhyloTree &tree,
107  const CPhyloTreeNode &node,
109 
110  std::unique_ptr<CBioTreeFormatLabel> m_LabelFormat;
111 };
112 
114 
115 #endif // GUI_WIDGETS_PHY_TREE___PHYLO_TREE_LABEL__HPP
Things for representing and manipulating bio trees.
CRef< CPhyloTreeScheme > m_SL
std::unique_ptr< CBioTreeFormatLabel > m_LabelFormat
CPhyloTreeLabel & operator=(const CPhyloTreeLabel &src)
CPhyloTreeLabel(const CPhyloTreeLabel &src)
Tree subclass also has functions and data needed for rendering and selection.
Definition: phylo_tree.hpp:52
int TVPUnit
Definition: gltypes.hpp:47
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_PHYLO_TREE_EXPORT
Definition: gui_export.h:535
static const char label[]
static Format format
Definition: njn_ioutil.cpp:53
Standard mechanism to include OpenGL headers for all platforms.
Modified on Fri Jun 14 16:48:04 2024 by modify_doxy.py rev. 669887