A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rectangular_layout.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_DRAWING_RECTANGULAR_LAYOUT_H_
2 #define GENESIS_TREE_DRAWING_RECTANGULAR_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 // Rectangular Layout
46 // =================================================================================================
47 
49 {
50 public:
51 
52  // -------------------------------------------------------------
53  // Constructors and Rule of Five
54  // -------------------------------------------------------------
55 
56  RectangularLayout() = default;
57  RectangularLayout( Tree const& orig_tree, Type const drawing_type = Type::kPhylogram );
58 
59  virtual ~RectangularLayout() = default;
60 
61  RectangularLayout( RectangularLayout const& ) = default;
62  RectangularLayout( RectangularLayout&& ) = default;
63 
64  RectangularLayout& operator= ( RectangularLayout const& ) = default;
66 
67  // -------------------------------------------------------------
68  // Options
69  // -------------------------------------------------------------
70 
71  RectangularLayout& scaler_x( double const sx );
72  double scaler_x() const;
73 
74  RectangularLayout& scaler_y( double const sy );
75  double scaler_y() const;
76 
77  // -------------------------------------------------------------
78  // Virtual Functions
79  // -------------------------------------------------------------
80 
81 private:
82 
83  void init_tree_( Tree const& orig_tree ) override;
84 
85  utils::SvgDocument to_svg_document_() const override;
86 
87  // -------------------------------------------------------------
88  // Internal Functions
89  // -------------------------------------------------------------
90 
91 private:
92 
93  void init_nodes_( Tree const& orig_tree );
94  void init_edges_( Tree const& orig_tree );
95 
96  void set_node_y_();
97  void set_node_x_phylogram_();
98  void set_node_x_cladogram_();
99 
100  // -------------------------------------------------------------
101  // Data Members
102  // -------------------------------------------------------------
103 
104 private:
105 
106  double scaler_x_ = 100.0;
107  double scaler_y_ = 10.0;
108 
109 };
110 
111 } // namespace tree
112 } // namespace genesis
113 
114 #endif // include guard
RectangularLayout & operator=(RectangularLayout const &)=default
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:95
virtual ~RectangularLayout()=default