diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-03-29 21:32:54 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-03-29 21:32:54 (GMT) |
commit | c3419fd29a2894195925560d2c37915dd555a6d6 (patch) | |
tree | d8f5cc7edca60fc84ec1bfa08c6a08fd3892177b /ds9 | |
parent | 4cc2d933414b448948fb17bf480b281163759016 (diff) | |
download | blt-c3419fd29a2894195925560d2c37915dd555a6d6.zip blt-c3419fd29a2894195925560d2c37915dd555a6d6.tar.gz blt-c3419fd29a2894195925560d2c37915dd555a6d6.tar.bz2 |
add ds9 plot parser
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/cat.tcl | 28 | ||||
-rw-r--r-- | ds9/library/colorbar.tcl | 35 | ||||
-rw-r--r-- | ds9/library/plotprocess.tcl | 70 | ||||
-rw-r--r-- | ds9/parsers/catparser.tac | 7 | ||||
-rw-r--r-- | ds9/parsers/colorbarparser.tac | 28 | ||||
-rw-r--r-- | ds9/parsers/font.trl | 10 | ||||
-rw-r--r-- | ds9/parsers/gridparser.tac | 33 | ||||
-rw-r--r-- | ds9/parsers/plotlex.fcl | 2 | ||||
-rw-r--r-- | ds9/parsers/plotparser.tac | 82 |
9 files changed, 212 insertions, 83 deletions
diff --git a/ds9/library/cat.tcl b/ds9/library/cat.tcl index 36acb35..90b2c3a 100644 --- a/ds9/library/cat.tcl +++ b/ds9/library/cat.tcl @@ -2069,6 +2069,34 @@ proc CatalogCmdSymbol {col value} { CATGenerate $cvarname } +proc CatalogCmdSymbolStyle {value} { + global cvarname + upvar #0 $cvarname cvar + global $cvar(symdb) + + switch $value { + normal { + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontweight] normal + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontslant] roman + } + bold { + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontweight] bold + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontslant] roman + } + italic { + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontweight] normal + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontslant] italic + } + } + CATGenerate $cvarname +} + proc CatalogCmdSymbolAdd {} { global cvarname upvar #0 $cvarname cvar diff --git a/ds9/library/colorbar.tcl b/ds9/library/colorbar.tcl index 94a5065..56bf164 100644 --- a/ds9/library/colorbar.tcl +++ b/ds9/library/colorbar.tcl @@ -1486,6 +1486,41 @@ proc ProcessColorbarCmd {varname iname} { } } +proc ColorbarCmdView {which value} { + global colorbar + + set colorbar($which) $value + UpdateView +} + +proc ColorbarCmdFontStyle {value} { + global cvarname + upvar #0 $cvarname cvar + global $cvar(symdb) + + switch $value { + normal { + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontweigth] normal + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontslant] roman + } + bold { + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontweight] bold + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) fontslant] roman + } + italic { + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) weight] normal + starbase_set $cvar(symdb) $cvar(row) \ + [starbase_colnum $cvar(symdb) slant] italic + } + } + CATGenerate $cvarname +} + proc ProcessSendColorbarCmd {proc id param} { global colorbar global view diff --git a/ds9/library/plotprocess.tcl b/ds9/library/plotprocess.tcl index bfe02a6..de2a6b1 100644 --- a/ds9/library/plotprocess.tcl +++ b/ds9/library/plotprocess.tcl @@ -524,8 +524,8 @@ proc ProcessPlotNewOne {which varname xarname iname buf} { } proc ProcessPlotData {varname xarname iname buf} { - upvar #0 $varname var global $varname + upvar #0 $varname var upvar 2 $xarname xar upvar 2 $iname i @@ -537,6 +537,74 @@ proc ProcessPlotData {varname xarname iname buf} { PlotList $varname } +proc PlotCmdLoad {fn dim} { + global cvarname + + if {$fn != {}} { + PlotLoadDataFile $cvarname $fn $dim + FileLast apdatafbox $fn + } +} + +proc PlotCmdSave {fn} { + global cvarname + + if {$fn != {}} { + PlotSaveDataFile $varname $fn + FileLast apdatafbox $fn + } +} + +proc PlotCmdStats {value} { + global cvarname + upvar #0 $cvarname cvar + + set cvar(stats) $value + PlotStats $cvarname +} + +proc PlotCmdList {value} { + global cvarname + upvar #0 $cvarname cvar + + set cvar(list) $value + PlotList $cvarname +} + +proc PlotCmdLoadConfig {fn} { + global cvarname + + if {$fn != {}} { + PlotLoadConfigFile $cvarname $fn + FileLast apconfigfbox $fn + } +} + +proc PlotCmdSaveConfig {fn} { + global cvarname + + if {$fn != {}} { + PlotSaveConfigFile $cvarname $fn + FileLast apconfigfbox $fn + } +} + +proc PlotCmdMode {value} { + global cvarname + upvar #0 $cvarname cvar + + set cvar(mode) $value + PlotChangMode $cvarname +} + +proc PlotCmdPlot {which value} { + global cvarname + upvar #0 $cvarname cvar + + set cvar($which) $value + $cvar(proc,updategraph) $cvarname +} + # File Menu proc ProcessPlotPrint {varname xarname iname} { upvar #0 $varname var diff --git a/ds9/parsers/catparser.tac b/ds9/parsers/catparser.tac index bbe1d26..8f41c04 100644 --- a/ds9/parsers/catparser.tac +++ b/ds9/parsers/catparser.tac @@ -154,7 +154,7 @@ catCmd : coordinate | SAVE_ STRING_ {CatalogCmdSave $2 VOTWrite} | SERVER_ server {CatalogCmdCat server $2} | SHOW_ yesno {CatalogCmdGenerate show $2} - | SIZE_ numeric numeric skyformat {CatalogCmdSize $1 $2 $3} + | SIZE_ numeric numeric skyformat {CatalogCmdSize $2 $3 $4} | SKY_ skyframe {CatalogCmdSkyframe $2} | SKYFORMAT_ skyformat {CatalogCmdSkyformat $2} | SORT_ sort @@ -238,8 +238,9 @@ symbol : ADD_ {CatalogCmdSymbolAdd} | CONDITION_ STRING_ {CatalogCmdSymbol condition $2} | FONT_ font {CatalogCmdSymbol font $2} | FONTSIZE_ INT_ {CatalogCmdSymbol fontsize $2} - | FONTWEIGHT_ fontweight {CatalogCmdSymbol fontweight $2} - | FONTSLANT_ fontslant {CatalogCmdSymbol fontslant $2} + | FONTWEIGHT_ fontWeight {CatalogCmdSymbol fontweight $2} + | FONTSLANT_ fontSlant {CatalogCmdSymbol fontslant $2} + | FONTSTYLE_ fontStyle {CatalogCmdSymbolStyle $2} | SIZE_ numeric {CatalogCmdSymbol size $2} | SIZE2_ numeric {CatalogCmdSymbol size2 $2} | SHAPE_ symbolShape {CatalogCmdSymbol shape $2} diff --git a/ds9/parsers/colorbarparser.tac b/ds9/parsers/colorbarparser.tac index bb928ba..e96c97b 100644 --- a/ds9/parsers/colorbarparser.tac +++ b/ds9/parsers/colorbarparser.tac @@ -35,28 +35,22 @@ colorbar : yesno {global view; set view(colorbar) $1; UpdateView} | MATCH_ {MatchColorCurrent} | LOCK_ yesno {global colorbar; set colorbar(lock) $2; LockColorCurrent} - | NUMERICS_ yesno {global colorbar; set colorbar(numerics) $2; UpdateView} - | SPACE_ space {global colorbar; set colorbar(space) $2; UpdateView} - | FONT_ font {global colorbar; set colorbar(font) $2; UpdateView} - | FONTSIZE_ INT_ {global colorbar; set colorbar(font,size) $2; UpdateView} - | FONTWEIGHT_ fontweight {global colorbar; set colorbar(font,weight) $2; UpdateView} - | FONTSLANT_ fontslant {global colorbar; set colorbar(font,slant) $2; UpdateView} -# backward compatibility - | FONTSTYLE_ fontstyle + | NUMERICS_ yesno {ColorbarCmdView numerics $2} + | SPACE_ space {ColorbarCmdView space $2} + | FONT_ font {ColorbarCmdView font $2} + | FONTSIZE_ INT_ {ColorbarCmdView font,size $2} + | FONTWEIGHT_ fontWeight {ColorbarCmdView font,weight $2} + | FONTSLANT_ fontSlant {ColorbarCmdView font,slant $2} + | FONTSTYLE_ fontStyle {ColorbarCmdFontStyle $2} - | orientation {global colorbar; set colorbar(orientation) $1; UpdateView} + | orientation {ColorbarCmdView orientation $1} # backward compatibility - | ORIENTATION_ orientation {global colorbar; set colorbar(orientation) $2; UpdateView} + | ORIENTATION_ orientation {ColorbarCmdView orientation $2} - | SIZE_ INT_ {global colorbar; set colorbar(size) $2; UpdateView} - | TICKS_ INT_ {global colorbar; set colorbar(ticks) $2; UpdateView} + | SIZE_ INT_ {ColorbarCmdView size $2} + | TICKS_ INT_ {ColorbarCmdView ticks $2} ; -fontstyle : NORMAL_ {global colorbar; set colorbar(font,weight) normal; set colorbar(font,slant) roman; UpdateView} - | BOLD_ {global colorbar; set colorbar(font,weight) bold; set colorbar(font,slant) roman; UpdateView} - | ITALIC_ {global colorbar; set colorbar(font,weight) normal; set colorbar(font,slant) italic; UpdateView} - ; - space : VALUE_ {set _ 1} | DISTANCE_ {set _ 0} ; diff --git a/ds9/parsers/font.trl b/ds9/parsers/font.trl index 1ed245b..ba41950 100644 --- a/ds9/parsers/font.trl +++ b/ds9/parsers/font.trl @@ -3,10 +3,16 @@ font : TIMES_ {set _ times} | COURIER_ {set _ courier} ; -fontweight : NORMAL_ {set _ normal} +fontWeight : NORMAL_ {set _ normal} | BOLD_ {set _ bold} ; -fontslant : ROMAN_ {set _ roman} +fontSlant : ROMAN_ {set _ roman} | ITALIC_ {set _ italic} ; + +fontStyle : NORMAL_ {set _ normal} + | BOLD_ {set _ bold} + | ITALIC_ {set _ italic} + ; + diff --git a/ds9/parsers/gridparser.tac b/ds9/parsers/gridparser.tac index c8b7afa..f0d2974 100644 --- a/ds9/parsers/gridparser.tac +++ b/ds9/parsers/gridparser.tac @@ -164,9 +164,9 @@ border : yesno {global grid; set grid(border) $1} numerics : yesno {global grid; set grid(numlab) $1} | FONT_ font {global grid; set grid(numlab,font) $2} | FONTSIZE_ INT_ {global grid; set grid(numlab,size) $2} - | FONTWEIGHT_ fontweight {global grid; set grid(numlab,weight) $2} - | FONTSLANT_ fontslant {global grid; set grid(numlab,slant) $2} - | FONTSTYLE_ numlabfontstyle + | FONTWEIGHT_ fontWeight {global grid; set grid(numlab,weight) $2} + | FONTSLANT_ fontSlant {global grid; set grid(numlab,slant) $2} + | FONTSTYLE_ fontStyle | COLOR_ STRING_ {global grid; set grid(numlab,color) $2} | GAP1_ numeric {global grid; set grid(numlab,gap1) $2} | GAP2_ numeric {global grid; set grid(numlab,gap2) $2} @@ -175,28 +175,18 @@ numerics : yesno {global grid; set grid(numlab) $1} | VERTICAL_ yesno {global grid; set grid(numlab,vertical) $2} ; -numlabfontstyle : NORMAL_ {global grid; set grid(numlab,weight) normal; set grid(numlab,slant) roman} - | BOLD_ {global grid; set grid(numlab,weight) bold; set grid(numlab,slant) roman} - | ITALIC_ {global grid; set grid(numlab,weight) normal; set grid(numlab,slant) italic} - ; - title : yesno {global grid; set grid(title) $1} | TEXT_ STRING_ {global grid; set grid(title,text) $2} | DEF_ yesno {global grid; set grid(title,def) $2} | GAP_ numeric {global grid; set grid(title,gap) $2} | FONT_ font {global grid; set grid(title,font) $2} | FONTSIZE_ INT_ {global grid; set grid(title,size) $2} - | FONTWEIGHT_ fontweight {global grid; set grid(title,weight) $2} - | FONTSLANT_ fontslant {global grid; set grid(title,slant) $2} - | FONTSTYLE_ titlefontstyle + | FONTWEIGHT_ fontWeight {global grid; set grid(title,weight) $2} + | FONTSLANT_ fontSlant {global grid; set grid(title,slant) $2} + | FONTSTYLE_ fontStyle | COLOR_ STRING_ {global grid; set grid(title,color) $2} ; -titlefontstyle : NORMAL_ {global grid; set grid(title,weight) normal; set grid(title,slant) roman} - | BOLD_ {global grid; set grid(title,weight) bold; set grid(title,slant) roman} - | ITALIC_ {global grid; set grid(title,weight) normal; set grid(title,slant) italic} - ; - labels : yesno {global grid; set grid(textlab) $1} | TEXT1_ STRING_ {global grid; set grid(textlab,text1) $2} | TEXT2_ STRING_ {global grid; set grid(textlab,text2) $2} @@ -206,17 +196,12 @@ labels : yesno {global grid; set grid(textlab) $1} | GAP2_ numeric {global grid; set grid(textlab,gap2) $2} | FONT_ font {global grid; set grid(textlab,font) $2} | FONTSIZE_ INT_ {global grid; set grid(textlab,size) $2} - | FONTWEIGHT_ fontweight {global grid; set grid(textlab,weight) $2} - | FONTSLANT_ fontslant {global grid; set grid(textlab,slant) $2} - | FONTSTYLE_ labelsfontstyle + | FONTWEIGHT_ fontWeight {global grid; set grid(textlab,weight) $2} + | FONTSLANT_ fontSlant {global grid; set grid(textlab,slant) $2} + | FONTSTYLE_ fontStyle | COLOR_ STRING_ {global grid; set grid(textlab,color) $2} ; -labelsfontstyle : NORMAL_ {global grid; set grid(textlab,weight) normal; set grid(textlab,slant) roman} - | BOLD_ {global grid; set grid(textlab,weight) bold; set grid(textlab,slant) roman} - | ITALIC_ {global grid; set grid(textlab,weight) normal; set grid(textlab,slant) italic} - ; - view : GRID_ yesno {global grid; set grid(grid) $1} | AXES_ viewaxes | TITLE_ yesno {global grid; set grid(title) $2} diff --git a/ds9/parsers/plotlex.fcl b/ds9/parsers/plotlex.fcl index 1ace9ce..b78964d 100644 --- a/ds9/parsers/plotlex.fcl +++ b/ds9/parsers/plotlex.fcl @@ -41,6 +41,7 @@ landscape {return $LANDSCAPE_} left {return $LEFT_} legal {return $LEGAL_} legend {return $LEGEND_} +legendtitle {return $LEGEND_} letter {return $LETTER_} line {return $LINE_} linear {return $LINEAR_} @@ -83,6 +84,7 @@ square {return $SQUARE_} stacked {return $STACKED_} stats {return $STATS_} step {return $STEP_} +style {return $STYLE_} tabloid {return $TABLOID_} title {return $TITLE_} top {return $TOP_} diff --git a/ds9/parsers/plotparser.tac b/ds9/parsers/plotparser.tac index 73cd1be..0d36e0f 100644 --- a/ds9/parsers/plotparser.tac +++ b/ds9/parsers/plotparser.tac @@ -42,6 +42,7 @@ %token LEFT_ %token LEGAL_ %token LEGEND_ +%token LEGENDTITLE_ %token LETTER_ %token LINE_ %token LINEAR_ @@ -84,6 +85,7 @@ %token STACKED_ %token STATS_ %token STEP_ +%token STYLE_ %token TABLOID_ %token TITLE_ %token TOP_ @@ -117,18 +119,18 @@ plot : new plotCmd : DATA_ dim | LOAD_ load - | SAVE_ STRING_ - | CLEAR_ - | DUPLICATE_ - | STATS_ - | LIST_ - | LOADCONFIG_ STRING_ - | SAVECONFIG_ STRING_ + | SAVE_ STRING_ {PlotCmdSave $2} + | CLEAR_ {global cvarname; PlotClearData $cvarname} + | DUPLICATE_ duplicate + | STATS_ yesno {PlotCmdStats $2} + | LIST_ yesno {PlotCmdList $2} + | LOADCONFIG_ STRING_ {PlotCmdLoadConfig $2} + | SAVECONFIG_ STRING_ {PlotCmdSaveConfig $2} | PAGESETUP_ pagesetup | PRINT_ print - | CLOSE_ + | CLOSE_ {global cvarname; PlotDestroy $cvarname} - | MODE_ mode + | MODE_ mode {PlotCmdMode $2} | AXIS_ axis | LEGEND_ legend @@ -175,12 +177,16 @@ xy : 'x' {set _x} | 'Y' {set _ y} ; -load : STRING_ - | STRING_ dim +load : STRING_ {PlotCmdLoad $1 xy} + | STRING_ dim {PlotCmdLoad $1 $2} ; -pagesetup : ORIENT_ pageOrient - | SIZE_ pageSize +duplicate : {global cvarname; PlotDupData $cvarname 1} + | INT_ {global cvarname; PlotDupData $cvarname $1} + ; + +pagesetup : ORIENT_ pageOrient {global ps; set ps(orient) $2} + | SIZE_ pageSize {global ps; set ps(size) $2} ; pageOrient : PORTRAIT_ {set _ portrait} @@ -194,10 +200,10 @@ pageSize : LETTER_ {set _ letter} | A4_ {set _ a4} ; -print : DESTINATION_ printDest - | COMMAND_ STRING_ - | FILENAME_ STRING_ - | COLOR_ printColor +print : DESTINATION_ printDest {global ps; set ps(dest) $2} + | COMMAND_ STRING_ {global ps; set ps(cmd) $2} + | FILENAME_ STRING_ {global ps; set ps(filename) $2} + | COLOR_ printColor {global ps; set ps(color) $2} ; printDest : PRINTER_ {set _ printer} @@ -212,17 +218,17 @@ mode : POINTER_ {set _ pointer} | ZOOM_ {set _ zoom} ; -axis : xy GRID_ yesno - | xy LOG_ yesno - | xy FLIP_ yesno - | xy AUTO_ yesno - | xy MIN_ numeric - | xy MAX_ numeric - | xy FORMAT_ STRING_ +axis : xy GRID_ yesno {PlotCmdPlot "axis,$1,grid" $3} + | xy LOG_ yesno {PlotCmdPlot $1 "axis,$1,log" $3} + | xy FLIP_ yesno {PlotCmdPlot $1 "axis,$1,flip" $3} + | xy AUTO_ yesno {PlotCmdPlot $1 "axis,$1,auto" $3} + | xy MIN_ numeric {PlotCmdPlot $1 "axis,$1,min" $3} + | xy MAX_ numeric {PlotCmdPlot $1 "axis,$1,max" $3} + | xy FORMAT_ STRING_ {PlotCmdPlot $1 "axis,$1,format" $3} ; -legend : yesno - | POSITION_ legendPos +legend : yesno {PlotCmdPlot legend $1} + | POSITION_ legendPos {PlotCmdPlot "legend,position" $2} ; legendPos : RIGHT_ {set _ right} @@ -231,18 +237,22 @@ legendPos : RIGHT_ {set _ right} | BOTTOM_ {set _ bottom} ; -fontt : fontType FONT_ font - | fontType FONTSIZE_ INT_ - | fontType FONTWEIGHT_ fontweight - | fontType FONTSLANT_ fontslant - | fontType SIZE_ INT_ - | fontType WEIGHT_ fontweight - | fontType SLANT_ fontslant +fontt : fontType FONT_ font {PlotCmdPlot "$1,family" $3} + | fontType FONTSIZE_ INT_ {PlotCmdPlot "$1,size" $3} + | fontType FONTWEIGHT_ fontWeight {PlotCmdPlot "$1,weight" $3} + | fontType FONTSLANT_ fontSlant {PlotCmdPlot "$1,slant" $3} + | fontType FONTSTYLE_ fontStyle + | fontType SIZE_ INT_ {PlotCmdPlot "$1,size" $3} + | fontType WEIGHT_ fontWeight {PlotCmdPlot "$1,weight" $3} + | fontType SLANT_ fontSlant {PlotCmdPlot "$1,slant" $3} + | fontType STYLE_ fontStyle ; -fontType : TITLE_ {set _ title} - | LABELS_ {set _ labels} - | NUMBERS_ {set _ numbers} +fontType : TITLE_ {set _ graph,title} + | LABELS_ {set _ axis,title} + | NUMBERS_ {set _ axis,numbers} + | LEGEND_ {set _ legend,font} + | LEGENDTITLE_ {set _ legend,title} ; title : STRING_ |