wumpus-tree 0.6.0 → 0.7.0
raw patch · 6 files changed
+129/−52 lines, 6 filesdep ~wumpus-basicdep ~wumpus-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: wumpus-basic, wumpus-core
API changes (from Hackage documentation)
Files
- CHANGES +14/−0
- demo/Demo01.hs +101/−15
- src/Wumpus/Tree.hs +3/−8
- src/Wumpus/Tree/Draw.hs +2/−2
- src/Wumpus/Tree/VersionNumber.hs +2/−2
- wumpus-tree.cabal +7/−25
CHANGES view
@@ -1,4 +1,18 @@ ++0.5.0 to 0.6.0:+ + * Updated to track changes in Wumpus-Basic.++0.4.0 to 0.5.0:++ * Updated to track changes in Wumpus-Basic. Nothing new.++0.3.0 to 0.4.0:++ * Updated to track changes in Wumpus-Basic. Nothing new.++ 0.2.0 to 0.3.0 * Updated to track changes in Wumpus-Basic. No new
demo/Demo01.hs view
@@ -11,31 +11,22 @@ import System.Directory -tree1 :: Tree Char-tree1 = Node 'A' [Node 'B' bs, Node 'F' fs]- where- bs = [Node 'C' [], Node 'D' [], Node 'E' []]- fs = [Node 'G' [Node 'H' [], Node 'I' [], Node 'J' []]] -tree2 :: Tree Char-tree2 = Node 'A' [Node 'B' bs, Node 'F' [], Node 'G' gs]- where- bs = [Node 'C' [], Node 'D' [], Node 'E' []]- gs = [Node 'H' [], Node 'I' [], Node 'J' []] -- main :: IO () main = createDirectoryIfMissing True "./out/" >> writeEPS_TreePicture "./out/tree01.eps" pic1 >> writeSVG_TreePicture "./out/tree01.svg" pic1 >> writeEPS_TreePicture "./out/tree02.eps" pic2 >> writeSVG_TreePicture "./out/tree02.svg" pic2---+ >> writeEPS_TreePicture "./out/tree03.eps" pic3+ >> writeSVG_TreePicture "./out/tree03.svg" pic3+ >> writeEPS_TreePicture "./out/tree04.eps" pic4+ >> writeSVG_TreePicture "./out/tree04.svg" pic4+ >> writeEPS_TreePicture "./out/tree05.eps" pic5+ >> writeSVG_TreePicture "./out/tree05.svg" pic5 pic1 :: TreePicture@@ -44,3 +35,98 @@ pic2 :: TreePicture pic2 = drawTreePicture (diskNode red) (standardContext 24) (uniformScaling 30) tree2 +pic3 :: TreePicture+pic3 = drawTreePicture charNode (standardContext 14) (uniformScaling 30) tree3++pic4 :: TreePicture+pic4 = drawTreePicture (circleNode black) + (standardContext 24) + (ScaleFactors 20 30) + tree4+pic5 :: TreePicture+pic5 = drawTreePicture (circleNode black) + (standardContext 24) + (ScaleFactors 20 30) + tree5+++tree1 :: Tree Char+tree1 = Node 'A' [Node 'B' bs, Node 'F' fs]+ where+ bs = [Node 'C' [], Node 'D' [], Node 'E' []]+ fs = [Node 'G' [Node 'H' [], Node 'I' [], Node 'J' []]]++tree2 :: Tree Char+tree2 = Node 'A' [Node 'B' bs, Node 'F' [], Node 'G' gs]+ where+ bs = [Node 'C' [], Node 'D' [], Node 'E' []]+ gs = [Node 'H' [], Node 'I' [], Node 'J' []]++-- This is the tree from Andrew Kennedy's +-- /Functional Pearl Drawing Trees/+--+-- Currently Wumpus-tree cannot render in the /family tree/ style.+--+tree3 :: Tree Char+tree3 = Node 'A' [a1, a2, a3]+ where+ a1 = Node 'B' [b1, b2]+ a2 = Node 'S' [b3,b4]+ a3 = Node 'o' [b5]+ b1 = Node 'C' [leaf 'D', c1]+ b2 = Node 'P' [leaf 'Q', leaf 'R']+ b3 = Node 'T' [leaf 'U', leaf 'V', c2]+ b4 = Node 'e' [c3, leaf 'h', c4]+ b5 = Node 'p' [c5, c6, leaf '2']+ c1 = Node 'E' [d1]+ c2 = Node 'W' [d2, d3]+ c3 = Node 'f' [leaf 'g']+ c4 = Node 'i' [d4]+ c5 = Node 'q' [leaf 'r', leaf 's', leaf 't', leaf 'u']+ c6 = Node 'v' [leaf 'w', d5, leaf '0', leaf '1']+ d1 = Node 'F' [leaf 'G', e1, leaf 'M', e2]+ d2 = Node 'X' [leaf 'Y']+ d3 = Node 'Z' [leaf 'a', leaf 'b', leaf 'c', leaf 'd']+ d4 = Node 'j' [leaf 'k', leaf 'l', leaf 'm', leaf 'n']+ d5 = Node 'x' [leaf 'y', leaf 'z'] + e1 = Node 'H' [leaf 'I', leaf 'J', leaf 'K', leaf 'L']+ e2 = Node 'N' [leaf 'O']++leaf :: a -> Tree a+leaf a = Node a []+++-- This is the tree (a) T3 from Buchheim, Junger and Leipert+-- /Improving Walker\'s Algorithm to Run in Linear Time/.+-- +tree4 :: Tree Int+tree4 = Node 1 [a1, a2]+ where+ a1 = Node 2 [b1]+ a2 = Node 3 [b2, b3]+ b1 = Node 4 [c1]+ b2 = Node 5 [c2]+ b3 = Node 6 [leaf 9, c3]+ c1 = Node 7 [d1]+ c2 = Node 8 [leaf 12]+ c3 = Node 10 [d2] + d1 = Node 11 [leaf 14]+ d2 = Node 13 [leaf 15]++-- This is the tree (b) T3 from Buchheim, Junger and Leipert+-- /Improving Walker\'s Algorithm to Run in Linear Time/.+-- +-- The generated picture is different - Wumpus-Tree only evenly+-- spaces the leaves, it looks like the trees in that paper are +-- evenly spaced at the interior nodes too.+-- +tree5 :: Tree Int+tree5 = Node 1 [a1, leaf 3, leaf 4, leaf 5, a2, leaf 7, leaf 8, leaf 9, a3]+ where+ a1 = Node 2 [leaf 11, leaf 12, leaf 13, leaf 14, leaf 15, leaf 16+ , leaf 17, leaf 18, leaf 19, leaf 20, b1]+ a2 = Node 6 [leaf 22]+ a3 = Node 10 [b2]+ b1 = Node 21 [leaf 24, leaf 25, leaf 26, leaf 27, leaf 28, leaf 29+ ,leaf 30, leaf 31, leaf 32, leaf 33, leaf 34]+ b2 = Node 23 [leaf 35]
src/Wumpus/Tree.hs view
@@ -107,14 +107,9 @@ -> Tree a -> TreePicture drawTreePicture drawF ctx sfactors tree = - post $ drawTree drawF ctx $ design funs tree+ liftToPictureU $ drawTree drawF ctx $ design funs tree where funs = scalingFunctions sfactors- post f = let xs = f [] in - if null xs then errK else frame xs- -errK :: a-errK = error "treePicture - empty tree drawing." scalingFunctions :: ScaleFactors -> (Double -> Double, Int -> Double)@@ -153,7 +148,7 @@ -- Suitable for printing the shape of a tree, ignoring the data. -- circleNode :: RGBi -> (a -> TreeNode)-circleNode rgb = \_ pt -> localCtxObj (primaryColour rgb) (dotCircle pt)+circleNode rgb = \_ pt -> localDF (primaryColour rgb) (dotCircle pt) -- | Tree nodes with a filled circle.@@ -161,7 +156,7 @@ -- Suitable for printing the shape of a tree, ignoring the data. -- diskNode :: RGBi -> (a -> TreeNode)-diskNode rgb = \_ pt -> localCtxObj (secondaryColour rgb) (dotDisk pt)+diskNode rgb = \_ pt -> localDF (secondaryColour rgb) (dotDisk pt)
src/Wumpus/Tree/Draw.hs view
@@ -41,7 +41,7 @@ drawTop :: (a -> TreeNode) -> CoordTree Double a -> Drawing Double () drawTop fn (Node (pt,a) ns) = do - ancr <- drawAtImg pt (fn a)+ ancr <- drawi $ fn a `ati` pt mapM_ (draw1 fn ancr) ns draw1 :: (a -> TreeNode) @@ -49,7 +49,7 @@ -> CoordTree Double a -> Drawing Double () draw1 fn ancr_from (Node (pt,a) ns) = do- ancr <- drawAtImg pt (fn a)+ ancr <- drawi $ fn a `ati` pt draw $ connector ancr_from ancr mapM_ (draw1 fn ancr) ns
src/Wumpus/Tree/VersionNumber.hs view
@@ -22,7 +22,7 @@ -- | Version number ----- > (0,6,0)+-- > (0,7,0) -- wumpus_tree_version :: (Int,Int,Int)-wumpus_tree_version = (0,6,0)+wumpus_tree_version = (0,7,0)
wumpus-tree.cabal view
@@ -1,5 +1,5 @@ name: wumpus-tree-version: 0.6.0+version: 0.7.0 license: BSD3 license-file: LICENSE copyright: Stephen Tetley <stephen.tetley@gmail.com>@@ -13,34 +13,16 @@ . Draw trees represented by Data.Tree, output SVG or EPS. The output should be quite good - no overlapping edges, identical - subtrees should have the same shape.+ subtrees should have the same shape, leaf nodes evenly spaced. . . Changelog: .- 0.5.0 to 0.6.0:+ 0.6.0 to 0.7.0: . - * Updated to track changes in Wumpus-Basic.- .- 0.4.0 to 0.5.0:- .- * Updated to track changes in Wumpus-Basic. Nothing new.- .- 0.3.0 to 0.4.0:- .- * Updated to track changes in Wumpus-Basic. Nothing new.- .- 0.2.0 to 0.3.0:- .- * Updated to track changes in Wumpus-Basic. No new - functionality.- .- 0.1.0 to 0.2.0:- .- * Changed internals to use ConsDrawing monad as Wumpus-Basic- has changed.+ * More example trees in Demo01.hs. .- * Internal change to use AGraphic rather than MGraphicF + * Updated to track changes in Wumpus-Basic. . . build-type: Simple@@ -57,8 +39,8 @@ build-depends: base < 5, containers >= 0.3.0 && < 0.4.0, vector-space >= 0.6,- wumpus-core == 0.32.0,- wumpus-basic == 0.7.0+ wumpus-core == 0.33.0,+ wumpus-basic == 0.8.0 exposed-modules: