module Wumpus.Tree.Base
(
OTMAnchorConn
, TreeProps(..)
, TreePropsF
, TreeDirection(..)
, tree_direction
, getTreeConnector
) where
import Wumpus.Basic.Kernel
type OTMAnchorConn u a = TreeDirection -> u -> a -> [a] -> Graphic u
data TreeProps u a = TreeProps
{ tp_sibling_distance :: u
, tp_level_distance :: u
, tp_multiconn :: OTMAnchorConn u a
, tp_direction :: TreeDirection
}
type TreePropsF u a = TreeProps u a -> TreeProps u a
data TreeDirection = TREE_UP | TREE_DOWN | TREE_LEFT | TREE_RIGHT
deriving (Eq,Ord,Show)
tree_direction :: TreeDirection -> TreePropsF u a
tree_direction dir props = props { tp_direction = dir }
getTreeConnector :: (DrawingCtxM m, InterpretUnit u)
=> TreeProps u a -> m (a -> [a] -> Graphic u)
getTreeConnector (TreeProps { tp_level_distance = lvl
, tp_multiconn = conn
, tp_direction = dir }) =
uconvertCtx1 lvl >>= \ulvl -> return (conn dir ulvl)