1 #ifndef GENESIS_TREE_FORMATS_PHYLOXML_COLOR_WRITER_PLUGIN_H_ 2 #define GENESIS_TREE_FORMATS_PHYLOXML_COLOR_WRITER_PLUGIN_H_ 100 throw std::length_error(
101 "Color vector does not have as many elements as the tree has edges." 139 void set_color_(
utils::XmlElement& element,
unsigned char r,
unsigned char g,
unsigned char b )
const 149 auto re = utils::make_unique< utils::XmlElement >(
"red");
152 auto ge = utils::make_unique< utils::XmlElement >(
"green");
155 auto be = utils::make_unique< utils::XmlElement >(
"blue");
158 auto color = utils::make_unique< utils::XmlElement >(
"color");
159 color->content.push_back(std::move(re));
160 color->content.push_back(std::move(ge));
161 color->content.push_back(std::move(be));
163 element.
content.push_back(std::move(color));
176 #endif // include guard
std::vector< utils::Color > const & edge_colors() const
Return the edge colors that are currently set.
PhyloxmlColorWriterPlugin()=default
Plugin class for PhyloXML output that allows coloring of edges.
Write a Tree to Phyloxml format.
void edge_to_element(TreeEdge const &edge, utils::XmlElement &element) const
size_t edge_count() const
Return the number of TreeEdges of the Tree.
size_t index() const
Return the index of this Edge.
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
void register_with(PhyloxmlWriter &writer) const
bool use_ignored_color() const
Return whether currently an ignored color is used.
std::vector< prepare_writing_function > prepare_writing_plugins
Collect all functions to be called before starting the actual tree writing.
Class for representing phylogenetic trees.
void prepare_writing(Tree const &tree, utils::XmlDocument &xml) const
Base class for creating plugin classes that allow coloring of Tree edges.
virtual ~PhyloxmlColorWriterPlugin()=default
unsigned char b_byte() const
A collection of classes for working with XML documents. See XmlDocument for more. ...
PhyloxmlColorWriterPlugin & operator=(PhyloxmlColorWriterPlugin const &)=default
utils::Color ignored_color() const
Return the currently set ignored color. See the setter for more information.
std::vector< std::unique_ptr< XmlValue > > content
unsigned char r_byte() const
std::shared_ptr< BaseOutputTarget > to_string(std::string &target_string)
Obtain an output target for writing to a string.
bool enable_color() const
Returns whether colors tags are written to the output.
unsigned char g_byte() const
std::vector< edge_to_element_function > edge_to_element_plugins
Collect all functions to be called for each TreeEdge in order to translate it to a Phyloxml represent...