A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
circular_layout.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_DRAWING_CIRCULAR_LAYOUT_H_
2 #define GENESIS_TREE_DRAWING_CIRCULAR_LAYOUT_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2017 Lucas Czech
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
37 
38 #include <string>
39 #include <vector>
40 
41 namespace genesis {
42 namespace tree {
43 
44 // =================================================================================================
45 // Circular Layout
46 // =================================================================================================
47 
48 class CircularLayout : public LayoutBase
49 {
50 public:
51 
52  // -------------------------------------------------------------
53  // Constructors and Rule of Five
54  // -------------------------------------------------------------
55 
56  CircularLayout() = default;
57  CircularLayout( Tree const& orig_tree, Type const drawing_type = Type::kPhylogram );
58 
59  virtual ~CircularLayout() = default;
60 
61  CircularLayout( CircularLayout const& ) = default;
62  CircularLayout( CircularLayout&& ) = default;
63 
64  CircularLayout& operator= ( CircularLayout const& ) = default;
66 
67  // -------------------------------------------------------------
68  // Options
69  // -------------------------------------------------------------
70 
71  CircularLayout& radius_scaler( double const value );
72  double radius_scaler() const;
73 
74  // -------------------------------------------------------------
75  // Virtual Functions
76  // -------------------------------------------------------------
77 
78 private:
79 
80  void init_tree_( Tree const& orig_tree ) override;
81 
82  utils::SvgDocument to_svg_document_() const override;
83 
84  // -------------------------------------------------------------
85  // Internal Functions
86  // -------------------------------------------------------------
87 
88 private:
89 
90  void init_nodes_( Tree const& orig_tree );
91  void init_edges_( Tree const& orig_tree );
92 
93  void set_node_a_();
94  void set_node_r_phylogram_();
95  void set_node_r_cladogram_();
96 
97  // -------------------------------------------------------------
98  // Data Members
99  // -------------------------------------------------------------
100 
101 private:
102 
103  double scaler_r_ = 10.0;
104 
105 };
106 
107 } // namespace tree
108 } // namespace genesis
109 
110 #endif // include guard
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:95
CircularLayout & operator=(CircularLayout const &)=default
virtual ~CircularLayout()=default