wumpus-tree 0.1.0 → 0.3.0
raw patch · 6 files changed
+59/−30 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 +10/−0
- src/Wumpus/Tree.hs +5/−4
- src/Wumpus/Tree/Base.hs +2/−3
- src/Wumpus/Tree/Draw.hs +22/−18
- src/Wumpus/Tree/VersionNumber.hs +2/−2
- wumpus-tree.cabal +18/−3
CHANGES view
@@ -1,5 +1,15 @@ +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.++ * Internal change to use AGraphic rather than MGraphicF 0.1.0:
src/Wumpus/Tree.hs view
@@ -45,9 +45,10 @@ import Wumpus.Tree.Design import Wumpus.Tree.Draw -import Wumpus.Basic.AnchorDots -- package: wumpus-basic+import Wumpus.Basic.Dots -- package: wumpus-basic import Wumpus.Basic.Graphic-import Wumpus.Basic.Monads.DrawingCtxClass+import Wumpus.Basic.Graphic.DrawingAttr+import Wumpus.Basic.Monads.Drawing import Wumpus.Core -- package: wumpus-core import Data.Maybe@@ -154,7 +155,7 @@ circleNode :: DRGB -> (a -> TreeNode) circleNode rgb = const fn where- fn pt = withinModifiedCtx (\s -> s { stroke_colour = rgb}) (dotCircle $ pt)+ fn = dotCircle `props` (\s -> s { stroke_colour = rgb}) -- | Tree nodes with a filled circle.@@ -164,7 +165,7 @@ diskNode :: DRGB -> (a -> TreeNode) diskNode rgb = const fn where- fn pt = withinModifiedCtx (\s -> s { fill_colour = rgb}) (dotDisk $ pt)+ fn = dotDisk `props` (\s -> s { fill_colour = rgb})
src/Wumpus/Tree/Base.hs view
@@ -26,9 +26,8 @@ import Wumpus.Core -- package: wumpus-core-import Wumpus.Basic.AnchorDots -- package: wumpus-basic+import Wumpus.Basic.Dots -- package: wumpus-basic import Wumpus.Basic.Monads.Drawing-import Wumpus.Basic.Monads.SnocDrawing import Data.Tree @@ -43,5 +42,5 @@ type CoordTree u a = Tree (Point2 u, a) -type TreeNode = MGraphicF (SnocDrawing Double) Double (DotAnchor Double)+type TreeNode = ANode Double (DotAnchor Double)
src/Wumpus/Tree/Draw.hs view
@@ -15,48 +15,52 @@ -- -------------------------------------------------------------------------------- -module Wumpus.Tree.Draw where+module Wumpus.Tree.Draw + (+ drawTree + ) where+ import Wumpus.Tree.Base import Wumpus.Core -- package: wumpus-core import Wumpus.Basic.Anchors -- package: wumpus-basic-import Wumpus.Basic.AnchorDots+import Wumpus.Basic.Dots import Wumpus.Basic.Graphic -import Wumpus.Basic.Monads.SnocDrawing+import Wumpus.Basic.Graphic.DrawingAttr+import Wumpus.Basic.Monads.Drawing+import Wumpus.Basic.Monads.DrawingMonad import Wumpus.Basic.SVGColours import Data.VectorSpace -- package: vector-space -import Data.Tree+import Data.Tree hiding ( drawTree ) --- Don\'t actually need the Turtle of SnocDrawing...+-- Don\'t actually need the Turtle of ConsDrawing... drawTree :: (a -> TreeNode) -> DrawingAttr -> CoordTree Double a -> DGraphic-drawTree drawF attr tree = - execSnocDrawing (regularConfig 1) (0,0) attr- $ drawTop drawF tree +drawTree drawF attr tree = execDrawing attr $ drawTop drawF tree -drawTop :: (a -> TreeNode) -> CoordTree Double a -> SnocDrawing Double ()-drawTop drawF (Node (pt,a) ns) = do - ancr <- drawF a pt- mapM_ (draw1 drawF ancr) ns+drawTop :: (a -> TreeNode) -> CoordTree Double a -> Drawing Double ()+drawTop fn (Node (pt,a) ns) = do + ancr <- nodeAt (fn a) pt+ mapM_ (draw1 fn ancr) ns draw1 :: (a -> TreeNode) -> DotAnchor Double -> CoordTree Double a - -> SnocDrawing Double ()-draw1 drawF ancr_from (Node (pt,a) ns) = do- ancr <- drawF a pt+ -> Drawing Double ()+draw1 fn ancr_from (Node (pt,a) ns) = do+ ancr <- nodeAt (fn a) pt connector ancr_from ancr- mapM_ (draw1 drawF ancr) ns + mapM_ (draw1 fn ancr) ns connector :: (Floating u, Real u, InnerSpace (Vec2 u)) - => DotAnchor u -> DotAnchor u -> SnocDrawing u ()-connector afrom ato = trace1 $ ostroke black $ vertexPath [p0,p1]+ => DotAnchor u -> DotAnchor u -> Drawing u ()+connector afrom ato = trace $ wrapG $ ostroke black $ vertexPath [p0,p1] where (ang0,ang1) = anchorAngles (center afrom) (center ato) p0 = radialAnchor ang0 afrom
src/Wumpus/Tree/VersionNumber.hs view
@@ -22,7 +22,7 @@ -- | Version number ----- > (0,1,0)+-- > (0,3,0) -- wumpus_tree_version :: (Int,Int,Int)-wumpus_tree_version = (0,1,0)+wumpus_tree_version = (0,3,0)
wumpus-tree.cabal view
@@ -1,5 +1,5 @@ name: wumpus-tree-version: 0.1.0+version: 0.3.0 license: BSD3 license-file: LICENSE copyright: Stephen Tetley <stephen.tetley@gmail.com>@@ -16,6 +16,21 @@ subtrees should have the same shape. . .+ Changelog:+ .+ 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.+ .+ * Internal change to use AGraphic rather than MGraphicF + .+ . build-type: Simple stability: highly unstable cabal-version: >= 1.2@@ -30,8 +45,8 @@ build-depends: base < 5, containers >= 0.3.0 && < 0.4.0, vector-space >= 0.6,- wumpus-core >= 0.22.0,- wumpus-basic >= 0.3.0+ wumpus-core >= 0.23.0,+ wumpus-basic >= 0.4.0 exposed-modules: