|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
50 if( offset < 0.0 || offset > 1.0 ) {
51 throw std::invalid_argument(
52 "Invalid Svg Gradient Stop offset. Has to be in range [ 0.0, 1.0 ], but is " +
84 throw std::invalid_argument(
85 "Invalid Svg Linar Gradient point. All coordinates of the points need to be in "
91 if(
stops.size() < 2 ) {
92 throw std::invalid_argument(
93 "Svg Linar Gradient range needs to contain at least two colors."
96 if(
stops.begin()->offset != 0.0 ) {
97 throw std::invalid_argument(
98 "Svg Linar Gradient range needs to start with key value 0.0."
101 if(
stops.rbegin()->offset != 1.0 ) {
102 throw std::invalid_argument(
103 "Svg Linar Gradient range needs to end with key value 1.0."
108 auto const sorted = std::is_sorted(
111 return lhs.offset < rhs.offset;
115 throw std::invalid_argument(
116 "Svg Linar Gradient range needs to be sorted by offset."
124 if(
stops.empty() ) {
131 out <<
"<linearGradient";
160 for(
auto const& stop :
stops ) {
166 out <<
"</linearGradient>\n";
173 for(
auto const& stop : ranges ) {
174 stops.emplace_back( stop.first, stop.second );
188 return stops.empty();
Provides some valuable algorithms that are not part of the C++ 11 STL.
std::string indent(std::string const &text, std::string const &indentation)
Indent each line of text with indentation and return the result.
std::vector< SvgGradientStop > stops
std::string to_string(GenomeLocus const &locus)
static std::string indentation_string
SvgGradientLinear & add_stop(SvgGradientStop const &stop)
Provides some commonly used string utility functions.
SpreadMethod spread_method
bool operator<(self_type const &rhs) const
void write(std::ostream &out, size_t indent=0) const
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Color operators and functions.
std::string svg_attribute(std::string const &name, T const &value, std::string const &unit="")
std::string repeat(std::string const &word, size_t times)
Take a string and repeat it a given number of times.
SvgGradientLinear & set_stops(std::map< double, Color > const &ranges)
void write(std::ostream &out) const
std::string color_to_hex(Color const &c, std::string const &prefix, bool uppercase, bool with_alpha)
Return a hex string representation of a Color in the format "#003366[ff]".
std::vector< T >::iterator insert_sorted(std::vector< T > &vec, T const &item)
Insert into a vector vec, sorted by the value of the item. The vector must already be sorted.