16#ifndef MiL_SVG_RENDER_STATE_H
17#define MiL_SVG_RENDER_STATE_H 1
61 inline constexpr select
64 using __utype =
typename std::underlying_type<select>::type;
65 __utype r =
static_cast<__utype
>(__a) &
static_cast<__utype
>(__b);
66 return static_cast<select>(r);
69 inline constexpr select
72 using __utype =
typename std::underlying_type<select>::type;
73 return select(
static_cast<__utype
>(__a) |
static_cast<__utype
>(__b));
76 inline constexpr select
79 using __utype =
typename std::underlying_type<select>::type;
80 return select(
static_cast<__utype
>(__a) ^
static_cast<__utype
>(__b));
83 inline constexpr select
86 using __utype =
typename std::underlying_type<select>::type;
87 return select(~
static_cast<__utype
>(__a));
92 {
return __a = __a | __b; }
96 {
return __a = __a & __b; }
100 {
return __a = __a ^ __b; }
143 using enum_map_type = std::map<scale, std::string>;
145 static enum_map_type enum_map;
146 if (enum_map.empty())
179 using __utype =
typename std::underlying_type<select>::type;
226 mangled +=
"visible-mode-";
227 mangled += std::to_string(vi);
235 mangled += k::hyphen;
238 mangled +=
"outline-mode-";
239 mangled += std::to_string(oi);
245 mangled += k::hyphen;
248 mangled +=
"opacity-";
250 const uint oi =
static_cast<uint>(o);
251 mangled += std::to_string(oi);
262 using colormap = std::unordered_map<string, color_qi>;
269 auto i =
klrs.find(s);
273 throw std::runtime_error(
"render_state::get_color " + s +
" not found");
302 const double angle = 0.0,
const double scale = 1.0)
331 cache.insert(std::make_pair(
id, state));
342 if (cache.count(
id) == 1)
344 auto iter = cache.find(
id);
350 if (cache.count(
"") == 1)
352 auto iter = cache.find(
"");
367 if (indx < values.size())
369 value = values[indx];
376 value = values[indx];
const select & operator^=(select &__a, select __b)
std::unordered_map< string, id_rstate > id_rstate_umap
const string to_string(const unit e)
constexpr select operator|(select __a, select __b)
void add_to_id_rstate_cache(const string id, const style styl, const select vis)
Add value to cache with base style of styl, colors klr, visibility vis.
const select & operator&=(select &__a, select __b)
@ telecom
telecom infrastructure
@ alt
alternate use specified in situ
@ legend
text and symbol legends
@ cartography
cartographic elements
@ satellite
megaconstellation satellite
@ raster
raster (pixel) elements
@ vector
svg path, circle, rectangle, etc.
@ tor
tor exit node infrastructure
@ blur
blur or gradient version of vector
@ echo
b & w outline version of vector
@ background
background elements
@ tooltip
tooltips meta layer
void clear_select(select &a, const select &b)
constexpr select operator^(select __a, select __b)
id_rstate_umap & get_id_rstate_cache()
color_rstate & get_render_state()
Global state.
constexpr select operator&(select __a, select __b)
void set_select(select &a, const select &b)
Forwarding functions.
const id_rstate traverse_states(const strings &values)
Roll through render states given in values squentially, index starts with zero.
void flip_select(select &a, const select &b)
const select & operator|=(select &__a, select __b)
constexpr select operator~(select __a)
std::vector< string > strings
const id_rstate get_id_rstate(const string id)
Given identifier/name/id, get corresponding id_rstate from cache.
collection_rstate(const collection_rstate &)=default
collection_rstate(const double o=0.10, const scale rscale=scale::medium)
Color quantified as integral RGB components in the range [0,255]. aka like Scalar in OpenCV.
Render settings for collections.
std::unordered_map< string, color_qi > colormap
color_qi get_color(const string &s) const
Named render state. Datum to take id string and tie it to visual representation.
id_rstate(const id_rstate &)=default
id_rstate & operator=(const id_rstate &)=default
id_rstate(const style s=dstyl, const string f="", const double angle=0.0, const double scale=1.0)
render_state_base(const select m=select::none)
bool is_visible(const select v) const
Datum consolidating style preferences.