From eed2656db0adae2c234c3d74af0913746ed5c444 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 16 Apr 2003 09:43:32 +0000 Subject: Many updates for the 3.2.90 release and new demos --- demos/allOptions.tcl | 46 +++--- demos/atomicGroups.tcl | 2 +- demos/clipping.tcl | 2 +- demos/colorCircular.tcl | 41 +++-- demos/colorX.tcl | 3 +- demos/colorY.tcl | 2 +- demos/curveBezier.tcl | 2 +- demos/data/hegias_parouest_TE.vid | Bin 0 -> 9216 bytes demos/data/videomap_orly | Bin 0 -> 67584 bytes demos/data/videomap_paris-w_90_2 | Bin 0 -> 8192 bytes demos/fillRule.tcl | 2 +- demos/groupsInAtcStrips.tcl | 2 +- demos/groupsPriority.tcl | 2 +- demos/iconTransform.tcl | 2 +- demos/items.tcl | 85 +++++++--- demos/labelformat.tcl | 2 +- demos/lines.tcl | 3 +- demos/mapinfo.tcl | 2 +- demos/pathTags.tcl | 2 +- demos/photoAlpha.tcl | 2 +- demos/reliefs.tcl | 261 +++++++++++++++++++++++++++++ demos/rotation.tcl | 2 +- demos/simpleInteractionTrack.tcl | 2 +- demos/simpleRadar.tcl | 336 ++++++++++++++++++++++++++++++++++++++ demos/textInput.tcl | 2 +- demos/tiger.tcl | 22 +-- demos/tkZincLogo.tcl | 2 +- demos/transforms.tcl | 2 +- demos/translation.tcl | 2 +- demos/triangles.tcl | 2 +- demos/windowContours.tcl | 2 +- demos/zinc-widget | 3 +- demos/zoom.tcl | 2 +- 33 files changed, 749 insertions(+), 93 deletions(-) create mode 100644 demos/data/hegias_parouest_TE.vid create mode 100644 demos/data/videomap_orly create mode 100644 demos/data/videomap_paris-w_90_2 create mode 100644 demos/reliefs.tcl create mode 100644 demos/simpleRadar.tcl diff --git a/demos/allOptions.tcl b/demos/allOptions.tcl index e4454fe..0e66b2d 100644 --- a/demos/allOptions.tcl +++ b/demos/allOptions.tcl @@ -18,17 +18,19 @@ button $w.buttons.code -text "See Code" -command "showCode $w" pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 # The explanation displayed when running this demo -label $w.label -text "Click on one of the following\nbuttons to get a list of Item\nattributes (or zinc options)\nwith their types.\n" -justify "left" +label $w.label -justify left -text {Click on one of the following +buttons to get a list of Item +attributes (or zinc options) +with their types.} pack $w.label -padx 10 -pady 10 # Creating the zinc widget -zinc $w.zinc -width 1 -height 1 -font "10x20" -borderwidth 0 -relief "sunken" +zinc $w.zinc -width 1 -height 1 -font 10x20 -borderwidth 0 -relief sunken pack $w.zinc # Creating an instance of every item type -#my %itemtypes; # These Items have fields! So the number of fields must be given at creation time foreach type {tabular track waypoint} { @@ -43,12 +45,12 @@ foreach type {group icon map reticle text window} { # These items needs some coordinates at creation time # However curves usually needs more than 2 points. foreach type {arc curve rectangle} { - set itemtypes($type) [$w.zinc add $type 1 "0 0 1 1"] + set itemtypes($type) [$w.zinc add $type 1 {0 0 1 1}] } # Triangles item needs at least 3 points for the coordinates foreach type {triangles} { - set itemtypes($type) [$w.zinc add $type 1 "0 0 1 1 2 2"] + set itemtypes($type) [$w.zinc add $type 1 {0 0 1 1 2 2}] } @@ -56,28 +58,28 @@ proc showAllOptions { w type} { global itemtypes if [winfo exists .tl] {destroy .tl} toplevel .tl - set title "All options of an item $type" - #my @option return - if {[string compare $type "zinc"]==0} { + if {[string compare $type zinc]==0} { set options [$w.zinc configure] - set typeopt "optionClass" - set readopt "defaultValue" - set title "All options of zinc widget" + set typeopt optionClass + set readopt defaultValue + set readoff 3 + set title {All options of zinc widget} } else { set options [$w.zinc itemconfigure $itemtypes($type)]; - set title "All attributes of an item $type" - set typeopt "Type" - set readopt "ReadOnly" + set title "All attributes of an $type item" + set typeopt Type + set readopt ReadOnly + set readoff 2 } - #.tl configure -title $title + wm title .tl $title frame .tl.f1 - set bgcolor "ivory" + set bgcolor ivory - label .tl.f1.opt -text "Option" -background $bgcolor -relief "ridge" -width 20 - label .tl.f1.typ -text $typeopt -background $bgcolor -relief "ridge" -width 20 - label .tl.f1.rd -text $readopt -background $bgcolor -relief "ridge" -width 21 + label .tl.f1.opt -text Option -background $bgcolor -relief ridge -width 20 + label .tl.f1.typ -text $typeopt -background $bgcolor -relief ridge -width 20 + label .tl.f1.rd -text $readopt -background $bgcolor -relief ridge -width 21 pack .tl.f1.opt .tl.f1.typ .tl.f1.rd -side left set nbelem [llength $options] @@ -86,13 +88,13 @@ proc showAllOptions { w type} { listbox .tl.f2.l2 -width 20 -height $nbelem listbox .tl.f2.l3 -width 20 -height $nbelem pack .tl.f2.l1 .tl.f2.l2 .tl.f2.l3 -side left - pack .tl.f1 .tl.f2 -side top -anchor "nw" + pack .tl.f1 .tl.f2 -side top -anchor nw # Remplissage des list box foreach elem $options { .tl.f2.l1 insert end [lindex $elem 0] .tl.f2.l2 insert end [lindex $elem 1] - .tl.f2.l3 insert end [lindex $elem 3] + .tl.f2.l3 insert end [lindex $elem $readoff] } } @@ -106,7 +108,7 @@ foreach type [lsort [array names itemtypes]] { } foreach type [lsort [array names itemtypes]] { - button $w.col.$type -text "$type" -width $width -command {showAllOptions $w $type} + button $w.col.$type -text "$type" -width $width -command "showAllOptions $w $type" pack $w.col.$type -pady 4 } diff --git a/demos/atomicGroups.tcl b/demos/atomicGroups.tcl index 97cd362..0c3b8bb 100644 --- a/demos/atomicGroups.tcl +++ b/demos/atomicGroups.tcl @@ -12,7 +12,7 @@ toplevel $w wm title $w "Zinc Atomicity Demonstration" wm iconname $w "Atomic" -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/clipping.tcl b/demos/clipping.tcl index 53a357e..435a581 100644 --- a/demos/clipping.tcl +++ b/demos/clipping.tcl @@ -11,7 +11,7 @@ toplevel $w wm title $w "Zinc Clipping Demonstration" wm iconname $w "Clipping" -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/colorCircular.tcl b/demos/colorCircular.tcl index 016e02d..63041c2 100644 --- a/demos/colorCircular.tcl +++ b/demos/colorCircular.tcl @@ -17,31 +17,44 @@ button $w.buttons.dismiss -text Dismiss -command "destroy $w" button $w.buttons.code -text "See Code" -command "showCode $w" pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] + zinc $w.zinc -width 700 -height 600 -borderwidth 3 -relief sunken -render 1 pack $w.zinc -$w.zinc add rectangle 1 {10 10 80 80} -fillcolor {red|blue 50 50} -filled 1 -$w.zinc add text 1 -font $defaultfont -text "Radial variation from non-transparent red to non-transparent blue\nin a squarre. The gradient starts from the lower right corner.\n" -anchor nw -position {120 20} -$w.zinc add arc 1 {10 110 90 190} -fillcolor {red;40|blue;40 0 25} -filled 1 +$w.zinc add rectangle 1 {10 10 80 80} -fillcolor {=radial 50 50|red|blue} -filled 1 +$w.zinc add text 1 -font $defaultfont -text {Radial variation from non-transparent red to non-transparent blue in a square. +The gradient starts in the lower right corner.} -anchor nw -position {120 20} + +$w.zinc add arc 1 {10 110 90 190} -fillcolor {=radial 0 25|red;40|blue;40} -filled 1 -$w.zinc add text 1 -font $defaultfont -text "Radial variation from 40%transparent red to 40% transparent blue\nin a disc. The gradient starts in the middle between\nthe center on the bottom point" -anchor nw -position {120 120} +$w.zinc add text 1 -font $defaultfont -text {Radial variation from 40% transparent red to 40% transparent blue in a disc. +The gradient starts mid way between the center and the bottom.} \ + -anchor nw -position {120 120} -$w.zinc add arc 1 {10 210 90 290} -fillcolor {red;40|green;40 50|blue;40 0 0} -filled 1 +$w.zinc add arc 1 {10 210 90 290} -fillcolor {=radial 0 0|red;40|green;40 50|blue;40} -filled 1 -$w.zinc add text 1 -font $defaultfont -text "A variation from 40%transparent red to 40% transparent blue.\nthrough a 40%green on the middle of the disc. The gradient is centered." -anchor nw -position {120 220} +$w.zinc add text 1 -font $defaultfont -text {A variation from 40% transparent red to 40% transparent blue +through 40% green in the middle of the disc. The gradient is centered.} \ + -anchor nw -position {120 220} -$w.zinc add text 1 -font $defaultfont -text "Two overlaping radialy transparently colored items on a white background" -anchor nw -position {20 320} +$w.zinc add text 1 -font $defaultfont -text {Two overlapping items filled by a transparent radial gradient on a white background. +On the right three gradient filled ovals, note the warped gradients following the ovals.} -anchor w -position {20 320} $w.zinc add rectangle 1 {10 340 690 590} -fillcolor white -filled 1 -$w.zinc add rectangle 1 {20 365 220 565} -fillcolor {red;40|green;40 50|blue;40 0 0} -filled 1 +$w.zinc add rectangle 1 {20 365 220 565} -fillcolor {=radial 0 0|red;40|green;40 50|blue;40} -filled 1 -$w.zinc add arc 1 {150 365 350 565} -fillcolor {yellow;40|black;40 50|cyan;40 0 0} -filled 1 +$w.zinc add arc 1 {150 365 350 565} -fillcolor {=radial 0 0|yellow;40|black;40 50|cyan;40} -filled 1 -$w.zinc add arc 1 {280 365 480 565} -fillcolor {black;100|black;100 20|white;40 0 0} -filled 1 -linewidth 0 +$w.zinc add arc 1 {280 365 480 565} -fillcolor {=radial 0 0|black;100|black;100 20|mistyrose;40} -filled 1 -linewidth 0 -$w.zinc add arc 1 {480 365 580 500} -fillcolor {black;100|white;40 -10 16} -filled 1 +set warc [$w.zinc add arc 1 {-50 -50 50 50} \ + -fillcolor {=radial -10 16|black;80|blue;20 90 100} -filled 1] +$w.zinc scale $warc 1.5 1 +$w.zinc translate $warc 500 432 -$w.zinc add arc 1 {580 410 680 580} -fillcolor {black;70|white;20 -40 -40} -filled 1 -$w.zinc add arc 1 {580 410 680 580} -fillcolor {black;70|white;20 40 40} -filled 1 \ No newline at end of file +set warc [$w.zinc add arc 1 {-50 -50 50 50} \ + -fillcolor {=radial 0 20|black;70|green;20} -filled 1] +$w.zinc scale $warc 1 1.5 +$w.zinc translate $warc 630 432 diff --git a/demos/colorX.tcl b/demos/colorX.tcl index 87a78b8..c93ba35 100644 --- a/demos/colorX.tcl +++ b/demos/colorX.tcl @@ -17,7 +17,8 @@ button $w.buttons.dismiss -text Dismiss -command "destroy $w" button $w.buttons.code -text "See Code" -command "showCode $w" pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] + zinc $w.zinc -width 700 -height 600 -borderwidth 3 -relief sunken -render 1 pack $w.zinc diff --git a/demos/colorY.tcl b/demos/colorY.tcl index 08f4788..7ebd4c8 100644 --- a/demos/colorY.tcl +++ b/demos/colorY.tcl @@ -17,8 +17,8 @@ button $w.buttons.dismiss -text Dismiss -command "destroy $w" button $w.buttons.code -text "See Code" -command "showCode $w" pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 +set defaultfont [font create -family Helvetica -size 10 -weight bold] -set defaultfont -adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-* zinc $w.zinc -width 700 -height 600 -borderwidth 3 -relief sunken -render 1 pack $w.zinc diff --git a/demos/curveBezier.tcl b/demos/curveBezier.tcl index 9546a41..eac012c 100644 --- a/demos/curveBezier.tcl +++ b/demos/curveBezier.tcl @@ -12,7 +12,7 @@ toplevel $w wm title $w "Zinc Curve Bezier Demonstration" wm iconname $w Curve -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/data/hegias_parouest_TE.vid b/demos/data/hegias_parouest_TE.vid new file mode 100644 index 0000000..1755d80 Binary files /dev/null and b/demos/data/hegias_parouest_TE.vid differ diff --git a/demos/data/videomap_orly b/demos/data/videomap_orly new file mode 100644 index 0000000..17f9c66 Binary files /dev/null and b/demos/data/videomap_orly differ diff --git a/demos/data/videomap_paris-w_90_2 b/demos/data/videomap_paris-w_90_2 new file mode 100644 index 0000000..fb32a5b Binary files /dev/null and b/demos/data/videomap_paris-w_90_2 differ diff --git a/demos/fillRule.tcl b/demos/fillRule.tcl index b4e7162..d04b211 100644 --- a/demos/fillRule.tcl +++ b/demos/fillRule.tcl @@ -11,7 +11,7 @@ toplevel $w wm title $w "Zinc Fillrule Demonstration" wm iconname $w "Fillrule" -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/groupsInAtcStrips.tcl b/demos/groupsInAtcStrips.tcl index 578b688..c5739f1 100644 --- a/demos/groupsInAtcStrips.tcl +++ b/demos/groupsInAtcStrips.tcl @@ -52,7 +52,7 @@ toplevel $w wm title $w "Atc electronic strips using groups" wm iconname $w groupsInAtcStrips -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/groupsPriority.tcl b/demos/groupsPriority.tcl index 1272fea..f58ed27 100644 --- a/demos/groupsPriority.tcl +++ b/demos/groupsPriority.tcl @@ -12,7 +12,7 @@ toplevel $w wm title $w "Zinc Groups priority Demonstration" wm iconname $w Groups -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/iconTransform.tcl b/demos/iconTransform.tcl index 4d00bad..e6384c2 100644 --- a/demos/iconTransform.tcl +++ b/demos/iconTransform.tcl @@ -13,7 +13,7 @@ toplevel $w wm title $w "Zinc icon scale/rotate Demonstration" wm iconname $w iconTransform -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/items.tcl b/demos/items.tcl index 0f18218..1667f86 100644 --- a/demos/items.tcl +++ b/demos/items.tcl @@ -11,29 +11,38 @@ toplevel $w wm title $w "Zinc Item Demonstration" wm iconname $w Items -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons -pack $w.buttons -side bottom -fill x -pady 2m +grid $w.buttons -row 4 -column 1 -columnspan 2 -sticky we -pady 2m button $w.buttons.dismiss -text Dismiss -command "destroy $w" button $w.buttons.code -text "See Code" -command "showCode $w" pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 -zinc $w.zinc -width 700 -height 600 -font 10x20 -borderwidth 3 -relief sunken +scrollbar $w.vscroll -command "$w.zinc yview" +grid $w.vscroll -row 2 -column 2 -sticky ns +scrollbar $w.hscroll -orient horiz -command "$w.zinc xview" +grid $w.hscroll -row 3 -column 1 -sticky we -pack $w.zinc +zinc $w.zinc -width 700 -height 600 -scrollregion {-100 0 1000 1000} \ + -xscrollcommand "$w.hscroll set" \ + -yscrollcommand "$w.vscroll set" \ + -font 10x20 -borderwidth 3 -relief sunken +grid $w.zinc -row 2 -column 1 -sticky news -$w.zinc add rectangle 1 {10 10 100 50} -fillcolor green -filled 1 -linewidth 10 -relief roundridge -linecolor darkgreen +$w.zinc add rectangle 1 {10 10 100 50} -fillcolor green -filled 1 -linewidth 10 \ + -relief roundridge -linecolor darkgreen -$w.zinc add text 1 -font $defaultfont -text "A filled rectangle with a \"roundridge\" relief border of 10 pixels." -anchor nw -position {120 20} - +$w.zinc add text 1 -font $defaultfont -anchor nw -position {120 20} \ + -text {A filled rectangle with a "roundridge" relief border of 10 pixels.} set labelformat {x82x60+0+0 x60a0^0^0 x32a0^0>1 a0a0>2>1 x32a0>3>1 a0a0^0>2}; set x 20; set y 120; -set track [$w.zinc add track 1 6 -labelformat $labelformat -position "$x $y" -speedvector {40 -10} -speedvectormark 1 -speedvectorticks 1] +set track [$w.zinc add track 1 6 -labelformat $labelformat -position "$x $y" \ + -speedvector {40 -10} -speedvectormark 1 -speedvectorticks 1] # moving the track, to display past positions for {set i 0} {$i<=5} {incr i} { @@ -42,7 +51,9 @@ for {set i 0} {$i<=5} {incr i} { $w.zinc coords "$track" "$x1 $y1" } -$w.zinc add text 1 -font $defaultfont -text "A flight track for a radar display. (A waypoint looks similar,\nbut has no speedvector neither past positions)" -anchor nw -position {200 80} +$w.zinc add text 1 -font $defaultfont -anchor nw -position {200 80} \ + -text {A flight track for a radar display. A waypoint looks similar, +but has no speed vector and no past positions.} $w.zinc itemconfigure $track 0 -filled 0 -bordercolor DarkGreen -border contour @@ -53,27 +64,34 @@ $w.zinc itemconfigure $track 4 -filled 0 -backcolor gray65 -text 410 $w.zinc itemconfigure $track 5 -filled 0 -backcolor gray65 -text Beacon -$w.zinc add arc 1 {150 140 450 240} -fillcolor gray20 -filled 0 -linewidth 1 -startangle 45 -extent 270 -$w.zinc add arc 1 {260 150 340 230} -fillcolor gray20 -filled 0 -linewidth 1 -startangle 45 -extent 270 -pieslice 1 -closed 1 -linestyle mixed -linewidth 3 +$w.zinc add arc 1 {150 140 450 240} -fillcolor gray20 -filled 0 -linewidth 1 \ + -startangle 45 -extent 270 +$w.zinc add arc 1 {260 150 340 230} -fillcolor gray20 -filled 0 -linewidth 1 \ + -startangle 45 -extent 270 -pieslice 1 -closed 1 -linestyle mixed -linewidth 3 -$w.zinc add text 1 -font $defaultfont -text "Two arcs, starting at 45° with an extent of 270°." -anchor nw -position {320 180} +$w.zinc add text 1 -font $defaultfont -anchor nw -position {320 180} \ + -text {Two arcs, starting at 45° with an extent of 270°} $w.zinc add curve 1 {10 324 24 300 45 432 247 356 128 401} -filled 0 -relief roundgroove # -linewidth 10, ## BUG with zinc 3.2.3g -$w.zinc add text 1 -font $defaultfont -text "An open curve." -anchor nw -position {50 350} +$w.zinc add text 1 -font $defaultfont -text {An open curve} -anchor nw -position {50 350} -$w.zinc add text 1 -font $defaultfont -text "A waypoint" -anchor nw -position {10 480} +$w.zinc add text 1 -font $defaultfont -text {A waypoint} -anchor nw -position {10 480} -set waypoint [$w.zinc add waypoint 1 6 -position {100 520} -labelformat $labelformat -symbol AtcSymbol2 -labeldistance 30] +set waypoint [$w.zinc add waypoint 1 6 -position {100 520} -labelformat $labelformat \ + -symbol AtcSymbol2 -labeldistance 30] for {set fieldId 1} {$fieldId<=5} {incr fieldId} { - $w.zinc itemconfigure $waypoint $fieldId -filled 0 -bordercolor DarkGreen -border contour -text "field$fieldId" + $w.zinc itemconfigure $waypoint $fieldId -filled 0 -bordercolor DarkGreen \ + -border contour -text "field$fieldId" } -$w.zinc add text 1 -font $defaultfont -text "3 tabulars of 2 fields,\nattached together." -anchor nw -position {510 380} +$w.zinc add text 1 -font $defaultfont -anchor nw -position {510 380} \ + -text {3 tabulars of 2 fields, +attached together.} set labelformat2 {x72x40 x72a0^0^0 x34a0^0>1} @@ -84,14 +102,37 @@ set tabular3 [$w.zinc add tabular 1 6 -connecteditem $tabular2 -labelformat $lab set count 1 foreach tab "$tabular1 $tabular2 $tabular3" { - $w.zinc itemconfigure $tab 1 -filled 0 -bordercolor DarkGreen -border "contour" -text tabular - $w.zinc itemconfigure $tab 2 -filled 0 -bordercolor DarkGreen -border "contour" -text "n°$count" + $w.zinc itemconfigure $tab 1 -filled 0 -bordercolor DarkGreen -border contour -text tabular + $w.zinc itemconfigure $tab 2 -filled 0 -bordercolor DarkGreen -border contour -text "n°$count" incr count } -$w.zinc add reticle 1 -position {530 550} -firstradius 20 -numcircles 6 -period 2 -stepsize 20 -brightlinestyle dashed -brightlinecolor darkred +$w.zinc add reticle 1 -position {530 550} -firstradius 20 -numcircles 6 \ + -period 2 -stepsize 20 -brightlinestyle dashed -brightlinecolor darkred + +$w.zinc add text 1 -font $defaultfont -text {a reticle with 6 circles} \ + -anchor nw -position {530 540} + +bind $w.zinc "press $w.zinc motion %x %y" +bind $w.zinc "release $w.zinc" -$w.zinc add text 1 -font $defaultfont -text "a reticle of 6 circles." -anchor nw -position {530 540} +proc press {z action x y} { + global curX curY + + set curX $x + set curY $y + bind $z "$action $z %x %y" +} -$w.zinc add text 1 -font $defaultfont -text "maps, triangles and groups items\nare not demonstrated here." -anchor nw -position {10 550} +proc motion {z x y} { + global curX curY + + $z translate current [expr $x - $curX] [expr $y - $curY] + set curX $x + set curY $y +} + +proc release {z} { + bind $z {} +} diff --git a/demos/labelformat.tcl b/demos/labelformat.tcl index 8d9f2a3..d7c0781 100644 --- a/demos/labelformat.tcl +++ b/demos/labelformat.tcl @@ -11,7 +11,7 @@ toplevel $w wm title $w "Zinc Label Format Demonstration" wm iconname $w Label -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/lines.tcl b/demos/lines.tcl index dab5f0a..a540ac8 100644 --- a/demos/lines.tcl +++ b/demos/lines.tcl @@ -17,7 +17,8 @@ button $w.buttons.dismiss -text Dismiss -command "destroy $w" button $w.buttons.code -text "See Code" -command "showCode $w" pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] + zinc $w.zinc -width 700 -height 600 -font 10x20 -borderwidth 3 -relief sunken pack $w.zinc diff --git a/demos/mapinfo.tcl b/demos/mapinfo.tcl index 02189e1..4d3b5fa 100644 --- a/demos/mapinfo.tcl +++ b/demos/mapinfo.tcl @@ -11,7 +11,7 @@ toplevel $w wm title $w "Zinc Mapinfo Demonstration" wm iconname $w Mapinfo -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/pathTags.tcl b/demos/pathTags.tcl index de2779b..238d197 100644 --- a/demos/pathTags.tcl +++ b/demos/pathTags.tcl @@ -12,7 +12,7 @@ toplevel $w wm title $w "Zinc Path tags Demonstration" wm iconname $w "Path tags" -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/photoAlpha.tcl b/demos/photoAlpha.tcl index 3f0908b..212ba97 100644 --- a/demos/photoAlpha.tcl +++ b/demos/photoAlpha.tcl @@ -13,7 +13,7 @@ toplevel $w wm title $w "Zinc photo transparency Demonstration" wm iconname $w photoAlpha -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/reliefs.tcl b/demos/reliefs.tcl new file mode 100644 index 0000000..d9fefa4 --- /dev/null +++ b/demos/reliefs.tcl @@ -0,0 +1,261 @@ +# $Id$ +# this simple demo has been developped by P.Lecoanet + +if {![info exists zincDemo]} { + error "This script should be run from the zinc-widget demo." +} + +package require Img + +set w .reliefs +catch {destroy $w} +toplevel $w +wm title $w "Zinc photo transparency Demonstration" +wm iconname $w reliefs + +set allReliefs {flat raised sunken groove ridge \ + roundraised roundsunken roundgroove roundridge \ + sunkenrule raisedrule} + +set defaultfont [font create -family Helvetica -size 10 -weight bold] + +frame $w.buttons +pack $w.buttons -side bottom -fill x -pady 2m +button $w.buttons.dismiss -text Dismiss -command "destroy $w" +button $w.buttons.code -text "See Code" -command "showCode $w" +pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 + + + +########################################### +# Text zone +####################### +#################### + +text $w.text -relief sunken -borderwidth 2 -height 8 -width 50 +pack $w.text -expand yes -fill both + +$w.text insert end { This demo lets you play with the various relief parameters +on rectangles polygons and arcs. Some reliefs and The smooth relief +capability is only available with openGL. + You can modify the items with your mouse: + + Drag-Button 1 for moving Ctrl/Shft-Button 1 for Incr/Decr sides + Drag-Button 2 for zooming Ctrl/Shft-Button 2 for cycling reliefs + Drag-Button 3 for rotating Ctrl/Shft-Button 3 for Incr/Decr border} + + +########################################### +# Zinc +########################################## +proc deg2Rad {deg} { + return [expr 3.14159 * $deg / 180.0] +} + +proc rad2Deg {rad} { + return [expr int(fmod(($rad * 180.0 / 3.14159)+360.0, 360.0))] +} + +set bw 4 +set width 60 +set lightAngle 120 +set lightAngleRad [deg2Rad $lightAngle] +set zincSize 500 + +zinc $w.zinc -width $zincSize -height $zincSize -render 1 -font 10x20 \ + -highlightthickness 0 -borderwidth 0 -relief sunken -backcolor lightgray \ + -lightangle $lightAngle +pack $w.zinc -expand t -fill both + +set topGroup [$w.zinc add group 1] + +proc polyPoints { ox oy rad n } { + set step [expr 2 * 3.14159 / $n] + for {set i 0} {$i < $n} {incr i} { + set x [expr $ox + ($rad * cos($i * $step))]; + set y [expr $oy + ($rad * sin($i * $step))]; + lappend coords $x $y; + } + lappend coords [lindex $coords 0] [lindex $coords 1] + return $coords +} + +proc makePoly {x y bw sides color group} { + global w state allReliefs width + + set relief 2 + + set g [$w.zinc add group $group] + $w.zinc translate $g $x $y + $w.zinc add curve $g [polyPoints 0 0 $width $sides] \ + -relief [lindex $allReliefs $relief] -linewidth $bw \ + -smoothrelief 1 -fillcolor $color -linecolor $color \ + -filled t -tags {subject polygon} + $w.zinc add text $g -anchor center \ + -text [lindex $allReliefs $relief] -tags {subject relief} + $w.zinc add text $g -anchor center -position {0 16} \ + -text $bw -tags {subject bw} + set state($g,sides) $sides + set state($g,relief) $relief + set state($g,bw) $bw + return $g +} + +set poly [makePoly 100 100 $bw 8 lightblue $topGroup] +set poly [makePoly [expr 100 + 2*($width + 10)] 100 $bw 8 tan $topGroup] +set poly [makePoly [expr 100 + 4*($width + 10) ] 100 $bw 8 slateblue $topGroup] + +proc lightCenter {radius angle} { + return [list [expr $radius * (1 + 0.95*cos($angle))] \ + [expr $radius * (1 - 0.95*sin($angle))]] +} + +# +# Place the light at lightAngle on the circle +$w.zinc add arc 1 {-5 -5 5 5} -filled 1 -fillcolor yellow \ + -tags light -priority 10 +eval "$w.zinc translate light [lightCenter [expr $zincSize/2] $lightAngleRad]" + +# +# Controls. +# +$w.zinc bind subject "press motion %x %y" +$w.zinc bind subject release +$w.zinc bind subject "press zoom %x %y" +$w.zinc bind subject release +$w.zinc bind subject "press mouseRotate %x %y" +$w.zinc bind subject release + +$w.zinc bind polygon "incrPolySides 1" +$w.zinc bind polygon "incrPolySides -1" + +$w.zinc bind subject "cycleRelief 1" +$w.zinc bind subject "cycleRelief -1" + +$w.zinc bind subject "incrBW 1" +$w.zinc bind subject "incrBW -1" + +$w.zinc bind light "press lightMotion %x %y" +$w.zinc bind light release + +set curX 0 +set curY 0 +set curAngle 0 + +proc press {action x y} { + global w curAngle curX curY + + $w.zinc raise [$w.zinc group current] + + set curX $x + set curY $y + set curAngle [expr atan2($y, $x)] + bind $w.zinc "$action %x %y" +} + +proc motion {x y} { + global w curX curY topGroup + + foreach {x1 y1 x2 y2} [$w.zinc transform $topGroup \ + [list $x $y $curX $curY]] break + $w.zinc translate [$w.zinc group current] [expr $x1 - $x2] [expr $y1 - $y2] + set curX $x + set curY $y +} + +proc lightMotion {x y} { + global w zincSize topGroup + + set radius [expr $zincSize/2] + if { $x < 0 } { + set x 0 + } elseif { $x > $zincSize } { + set x $zincSize + } + + set angle [expr acos(double($x-$radius)/$radius)] + if { $y > $radius } { + set angle [expr - $angle] + } + $w.zinc treset light + eval "$w.zinc translate light [lightCenter [expr $zincSize/2] $angle]" + $w.zinc configure -lightangle [rad2Deg $angle] +} + +proc zoom {x y} { + global w curX curY + + if {$x > $curX} { + set maxX $x + } else { + set maxX $curX + } + if {$y > $curY} { + set maxY $y + } else { + set maxY $curY + } + if {($maxX == 0) || ($maxY == 0)} { + return; + } + set sx [expr 1.0 + (double($x - $curX) / $maxX)] + set sy [expr 1.0 + (double($y - $curY) / $maxY)] + $w.zinc scale current $sx $sx + + set curX $x + set curY $y +} + +proc mouseRotate {x y} { + global w curAngle + + set lAngle [expr atan2($y, $x)] + $w.zinc rotate current [expr $lAngle - $curAngle] + set curAngle $lAngle +} + +proc release {} { + global w + + bind $w.zinc {} +} + +proc incrPolySides {incr} { + global w state width + + set g [$w.zinc group current] + incr state($g,sides) $incr + if { $state($g,sides) < 3 } { + set state($g,sides) 3 + } + + set points [polyPoints 0 0 $width $state($g,sides)] + $w.zinc coords $g.polygon $points +} + +proc cycleRelief {incr} { + global w state allReliefs + + set g [$w.zinc group current] + incr state($g,relief) $incr + if { $state($g,relief) < 0 } { + set state($g,relief) [expr [llength $allReliefs] - 1] + } elseif { $state($g,relief) >= [llength $allReliefs] } { + set state($g,relief) 0 + } + set rlf [lindex $allReliefs $state($g,relief)] + $w.zinc itemconfigure $g.polygon -relief $rlf + $w.zinc itemconfigure $g.relief -text $rlf +} + +proc incrBW {incr} { + global w state + + set g [$w.zinc group current] + incr state($g,bw) $incr + if { $state($g,bw) < 0 } { + set state($g,bw) 0 + } + $w.zinc itemconfigure $g.polygon -linewidth $state($g,bw) + $w.zinc itemconfigure $g.bw -text $state($g,bw) +} diff --git a/demos/rotation.tcl b/demos/rotation.tcl index 488397d..feb899f 100644 --- a/demos/rotation.tcl +++ b/demos/rotation.tcl @@ -13,7 +13,7 @@ toplevel $w wm title $w "Zinc Rotation Demonstration" wm iconname $w Rotation -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/simpleInteractionTrack.tcl b/demos/simpleInteractionTrack.tcl index c24c09c..f03023c 100644 --- a/demos/simpleInteractionTrack.tcl +++ b/demos/simpleInteractionTrack.tcl @@ -12,7 +12,7 @@ toplevel $w wm title $w "Zinc Track Interaction Demonstration" wm iconname $w TrackInteraction -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/simpleRadar.tcl b/demos/simpleRadar.tcl new file mode 100644 index 0000000..9179d4b --- /dev/null +++ b/demos/simpleRadar.tcl @@ -0,0 +1,336 @@ +# $Id$ +# This simple radar has been initially developped by P. Lecoanet +# It has been adapted by C. Mertz for demo purpose. + +if {![info exists zincDemo]} { + error "This script should be run from the zinc-widget demo." +} + +set w .simpleRadar +catch {destroy $w} +toplevel $w +wm title $w "Simple radar display" +wm iconname $w SimpleRadar + +text $w.text -relief sunken -borderwidth 2 -height 11 +pack $w.text -expand yes -fill both + +$w.text insert end {This a very simple radar display, where you can see flight tracks, +a so-called ministrip (green) and and extend flight label (tan background). + The following operations are possible: + Shift-Button 1 for using a square lasso (result in the terminal). + Click Button 2 for identifiying the closest item (result in the terminal). + Button 3 for dragging most items, but not the ministrip (not in the same group). + Shift-Button 3 for zooming independently on X and Y axis. + Ctrl-Button 3 for rotationg graphic objects. + Enter/Leave in flight label fields, speed vector, position and leader, + and in the ministrip fields. + Click Button 1 on flight track to display a route.} + + + +#------------------------------------------------- +# Create zinc +#------------------------------------------------- +set top 1 +set scale 1.0 +set centerX 0.0 +set centerY 0.0 +set zincWidth 800 +set zincHeight 500 +set delay 2000 +set rate 0.3 +array unset tracks +# if true the flights are no more moving +set pause 0 + +zinc $w.zinc -backcolor gray65 -relief sunken -font 10x20 \ + -width $zincWidth -height $zincHeight +pack $w.zinc -expand 1 -fill both + +$w.zinc add group $top -tags {controls radar} +$w.zinc configure -overlapmanager [$w.zinc find withtag radar] + + +#------------------------------------------------- +# Create control panel +#------------------------------------------------- +frame $w.f +pack $w.f +button $w.f.up -text Up -command "set centerY [expr $centerY-30.0]; updateTransform $w.zinc" +grid $w.f.up -row 0 -column 2 -sticky ew +button $w.f.down -text Down -command "set centerY [expr $centerY+30.0]; updateTransform $w.zinc" +grid $w.f.down -row 2 -column 2 -sticky ew +button $w.f.left -text Left -command "set centerY [expr $centerX+30.0]; updateTransform $w.zinc" +grid $w.f.left -row 1 -column 1 +button $w.f.right -text Right -command "set centerY [expr $centerX-30.0]; updateTransform $w.zinc" +grid $w.f.right -row 1 -column 3 +button $w.f.expand -text Expand -command "set scale \[expr $scale*1.1\]; updateTransform $w.zinc" +grid $w.f.expand -row 1 -column 4 +button $w.f.shrink -text Shrink -command "set scale \[expr $scale*0.9\]; updateTransform $w.zinc" +grid $w.f.shrink -row 1 -column 0 +button $w.f.reset -text Reset -command "set scale 1.0; set centerX 0.0; set centerY 0.0; updateTransform $w.zinc" +grid $w.f.reset -row 1 -column 2 -sticky ew +button $w.f.pause -text Pause -command "set pause \[expr ! $pause\]" +grid $w.f.pause -row 0 -column 6 + +#-------------------------------------------------- +# Resize handling code +#-------------------------------------------------- +bind $w.zinc "resize $w.zinc %w %h" + +proc resize {z w h} { + global zincWidth zincHeight + + set bw [$z cget -borderwidth] + set zincWidth [expr $w - 2 * $bw] + set zincHeight [expr $h - 2 * $bw] + updateTransform $z +} + +proc updateTransform {z} { + global centerX centerY zincWidth zincHeight scale + + $z treset 1 + $z translate 1 [expr -$centerX] [expr -$centerY] + $z scale 1 $scale $scale + $z scale 1 1 -1 + $z translate 1 [expr $zincWidth/2] [expr $zincHeight/2] +} + +#------------------------------------------------ +# Create the tracks +#------------------------------------------------ +proc createTracks {z} { + global oneTrack zincWidth zincHeight scale + global centerX centerY tracks + + set w [expr $zincWidth / $scale] + set h [expr $zincHeight / $scale] + + set allTracks {} + + set bOn "$z itemconfigure current \[$z currentpart\] -border contour" + set bOff "$z itemconfigure current \[$z currentpart\] -border noborder" + + for {set i 20} {$i > 0} {incr i -1} { + set item [$z add track radar 6] + lappend allTracks $item + set oneTrack $item + + set tracks($item,x) [expr rand()*$w - $w/2 + $centerX] + set tracks($item,y) [expr rand()*$h - $h/2 + $centerY] + set d [expr (rand() > 0.5) ? 1 : -1] + set tracks($item,vx) [expr (8.0 + rand()*10.0) * $d] + set d [expr (rand() > 0.5) ? 1 : -1] + set tracks($item,vy) [expr (8.0 + rand()*10.0) * $d] + $z itemconfigure $item -position "$tracks($item,x) $tracks($item,y)" -circlehistory 1 \ + -speedvector "$tracks($item,vx) $tracks($item,vy)" -speedvectorsensitive 1 \ + -labeldistance 30 -markersize 20 -historycolor gray30 -filledhistory 0 \ + -labelformat {x80x60+0+0 x63a0^0^0 x33a0^0>1 a0a0>2>1 x33a0>3>1 a0a0^0>2} + $z itemconfigure $item 0 -filled 0 -backcolor gray60 -sensitive 1 + $z itemconfigure $item 1 -filled 1 -backcolor gray55 -text [format {AFR%03i} $i] + $z itemconfigure $item 2 -filled 0 -backcolor gray65 -text 360 + $z itemconfigure $item 3 -filled 0 -backcolor gray65 -text / + $z itemconfigure $item 4 -filled 0 -backcolor gray65 -text 410 + $z itemconfigure $item 5 -filled 0 -backcolor gray65 -text Balise + + for {set j 0} {$j < 6} {incr j} { + $z bind $item:$j $bOn + $z bind $item:$j $bOff + $z bind $item <1> "fieldSensitivity $z" + $z bind $item {} + } + $z bind $item [list $z itemconfigure current -historycolor red3 \ + -symbolcolor red3 -markercolor red3 -leaderwidth 2 \ + -leadercolor red3 -speedvectorwidth 2 -speedvectorcolor red3] + $z bind $item [list $z itemconfigure current -historycolor black \ + -symbolcolor black -markercolor black -leaderwidth 1 \ + -leadercolor black -speedvectorwidth 1 -speedvectorcolor black] + $z bind $item:position <1> "createRoute $z" + $z bind $item:position {} + set tracks($item,route) 0 + } + + set tracks(all) $allTracks +} + +createTracks $w.zinc + +#--------------------------------------------------- +# Create route way points +#--------------------------------------------------- +proc createRoute {z} { + global tracks + + set track [$z find withtag current] + + if { $tracks($track,route) == 0 } { + set x [expr $tracks($track,x) + 8.0 * $tracks($track,vx)] + set y [expr $tracks($track,y) + 8.0 * $tracks($track,vy)] + set connected $track + for {set i 4} {$i > 0} {incr i -1} { + set wp [$z add waypoint radar 2 -position "$x $y" -labelformat x20x18+0+0 \ + -connecteditem $connected -connectioncolor green -symbolcolor green] + $z lower $wp $connected + $z bind $wp:0 "$z itemconfigure current 0 -border contour" + $z bind $wp:position "$z itemconfigure current -symbolcolor red" + $z bind $wp:leader "$z itemconfigure current -leadercolor red" + $z bind $wp:connection "$z itemconfigure current -connectioncolor red" + $z bind $wp:0 "$z itemconfigure current 0 -border noborder" + $z bind $wp:position "$z itemconfigure current -symbolcolor green" + $z bind $wp:leader "$z itemconfigure current -leadercolor black" + $z bind $wp:connection "$z itemconfigure current -connectioncolor green" + $z itemconfigure $wp 0 -text $i -filled 1 -backcolor gray55 + $z bind $wp:position <1> "delWaypoint $z" + set x [expr $x + (2.0 + rand()*8.0) * $tracks($track,vx)] + set y [expr $y + (2.0 + rand()*8.0) * $tracks($track,vy)] + set connected $wp + } + set tracks($track,route) $wp + } else { + set wp $tracks($track,route) + while { $wp != $track } { + set tracks($track,route) [$z itemcget $wp -connecteditem] + $z bind $wp:position <1> {} + $z bind $wp:position {} + $z bind $wp:position {} + $z bind $wp:leader {} + $z bind $wp:leader {} + $z bind $wp:connection {} + $z bind $wp:connection {} + $z bind $wp:0 {} + $z bind $wp:0 {} + $z remove $wp + set wp $tracks($track,route) + } + set tracks($track,route) 0 + } +} + +#----------------------------------------------------- +# Toggle current field sensitivity +#----------------------------------------------------- +proc fieldSensitivity {z} { + set curPart [$z currentpart] + if { [regexp {[0-9]+} $curPart] } { + set onOff [$z itemcget current $curPart -sensitive] + $z itemconfigure current $curPart -sensitive [expr !$onOff] + } +} + +#----------------------------------------------------- +# Removal of a route Waypoint +#----------------------------------------------------- +proc findTrack {z wp} { + set connected $wp + + while { [$z type $connected] != "track" } { + set connected [$z itemcget $connected -connecteditem] + } + return $connected +} + +proc delWaypoint {z} { + global tracks + + set wp [$z find withtag current] + set track [findTrack $z $wp] + set next [$z itemcget $wp -connecteditem] + + set prev $tracks($track,route) + if { $prev != $wp } { + set prevnext [$z itemcget $prev -connecteditem] + while { $prevnext != $wp } { + set prev $prevnext + set prevnext [$z itemcget $prev -connecteditem] + } + } + $z itemconfigure $prev -connecteditem $next + $z bind $wp:position <1> {} + $z remove $wp + if { $wp == $tracks($track,route) } { + if { $next == $track } { + set tracks($track,route) 0 + } else { + set tracks($track,route) $next + } + } +} + + +#--------------------------------------------- +# Create a macro +#--------------------------------------------- +set macro [$w.zinc add tabular radar 10 -labelformat {x73x20+0+0 x20x20+0+0 x53x20+20+0}] +$w.zinc itemconfigure $macro 0 -backcolor tan1 -filled 1 -fillpattern AlphaStipple7 \ + -bordercolor red3 +$w.zinc itemconfigure $macro 1 -text a +$w.zinc itemconfigure $macro 2 -text macro +$w.zinc itemconfigure $macro -connecteditem $oneTrack +foreach part {0 1 2} { + $w.zinc bind $macro:$part "borders $w.zinc 1" + $w.zinc bind $macro:$part "borders $w.zinc 0" +} + +proc borders {z on} { + if { $on } { + set contour contour + } else { + set contour noborder + } + $z itemconfigure current 0 -border $contour +} + +#--------------------------------------------- +# Create a ministrip +#--------------------------------------------- +set ministrip [$w.zinc add tabular 1 10 -position {100 10} \ + -labelformat {x153x80^0^0 x93x20^0^0 x63a0^0>1 a0a0>2>1 x33a0>3>1 a0a0^0>2}] +$w.zinc itemconfigure $ministrip 0 -filled 1 -backcolor grey70 -border contour -bordercolor green +$w.zinc itemconfigure $ministrip 1 -text ministrip -color darkgreen -backcolor grey40 +$w.zinc itemconfigure $ministrip 2 -text field1 -color darkgreen -backcolor grey40 +$w.zinc itemconfigure $ministrip 3 -text field2 -color darkgreen -backcolor grey40 +$w.zinc itemconfigure $ministrip 4 -text f3 -color darkgreen -backcolor grey40 +$w.zinc itemconfigure $ministrip 5 -text field4 -color darkgreen -backcolor grey40 + +foreach field {1 2 3 4 5} { + $w.zinc bind $ministrip:$field \ + "$w.zinc itemconfigure current $field -border contour -filled 1 -color white" + $w.zinc bind $ministrip:$field \ + "$w.zinc itemconfigure current $field -border noborder -filled 0 -color darkgreen" +} + +#------------------------------------------- +# Create some maps +#------------------------------------------- +set dataDir [file join [file dirname [info script]] data] +videomap load [file join $dataDir videomap_paris-w_90_2] 0 paris-w +videomap load [file join $dataDir videomap_orly] 17 orly +videomap load [file join $dataDir hegias_parouest_TE.vid] 0 paris-ouest + +$w.zinc add map radar -color gray80 -mapinfo orly +$w.zinc add map radar -color gray60 -filled 1 -priority 0 \ + -fillpattern AlphaStipple6 -mapinfo paris-ouest +$w.zinc add map radar -color gray50 -mapinfo paris-w + + +#-------------------------------------------- +# Animate tracks along their trajectories +#-------------------------------------------- +set timer [after $delay "refresh $w.zinc"] +bind $w.zinc "puts {canceling timer}; after cancel $timer" + +proc refresh {z} { + global pause timer delay tracks rate + + set timer [after $delay "refresh $z"] + + if { ! $pause } { + foreach t $tracks(all) { + set tracks($t,x) [expr $tracks($t,x) + $tracks($t,vx) * $rate] + set tracks($t,y) [expr $tracks($t,y) + $tracks($t,vy) * $rate] + $z itemconfigure $t -position "$tracks($t,x) $tracks($t,y)" + } + } +} diff --git a/demos/textInput.tcl b/demos/textInput.tcl index 3de2821..ca01de4 100644 --- a/demos/textInput.tcl +++ b/demos/textInput.tcl @@ -17,7 +17,7 @@ toplevel $w wm title $w "Zinc textInput Demonstration" wm iconname $w textInput -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/tiger.tcl b/demos/tiger.tcl index 74b455c..008d68d 100644 --- a/demos/tiger.tcl +++ b/demos/tiger.tcl @@ -12,13 +12,13 @@ if {![info exists zincDemo]} { error "This script should be run from the zinc-widget demo." } -set w .textInput +set w .tiger catch {destroy $w} toplevel $w wm title $w "Zinc tiger (Generated from SVG) Demonstration" wm iconname $w tiger -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m @@ -32,7 +32,8 @@ pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 ########################################## zinc $w.zinc -width 600 -height 600 \ -font 9x15 -borderwidth 0 -backcolor grey90 \ - -render 1 -reshape 1 -fullreshape 1 + -render 1 +# -reshape 1 -fullreshape 1 pack $w.zinc set topGroup [$w.zinc add group 1] @@ -42,10 +43,9 @@ Drag-Button 1 for moving the tiger, Drag-Button 2 for zooming the tiger, } -set clip [$w.zinc add curve 1 { {0 150} {150 0} {470 20} {580 200} - {600 300} {500 560} {50 550} {10 450} {100 480}} \ - -closed 1 -visible 0] -$w.zinc itemconfigure 1 -clip $clip +#set clip [$w.zinc add curve 1 { {0 150} {150 0} {470 20} {580 200} +# {600 300} {500 560} {50 550} {10 450} {100 480}} -closed 1 -visible 0] +#$w.zinc itemconfigure 1 -clip $clip $w.zinc add text 1 -position {51 521} -anchor w \ -priority 20 -text $text -color white @@ -561,7 +561,7 @@ proc motion {x y} { } proc zoom {x y} { - global w topGroup curX curY + global w curX curY if {$x > $curX} { set maxX $x @@ -578,16 +578,16 @@ proc zoom {x y} { } set sx [expr 1.0 + (double($x - $curX) / $maxX)] set sy [expr 1.0 + (double($y - $curY) / $maxY)] - $w.zinc scale $topGroup $sx $sx + $w.zinc scale __svg__1 $sx $sx set curX $x set curY $y } proc mouseRotate {x y} { - global w curAngle topGroup + global w curAngle set lAngle [expr atan2($y, $x)] - $w.zinc rotate $topGroup [expr $lAngle - $curAngle] + $w.zinc rotate __svg__1 [expr $lAngle - $curAngle] set curAngle $lAngle } diff --git a/demos/tkZincLogo.tcl b/demos/tkZincLogo.tcl index 96891f3..2af91d4 100644 --- a/demos/tkZincLogo.tcl +++ b/demos/tkZincLogo.tcl @@ -19,7 +19,7 @@ toplevel $w wm title $w "Zinc logo Demonstration" wm iconname $w tkZincLogo -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/transforms.tcl b/demos/transforms.tcl index 04ef251..be0273e 100644 --- a/demos/transforms.tcl +++ b/demos/transforms.tcl @@ -17,7 +17,7 @@ toplevel $w wm title $w "Zinc Transformation Demonstration" wm iconname $w Transformation -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/translation.tcl b/demos/translation.tcl index 16aa256..18bf6f7 100644 --- a/demos/translation.tcl +++ b/demos/translation.tcl @@ -11,7 +11,7 @@ toplevel $w wm title $w "Zinc Translation Demonstration" wm iconname $w Translation -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/triangles.tcl b/demos/triangles.tcl index bde074c..9c0af14 100644 --- a/demos/triangles.tcl +++ b/demos/triangles.tcl @@ -18,7 +18,7 @@ button $w.buttons.code -text "See Code" -command "showCode $w" pack $w.buttons.dismiss $w.buttons.code -side left -expand 1 -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] zinc $w.zinc -width 700 -height 300 -font 10x20 -render 1 -borderwidth 3 -relief sunken pack $w.zinc diff --git a/demos/windowContours.tcl b/demos/windowContours.tcl index 32d30ab..19e7c03 100644 --- a/demos/windowContours.tcl +++ b/demos/windowContours.tcl @@ -11,7 +11,7 @@ toplevel $w wm title $w "Zinc Contours Demonstration" wm iconname $w Contours -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m diff --git a/demos/zinc-widget b/demos/zinc-widget index 0051f53..7451798 100644 --- a/demos/zinc-widget +++ b/demos/zinc-widget @@ -114,6 +114,7 @@ set lastLine "" } .t insert end "\n" {} "Small applications\n" title .t insert end "1. The famous tiger (better with openGL).\n" {demo demo-tiger} +.t insert end "2. A toy radar display.\n" {demo demo-simpleRadar} .t insert end "\n" {} "All Items\n" title .t insert end "1. Exemples of all items.\n" {demo demo-items} @@ -150,7 +151,7 @@ set lastLine "" .t insert end "5. Axial color variation on the Y axis.\n" {demo demo-colorY} .t insert end "6. Circular color variation.\n" {demo demo-colorCircular} .t insert end "7. The triangles item.\n" {demo demo-triangles} -.t insert end "8. Relief testbed (Better with openGL).\n" {demo demo-reliefs} +.t insert end "8. Relief testbed.\n" {demo demo-reliefs} .t configure -state disabled focus .s diff --git a/demos/zoom.tcl b/demos/zoom.tcl index 038848e..7804b55 100644 --- a/demos/zoom.tcl +++ b/demos/zoom.tcl @@ -12,7 +12,7 @@ toplevel $w wm title $w "Zinc Zoom Demonstration" wm iconname $w Zoom -set defaultfont "-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*" +set defaultfont [font create -family Helvetica -size 10 -weight bold] frame $w.buttons pack $w.buttons -side bottom -fill x -pady 2m -- cgit v1.1