A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
layout_tree.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_DRAWING_LAYOUT_TREE_H_
2 #define GENESIS_TREE_DRAWING_LAYOUT_TREE_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2018 Lucas Czech and HITS gGmbH
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 
35 #include "genesis/tree/tree.hpp"
37 
38 #include <string>
39 #include <vector>
40 
41 namespace genesis {
42 namespace tree {
43 
44 // =================================================================================================
45 // Typedefs
46 // =================================================================================================
47 
52 
58 
64 
69 
70 // =================================================================================================
71 // Layout Tree Node Data
72 // =================================================================================================
73 
81 {
82  // -------------------------------------------------------------------
83  // Constructor and Rule of Five
84  // -------------------------------------------------------------------
85 
86 public:
87 
88  virtual ~LayoutNodeData() = default;
89 
90  // Move ctor and assignment.
91  LayoutNodeData( LayoutNodeData&& ) = delete;
93 
94 protected:
95 
96  LayoutNodeData() = default;
97 
98  // Copy ctor and assignment.
99  LayoutNodeData( LayoutNodeData const& ) = default;
100  LayoutNodeData& operator= ( LayoutNodeData const& ) = default;
101 
102 public:
103 
104  static std::unique_ptr< LayoutNodeData > create()
105  {
106  return std::unique_ptr< LayoutNodeData >( new LayoutNodeData() );
107  }
108 
109  virtual std::unique_ptr< BaseNodeData > recreate() const override
110  {
111  return std::unique_ptr< LayoutNodeData >( new LayoutNodeData() );
112  }
113 
114  virtual std::unique_ptr< BaseNodeData > clone() const override
115  {
116  return std::unique_ptr< LayoutNodeData >( new LayoutNodeData( *this ));
117  }
118 
119  // -----------------------------------------------------
120  // Data Members
121  // -----------------------------------------------------
122 
123 public:
124 
132  double distance = -1.0;
133 
144  double spreading = -1.0;
145 
146  int parent_index = -1;
147 
149 
150 };
151 
152 // =================================================================================================
153 // Layout Tree Edge Data
154 // =================================================================================================
155 
163 {
164  // -------------------------------------------------------------------
165  // Constructor and Rule of Five
166  // -------------------------------------------------------------------
167 
168 public:
169 
170  virtual ~LayoutEdgeData() = default;
171 
172  // Move ctor and assignment.
173  LayoutEdgeData( LayoutEdgeData&& ) = delete;
175 
176 protected:
177 
178  LayoutEdgeData() = default;
179 
180  // Copy ctor and assignment.
181  LayoutEdgeData( LayoutEdgeData const& ) = default;
182  LayoutEdgeData& operator= ( LayoutEdgeData const& ) = default;
183 
184 public:
185 
186  static std::unique_ptr< LayoutEdgeData > create()
187  {
188  return std::unique_ptr< LayoutEdgeData >( new LayoutEdgeData() );
189  }
190 
191  virtual std::unique_ptr< BaseEdgeData > recreate() const override
192  {
193  return std::unique_ptr< LayoutEdgeData >( new LayoutEdgeData() );
194  }
195 
196  virtual std::unique_ptr< BaseEdgeData > clone() const override
197  {
198  return std::unique_ptr< LayoutEdgeData >( new LayoutEdgeData( *this ));
199  }
200 
201  // -----------------------------------------------------
202  // Data Members
203  // -----------------------------------------------------
204 
205 public:
206 
209 
211 
212 };
213 
214 } // namespace tree
215 } // namespace genesis
216 
217 #endif // include guard
double distance
Distance of the node to the root.
virtual std::unique_ptr< BaseNodeData > clone() const override
Polymorphically copy an instance of this class. Use instead of copy constructor.
LayoutNodeData & operator=(LayoutNodeData &&)=delete
static std::unique_ptr< LayoutNodeData > create()
utils::SvgStroke distance_stroke
static std::unique_ptr< LayoutEdgeData > create()
Default class containing the commonly needed data for tree nodes.
virtual std::unique_ptr< BaseNodeData > recreate() const override
Polymorphically create a default-constructed instance of this class with the same derived type as it ...
Default class containing the commonly needed data for tree edges.
Data class for LayoutTreeEdges.
virtual ~LayoutNodeData()=default
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:95
utils::SvgStroke spreading_stroke
LayoutEdgeData & operator=(LayoutEdgeData &&)=delete
double spreading
Position of the node along the second axis.
Data class for LayoutTreeNodes.
Definition: layout_tree.hpp:80
Header of Tree class.
virtual std::unique_ptr< BaseEdgeData > recreate() const override
Polymorphically create a default-constructed instance of this class with the same derived type as it ...
virtual ~LayoutEdgeData()=default
virtual std::unique_ptr< BaseEdgeData > clone() const override
Polymorphically copy an instance of this class. Use instead of copy constructor.