Port to diagrams >1.3
This commit is contained in:
@@ -233,7 +233,7 @@ treePretty = Diag f
|
||||
getCurQT (q:qs) z = case q of
|
||||
Right x -> getCurQT qs (fromMaybe z (findNeighbor x z))
|
||||
Left x -> getCurQT qs (fromMaybe z (goQuad x z))
|
||||
prettyRoseTree :: Tree String -> Diagram Cairo R2
|
||||
prettyRoseTree :: Tree String -> Diagram Cairo
|
||||
prettyRoseTree tree =
|
||||
-- HACK: in order to give specific nodes a specific color
|
||||
renderTree (\n -> case head n of
|
||||
|
||||
@@ -16,7 +16,7 @@ data Diag =
|
||||
{
|
||||
mkDiag :: DiagProp
|
||||
-> [[PT]]
|
||||
-> Diagram Cairo R2
|
||||
-> Diagram Cairo
|
||||
}
|
||||
| GifDiag
|
||||
{
|
||||
@@ -24,9 +24,9 @@ data Diag =
|
||||
-> Colour Double
|
||||
-> ([PT] -> [[PT]])
|
||||
-> [PT]
|
||||
-> [Diagram Cairo R2]
|
||||
-> [Diagram Cairo]
|
||||
}
|
||||
| EmptyDiag (Diagram Cairo R2)
|
||||
| EmptyDiag (Diagram Cairo)
|
||||
|
||||
|
||||
-- |Holds the properties for a Diagram, like thickness of 2d points etc.
|
||||
@@ -148,19 +148,19 @@ diagDimSquare p = dimToSquare (xDimension p) $ yDimension p
|
||||
-- |Draw a list of points.
|
||||
drawP :: [PT] -- ^ the points to draw
|
||||
-> Double -- ^ dot size
|
||||
-> Diagram Cairo R2 -- ^ the resulting diagram
|
||||
-> Diagram Cairo -- ^ the resulting diagram
|
||||
drawP [] _ = mempty
|
||||
drawP vt ds =
|
||||
position (zip vt (repeat dot))
|
||||
where
|
||||
dot = circle ds :: Diagram Cairo R2
|
||||
dot = circle ds :: Diagram Cairo
|
||||
|
||||
|
||||
-- |Create a rectangle around a diagonal line, which has sw
|
||||
-- as startpoint and nw as endpoint.
|
||||
rectByDiagonal :: (Double, Double) -- ^ sw point
|
||||
-> (Double, Double) -- ^ nw point
|
||||
-> Diagram Cairo R2
|
||||
-> Diagram Cairo
|
||||
rectByDiagonal (xmin, ymin) (xmax, ymax) =
|
||||
fromVertices [p2 (xmin, ymin)
|
||||
, p2 (xmax, ymin)
|
||||
@@ -172,7 +172,7 @@ rectByDiagonal (xmin, ymin) (xmax, ymax) =
|
||||
|
||||
-- |Creates a Diagram from a point that shows the coordinates
|
||||
-- in text format, such as "(1.0, 2.0)".
|
||||
pointToTextCoord :: PT -> Diagram Cairo R2
|
||||
pointToTextCoord :: PT -> Diagram Cairo
|
||||
pointToTextCoord pt =
|
||||
text ("(" ++ (show . trim') x ++ ", " ++ (show . trim') y ++ ")") # scale 10
|
||||
where
|
||||
|
||||
@@ -16,7 +16,7 @@ import Parser.Meshparser
|
||||
|
||||
|
||||
-- |Return a list of tuples used by 'gifMain' to generate an animated gif.
|
||||
gifDiag :: DiagProp -> [PT] -> [(Diagram Cairo R2, GifDelay)]
|
||||
gifDiag :: DiagProp -> [PT] -> [(Diagram Cairo, GifDelay)]
|
||||
gifDiag p xs =
|
||||
fmap ((\x -> (x, 50)) . (<> nonChDiag))
|
||||
(upperHullList
|
||||
@@ -35,5 +35,5 @@ gifDiag p xs =
|
||||
|
||||
-- |Same as gifDiag, except that it takes a string containing the
|
||||
-- mesh file content instead of the the points.
|
||||
gifDiagS :: DiagProp -> B.ByteString -> [(Diagram Cairo R2, GifDelay)]
|
||||
gifDiagS :: DiagProp -> B.ByteString -> [(Diagram Cairo, GifDelay)]
|
||||
gifDiagS p = gifDiag p . filterValidPT p . meshVertices
|
||||
|
||||
@@ -46,7 +46,7 @@ diagTreAlgos =
|
||||
|
||||
|
||||
-- |Create the Diagram from the points.
|
||||
diag :: DiagProp -> [DiagAlgo] -> [[PT]] -> Diagram Cairo R2
|
||||
diag :: DiagProp -> [DiagAlgo] -> [[PT]] -> Diagram Cairo
|
||||
diag p das vts = maybe mempty (\x -> mkDiag x p vts)
|
||||
$ mconcat
|
||||
-- get the actual [Diag] array
|
||||
@@ -58,7 +58,7 @@ diag p das vts = maybe mempty (\x -> mkDiag x p vts)
|
||||
|
||||
-- |Create the Diagram from a String which is supposed to be the contents
|
||||
-- of an obj file.
|
||||
diagS :: DiagProp -> B.ByteString -> Diagram Cairo R2
|
||||
diagS :: DiagProp -> B.ByteString -> Diagram Cairo
|
||||
diagS p mesh =
|
||||
diag p diagAlgos
|
||||
. fmap (filterValidPT p)
|
||||
@@ -69,7 +69,7 @@ diagS p mesh =
|
||||
|
||||
-- |Create the tree diagram from a String which is supposed to be the contents
|
||||
-- of an obj file.
|
||||
diagTreeS :: DiagProp -> B.ByteString -> Diagram Cairo R2
|
||||
diagTreeS :: DiagProp -> B.ByteString -> Diagram Cairo
|
||||
diagTreeS p mesh =
|
||||
diag p diagTreAlgos
|
||||
. fmap (filterValidPT p)
|
||||
|
||||
Reference in New Issue
Block a user