A library for working with phylogenetic and population genetic data.
v0.27.0
color_writer_plugin.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_TREE_FORMATS_COLOR_WRITER_PLUGIN_H_
2 #define GENESIS_TREE_FORMATS_COLOR_WRITER_PLUGIN_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2019 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 
36 
37 #include <vector>
38 
39 namespace genesis {
40 namespace tree {
41 
42 // =================================================================================================
43 // Color Writer Plugin Base
44 // =================================================================================================
45 
82 {
83  // -------------------------------------------------------------------------
84  // Base Class
85  // -------------------------------------------------------------------------
86 
87 public:
88 
89  virtual ~ColorWriterPlugin() = default;
90 
91  // -------------------------------------------------------------------------
92  // Properties
93  // -------------------------------------------------------------------------
94 
95 public:
96 
107  void edge_colors( std::vector<utils::Color> const& color_vector )
108  {
109  edge_colors_ = color_vector;
110  }
111 
115  std::vector<utils::Color> const& edge_colors() const
116  {
117  return edge_colors_;
118  }
119 
123  void enable_color( bool value )
124  {
125  enable_color_ = value;
126  }
127 
131  bool enable_color() const
132  {
133  return enable_color_;
134  }
135 
147  {
148  ignored_color_ = value;
149  use_ignored_color_ = true;
150  }
151 
156  {
157  return ignored_color_;
158  }
159 
166  void use_ignored_color( bool value )
167  {
168  use_ignored_color_ = value;
169  }
170 
174  bool use_ignored_color() const
175  {
176  return use_ignored_color_;
177  }
178 
179  // -------------------------------------------------------------------------
180  // Data Members
181  // -------------------------------------------------------------------------
182 
183 private:
184 
185  std::vector<utils::Color> edge_colors_;
186  bool enable_color_ = true;
187  utils::Color ignored_color_ = utils::Color(0, 0, 0);
188  bool use_ignored_color_ = false;
189 
190 };
191 
192 } // namespace tree
193 } // namespace genesis
194 
195 #endif // include guard
genesis::utils::Color
Definition: color.hpp:47
genesis::tree::ColorWriterPlugin::ignored_color
void ignored_color(utils::Color value)
Set a color that is used as marker for partially disabling the output of color tags.
Definition: color_writer_plugin.hpp:146
genesis::tree::ColorWriterPlugin::edge_colors
void edge_colors(std::vector< utils::Color > const &color_vector)
Set the edge colors that shall be written to the output.
Definition: color_writer_plugin.hpp:107
genesis::tree::ColorWriterPlugin::ignored_color
utils::Color ignored_color() const
Return the currently set ignored color. See the setter for more information.
Definition: color_writer_plugin.hpp:155
genesis::tree::ColorWriterPlugin::~ColorWriterPlugin
virtual ~ColorWriterPlugin()=default
genesis::tree::ColorWriterPlugin::use_ignored_color
void use_ignored_color(bool value)
Set whether to use the ignored_color().
Definition: color_writer_plugin.hpp:166
genesis::tree::ColorWriterPlugin::enable_color
bool enable_color() const
Returns whether colors tags are written to the output.
Definition: color_writer_plugin.hpp:131
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42
functions.hpp
Color operators and functions.
color.hpp
Header of Color class.
genesis::tree::ColorWriterPlugin::use_ignored_color
bool use_ignored_color() const
Return whether currently an ignored color is used.
Definition: color_writer_plugin.hpp:174
genesis::tree::ColorWriterPlugin::enable_color
void enable_color(bool value)
Set whether colors tags are written to the output.
Definition: color_writer_plugin.hpp:123
genesis::tree::ColorWriterPlugin
Base class for creating plugin classes that allow coloring of Tree edges.
Definition: color_writer_plugin.hpp:81
genesis::tree::ColorWriterPlugin::edge_colors
std::vector< utils::Color > const & edge_colors() const
Return the edge colors that are currently set.
Definition: color_writer_plugin.hpp:115