Merge asterix-experiments to master
Change-Id: I79b91e045bd056e62adb6e48795a6625baee0062
Reviewed-on: https://asterix-gerrit.ics.uci.edu/642
Reviewed-by: Ian Maxon <imaxon@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterix-experiments/src/main/resources/gantt/foo.eps b/asterix-experiments/src/main/resources/gantt/foo.eps
new file mode 100644
index 0000000..0f13788
--- /dev/null
+++ b/asterix-experiments/src/main/resources/gantt/foo.eps
@@ -0,0 +1,928 @@
+%!PS-Adobe-2.0 EPSF-2.0
+%%Title: foo.eps
+%%Creator: gnuplot 4.6 patchlevel 5
+%%CreationDate: Sat Jul 11 23:19:23 2015
+%%DocumentFonts: (atend)
+%%BoundingBox: 50 50 410 302
+%%EndComments
+%%BeginProlog
+/gnudict 256 dict def
+gnudict begin
+%
+% The following true/false flags may be edited by hand if desired.
+% The unit line width and grayscale image gamma correction may also be changed.
+%
+/Color true def
+/Blacktext false def
+/Solid true def
+/Dashlength 1 def
+/Landscape false def
+/Level1 false def
+/Rounded false def
+/ClipToBoundingBox false def
+/SuppressPDFMark false def
+/TransparentPatterns false def
+/gnulinewidth 5.000 def
+/userlinewidth gnulinewidth def
+/Gamma 1.0 def
+/BackgroundColor {-1.000 -1.000 -1.000} def
+%
+/vshift -46 def
+/dl1 {
+ 10.0 Dashlength mul mul
+ Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if
+} def
+/dl2 {
+ 10.0 Dashlength mul mul
+ Rounded { currentlinewidth 0.75 mul add } if
+} def
+/hpt_ 31.5 def
+/vpt_ 31.5 def
+/hpt hpt_ def
+/vpt vpt_ def
+/doclip {
+ ClipToBoundingBox {
+ newpath 50 50 moveto 410 50 lineto 410 302 lineto 50 302 lineto closepath
+ clip
+ } if
+} def
+%
+% Gnuplot Prolog Version 4.6 (September 2012)
+%
+%/SuppressPDFMark true def
+%
+/M {moveto} bind def
+/L {lineto} bind def
+/R {rmoveto} bind def
+/V {rlineto} bind def
+/N {newpath moveto} bind def
+/Z {closepath} bind def
+/C {setrgbcolor} bind def
+/f {rlineto fill} bind def
+/g {setgray} bind def
+/Gshow {show} def % May be redefined later in the file to support UTF-8
+/vpt2 vpt 2 mul def
+/hpt2 hpt 2 mul def
+/Lshow {currentpoint stroke M 0 vshift R
+ Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
+/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R
+ Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
+/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R
+ Blacktext {gsave 0 setgray show grestore} {show} ifelse} def
+/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
+ /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def
+/DL {Color {setrgbcolor Solid {pop []} if 0 setdash}
+ {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def
+/BL {stroke userlinewidth 2 mul setlinewidth
+ Rounded {1 setlinejoin 1 setlinecap} if} def
+/AL {stroke userlinewidth 2 div setlinewidth
+ Rounded {1 setlinejoin 1 setlinecap} if} def
+/UL {dup gnulinewidth mul /userlinewidth exch def
+ dup 1 lt {pop 1} if 10 mul /udl exch def} def
+/PL {stroke userlinewidth setlinewidth
+ Rounded {1 setlinejoin 1 setlinecap} if} def
+3.8 setmiterlimit
+% Default Line colors
+/LCw {1 1 1} def
+/LCb {0 0 0} def
+/LCa {0 0 0} def
+/LC0 {1 0 0} def
+/LC1 {0 1 0} def
+/LC2 {0 0 1} def
+/LC3 {1 0 1} def
+/LC4 {0 1 1} def
+/LC5 {1 1 0} def
+/LC6 {0 0 0} def
+/LC7 {1 0.3 0} def
+/LC8 {0.5 0.5 0.5} def
+% Default Line Types
+/LTw {PL [] 1 setgray} def
+/LTb {BL [] LCb DL} def
+/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def
+/LT0 {PL [] LC0 DL} def
+/LT1 {PL [4 dl1 2 dl2] LC1 DL} def
+/LT2 {PL [2 dl1 3 dl2] LC2 DL} def
+/LT3 {PL [1 dl1 1.5 dl2] LC3 DL} def
+/LT4 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def
+/LT5 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC5 DL} def
+/LT6 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC6 DL} def
+/LT7 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC7 DL} def
+/LT8 {PL [2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 2 dl2 2 dl1 4 dl2] LC8 DL} def
+/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def
+/Dia {stroke [] 0 setdash 2 copy vpt add M
+ hpt neg vpt neg V hpt vpt neg V
+ hpt vpt V hpt neg vpt V closepath stroke
+ Pnt} def
+/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V
+ currentpoint stroke M
+ hpt neg vpt neg R hpt2 0 V stroke
+ } def
+/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
+ 0 vpt2 neg V hpt2 0 V 0 vpt2 V
+ hpt2 neg 0 V closepath stroke
+ Pnt} def
+/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M
+ hpt2 vpt2 neg V currentpoint stroke M
+ hpt2 neg 0 R hpt2 vpt2 V stroke} def
+/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M
+ hpt neg vpt -1.62 mul V
+ hpt 2 mul 0 V
+ hpt neg vpt 1.62 mul V closepath stroke
+ Pnt} def
+/Star {2 copy Pls Crs} def
+/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M
+ 0 vpt2 neg V hpt2 0 V 0 vpt2 V
+ hpt2 neg 0 V closepath fill} def
+/TriUF {stroke [] 0 setdash vpt 1.12 mul add M
+ hpt neg vpt -1.62 mul V
+ hpt 2 mul 0 V
+ hpt neg vpt 1.62 mul V closepath fill} def
+/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
+ hpt neg vpt 1.62 mul V
+ hpt 2 mul 0 V
+ hpt neg vpt -1.62 mul V closepath stroke
+ Pnt} def
+/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M
+ hpt neg vpt 1.62 mul V
+ hpt 2 mul 0 V
+ hpt neg vpt -1.62 mul V closepath fill} def
+/DiaF {stroke [] 0 setdash vpt add M
+ hpt neg vpt neg V hpt vpt neg V
+ hpt vpt V hpt neg vpt V closepath fill} def
+/Pent {stroke [] 0 setdash 2 copy gsave
+ translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+ closepath stroke grestore Pnt} def
+/PentF {stroke [] 0 setdash gsave
+ translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+ closepath fill grestore} def
+/Circle {stroke [] 0 setdash 2 copy
+ hpt 0 360 arc stroke Pnt} def
+/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def
+/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def
+/C1 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 0 90 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C2 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 90 180 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C3 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 0 180 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C4 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 180 270 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C5 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 0 90 arc
+ 2 copy moveto
+ 2 copy vpt 180 270 arc closepath fill
+ vpt 0 360 arc} bind def
+/C6 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 90 270 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C7 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 0 270 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C8 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 270 360 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C9 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 270 450 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
+ 2 copy moveto
+ 2 copy vpt 90 180 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C11 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 0 180 arc closepath fill
+ 2 copy moveto
+ 2 copy vpt 270 360 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C12 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 180 360 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C13 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 0 90 arc closepath fill
+ 2 copy moveto
+ 2 copy vpt 180 360 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/C14 {BL [] 0 setdash 2 copy moveto
+ 2 copy vpt 90 360 arc closepath fill
+ vpt 0 360 arc} bind def
+/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
+ vpt 0 360 arc closepath} bind def
+/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
+ neg 0 rlineto closepath} bind def
+/Square {dup Rec} bind def
+/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def
+/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def
+/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def
+/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def
+/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill
+ exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def
+/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
+ 2 copy vpt Square fill Bsquare} bind def
+/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def
+/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def
+/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
+ Bsquare} bind def
+/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
+ Bsquare} bind def
+/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def
+/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+ 2 copy vpt Square fill Bsquare} bind def
+/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
+ 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def
+/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def
+/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def
+/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def
+/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def
+/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def
+/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def
+/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def
+/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def
+/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def
+/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def
+/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def
+/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def
+/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def
+/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def
+/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def
+/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def
+/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def
+/DiaE {stroke [] 0 setdash vpt add M
+ hpt neg vpt neg V hpt vpt neg V
+ hpt vpt V hpt neg vpt V closepath stroke} def
+/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M
+ 0 vpt2 neg V hpt2 0 V 0 vpt2 V
+ hpt2 neg 0 V closepath stroke} def
+/TriUE {stroke [] 0 setdash vpt 1.12 mul add M
+ hpt neg vpt -1.62 mul V
+ hpt 2 mul 0 V
+ hpt neg vpt 1.62 mul V closepath stroke} def
+/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M
+ hpt neg vpt 1.62 mul V
+ hpt 2 mul 0 V
+ hpt neg vpt -1.62 mul V closepath stroke} def
+/PentE {stroke [] 0 setdash gsave
+ translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+ closepath stroke grestore} def
+/CircE {stroke [] 0 setdash
+ hpt 0 360 arc stroke} def
+/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def
+/DiaW {stroke [] 0 setdash vpt add M
+ hpt neg vpt neg V hpt vpt neg V
+ hpt vpt V hpt neg vpt V Opaque stroke} def
+/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M
+ 0 vpt2 neg V hpt2 0 V 0 vpt2 V
+ hpt2 neg 0 V Opaque stroke} def
+/TriUW {stroke [] 0 setdash vpt 1.12 mul add M
+ hpt neg vpt -1.62 mul V
+ hpt 2 mul 0 V
+ hpt neg vpt 1.62 mul V Opaque stroke} def
+/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M
+ hpt neg vpt 1.62 mul V
+ hpt 2 mul 0 V
+ hpt neg vpt -1.62 mul V Opaque stroke} def
+/PentW {stroke [] 0 setdash gsave
+ translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
+ Opaque stroke grestore} def
+/CircW {stroke [] 0 setdash
+ hpt 0 360 arc Opaque stroke} def
+/BoxFill {gsave Rec 1 setgray fill grestore} def
+/Density {
+ /Fillden exch def
+ currentrgbcolor
+ /ColB exch def /ColG exch def /ColR exch def
+ /ColR ColR Fillden mul Fillden sub 1 add def
+ /ColG ColG Fillden mul Fillden sub 1 add def
+ /ColB ColB Fillden mul Fillden sub 1 add def
+ ColR ColG ColB setrgbcolor} def
+/BoxColFill {gsave Rec PolyFill} def
+/PolyFill {gsave Density fill grestore grestore} def
+/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def
+%
+% PostScript Level 1 Pattern Fill routine for rectangles
+% Usage: x y w h s a XX PatternFill
+% x,y = lower left corner of box to be filled
+% w,h = width and height of box
+% a = angle in degrees between lines and x-axis
+% XX = 0/1 for no/yes cross-hatch
+%
+/PatternFill {gsave /PFa [ 9 2 roll ] def
+ PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate
+ PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec
+ TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+ clip
+ currentlinewidth 0.5 mul setlinewidth
+ /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def
+ 0 0 M PFa 5 get rotate PFs -2 div dup translate
+ 0 1 PFs PFa 4 get div 1 add floor cvi
+ {PFa 4 get mul 0 M 0 PFs V} for
+ 0 PFa 6 get ne {
+ 0 1 PFs PFa 4 get div 1 add floor cvi
+ {PFa 4 get mul 0 2 1 roll M PFs 0 V} for
+ } if
+ stroke grestore} def
+%
+/languagelevel where
+ {pop languagelevel} {1} ifelse
+ 2 lt
+ {/InterpretLevel1 true def}
+ {/InterpretLevel1 Level1 def}
+ ifelse
+%
+% PostScript level 2 pattern fill definitions
+%
+/Level2PatternFill {
+/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8}
+ bind def
+/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke}
+>> matrix makepattern
+/Pat1 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke
+ 0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke}
+>> matrix makepattern
+/Pat2 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L
+ 8 8 L 8 0 L 0 0 L fill}
+>> matrix makepattern
+/Pat3 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L
+ 0 12 M 12 0 L stroke}
+>> matrix makepattern
+/Pat4 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L
+ 0 -4 M 12 8 L stroke}
+>> matrix makepattern
+/Pat5 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L
+ 0 12 M 8 -4 L 4 12 M 10 0 L stroke}
+>> matrix makepattern
+/Pat6 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L
+ 0 -4 M 8 12 L 4 -4 M 10 8 L stroke}
+>> matrix makepattern
+/Pat7 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L
+ 12 0 M -4 8 L 12 4 M 0 10 L stroke}
+>> matrix makepattern
+/Pat8 exch def
+<< Tile8x8
+ /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L
+ -4 0 M 12 8 L -4 4 M 8 10 L stroke}
+>> matrix makepattern
+/Pat9 exch def
+/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def
+/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def
+/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def
+/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def
+/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def
+/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def
+/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def
+} def
+%
+%
+%End of PostScript Level 2 code
+%
+/PatternBgnd {
+ TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse
+} def
+%
+% Substitute for Level 2 pattern fill codes with
+% grayscale if Level 2 support is not selected.
+%
+/Level1PatternFill {
+/Pattern1 {0.250 Density} bind def
+/Pattern2 {0.500 Density} bind def
+/Pattern3 {0.750 Density} bind def
+/Pattern4 {0.125 Density} bind def
+/Pattern5 {0.375 Density} bind def
+/Pattern6 {0.625 Density} bind def
+/Pattern7 {0.875 Density} bind def
+} def
+%
+% Now test for support of Level 2 code
+%
+Level1 {Level1PatternFill} {Level2PatternFill} ifelse
+%
+/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont
+dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall
+currentdict end definefont pop
+Level1 SuppressPDFMark or
+{} {
+/SDict 10 dict def
+systemdict /pdfmark known not {
+ userdict /pdfmark systemdict /cleartomark get put
+} if
+SDict begin [
+ /Title (foo.eps)
+ /Subject (gnuplot plot)
+ /Creator (gnuplot 4.6 patchlevel 5)
+ /Author (kisskys)
+% /Producer (gnuplot)
+% /Keywords ()
+ /CreationDate (Sat Jul 11 23:19:23 2015)
+ /DOCINFO pdfmark
+end
+} ifelse
+end
+%%EndProlog
+%%Page: 1 1
+gnudict begin
+gsave
+doclip
+50 50 translate
+0.050 0.050 scale
+0 setgray
+newpath
+(Helvetica) findfont 140 scalefont setfont
+BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {BackgroundColor C 1.000 0 0 7200.00 5040.00 BoxColFill} if
+gsave % colour palette begin
+/maxcolors 0 def
+/HSV2RGB { exch dup 0.0 eq {pop exch pop dup dup} % achromatic gray
+ { /HSVs exch def /HSVv exch def 6.0 mul dup floor dup 3 1 roll sub
+ /HSVf exch def /HSVi exch cvi def /HSVp HSVv 1.0 HSVs sub mul def
+ /HSVq HSVv 1.0 HSVs HSVf mul sub mul def
+ /HSVt HSVv 1.0 HSVs 1.0 HSVf sub mul sub mul def
+ /HSVi HSVi 6 mod def 0 HSVi eq {HSVv HSVt HSVp}
+ {1 HSVi eq {HSVq HSVv HSVp}{2 HSVi eq {HSVp HSVv HSVt}
+ {3 HSVi eq {HSVp HSVq HSVv}{4 HSVi eq {HSVt HSVp HSVv}
+ {HSVv HSVp HSVq} ifelse} ifelse} ifelse} ifelse} ifelse
+ } ifelse} def
+/Constrain {
+ dup 0 lt {0 exch pop}{dup 1 gt {1 exch pop} if} ifelse} def
+/YIQ2RGB {
+ 3 copy -1.702 mul exch -1.105 mul add add Constrain 4 1 roll
+ 3 copy -0.647 mul exch -0.272 mul add add Constrain 5 1 roll
+ 0.621 mul exch -0.956 mul add add Constrain 3 1 roll } def
+/CMY2RGB { 1 exch sub exch 1 exch sub 3 2 roll 1 exch sub 3 1 roll exch } def
+/XYZ2RGB { 3 copy -0.9017 mul exch -0.1187 mul add exch 0.0585 mul exch add
+ Constrain 4 1 roll 3 copy -0.0279 mul exch 1.999 mul add exch
+ -0.9844 mul add Constrain 5 1 roll -0.2891 mul exch -0.5338 mul add
+ exch 1.91 mul exch add Constrain 3 1 roll} def
+/SelectSpace {ColorSpace (HSV) eq {HSV2RGB}{ColorSpace (XYZ) eq {
+ XYZ2RGB}{ColorSpace (CMY) eq {CMY2RGB}{ColorSpace (YIQ) eq {YIQ2RGB}
+ if} ifelse} ifelse} ifelse} def
+/InterpolatedColor true def
+/grayindex {/gidx 0 def
+ {GrayA gidx get grayv ge {exit} if /gidx gidx 1 add def} loop} def
+/dgdx {grayv GrayA gidx get sub GrayA gidx 1 sub get
+ GrayA gidx get sub div} def
+/redvalue {RedA gidx get RedA gidx 1 sub get
+ RedA gidx get sub dgdxval mul add} def
+/greenvalue {GreenA gidx get GreenA gidx 1 sub get
+ GreenA gidx get sub dgdxval mul add} def
+/bluevalue {BlueA gidx get BlueA gidx 1 sub get
+ BlueA gidx get sub dgdxval mul add} def
+/interpolate {
+ grayindex grayv GrayA gidx get sub abs 1e-5 le
+ {RedA gidx get GreenA gidx get BlueA gidx get}
+ {/dgdxval dgdx def redvalue greenvalue bluevalue} ifelse} def
+/GrayA [0 .2 .4 .6 .8 1 ] def
+/RedA [1 1 .8 .8 .8 1 ] def
+/GreenA [.8 .8 .8 1 1 1 ] def
+/BlueA [.8 1 1 1 .8 .8 ] def
+/pm3dround {maxcolors 0 gt {dup 1 ge
+ {pop 1} {maxcolors mul floor maxcolors 1 sub div} ifelse} if} def
+/pm3dGamma 1.0 1.5 Gamma mul div def
+/ColorSpace (RGB) def
+Color InterpolatedColor or { % COLOUR vs. GRAY map
+ InterpolatedColor { %% Interpolation vs. RGB-Formula
+ /g {stroke pm3dround /grayv exch def interpolate
+ SelectSpace setrgbcolor} bind def
+ }{
+ /g {stroke pm3dround dup cF7 Constrain exch dup cF5 Constrain exch cF15 Constrain
+ SelectSpace setrgbcolor} bind def
+ } ifelse
+}{
+ /g {stroke pm3dround pm3dGamma exp setgray} bind def
+} ifelse
+1.000 UL
+LTb
+LCb setrgbcolor
+378 1277 M
+63 0 V
+5687 0 R
+-63 0 V
+-5771 0 R
+(S2) Rshow
+1.000 UL
+LTb
+LCb setrgbcolor
+378 2660 M
+63 0 V
+5687 0 R
+-63 0 V
+-5771 0 R
+(A) Rshow
+1.000 UL
+LTb
+LCb setrgbcolor
+378 4042 M
+63 0 V
+5687 0 R
+-63 0 V
+-5771 0 R
+(S0) Rshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTa
+LCa setrgbcolor
+378 448 M
+0 4423 V
+stroke
+LTb
+LCb setrgbcolor
+378 448 M
+0 63 V
+0 4360 R
+0 -63 V
+378 308 M
+( 0) Cshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTa
+LCa setrgbcolor
+1336 448 M
+0 4423 V
+stroke
+LTb
+LCb setrgbcolor
+1336 448 M
+0 63 V
+0 4360 R
+0 -63 V
+0 -4500 R
+( 5) Cshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTa
+LCa setrgbcolor
+2295 448 M
+0 4423 V
+stroke
+LTb
+LCb setrgbcolor
+2295 448 M
+0 63 V
+0 4360 R
+0 -63 V
+0 -4500 R
+( 10) Cshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTa
+LCa setrgbcolor
+3253 448 M
+0 4423 V
+stroke
+LTb
+LCb setrgbcolor
+3253 448 M
+0 63 V
+0 4360 R
+0 -63 V
+0 -4500 R
+( 15) Cshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTa
+LCa setrgbcolor
+4211 448 M
+0 4423 V
+stroke
+LTb
+LCb setrgbcolor
+4211 448 M
+0 63 V
+0 4360 R
+0 -63 V
+0 -4500 R
+( 20) Cshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTa
+LCa setrgbcolor
+5170 448 M
+0 4423 V
+stroke
+LTb
+LCb setrgbcolor
+5170 448 M
+0 63 V
+0 4360 R
+0 -63 V
+0 -4500 R
+( 25) Cshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTa
+LCa setrgbcolor
+6128 448 M
+0 4423 V
+stroke
+LTb
+LCb setrgbcolor
+6128 448 M
+0 63 V
+0 4360 R
+0 -63 V
+0 -4500 R
+( 30) Cshow
+1.000 UL
+LTb
+LCb setrgbcolor
+1.000 UL
+LTb
+LCb setrgbcolor
+378 4871 N
+378 448 L
+5750 0 V
+0 4423 V
+-5750 0 V
+Z stroke
+LCb setrgbcolor
+112 2659 M
+currentpoint gsave translate -270 rotate 0 0 M
+() Cshow
+grestore
+LTb
+LCb setrgbcolor
+3253 98 M
+(time) Cshow
+LTb
+3253 4801 M
+() Cshow
+1.000 UL
+LTb
+0 g 0.800 378 3489 575 1106 BoxColFill
+LCb setrgbcolor
+378 3489 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+0 g 0.800 953 2107 383 1105 BoxColFill
+LCb setrgbcolor
+953 2107 M
+0 1105 V
+383 0 V
+0 -1105 V
+-383 0 V
+stroke
+LTb
+.2 g 0.800 1145 3489 575 1106 BoxColFill
+LCb setrgbcolor
+1145 3489 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+0 g 0.800 1336 724 575 1106 BoxColFill
+LCb setrgbcolor
+1336 724 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+.2 g 0.800 1720 2107 766 1105 BoxColFill
+LCb setrgbcolor
+1720 2107 M
+0 1105 V
+766 0 V
+0 -1105 V
+-766 0 V
+stroke
+LTb
+.4 g 0.800 1911 3489 575 1106 BoxColFill
+LCb setrgbcolor
+1911 3489 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+.2 g 0.800 2486 724 575 1106 BoxColFill
+LCb setrgbcolor
+2486 724 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+.4 g 0.800 2486 2107 575 1105 BoxColFill
+LCb setrgbcolor
+2486 2107 M
+0 1105 V
+575 0 V
+0 -1105 V
+-575 0 V
+stroke
+LTb
+.6 g 0.800 2678 3489 575 1106 BoxColFill
+LCb setrgbcolor
+2678 3489 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+.4 g 0.800 3061 724 575 1106 BoxColFill
+LCb setrgbcolor
+3061 724 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+.6 g 0.800 3253 2107 767 1105 BoxColFill
+LCb setrgbcolor
+3253 2107 M
+0 1105 V
+767 0 V
+0 -1105 V
+-767 0 V
+stroke
+LTb
+.8 g 0.800 3445 3489 575 1106 BoxColFill
+LCb setrgbcolor
+3445 3489 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+.6 g 0.800 4020 724 575 1106 BoxColFill
+LCb setrgbcolor
+4020 724 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+.8 g 0.800 4020 2107 575 1105 BoxColFill
+LCb setrgbcolor
+4020 2107 M
+0 1105 V
+575 0 V
+0 -1105 V
+-575 0 V
+stroke
+LTb
+1 g 0.800 4211 3489 575 1106 BoxColFill
+LCb setrgbcolor
+4211 3489 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+.8 g 0.800 4595 724 575 1106 BoxColFill
+LCb setrgbcolor
+4595 724 M
+0 1106 V
+575 0 V
+0 -1106 V
+-575 0 V
+stroke
+LTb
+1 g 0.800 4786 2107 767 1105 BoxColFill
+LCb setrgbcolor
+4786 2107 M
+0 1105 V
+767 0 V
+0 -1105 V
+-767 0 V
+stroke
+LTb
+1 g 0.800 5553 724 574 1106 BoxColFill
+LCb setrgbcolor
+5553 724 M
+0 1106 V
+574 0 V
+0 -1106 V
+-574 0 V
+1.000 UP
+stroke
+LTb
+LCb setrgbcolor
+% Begin plot #1
+6.000 UL
+LT0
+0 g LCb setrgbcolor
+6548 4801 M
+(0) Rshow
+LT0
+0 g 6632 4801 M
+399 0 V
+% End plot #1
+% Begin plot #2
+stroke
+LT1
+.2 g LCb setrgbcolor
+6548 4661 M
+(1) Rshow
+LT1
+.2 g 6632 4661 M
+399 0 V
+% End plot #2
+% Begin plot #3
+stroke
+LT2
+.4 g LCb setrgbcolor
+6548 4521 M
+(2) Rshow
+LT2
+.4 g 6632 4521 M
+399 0 V
+% End plot #3
+% Begin plot #4
+stroke
+LT3
+.6 g LCb setrgbcolor
+6548 4381 M
+(3) Rshow
+LT3
+.6 g 6632 4381 M
+399 0 V
+% End plot #4
+% Begin plot #5
+stroke
+LT4
+.8 g LCb setrgbcolor
+6548 4241 M
+(4) Rshow
+LT4
+.8 g 6632 4241 M
+399 0 V
+% End plot #5
+% Begin plot #6
+stroke
+LT5
+1 g LCb setrgbcolor
+6548 4101 M
+(5) Rshow
+LT5
+1 g 6632 4101 M
+399 0 V
+% End plot #6
+stroke
+1.000 UL
+LTb
+LCb setrgbcolor
+378 4871 N
+378 448 L
+5750 0 V
+0 4423 V
+-5750 0 V
+Z stroke
+1.000 UP
+1.000 UL
+LTb
+LCb setrgbcolor
+grestore % colour palette end
+stroke
+grestore
+end
+showpage
+%%Trailer
+%%DocumentFonts: Helvetica
diff --git a/asterix-experiments/src/main/resources/gantt/foo.gpl b/asterix-experiments/src/main/resources/gantt/foo.gpl
new file mode 100644
index 0000000..d1e62bf
--- /dev/null
+++ b/asterix-experiments/src/main/resources/gantt/foo.gpl
@@ -0,0 +1,35 @@
+set xrange [0.000000:30.000000]
+set yrange [0.400000:3.600000]
+set autoscale x
+set xlabel "time"
+set ylabel ""
+set title ""
+set ytics ("A" 2, "S2" 1, "S0" 3)
+set key outside width +2
+set grid xtics
+set palette model RGB defined ( 0 1.0 0.8 0.8, 1 1.0 0.8 1.0, 2 0.8 0.8 1.0, 3 0.8 1.0 1.0, 4 0.8 1.0 0.8, 5 1.0 1.0 0.8 )
+unset colorbox
+set object 1 rectangle from 0.000000, 2.6 to 3.000000, 3.4 fillcolor palette frac 0.00 fillstyle solid 0.8
+set object 2 rectangle from 3.000000, 1.6 to 5.000000, 2.4 fillcolor palette frac 0.00 fillstyle solid 0.8
+set object 3 rectangle from 4.000000, 2.6 to 7.000000, 3.4 fillcolor palette frac 0.20 fillstyle solid 0.8
+set object 4 rectangle from 5.000000, 0.6 to 8.000000, 1.4 fillcolor palette frac 0.00 fillstyle solid 0.8
+set object 5 rectangle from 7.000000, 1.6 to 11.000000, 2.4 fillcolor palette frac 0.20 fillstyle solid 0.8
+set object 6 rectangle from 8.000000, 2.6 to 11.000000, 3.4 fillcolor palette frac 0.40 fillstyle solid 0.8
+set object 7 rectangle from 11.000000, 0.6 to 14.000000, 1.4 fillcolor palette frac 0.20 fillstyle solid 0.8
+set object 8 rectangle from 11.000000, 1.6 to 14.000000, 2.4 fillcolor palette frac 0.40 fillstyle solid 0.8
+set object 9 rectangle from 12.000000, 2.6 to 15.000000, 3.4 fillcolor palette frac 0.60 fillstyle solid 0.8
+set object 10 rectangle from 14.000000, 0.6 to 17.000000, 1.4 fillcolor palette frac 0.40 fillstyle solid 0.8
+set object 11 rectangle from 15.000000, 1.6 to 19.000000, 2.4 fillcolor palette frac 0.60 fillstyle solid 0.8
+set object 12 rectangle from 16.000000, 2.6 to 19.000000, 3.4 fillcolor palette frac 0.80 fillstyle solid 0.8
+set object 13 rectangle from 19.000000, 0.6 to 22.000000, 1.4 fillcolor palette frac 0.60 fillstyle solid 0.8
+set object 14 rectangle from 19.000000, 1.6 to 22.000000, 2.4 fillcolor palette frac 0.80 fillstyle solid 0.8
+set object 15 rectangle from 20.000000, 2.6 to 23.000000, 3.4 fillcolor palette frac 1.00 fillstyle solid 0.8
+set object 16 rectangle from 22.000000, 0.6 to 25.000000, 1.4 fillcolor palette frac 0.80 fillstyle solid 0.8
+set object 17 rectangle from 23.000000, 1.6 to 27.000000, 2.4 fillcolor palette frac 1.00 fillstyle solid 0.8
+set object 18 rectangle from 27.000000, 0.6 to 30.000000, 1.4 fillcolor palette frac 1.00 fillstyle solid 0.8
+plot -1 title "0" with lines linecolor palette frac 0.00 linewidth 6, \
+ -1 title "1" with lines linecolor palette frac 0.20 linewidth 6, \
+ -1 title "2" with lines linecolor palette frac 0.40 linewidth 6, \
+ -1 title "3" with lines linecolor palette frac 0.60 linewidth 6, \
+ -1 title "4" with lines linecolor palette frac 0.80 linewidth 6, \
+ -1 title "5" with lines linecolor palette frac 1.00 linewidth 6
\ No newline at end of file
diff --git a/asterix-experiments/src/main/resources/gantt/gantt.py b/asterix-experiments/src/main/resources/gantt/gantt.py
new file mode 100644
index 0000000..faf9e94
--- /dev/null
+++ b/asterix-experiments/src/main/resources/gantt/gantt.py
@@ -0,0 +1,387 @@
+#!/usr/bin/env python
+#
+# TODO:
+# - Task colors:
+# - User-defined using config file.
+# - Automagically chosen from color space.
+# - Advanced algorithm (contact Hannes Pretorius).
+# - Koos' specs:
+# - Resources and tasks sorted in read-in order (default)
+# or alphabetically (flag).
+# - Have proper gnuplot behavior on windows/x11, eps/pdf, latex terminals.
+# - Create and implement algorithm for critical path analysis.
+# - Split generic stuff into a Gantt class, and specific stuff into the main.
+#
+# gantt.py ganttfile | gnuplot
+
+import itertools, sys, getopt
+from ConfigParser import ConfigParser
+
+rectangleHeight = 0.8 #: Height of a rectangle in units.
+
+class Activity(object):
+ """
+ Container for activity information.
+
+ @ivar resource: Resource name.
+ @type resource: C{str}
+
+ @ivar start: Start time of the activity.
+ @type start: C{float}
+
+ @ivar stop: End time of the activity.
+ @type stop: C{float}
+
+ @ivar task: Name of the task/activity being performed.
+ @type task: C{str}
+ """
+ def __init__(self, resource, start, stop, task):
+ self.resource = resource
+ self.start = start
+ self.stop = stop
+ self.task = task
+
+class Rectangle(object):
+ """
+ Container for rectangle information.
+ """
+ def __init__(self, bottomleft, topright, fillcolor):
+ self.bottomleft = bottomleft
+ self.topright = topright
+ self.fillcolor = fillcolor
+ self.fillstyle = 'solid 0.8'
+ self.linewidth = 2
+
+class ColorBook(object):
+ """
+ Class managing colors.
+
+ @ivar colors
+ @ivar palette
+ @ivar prefix
+ """
+ def __init__(self, colorfname, tasks):
+ """
+ Construct a ColorBook object.
+
+ @param colorfname: Name of the color config file (if specified).
+ @type colorfname: C{str} or C{None}
+
+ @param tasks: Existing task types.
+ @type tasks: C{list} of C{str}
+ """
+ if colorfname:
+ values = self.load_config(colorfname, tasks)
+ else:
+ values = self.fixed(tasks)
+
+ self.colors, self.palette, self.prefix = values
+
+
+ def load_config(self, colorfname, tasks):
+ """
+ Read task colors from a configuration file.
+ """
+ palettedef = 'model RGB'
+ colorprefix = 'rgb'
+
+ # Read in task colors from configuration file
+ config = ConfigParser()
+ config.optionxform = str # makes option names case sensitive
+ config.readfp(open(colorfname, 'r'))
+ # Colors are RGB colornames
+ colors = dict(config.items('Colors'))
+
+ # Raise KeyError if no color is specified for a task
+ nocolors = [t for t in tasks if not colors.has_key(t)]
+ if nocolors:
+ msg = 'Could not find task color for ' + ', '.join(nocolors)
+ raise KeyError(msg)
+
+ return colors, palettedef, colorprefix
+
+ def fixed(self, tasks):
+ """
+ Pick colors from a pre-defined palette.
+ """
+ # Set task colors
+ # SE colors
+ # (see http://w3.wtb.tue.nl/nl/organisatie/systems_engineering/\
+ # info_for_se_students/how2make_a_poster/pictures/)
+ # Decrease the 0.8 values for less transparent colors.
+ se_palette = {"se_red": (1.0, 0.8, 0.8),
+ "se_pink": (1.0, 0.8, 1.0),
+ "se_violet": (0.8, 0.8, 1.0),
+ "se_blue": (0.8, 1.0, 1.0),
+ "se_green": (0.8, 1.0, 0.8),
+ "se_yellow": (1.0, 1.0, 0.8)}
+ se_gradient = ["se_red", "se_pink", "se_violet",
+ "se_blue", "se_green", "se_yellow"]
+ se_palettedef = '( ' + \
+ ', '.join(('%d ' % n +
+ ' '.join((str(x) for x in se_palette[c]))
+ for n, c in enumerate(se_gradient))) + \
+ ' )'
+
+ palettedef = 'model RGB defined %s' % se_palettedef
+ colorprefix = 'palette frac'
+ # Colors are fractions from the palette defined
+ colors = dict((t, '%0.2f' % (float(n)/(len(tasks)-1)))
+ for n, t in enumerate(tasks))
+
+ return colors, palettedef, colorprefix
+
+class DummyClass(object):
+ """
+ Dummy class for storing option values in.
+ """
+
+
+def make_rectangles(activities, resource_map, colors):
+ """
+ Construct a collection of L{Rectangle} for all activities.
+
+ @param activities: Activities being performed.
+ @type activities: C{iterable} of L{Activity}
+
+ @param resource_map: Indices of all resources.
+ @type resource_map: C{dict} of C{str} to C{int}
+
+ @param colors: Colors for all tasks.
+ @type colors: C{dict} of C{str} to C{str}
+
+ @return: Collection of rectangles to draw.
+ @rtype: C{list} of L{Rectangle}
+ """
+ rectangles = []
+ for act in activities:
+ ypos = resource_map[act.resource]
+ bottomleft = (act.start, ypos - 0.5 * rectangleHeight)
+ topright = (act.stop, ypos + 0.5 * rectangleHeight)
+ fillcolor = colors[act.task]
+ rectangles.append(Rectangle(bottomleft, topright, fillcolor))
+
+ return rectangles
+
+
+def load_ganttfile(ganttfile):
+ """
+ Load the resource/task file.
+
+ @param ganttfile: Name of the gantt file.
+ @type ganttfile: C{str}
+
+ @return: Activities loaded from the file, collection of
+ (resource, start, end, task) activities.
+ @rtype: C{list} of L{Activity}
+ """
+ activities = []
+ for line in open(ganttfile, 'r').readlines():
+ line = line.strip().split()
+ if len(line) == 0:
+ continue
+ resource = line[0]
+ start = float(line[1])
+ stop = float(line[2])
+ task = line[3]
+ activities.append(Activity(resource, start, stop, task))
+
+ return activities
+
+def make_unique_tasks_resources(alphasort, activities):
+ """
+ Construct collections of unique task names and resource names.
+
+ @param alphasort: Sort resources and tasks alphabetically.
+ @type alphasort: C{bool}
+
+ @param activities: Activities to draw.
+ @type activities: C{list} of L{Activity}
+
+ @return: Collections of task-types and resources.
+ @rtype: C{list} of C{str}, C{list} of C{str}
+ """
+ # Create list with unique resources and tasks in activity order.
+ resources = []
+ tasks = []
+ for act in activities:
+ if act.resource not in resources:
+ resources.append(act.resource)
+ if act.task not in tasks:
+ tasks.append(act.task)
+
+ # Sort such that resources and tasks appear in alphabetical order
+ if alphasort:
+ resources.sort()
+ tasks.sort()
+
+ # Resources are read from top (y=max) to bottom (y=1)
+ resources.reverse()
+
+ return tasks, resources
+
+
+def generate_plotdata(activities, resources, tasks, rectangles, options,
+ resource_map, color_book):
+ """
+ Generate Gnuplot lines.
+ """
+ xmin = 0
+ xmax = max(act.stop for act in activities)
+ ymin = 0 + (rectangleHeight / 2)
+ ymax = len(resources) + 1 - (rectangleHeight / 2)
+ xlabel = 'time'
+ ylabel = ''
+ title = options.plottitle
+ ytics = ''.join(['(',
+ ', '.join(('"%s" %d' % item)
+ for item in resource_map.iteritems()),
+ ')'])
+ # outside and 2 characters from the graph
+ key_position = 'outside width +2'
+ grid_tics = 'xtics'
+
+ # Set plot dimensions
+ plot_dimensions = ['set xrange [%f:%f]' % (xmin, xmax),
+ 'set yrange [%f:%f]' % (ymin, ymax),
+ 'set autoscale x', # extends x axis to next tic mark
+ 'set xlabel "%s"' % xlabel,
+ 'set ylabel "%s"' % ylabel,
+ 'set title "%s"' % title,
+ 'set ytics %s' % ytics,
+ 'set key %s' % key_position,
+ 'set grid %s' % grid_tics,
+ 'set palette %s' % color_book.palette,
+ 'unset colorbox']
+
+ # Generate gnuplot rectangle objects
+ plot_rectangles = (' '.join(['set object %d rectangle' % n,
+ 'from %f, %0.1f' % r.bottomleft,
+ 'to %f, %0.1f' % r.topright,
+ 'fillcolor %s %s' % (color_book.prefix,
+ r.fillcolor),
+ 'fillstyle solid 0.8'])
+ for n, r in itertools.izip(itertools.count(1), rectangles))
+
+ # Generate gnuplot lines
+ plot_lines = ['plot ' +
+ ', \\\n\t'.join(' '.join(['-1',
+ 'title "%s"' % t,
+ 'with lines',
+ 'linecolor %s %s ' % (color_book.prefix,
+ color_book.colors[t]),
+ 'linewidth 6'])
+ for t in tasks)]
+
+ return plot_dimensions, plot_rectangles, plot_lines
+
+def write_data(plot_dimensions, plot_rectangles, plot_lines, fname):
+ """
+ Write plot data out to file or screen.
+
+ @param fname: Name of the output file, if specified.
+ @type fname: C{str} (??)
+ """
+ if fname:
+ g = open(fname, 'w')
+ g.write('\n'.join(itertools.chain(plot_dimensions, plot_rectangles,
+ plot_lines)))
+ g.close()
+ else:
+ print '\n'.join(itertools.chain(plot_dimensions, plot_rectangles,
+ plot_lines))
+
+def fmt_opt(short, long, arg, text):
+ if arg:
+ return '-%s %s, --%s%s\t%s' % (short[:-1], arg, long, arg, text)
+ else:
+ return '-%s, --%s\t%s' % (short, long, text)
+
+def make_default_options():
+ option_values = DummyClass()
+ option_values.outputfile = ''
+ option_values.colorfile = ''
+ option_values.alphasort = False
+ option_values.plottitle = ''
+ return option_values
+
+def process_options():
+ """
+ Handle option and command-line argument processing.
+
+ @return: Options and gantt input filename.
+ @rtype: L{OptionParser} options, C{str}
+ """
+ optdefs = [('o:', 'output=', 'FILE', 'Write output to FILE.'),
+ ('c:', 'color=', 'FILE', 'Use task colors (RGB) as defined in '
+ 'configuration FILE (in RGB triplets,\n\t\t\t\tGnuplot '
+ 'colornames, or hexadecimal representations.'),
+ ('a', 'alpha', '', '\t\tShow resources and tasks in '
+ 'alphabetical order.'),
+ ('t:','title=', 'TITLE', 'Set plot title to TITLE (between '
+ 'double quotes).'),
+ ('h', 'help', '', '\t\tShow online help.')]
+ short_opts = ''.join(opt[0] for opt in optdefs if opt[0])
+ long_opts = [opt[1] for opt in optdefs if opt[1]]
+ usage_text = 'gantt.py [options] gantt-file\nwhere\n' + \
+ '\n'.join(' ' + fmt_opt(*opt) for opt in optdefs)
+
+ option_values = make_default_options()
+
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts)
+ except getopt.GetoptError, err:
+ sys.stderr.write("gantt.py: %s\n" % err)
+ sys.exit(2)
+
+ for opt, optval in opts:
+ if opt in ('-o', '--output'):
+ option_values.outputfile = optval
+ continue
+ if opt in ('-c', '--color'):
+ option_values.colorfile = optval
+ continue
+ if opt in ('-a', '--alphasort'):
+ option_values.alphasort = True
+ continue
+ if opt in ('-t', '--title'):
+ option_values.plottitle = optval
+ continue
+ if opt in ('-h', '--help'):
+ print usage_text
+ sys.exit(0)
+
+ # Check if correct number of arguments is supplied
+ if len(args) != 1:
+ sys.stderr.write('gantty.py: incorrect number of arguments '
+ '(task/resource file expected)\n')
+ sys.exit(1)
+
+ return option_values, args[0]
+
+def compute(options, ganttfile):
+ activities = load_ganttfile(ganttfile)
+ tasks, resources = make_unique_tasks_resources(options.alphasort,
+ activities)
+
+ # Assign indices to resources
+ resource_map = dict(itertools.izip(resources, itertools.count(1)))
+
+ color_book = ColorBook(options.colorfile, tasks)
+ rectangles = make_rectangles(activities, resource_map, color_book.colors)
+
+ plot_dims, plot_rects, plot_lines = \
+ generate_plotdata(activities, resources, tasks, rectangles,
+ options, resource_map, color_book)
+
+ write_data(plot_dims, plot_rects, plot_lines, options.outputfile)
+
+def run():
+ options, ganttfile = process_options()
+ compute(options, ganttfile)
+
+
+if __name__ == '__main__':
+ run()
+
+
diff --git a/asterix-experiments/src/main/resources/gantt/vargantt1.gpl b/asterix-experiments/src/main/resources/gantt/vargantt1.gpl
new file mode 100644
index 0000000..02ac5e3
--- /dev/null
+++ b/asterix-experiments/src/main/resources/gantt/vargantt1.gpl
@@ -0,0 +1,35 @@
+set xrange [0.000000:30.000000]
+set yrange [0.400000:3.600000]
+set autoscale x
+set xlabel "time"
+set ylabel ""
+set title "Gantt chart"
+set ytics ("A" 2, "S2" 1, "S0" 3)
+set key outside width +2
+set grid xtics
+set palette model RGB
+unset colorbox
+set object 1 rectangle from 0.000000, 2.6 to 3.000000, 3.4 fillcolor rgb "#0092B5" fillstyle solid 0.8
+set object 2 rectangle from 3.000000, 1.6 to 5.000000, 2.4 fillcolor rgb "#0092B5" fillstyle solid 0.8
+set object 3 rectangle from 4.000000, 2.6 to 7.000000, 3.4 fillcolor rgb "#00AC82" fillstyle solid 0.8
+set object 4 rectangle from 5.000000, 0.6 to 8.000000, 1.4 fillcolor rgb "#0092B5" fillstyle solid 0.8
+set object 5 rectangle from 7.000000, 1.6 to 11.000000, 2.4 fillcolor rgb "#00AC82" fillstyle solid 0.8
+set object 6 rectangle from 8.000000, 2.6 to 11.000000, 3.4 fillcolor rgb "#84D200" fillstyle solid 0.8
+set object 7 rectangle from 11.000000, 0.6 to 14.000000, 1.4 fillcolor rgb "#00AC82" fillstyle solid 0.8
+set object 8 rectangle from 11.000000, 1.6 to 14.000000, 2.4 fillcolor rgb "#84D200" fillstyle solid 0.8
+set object 9 rectangle from 12.000000, 2.6 to 15.000000, 3.4 fillcolor rgb "#CEDF00" fillstyle solid 0.8
+set object 10 rectangle from 14.000000, 0.6 to 17.000000, 1.4 fillcolor rgb "#84D200" fillstyle solid 0.8
+set object 11 rectangle from 15.000000, 1.6 to 19.000000, 2.4 fillcolor rgb "#CEDF00" fillstyle solid 0.8
+set object 12 rectangle from 16.000000, 2.6 to 19.000000, 3.4 fillcolor rgb "#FFDD00" fillstyle solid 0.8
+set object 13 rectangle from 19.000000, 0.6 to 22.000000, 1.4 fillcolor rgb "#CEDF00" fillstyle solid 0.8
+set object 14 rectangle from 19.000000, 1.6 to 22.000000, 2.4 fillcolor rgb "#FFDD00" fillstyle solid 0.8
+set object 15 rectangle from 20.000000, 2.6 to 23.000000, 3.4 fillcolor rgb "#FF9A00" fillstyle solid 0.8
+set object 16 rectangle from 22.000000, 0.6 to 25.000000, 1.4 fillcolor rgb "#FFDD00" fillstyle solid 0.8
+set object 17 rectangle from 23.000000, 1.6 to 27.000000, 2.4 fillcolor rgb "#FF9A00" fillstyle solid 0.8
+set object 18 rectangle from 27.000000, 0.6 to 30.000000, 1.4 fillcolor rgb "#FF9A00" fillstyle solid 0.8
+plot -1 title "0" with lines linecolor rgb "#0092B5" linewidth 6, \
+ -1 title "1" with lines linecolor rgb "#00AC82" linewidth 6, \
+ -1 title "2" with lines linecolor rgb "#84D200" linewidth 6, \
+ -1 title "3" with lines linecolor rgb "#CEDF00" linewidth 6, \
+ -1 title "4" with lines linecolor rgb "#FFDD00" linewidth 6, \
+ -1 title "5" with lines linecolor rgb "#FF9A00" linewidth 6
\ No newline at end of file
diff --git a/asterix-experiments/src/main/resources/gantt/vargantt1.plt b/asterix-experiments/src/main/resources/gantt/vargantt1.plt
new file mode 100644
index 0000000..7f48291
--- /dev/null
+++ b/asterix-experiments/src/main/resources/gantt/vargantt1.plt
@@ -0,0 +1,4 @@
+set terminal postscript eps color solid
+set output "foo.eps"
+load "foo.gpl"
+unset output
diff --git a/asterix-experiments/src/main/resources/gantt/vargantt1.txt b/asterix-experiments/src/main/resources/gantt/vargantt1.txt
new file mode 100644
index 0000000..26a5641
--- /dev/null
+++ b/asterix-experiments/src/main/resources/gantt/vargantt1.txt
@@ -0,0 +1,18 @@
+S0 0.00000000000000000000 3.00000000000000000000 0
+A 3.00000000000000000000 5.00000000000000000000 0
+S0 4.00000000000000000000 7.00000000000000000000 1
+S2 5.00000000000000000000 8.00000000000000000000 0
+A 7.00000000000000000000 11.00000000000000000000 1
+S0 8.00000000000000000000 11.00000000000000000000 2
+S2 11.00000000000000000000 14.00000000000000000000 1
+A 11.00000000000000000000 14.00000000000000000000 2
+S0 12.00000000000000000000 15.00000000000000000000 3
+S2 14.00000000000000000000 17.00000000000000000000 2
+A 15.00000000000000000000 19.00000000000000000000 3
+S0 16.00000000000000000000 19.00000000000000000000 4
+S2 19.00000000000000000000 22.00000000000000000000 3
+A 19.00000000000000000000 22.00000000000000000000 4
+S0 20.00000000000000000000 23.00000000000000000000 5
+S2 22.00000000000000000000 25.00000000000000000000 4
+A 23.00000000000000000000 27.00000000000000000000 5
+S2 27.00000000000000000000 30.00000000000000000000 5