Module Hugin.View
View values.
A view holds the values a viewer sets on a figure: the values of keys the figure reads through bind, and the zooms of its continuous scales. Views live outside figures, so a rebuilt figure reads the values set on the previous one. A key is identified by its name and its sort, so code that runs again builds equal keys.
Keys
type 'a keyThe type for keys of values of type 'a. A key has a name, a sort (number, choice, interval, or zoom of a kind of scale) and an initial value.
number name ~init is the key name of a number, initially init.
choice name ~init is the key name of a choice among strings, initially init.
interval name ~init is the key name of an interval or none, such as a brushed selection, initially init.
Raises Invalid_argument if init is Some (lo, hi) with lo or hi not finite or lo > hi.
zoom ~at s is the key of the zoom of the continuous scale named like s, of the kind of s, in the scope that holds the node at (Scopes), the root by default. Its value Some (a, b) sets that scale's domain to [a;b] (Scale.with_domain) in place of its fitted and explicit domains, and its initial value None leaves it. Every continuous scale has such a key without declaring one, and user keys cannot name it. In resolve, after the figure's structure changes, a zoom whose node lies in another scope with a scale of its name and kind applies there; one whose node, name or kind is gone, whose node no scope of its name holds, or whose domain the scale cannot take, is ignored with a warning, and so are the zooms of a scale that several set.
Raises Invalid_argument if s is unnamed or categorical.
Views
type tThe type for views: keys bound to values.
set k v view is view with k bound to v, replacing any value bound to a key of the name of k, whatever its sort.
Raises Invalid_argument if k is an interval key and v is Some (lo, hi) with lo or hi not finite or lo > hi.
get k view is the value bound to k in view, or the initial value of k if view binds none or binds the name of k with another sort.
equal view view' is true iff view and view' bind the same keys to equal values, floats compared by Float.equal.