From 64089dca388f5a9a8235a94b4372763875132219 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 2 Feb 2000 14:01:15 +0000 Subject: Passage en Zinc --- sandbox/testarc.tcl | 4 +- sandbox/testicon.tcl | 4 +- sandbox/testpoly.tcl | 4 +- sandbox/testtext.tcl | 4 +- sandbox/testzinc.pl | 180 +++++++++++++++++++++++++-------------------------- sandbox/zinc.tcl | 38 +++++------ 6 files changed, 117 insertions(+), 117 deletions(-) (limited to 'sandbox') diff --git a/sandbox/testarc.tcl b/sandbox/testarc.tcl index 6c3f777..deaf98b 100644 --- a/sandbox/testarc.tcl +++ b/sandbox/testarc.tcl @@ -1,6 +1,6 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 @@ -9,7 +9,7 @@ image create photo logo -file /usr/share/toccata/images/logo.gif #image create photo papier -file /usr/share/toccata/images/dgtexture-dragstrip.xpm image create photo penguin -file /usr/X11R6/include/X11/pixmaps/xpenguin_color.xpm -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both .r configure -width 800 -height 500 #.r configure -drawbboxes t diff --git a/sandbox/testicon.tcl b/sandbox/testicon.tcl index 489478c..5c790e4 100644 --- a/sandbox/testicon.tcl +++ b/sandbox/testicon.tcl @@ -1,6 +1,6 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 @@ -8,7 +8,7 @@ set top 1 image create photo penguin -file /usr/X11R6/include/X11/pixmaps/xpenguin_color.xpm set mask "/usr/X11R6/include/X11/bitmaps/fvwm.xbm" -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both .r configure -width 800 -height 500 #.r configure -drawbboxes t diff --git a/sandbox/testpoly.tcl b/sandbox/testpoly.tcl index 0341bf9..1d64a5e 100644 --- a/sandbox/testpoly.tcl +++ b/sandbox/testpoly.tcl @@ -1,6 +1,6 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 @@ -33,7 +33,7 @@ set show {\ image create photo logo -file /usr/share/toccata/images/logo.gif #image create photo papier -file /usr/share/toccata/images/dgtexture-dragstrip.xpm -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both .r configure -width 1024 -height 800 .r scale $top 1 -1 diff --git a/sandbox/testtext.tcl b/sandbox/testtext.tcl index 747f598..44df4e8 100644 --- a/sandbox/testtext.tcl +++ b/sandbox/testtext.tcl @@ -1,12 +1,12 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 set mask "/usr/X11R6/include/X11/bitmaps/fvwm.xbm" -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both .r configure -width 800 -height 500 .r configure -drawbboxes t diff --git a/sandbox/testzinc.pl b/sandbox/testzinc.pl index ebcb40c..28efa43 100644 --- a/sandbox/testzinc.pl +++ b/sandbox/testzinc.pl @@ -15,113 +15,113 @@ $logo = $mw->Photo(-file => "/home/etienne/images/logo.gif"); # MainLoop; # exit; ################################################### -# creation radar +# creation zinc ################################################### -#$mw->Radar()->pack; +#$mw->Zinc()->pack; #MainLoop; exit; -$radar = $mw->Radar(-backcolor => 'skyblue', -relief => 'sunken'); -$radar->pack(-expand => t, -fill => 'both'); +$zinc = $mw->Zinc(-backcolor => 'skyblue', -relief => 'sunken'); +$zinc->pack(-expand => t, -fill => 'both'); -$radar->configure(-width => 800, -height => 500); -$color = $radar->cget("-backcolor"); print "radar backcolor=$color\n"; +$zinc->configure(-width => 800, -height => 500); +$color = $zinc->cget("-backcolor"); print "zinc backcolor=$color\n"; ################################################### # creation track ################################################### -$track = $radar->add("track", 10); -#$radar->itemconfigure($track, -tags => 'toto'); - -$radar->itemconfigure($track, -position => [1, 1]); -$radar->itemconfigure($track, -position => [10, 10]); -$radar->itemconfigure($track, -position => [20, 20]); -$radar->itemconfigure($track, -position => [30, 30]); -$radar->itemconfigure($track, -position => [40, 40]); -$radar->itemconfigure($track, -position => [50, 50]); -$radar->itemconfigure($track, -position => [60, 50]); -$radar->itemconfigure($track, -speedvector => [20, 0]); -$radar->itemconfigure($track, -symbolcolor => 'red', -labeldistance => 60); -$radar->itemconfigure($track, -markersize => 10, -filledmarker => 1, +$track = $zinc->add("track", 10); +#$zinc->itemconfigure($track, -tags => 'toto'); + +$zinc->itemconfigure($track, -position => [1, 1]); +$zinc->itemconfigure($track, -position => [10, 10]); +$zinc->itemconfigure($track, -position => [20, 20]); +$zinc->itemconfigure($track, -position => [30, 30]); +$zinc->itemconfigure($track, -position => [40, 40]); +$zinc->itemconfigure($track, -position => [50, 50]); +$zinc->itemconfigure($track, -position => [60, 50]); +$zinc->itemconfigure($track, -speedvector => [20, 0]); +$zinc->itemconfigure($track, -symbolcolor => 'red', -labeldistance => 60); +$zinc->itemconfigure($track, -markersize => 10, -filledmarker => 1, -markercolor => "green"); -print "radar itemconfigure :\n\n"; -for $attr ($radar->itemconfigure($track)) { +print "zinc itemconfigure :\n\n"; +for $attr ($zinc->itemconfigure($track)) { print " ( ",join(',', @$attr)," )\n" ; } print "\n"; -$size = $radar->itemcget($track, -markersize); print "track markersize=$size\n"; -(@coords) = $radar->itemcget($track, "-position"); +$size = $zinc->itemcget($track, -markersize); print "track markersize=$size\n"; +(@coords) = $zinc->itemcget($track, "-position"); print "track position=",$coords[0],"+",$coords[1],"\n"; -$radar->itemconfigure($track, -labelformat => +$zinc->itemconfigure($track, -labelformat => "150x60|40+20|40+20|40+20,0:40x20+0+0,1:40x20+40+0,2:150x60+0+0"); -$radar->itemconfigure($track, 0, -filled => 1 , -backcolor => "red", +$zinc->itemconfigure($track, 0, -filled => 1 , -backcolor => "red", -border => "contour"); -$radar->itemconfigure($track, 0, -text => "TO"); -$radar->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", +$zinc->itemconfigure($track, 0, -text => "TO"); +$zinc->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", -border => "contour"); -$radar->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", +$zinc->itemconfigure($track, 1, -filled => 1 , -backcolor => "green", -border => "contour"); -$radar->itemconfigure($track, 2, -image => $logo , -alignment => "center"); -$mk = $radar->itemcget($track, -markercolor); +$zinc->itemconfigure($track, 2, -image => $logo , -alignment => "center"); +$mk = $zinc->itemcget($track, -markercolor); -$radar->itemconfigure($track, 0, -reliefthickness => 2, -relief => "sunken", +$zinc->itemconfigure($track, 0, -reliefthickness => 2, -relief => "sunken", -bordercolor => "red", -border => "noborder"); -$radar->bind($track.":-3", "", - sub {$radar->itemconfigure($track, -speedvectorcolor => 'red')}); -$radar->bind($track.":-3", "", - sub {$radar->itemconfigure($track, -speedvectorcolor => 'black')}); +$zinc->bind($track.":-3", "", + sub {$zinc->itemconfigure($track, -speedvectorcolor => 'red')}); +$zinc->bind($track.":-3", "", + sub {$zinc->itemconfigure($track, -speedvectorcolor => 'black')}); ################################################### # creation way point ################################################### print "creating way point\n"; -my $wp = $radar->add("waypoint", 10); -$radar->itemconfigure($wp, +my $wp = $zinc->add("waypoint", 10); +$zinc->itemconfigure($wp, -symbolcolor => "green", -position => [0, 80], -labelformat => "80x40|40+20|40+20|40+20,0:40x20+0+0,1:40x20+40+0,2:80x40+0+0" ); -$radar->itemconfigure($wp, 0 ,-filled => 1 ,-backcolor => "tan",-text => "TO"); -$radar->itemconfigure($wp, 1 ,-filled => 1 ,-backcolor => "wheat",-text => "TO"); -$radar->itemconfigure($wp, 2 ,-border => "contour"); -$radar->bind($wp, "", [ \&borders, "on"]); -$radar->bind($wp, "", [ \&borders, "off"]); +$zinc->itemconfigure($wp, 0 ,-filled => 1 ,-backcolor => "tan",-text => "TO"); +$zinc->itemconfigure($wp, 1 ,-filled => 1 ,-backcolor => "wheat",-text => "TO"); +$zinc->itemconfigure($wp, 2 ,-border => "contour"); +$zinc->bind($wp, "", [ \&borders, "on"]); +$zinc->bind($wp, "", [ \&borders, "off"]); ################################################### # creation 2nd track ################################################### print "creating second track\n"; -$track2 = $radar->add("track", 10, -speedvector => [-20, 0], -position => [0, 50]); -$radar->itemconfigure($track2, -connecteditem => $track); +$track2 = $zinc->add("track", 10, -speedvector => [-20, 0], -position => [0, 50]); +$zinc->itemconfigure($track2, -connecteditem => $track); ################################################### # creation macro ################################################### print "creating macro\n"; -$macro = $radar->add("macro", 10, +$macro = $zinc->add("macro", 10, -labelformat => "80x40|40+20|40+20|40+20,0:40x20+0+0,1:40x20+40+0" ); -$radar->itemconfigure($macro, 0 , -text => "une"); -$radar->itemconfigure($macro, 1, -text => "macro"); -$radar->itemconfigure($macro, -connecteditem => $track); -$radar->bind($macro.":0", "", [ \&borders, "on"]); -$radar->bind($macro.":0", "", [ \&borders, "off"]); +$zinc->itemconfigure($macro, 0 , -text => "une"); +$zinc->itemconfigure($macro, 1, -text => "macro"); +$zinc->itemconfigure($macro, -connecteditem => $track); +$zinc->bind($macro.":0", "", [ \&borders, "on"]); +$zinc->bind($macro.":0", "", [ \&borders, "off"]); ################################################### # creation ministrip ################################################### print "creating ministrip\n"; -$ministrip = $radar->add("ministrip", 10, +$ministrip = $zinc->add("ministrip", 10, -labelformat => "80x40|40+20|40+20|40+20,0:40x20+0+0,1:40x20+40+0", -position => [100, 10] ); -$radar->itemconfigure($ministrip, 0 , -text => 'ministrip'); +$zinc->itemconfigure($ministrip, 0 , -text => 'ministrip'); ################################################### # creation map @@ -133,41 +133,41 @@ $mw->videomap("load", "/home/etienne/tmp/hegias_parouest_TE.vid", 0, "paris-oues print "videomap ids : ", join('|', $mw->videomap("ids", "/home/etienne/tmp/videomap_orly")),"\n"; -$map = $radar->add("map", -color => red); -$radar->itemconfigure($map,-mapinfo => orly); +$map = $zinc->add("map", -color => red); +$zinc->itemconfigure($map,-mapinfo => orly); -$map2 = $radar->add("map", -color => green, -filled => 1, -priority => 0, +$map2 = $zinc->add("map", -color => green, -filled => 1, -priority => 0, -fillpattern => AlphaStipple6); -#$radar->itemconfigure($map2, -mapinfo => paris-ouest); +#$zinc->itemconfigure($map2, -mapinfo => paris-ouest); -$map3 = $radar->add("map", -color => orange); -$radar->itemconfigure($map3,-mapinfo => "paris-w"); +$map3 = $zinc->add("map", -color => orange); +$zinc->itemconfigure($map3,-mapinfo => "paris-w"); ################################################### #creation rectangle, arc, curve ################################################### -$rect = $radar->add(rectangle, -50, -50, 50, -80, -linecolor => bisque); -$radar->bind($rect, '', sub { $radar->itemconfigure($rect, -linecolor => red)}); -$radar->bind($rect, '', sub { $radar->itemconfigure($rect, -linecolor => bisque)}); +$rect = $zinc->add(rectangle, -50, -50, 50, -80, -linecolor => bisque); +$zinc->bind($rect, '', sub { $zinc->itemconfigure($rect, -linecolor => red)}); +$zinc->bind($rect, '', sub { $zinc->itemconfigure($rect, -linecolor => bisque)}); -$arc = $radar->add(arc, -100, 80, -50, 30, -linecolor => bisque, +$arc = $zinc->add(arc, -100, 80, -50, 30, -linecolor => bisque, -tags => ["arc"]); -#$radar->addtag("fleche",'withtag', $arc); -#$radar->addtag("carquois",'withtag', $arc); -$radar->add(rectangle, -101, 81, -49, 29, -linecolor => green); -$radar->raise($arc); -$radar->bind($arc, '', sub {$radar->itemconfigure($arc, -linecolor => red)}); -$radar->bind($arc, '', sub {$radar->itemconfigure($arc, -linecolor => bisque)}); -print "arc tags=", join('|',$radar->gettags($arc)),"\n"; - -$radar->itemconfigure($arc, -startangle => 0, -extent => 360); - -$mp = $radar->add(curve, -300, 0, -250, 100, -80, 20); -$radar->itemconfigure($mp, -filled => 1, -linewidth => 4, -linecolor => yellow, +#$zinc->addtag("fleche",'withtag', $arc); +#$zinc->addtag("carquois",'withtag', $arc); +$zinc->add(rectangle, -101, 81, -49, 29, -linecolor => green); +$zinc->raise($arc); +$zinc->bind($arc, '', sub {$zinc->itemconfigure($arc, -linecolor => red)}); +$zinc->bind($arc, '', sub {$zinc->itemconfigure($arc, -linecolor => bisque)}); +print "arc tags=", join('|',$zinc->gettags($arc)),"\n"; + +$zinc->itemconfigure($arc, -startangle => 0, -extent => 360); + +$mp = $zinc->add(curve, -300, 0, -250, 100, -80, 20); +$zinc->itemconfigure($mp, -filled => 1, -linewidth => 4, -linecolor => yellow, -fillcolor => tan, -fillpattern => AlphaStipple8); -$radar->itemconfigure($mp, -marker => AtcSymbol9 , -markercolor => red); +$zinc->itemconfigure($mp, -marker => AtcSymbol9 , -markercolor => red); ################################################### # Map info @@ -176,7 +176,7 @@ $mw->mapinfo('mpessai', 'create'); $mw->mapinfo('mpessai', add, text, normal, simple, 0, 200, "Et voilą"); $mw->mapinfo(mpessai, add, line, simple, 0, 0, 0, 0, 200); #$mw->mapinfo('mpessai', add, line, simple, 5, -100, 100, 0, 0); -$radar->itemconfigure($map3, -mapinfo => mpessai); +$zinc->itemconfigure($map3, -mapinfo => mpessai); print "mapinfo count line : ", $mw->mapinfo(mpessai, count, line),"\n"; print "mapinfo get line 3: ", join('|',$mw->mapinfo(mpessai, get, line, 0)),"\n"; @@ -184,28 +184,28 @@ print "mapinfo get line 3: ", join('|',$mw->mapinfo(mpessai, get, line, 0)),"\n" # tests diverses methodes ################################################### -for ($radar->find('all')) { - print $_, " -> ", $radar->type($_),"\n"; +for ($zinc->find('all')) { + print $_, " -> ", $zinc->type($_),"\n"; } -$radar->Tk::bind("<2>", [sub { +$zinc->Tk::bind("<2>", [sub { print $_[1], "@" ,$_[2], ", closest: ", - join(' ',$radar->find('closest', $_[1], $_[2])),"\n"; + join(' ',$zinc->find('closest', $_[1], $_[2])),"\n"; }, Ev('x'), Ev('y')]); -$radar->Tk::bind('', +$zinc->Tk::bind('', [ sub {($origx, $origy) = ($_[1], $_[2]); }, Ev('x'), Ev('y') ]); -$radar->Tk::bind('', +$zinc->Tk::bind('', [ sub {&finditems($_[1], $_[2]); }, Ev('x'), Ev('y') ]); -$radar->Tk::bind("<2>", sub {$radar->translate('all', 10,10); }); -$radar->Tk::bind("<3>", sub {$radar->scale(1.1, 1.1); }); +$zinc->Tk::bind("<2>", sub {$zinc->translate('all', 10,10); }); +$zinc->Tk::bind("<3>", sub {$zinc->scale(1.1, 1.1); }); @position = [20, 40, 50, 80]; -#@xy = $radar -> worldcoords (0, @position); -@xy = $radar -> worldcoords (0, [10, 23, 45, 65]); +#@xy = $zinc -> worldcoords (0, @position); +@xy = $zinc -> worldcoords (0, [10, 23, 45, 65]); print ("x = ",$xy[0]," y = ",$xy[1],"\n"); @@ -214,16 +214,16 @@ MainLoop; sub borders { my($widget, $onoff) = @_; - my $part = $radar->currentpart; + my $part = $zinc->currentpart; my $contour = "noborder"; $contour = "contour" if ($onoff eq 'on'); - $radar->itemconfigure('current', $part, -border => $contour) if ($part >= 0); + $zinc->itemconfigure('current', $part, -border => $contour) if ($part >= 0); } sub finditems { my($cornerx, $cornery) = @_; print "--- enclosed --->", - join('|', $radar->find('enclosed',$origx, $origy, $cornerx, $cornery)),"\n"; + join('|', $zinc->find('enclosed',$origx, $origy, $cornerx, $cornery)),"\n"; print "--- overlapping --->", - join('|',$radar->find('overlapping',$origx, $origy, $cornerx, $cornery)),"\n\n"; + join('|',$zinc->find('overlapping',$origx, $origy, $cornerx, $cornery)),"\n\n"; } diff --git a/sandbox/zinc.tcl b/sandbox/zinc.tcl index a828934..0151046 100644 --- a/sandbox/zinc.tcl +++ b/sandbox/zinc.tcl @@ -1,6 +1,6 @@ #!/usr/bin/wish -f -load tkradar3.1.so +load tkzinc3.1.so package require Img set top 1 @@ -9,14 +9,14 @@ image create photo logo -file /usr/share/toccata/images/logo.gif image create photo logosmall -file /usr/share/toccata/images/logo-small.gif #image create photo papier -file /usr/share/toccata/images/dgtexture-dragstrip.xpm -set r [radar .r -backcolor gray -relief sunken] +set r [zinc .r -backcolor gray -relief sunken] pack .r -expand t -fill both set scale 1.0 set centerX 0.0 set centerY 0.0 -set radarWidth 800 -set radarHeight 500 -.r configure -width $radarWidth -height $radarHeight +set zincWidth 800 +set zincHeight 500 +.r configure -width $zincWidth -height $zincHeight #.r configure -drawbboxes t set view [.r add group $top -tags "controls"] @@ -45,27 +45,27 @@ grid .rc.shrink -row 1 -column 0 grid .rc.reset -row 1 -column 2 -sticky ew pack .rc -bind .r "RadarStyleConfig %W %w %h" +bind .r "ZincStyleConfig %W %w %h" -proc RadarStyleConfig {radar w h} { - global radarWidth radarHeight +proc ZincStyleConfig {zinc w h} { + global zincWidth zincHeight - set bw [$radar cget -borderwidth] - set radarWidth [expr $w - 2*$bw] - set radarHeight [expr $h - 2*$bw] - updateTransform $radar + set bw [$zinc cget -borderwidth] + set zincWidth [expr $w - 2*$bw] + set zincHeight [expr $h - 2*$bw] + updateTransform $zinc } -proc updateTransform {radar} { - global radarWidth radarHeight +proc updateTransform {zinc} { + global zincWidth zincHeight global scale centerX centerY global top - $radar treset $top - $radar scale $top 1 -1 - $radar translate $top [expr -$centerX] [expr -$centerY] - $radar scale $top $scale $scale - $radar translate $top [expr $radarWidth/2] [expr $radarHeight/2] + $zinc treset $top + $zinc scale $top 1 -1 + $zinc translate $top [expr -$centerX] [expr -$centerY] + $zinc scale $top $scale $scale + $zinc translate $top [expr $zincWidth/2] [expr $zincHeight/2] } # -- cgit v1.1