TimelineEncoding.h header
#include <ew/app/TimelineEncoding.h>
Namespace ew::app
TimelineEncoding struct
struct ew::app::TimelineEncoding
A two-channel (colour + shape) encoding of a set of events by a chosen dimension (TL-73 / TL-77): every event that shares a value is assigned the same (colour, shape) pair, and the matching legend (TL-74) names each. It is deliberately UI-free – the caller extracts each event's value from the codex and maps the returned slots to a concrete colour and marker shape – so the policy is tested here in pixels-free isolation, exactly as TimelineLayout is.
Members
std::vector<TimelineLegendEntry> ew::app::TimelineEncoding::legend
One entry per distinct non-empty value, in first-appearance order.
std::map<QString, TimelineEncodingSlot> ew::app::TimelineEncoding::keySlots
Each distinct non-empty value mapped to its channel slots. (Named keySlots, not "slots", which is a Qt macro.)
TimelineEncodingSlot ew::app::TimelineEncoding::slotForKey(const QString &key) const
The channel slots for key, or {-1, -1} when key is empty or was never encoded – the "unencoded" bucket the panel draws in the neutral/track colour with no marker.
bool ew::app::TimelineEncoding::isEmpty() const
Whether nothing was encoded, so there is no legend to show.
TimelineEncodingSlot struct
struct ew::app::TimelineEncodingSlot
The pair of channel slots a dimension value is assigned (TL-73 / TL-77): which colour it takes AND which marker shape. Two channels, not one, because colour alone stops disambiguating past the palette and fails outright for colour-blind readers – the panel maps each slot to a concrete colour and a concrete marker shape.
Members
int ew::app::TimelineEncodingSlot::colorSlot = -1
Index into the panel's colour palette, or -1 when the value is unencoded.
int ew::app::TimelineEncodingSlot::shapeSlot = -1
Index into the panel's shape set, or -1 when the value is unencoded.
bool operator==(const TimelineEncodingSlot &, const TimelineEncodingSlot &)=default
Compares both channel slots for equality.
TimelineLegendEntry struct
struct ew::app::TimelineLegendEntry
One row of the encoding legend: a distinct value in the chosen dimension and the channel slots assigned to it. The panel maps colorSlot to a colour and shapeSlot to a marker shape (this engine stays free of QColor and of any drawing).
Members
QString ew::app::TimelineLegendEntry::label
The dimension value shown to the reader (e.g. a character or location name).
int ew::app::TimelineLegendEntry::colorSlot = 0
The palette slot for this value; the panel turns it into a colour.
int ew::app::TimelineLegendEntry::shapeSlot = 0
The shape slot for this value; the panel turns it into a marker shape (TL-77).
Functions
TimelineEncoding ew::app::buildTimelineEncoding(const std::vector< QString > &keys, int colorCount, int shapeCount)
Builds the encoding over keys – one dimension value per event, in event order (the caller resolves each event's value: character, location, tag, status...). Each non-empty value not seen before is assigned the next ordinal, split across two channels: colour = ordinal % colorCount, shape = (ordinal / colorCount) % shapeCount. So the first colorCount values get distinct colours (shape 0); the value after that reuses colour 0 but advances to shape 1 – the (colour, shape) PAIR stays distinct for colorCount * shapeCount values before any pair repeats, which is what lets the timeline distinguish far more categories than colour alone can and stay legible for colour-blind readers (TL-77). An empty value is left unencoded. First-appearance ordering makes the result stable for a given event order. Both counts are floored at 1.