Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swimunit 0.2.0.261 initium #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGES.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
1.3.6.7 (18 September 2015)
---------------------------

* **New features**

- included package "swimunit".
"swimunit" will be a very versatile plotting library.
As one of its main design goals will be that every part
of the plot can be put together like playing with lego.
In addition error messages are displayed as diagrams in
the plot.
As a goodi "swimunit" comes with a function that generates
a diagram that renders text like beeing displayed on an old
dotmatrix panel.


1.3.0.6 (17 September 2015)
---------------------------

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Michael Sloan <mgsloan@gmail.com>
Dominic Steinitz <dominic@steinitz.org>
Ryan Yates <ryates@cs.rochester.edu>
Brent Yorgey <byorgey@gmail.com>
Wolfram Herkendell <wolfram@herkendell.de>
19 changes: 19 additions & 0 deletions drv/BaseDriver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#

if [[ -z $SWIMUNIT_ROOT ]]
then
echo "[FATAL] Environment variable SWIMUNIT_ROOT is not set."
echo " Remedy: Set SWIMUNIT_ROOT to directory of Swimunit sources."
exit -1
fi

OUTPUT=$SWIMUNIT_ROOT/output/drv
XRES=999
YRES=999


cabal run BaseDriver -- --width $XRES --height $YRES --output $OUTPUT/Base.svg

##
####
##
33 changes: 33 additions & 0 deletions drv/Diagrams/Swimunit/BaseDriver.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{-# LANGUAGE NoMonomorphismRestriction #-}

{-|

-}
module Main
where

import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

import Diagrams.Swimunit.Base

{-|
MAIN method. Call 'main' to produce output.
-}
main :: IO ()
main = mainWith (
error1
)

error1 :: Diagram B
error1 = errord (
"[ERROR]{TEST}: "
++ "<° "
++ "Victor j@gt zw*lf Boxk#mpfer quer "
++ "^ber den gro|en Sylter Deich."
++ " °>"
)

--
----
--
120 changes: 120 additions & 0 deletions drv/Diagrams/Swimunit/DotmatrixDarkAlphabetDriver.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{-# LANGUAGE NoMonomorphismRestriction #-}

{-|

-}
module Main
where

import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

import Diagrams.Swimunit.Dotmatrix

{-|
MAIN method. Call 'main' to produce output.
-}
main :: IO ()
main = mainWith (
let alphabet = (
withoutDarkDots -- print without panel
===
(
withoutDarkDots -- print without panel
<>
darkDots -- print panel
)
) # centerXY
in alphabet
<>
backgroundrect 1.1 alphabet
# centerXY -- center background
)

{-|
Render testing alphabet dotmatrix.
-}
withoutDarkDots :: Diagram B
withoutDarkDots = (
dotmatrix defdot dotfont_B6x9 line1 # fc blue # lc aqua
===
dotmatrix defdot dotfont_B6x9 line2 # fc blue # lc aqua
===
dotmatrix defdot dotfont_B6x9 line3 # fc blue # lc aqua
===
dotmatrix defdot dotfont_B6x9 line4 # fc blue # lc aqua
===
dotmatrix defdot dotfont_B6x9 line5 # fc blue # lc aqua
===
dotmatrix defdot dotfont_B6x9 line6 # fc blue # lc aqua
===
dotmatrix defdot dotfont_B6x9 line7 # fc blue # lc aqua
===
dotmatrix defdot dotfont_B6x9 "" # fc blue # lc aqua
===
dotmatrix defdot dotfont_B6x9 "" # fc blue # lc aqua
)

{-|
Render background panel of testing alphabet.
-}
darkDots :: Diagram B
darkDots = (
notdotmatrix defdot dotfont_B6x9 line1 # fc black # lc darkslategray
===
notdotmatrix defdot dotfont_B6x9 line2 # fc black # lc darkslategray
===
notdotmatrix defdot dotfont_B6x9 line3 # fc black # lc darkslategray
===
notdotmatrix defdot dotfont_B6x9 line4 # fc black # lc darkslategray
===
notdotmatrix defdot dotfont_B6x9 line5 # fc black # lc darkslategray
===
notdotmatrix defdot dotfont_B6x9 line6 # fc black # lc darkslategray
===
notdotmatrix defdot dotfont_B6x9 line7 # fc black # lc darkslategray
===
notdotmatrix defdot dotfont_B6x9 "" # fc black # lc darkslategray
===
notdotmatrix defdot dotfont_B6x9 "" # fc black # lc darkslategray
)

{-|
Define testing alphabet.
-}
line1 :: String
line1 = "ABCDEFGHIJ" -- fully implemented

line2 :: String
line2 = "KLMNOPQRST" -- fully implemented

line3 :: String
line3 = "UVWXYZ ÄÖÜ" -- fully implemented

line4 :: String
line4 = "1234567890" -- fully implemented

line5 :: String
line5 = "#:,;.+-_!=" -- fully implemented

line6 :: String
line6 = "&*{}[]'<|>"

line7 :: String
line7 = "^°~@$%/()?"

defdot :: Diagram B
defdot = circle 1.0

{-|
Define dark background rectangle.
-}
backgroundrect :: Double
-> Diagram B
-> Diagram B
backgroundrect scl diagram = rect ((width diagram) * scl) ((height diagram) * scl)
# lc gray
# fc black
--
----
--
44 changes: 44 additions & 0 deletions drv/Diagrams/Swimunit/DotmatrixModuleNameDriver.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{-# LANGUAGE NoMonomorphismRestriction #-}

{-|

-}
module Main
where

import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

import Diagrams.Swimunit.Dotmatrix

{-|
MAIN method. Call 'main' to produce output.
-}
main :: IO ()
main = mainWith (
let mname = (
dotmatrix defdot dotfont_B6x9 "SWIMUNIT.DOTMATRIX" # fc aqua # lc dodgerblue
<>
notdotmatrix defdot dotfont_B6x9 "SWIMUNIT.DOTMATRIX" # fc black # lc darkslategray
) # centerXY
in mname
<>
backgroundrect 1.1 mname
# centerXY -- center background
)

defdot :: Diagram B
defdot = circle 1.0

{-|
Define dark background rectangle.
-}
backgroundrect :: Double
-> Diagram B
-> Diagram B
backgroundrect scl diagram = rect ((width diagram) * scl) ((height diagram) * scl)
# lc gray
# fc black
--
----
--
44 changes: 44 additions & 0 deletions drv/Diagrams/Swimunit/SwimunitModuleNameDriver.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{-# LANGUAGE NoMonomorphismRestriction #-}

{-|

-}
module Main
where

import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

import Diagrams.Swimunit.Dotmatrix

{-|
MAIN method. Call 'main' to produce output.
-}
main :: IO ()
main = mainWith (
let mname = (
dotmatrix defdot dotfont_B6x9 "SWIMUNIT" # fc aqua # lc dodgerblue
<>
notdotmatrix defdot dotfont_B6x9 "SWIMUNIT" # fc black # lc darkslategray
) # centerXY
in mname
<>
backgroundrect 1.1 mname
# centerXY -- center background
)

defdot :: Diagram B
defdot = circle 1.0

{-|
Define dark background rectangle.
-}
backgroundrect :: Double
-> Diagram B
-> Diagram B
backgroundrect scl diagram = rect ((width diagram) * scl) ((height diagram) * scl)
# lc gray
# fc black
--
----
--
72 changes: 72 additions & 0 deletions drv/Diagrams/Swimunit/VGridDriver.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{-# LANGUAGE NoMonomorphismRestriction #-}

{- |

-}
module Main
where

import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

import Diagrams.Swimunit.Axis
import Diagrams.Swimunit.Grid

{-|
MAIN method. Call 'main' to produce output.
-}
main :: IO ()
main = mainWith (
gridplot
<>
backgroundrect 1.1 gridplot
# centerXY -- center background
)

gridplot :: Diagram B
gridplot = ( vplot
# centerXY -- center plot
)

vplot :: Diagram B
vplot = ( verticlabel vml1 0.3
# fc aqua
||| (
verticticks vmt1 0.2 0.0
# lc lightblue
<>
verticticks vnt1 0.1 (-1.0)
# lc lightblue
)
|||
verticgrid vmt1 8.2
# lc aqua
|||
verticticks vmt1 0.2 1.0
# lc lime
)

vmt1 :: [Double]
vmt1 = [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ]

{- Minor ticks. -}
vnt1 :: [Double]
vnt1 = [ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9
, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9
, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9
, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9 ]

vml1 :: [String]
vml1 = [ "2", "4", "6", "8" ]

backgroundrect :: Double
-> Diagram B
-> Diagram B
backgroundrect scl diagram = rect ((width diagram) * scl)
((height diagram) * scl)
# lc green
# fc black

--
----
--
Loading