Changeset 43426
- Timestamp:
- Sep 8, 2010, 7:18:26 AM (14 years ago)
- Location:
- grass/branches/develbranch_6/gui/tcltk/gis.m
- Files:
-
- 2 edited
-
mapcanvas.tcl (modified) (1 diff)
-
maplabels.tcl (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
grass/branches/develbranch_6/gui/tcltk/gis.m/mapcanvas.tcl
r39856 r43426 710 710 } 711 711 712 # cvdisplay might need new canvas coordinates. Coordconv has to be run first! 713 MapCanvas::coordconv $mon 712 714 GmTree::cvdisplay "root" 713 set drawprog 100 714 715 MapCanvas::coordconv $mon 715 716 716 set drawprog 0 717 717 $mapframe($mon) showstatusbar status -
grass/branches/develbranch_6/gui/tcltk/gis.m/maplabels.tcl
r40450 r43426 29 29 variable optlist 30 30 variable array dup ;# layer 31 variable canvasId ;# List of canvas item ID's for deletion on update 31 32 } 32 33 … … 37 38 variable optlist 38 39 variable dup 40 variable canvasId 39 41 global mon 40 42 global iconpath … … 105 107 foreach key $optlist { 106 108 set opt($count,0,$key) $opt($count,1,$key) 107 } 109 } 110 111 set canvasId [ list ] ;# CanvasId is an empty list 108 112 109 113 incr count … … 299 303 variable dup 300 304 variable count 305 variable canvasId 301 306 302 307 set tree($mon) $GmTree::tree($mon) 303 308 set id [GmTree::node_id $node] 304 309 310 # No need to do anything, if we are invisible/unset. 311 if { ! ( $opt($id,1,_check) ) } { return } 305 312 if {$opt($id,1,labels) == "" } {return} 306 313 … … 313 320 set labelpath "$env(GISDBASE)/$env(LOCATION_NAME)/$env(MAPSET)/paint/labels/$opt($id,1,labels)" 314 321 } 315 316 if { ! ( $opt($id,1,_check) ) } { return }317 322 318 323 # open the v.label file for reading … … 321 326 return 322 327 } 328 329 # Delete current labels on Canvas and empty ID list 330 $can($mon) delete canvasId 331 set canvasId [ list ] ;# CanvasId is an empty list 323 332 324 333 #loop through coordinates and options for each label … … 485 494 486 495 # create box around text 487 488 switch $ropt($id,1,anchor) { 489 "ne" { 490 set boxcenter_x [expr {$ropt($id,1,xcoord) - ($wid-4) / 2}] 491 set boxcenter_y [expr {$ropt($id,1,ycoord) + ($lineh+4) / 2}] 492 } 493 "n" { 494 set boxcenter_x $ropt($id,1,xcoord) 495 set boxcenter_y [expr {$ropt($id,1,ycoord) - ($lineh+4) / 2}] 496 } 497 "nw" { 498 set boxcenter_x [expr {$ropt($id,1,xcoord) + ($wid-4) / 2}] 499 set boxcenter_y [expr {$ropt($id,1,ycoord) + ($lineh+4) / 2}] 500 } 501 "e" { 502 set boxcenter_x [expr {$ropt($id,1,xcoord) - ($wid-4) / 2}] 503 set boxcenter_y $ropt($id,1,ycoord) 504 } 505 "center" { 506 set boxcenter_x $ropt($id,1,xcoord) 507 set boxcenter_y $ropt($id,1,ycoord) 508 } 509 "w" { 510 set boxcenter_x [expr {$ropt($id,1,xcoord) + ($wid-4) / 2}] 511 set boxcenter_y $ropt($id,1,ycoord) 512 } 513 "se" { 514 set boxcenter_x [expr {$ropt($id,1,xcoord) - ($wid-4) / 2}] 515 set boxcenter_y [expr {$ropt($id,1,ycoord) - ($lineh+4) / 2}] 516 } 517 "s" { 518 set boxcenter_x $ropt($id,1,xcoord) 519 set boxcenter_y [expr {$ropt($id,1,ycoord) - ($lineh+4) / 2}] 520 } 521 "sw" { 522 set boxcenter_x [expr {$ropt($id,1,xcoord) + ($wid-4) / 2}] 523 set boxcenter_y [expr {$ropt($id,1,ycoord) - ($lineh+4) / 2}] 524 } 525 default { 526 set boxcenter_x $ropt($id,1,xcoord) 527 set boxcenter_y $ropt($id,1,ycoord) 528 } 496 if {$opt($id,1,lboxenable)} { 497 switch $ropt($id,1,anchor) { 498 "ne" { 499 set boxcenter_x [expr {$ropt($id,1,xcoord) - ($wid-4) / 2}] 500 set boxcenter_y [expr {$ropt($id,1,ycoord) + ($lineh+4) / 2}] 501 } 502 "n" { 503 set boxcenter_x $ropt($id,1,xcoord) 504 set boxcenter_y [expr {$ropt($id,1,ycoord) - ($lineh+4) / 2}] 505 } 506 "nw" { 507 set boxcenter_x [expr {$ropt($id,1,xcoord) + ($wid-4) / 2}] 508 set boxcenter_y [expr {$ropt($id,1,ycoord) + ($lineh+4) / 2}] 509 } 510 "e" { 511 set boxcenter_x [expr {$ropt($id,1,xcoord) - ($wid-4) / 2}] 512 set boxcenter_y $ropt($id,1,ycoord) 513 } 514 "center" { 515 set boxcenter_x $ropt($id,1,xcoord) 516 set boxcenter_y $ropt($id,1,ycoord) 517 } 518 "w" { 519 set boxcenter_x [expr {$ropt($id,1,xcoord) + ($wid-4) / 2}] 520 set boxcenter_y $ropt($id,1,ycoord) 521 } 522 "se" { 523 set boxcenter_x [expr {$ropt($id,1,xcoord) - ($wid-4) / 2}] 524 set boxcenter_y [expr {$ropt($id,1,ycoord) - ($lineh+4) / 2}] 525 } 526 "s" { 527 set boxcenter_x $ropt($id,1,xcoord) 528 set boxcenter_y [expr {$ropt($id,1,ycoord) - ($lineh+4) / 2}] 529 } 530 "sw" { 531 set boxcenter_x [expr {$ropt($id,1,xcoord) + ($wid-4) / 2}] 532 set boxcenter_y [expr {$ropt($id,1,ycoord) - ($lineh+4) / 2}] 533 } 534 default { 535 set boxcenter_x $ropt($id,1,xcoord) 536 set boxcenter_y $ropt($id,1,ycoord) 537 } 538 } 529 539 } 530 540 531 541 if {$opt($id,1,lboxenable)} { 532 542 # draw recangle around label 533 $can($mon) create rectangle \543 lappend canvasId [$can($mon) create rectangle \ 534 544 [expr {$boxcenter_x - $opt($id,1,lhoffset) - $wid / 2}] \ 535 545 [expr {$boxcenter_y -2- $opt($id,1,lvoffset) - $lineh / 2}]\ … … 538 548 -width $wdth \ 539 549 -outline $ropt($id,1,lborder) \ 540 -fill $lbackground 541 } 542 $can($mon) create text $ropt($id,1,xcoord) $ropt($id,1,ycoord) \550 -fill $lbackground] 551 } 552 lappend canvasId [$can($mon) create text $ropt($id,1,xcoord) $ropt($id,1,ycoord) \ 543 553 -anchor $ropt($id,1,anchor) \ 544 554 -justify $opt($id,1,ljust) \ … … 546 556 -fill $ropt($id,1,lfill) \ 547 557 -font $ropt($id,1,lfont) \ 548 -text $ropt($id,1,ltxt) 558 -text $ropt($id,1,ltxt)] 549 559 } 550 560 default {
Note:
See TracChangeset
for help on using the changeset viewer.
