wumpus-tree-0.4.0: Drawing treesSource codeContentsIndex
Wumpus.Tree
PortabilityGHC
Stabilityhighly unstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>
Contents
The type of rendered trees
Render a Data.Tree to a TreePicture
Output to file
Drawing nodes
Description
Synopsis
type TreePicture = Picture Double
data DrawingAttr = DrawingAttr {
line_width :: Double
font_props :: FontAttr
stroke_colour :: RGBi
fill_colour :: RGBi
}
standardAttr :: FontSize -> DrawingAttr
data ScaleFactors = ScaleFactors {
dx_scale :: Double
dy_scale :: Double
}
uniformScaling :: Double -> ScaleFactors
drawTreePicture :: (a -> TreeNode) -> DrawingAttr -> ScaleFactors -> Tree a -> TreePicture
writeEPS_TreePicture :: FilePath -> TreePicture -> IO ()
writeSVG_TreePicture :: FilePath -> TreePicture -> IO ()
charNode :: Char -> TreeNode
textNode :: String -> TreeNode
circleNode :: RGBi -> a -> TreeNode
diskNode :: RGBi -> a -> TreeNode
The type of rendered trees
type TreePicture = Picture DoubleSource
A rendered tree - alias for for Picture Double in Wumpus-Core.
Render a Data.Tree to a TreePicture
data DrawingAttr Source
Constructors
DrawingAttr
line_width :: Double
font_props :: FontAttr
stroke_colour :: RGBi
fill_colour :: RGBi
show/hide Instances
standardAttr :: FontSize -> DrawingAttrSource
data ScaleFactors Source

Customize the size of the printed tree.

A tree is designed with a height of 1 unit between parent and child nodes.

The y-scaling factor multiplies the unit height, a scaling factor of 30 represents 30 points.

In the horizontal, 1 unit is the smallest possible distance between child nodes.

Constructors
ScaleFactors
dx_scale :: Double
dy_scale :: Double
show/hide Instances
uniformScaling :: Double -> ScaleFactorsSource
Build uniform x- and y-scaling factors, i.e. x == y .
drawTreePicture :: (a -> TreeNode) -> DrawingAttr -> ScaleFactors -> Tree a -> TreePictureSource

drawTreePicture : draw_fun * attr * scale_factors * tree -> TreePicture

The rendering function.

draw_fun renders the individual nodes. Usually charNode, circleNode

attr is the font size (translates to node size), stroke colour, fill colour.

scale_factors scales the distances between parent and child (y-scale) and sibling nodes (x-scale).

tree is the input tree to be rendered.

Output to file
writeEPS_TreePicture :: FilePath -> TreePicture -> IO ()Source
Output a TreePicture, generating an EPS file.
writeSVG_TreePicture :: FilePath -> TreePicture -> IO ()Source
Output a TreePicture, generating a SVG file.
Drawing nodes
charNode :: Char -> TreeNodeSource

Render tree nodes with a single character.

Useful for rendering Data.Tree Char .

textNode :: String -> TreeNodeSource

Tree nodes with a text label.

Useful for rendering Data.Tree String .

Note the width of the label is not accounted for in the design of the tree. Labels with long texts may overlap. Also, only a single line of text is printed - any text after the first newline character will be dropped.

circleNode :: RGBi -> a -> TreeNodeSource

Tree nodes with a stroked circle.

Suitable for printing the shape of a tree, ignoring the data.

diskNode :: RGBi -> a -> TreeNodeSource

Tree nodes with a filled circle.

Suitable for printing the shape of a tree, ignoring the data.

Produced by Haddock version 2.6.1