#include <genesis/tree/formats/color_writer_plugin.hpp>
Inherited by NewickColorWriterPlugin, and PhyloxmlColorWriterPlugin.
Base class for creating plugin classes that allow coloring of Tree edges.
The effect of this class on the Tree output is that (if enabled) a color tag will be added to each edge.
There are two ways this plugin can be used:
edge_color_vector()
to set a vector of colors for each edge before calling the actual writing function. This can be done by client code that needs a particular coloring of the edges, but can also be used by superclasses to set all edge colors at once.set_color()
in the superclass to set the color of individual edges. This is helpful within the edge_to_element()
function of the superclass. This function is however not implemented in this base class, as it needs knowledge of the actual type of Tree output to work. Thus, this is a function that the plugin classes should provide.If neither of this is done, no color tags will be written. Color tags can also be deactivated by client code using the enable_color()
option.
Furthermore, with the ignored_color option, by default, all edged that are colored black (Color(0, 0, 0)
) are ignored in the output, i.e., they produce no color tag. See ignored_color to set the value to a different color.
For the root node, there is no color tag written, for those reasons:
This class is intended to be used as base for plugin classes that do actual tree output.
Definition at line 81 of file color_writer_plugin.hpp.
Public Member Functions | |
virtual | ~ColorWriterPlugin ()=default |
std::vector< utils::Color > const & | edge_colors () const |
Return the edge colors that are currently set. More... | |
void | edge_colors (std::vector< utils::Color > const &color_vector) |
Set the edge colors that shall be written to the output. More... | |
bool | enable_color () const |
Returns whether colors tags are written to the output. More... | |
void | enable_color (bool value) |
Set whether colors tags are written to the output. More... | |
utils::Color | ignored_color () const |
Return the currently set ignored color. See the setter for more information. More... | |
void | ignored_color (utils::Color value) |
Set a color that is used as marker for partially disabling the output of color tags. More... | |
bool | use_ignored_color () const |
Return whether currently an ignored color is used. More... | |
void | use_ignored_color (bool value) |
Set whether to use the ignored_color(). More... | |
|
virtualdefault |
|
inline |
Return the edge colors that are currently set.
Definition at line 115 of file color_writer_plugin.hpp.
|
inline |
Set the edge colors that shall be written to the output.
If this function is called with a vector of size > 0, the edges in the output will be colored according to the values given as a parameter. The vector then needs to contain as many elements as the tree has edges. The elements need to be indexed using the edge.index() value.
If this function is called with an empty vector, the color printing is reset to not print the edge colors that might have been set before.
Definition at line 107 of file color_writer_plugin.hpp.
|
inline |
Returns whether colors tags are written to the output.
Definition at line 131 of file color_writer_plugin.hpp.
|
inline |
Set whether colors tags are written to the output.
Definition at line 123 of file color_writer_plugin.hpp.
|
inline |
Return the currently set ignored color. See the setter for more information.
Definition at line 155 of file color_writer_plugin.hpp.
|
inline |
Set a color that is used as marker for partially disabling the output of color tags.
All edges that have set a color equal to the ignored color will produce no color tag output. This is thus something like magic pink, where all parts of an image are rendered transparent when originially colored in pink.
By default, we do not use an ignored color. If this function is called (which sets a color), also use_ignored_color() is set to true
, so that the color is actually used.
Definition at line 146 of file color_writer_plugin.hpp.
|
inline |
Return whether currently an ignored color is used.
Definition at line 174 of file color_writer_plugin.hpp.
|
inline |
Set whether to use the ignored_color().
If this option is set to true
, the color that is set via ignored_color() is not written as a color attribute to the output format.
Definition at line 166 of file color_writer_plugin.hpp.