tkmap.tcl File Reference
Go to the source code of this file.
Function Documentation
Definition at line 253 of file tkmap.tcl.
00253 {
00254 variable reader
00255 unset reader
00256 .c configure -scrollregion [.c bbox all]
00257 return
00258 }
ret isProjection |
( |
type |
pro |
) |
|
Definition at line 432 of file tkmap.tcl.
00432 {
00433 if {![catch {makeProjCmds $pro 0} r]} {
00434 return 1
00435 } else {
00436 puts $r
00437 return 0
00438 }
00439 }
ret locate |
( |
type |
w, |
|
|
type |
x, |
|
|
type |
y | |
|
) |
| | |
Definition at line 274 of file tkmap.tcl.
00274 {
00275 variable lon
00276 variable lat
00277 variable fromProjCmd
00278 set x [$w canvasx $x]
00279 set y [$w canvasy $y]
00280 set x [expr {($x - 316.) / 100.}]
00281 set y [expr {(316. - $y) / 100.}]
00282 set pcmd $fromProjCmd
00283 lappend pcmd $x $y
00284 foreach {lon lat} [eval $pcmd] break
00285 return
00286 }
ret makeProjCmds |
( |
type |
pro, |
|
|
optional |
comps = 1 | |
|
) |
| | |
Definition at line 364 of file tkmap.tcl.
00364 {
00365 variable phi_0
00366 variable phi_1
00367 variable phi_2
00368 variable lambda_0
00369 set toProjCmd ::mapproj::to$pro
00370 set alist [info args ::mapproj::to$pro]
00371 if {[llength $alist] < 2} {
00372 return -code error "$toProjCmd has too few args"
00373 }
00374 if {[lindex $alist end-1] ne {lambda}
00375 || [lindex $alist end] ne {phi}} {
00376 return -code error "$toProjCmd does not accept lambda and phi"
00377 }
00378 foreach a [lrange $alist 0 end-2] {
00379 switch -exact $a {
00380 phi_0 - phi_1 - phi_2 - lambda_0 {
00381 lappend toProjCmd [set $a]
00382 set have($a) {}
00383 }
00384 default {
00385 return -code error "$toProjCmd accepts an unknown arg $a"
00386 }
00387 }
00388 }
00389 set fromProjCmd ::mapproj::from$pro
00390 set alist [info args ::mapproj::from$pro]
00391 if {[llength $alist] < 2} {
00392 return -code error "$fromProjCmd has too few args"
00393 }
00394 if {[lindex $alist end-1] ne {x}
00395 || [lindex $alist end] ne {y}} {
00396 return -code error "$fromProjCmd does not accept x and y"
00397 }
00398 foreach a [lrange $alist 0 end-2] {
00399 switch -exact $a {
00400 phi_0 - phi_1 - phi_2 - lambda_0 {
00401 lappend fromProjCmd [set $a]
00402 set have($a) {}
00403 }
00404 default {
00405 return -code error "$fromProjCmd accepts an unknown arg $a"
00406 }
00407 }
00408 }
00409 if {$comps} {
00410 foreach item {lambda_0 phi_0 phi_1 phi_2} {
00411 if {[info exists have($item)] && ![winfo ismapped .extras.$item]} {
00412 grid .extras.$item -sticky ew -columnspan 2
00413 } elseif {![info exists have($item)]
00414 && [winfo ismapped .extras.$item]} {
00415 grid forget .extras.$item
00416 }
00417 }
00418 }
00419 return [list $toProjCmd $fromProjCmd]
00420 }
ret plot |
( |
type |
id, |
|
|
type |
la0, |
|
|
type |
lo0, |
|
|
type |
la1, |
|
|
type |
lo1, |
|
|
type |
ptlist | |
|
) |
| | |
Definition at line 202 of file tkmap.tcl.
00202 {
00203 variable toProjCmd
00204 set command [list .c create line]
00205 foreach {lo la} $ptlist {
00206 set ok 0
00207 set pcmd $toProjCmd
00208 lappend pcmd $lo $la
00209 foreach {x y} [eval $pcmd] {
00210 set ok 1
00211 }
00212 if {!$ok
00213 || ([info exists lastx] && hypot($x-$lastx, $y-$lasty) > 0.25)} {
00214 if {[llength $command] >= 7} {
00215 if {$id == 0} {
00216 lappend command -fill \#cccccc
00217 } else {
00218 lappend command -fill \#cc0000
00219 }
00220 eval $command
00221 }
00222 set command [list .c create line]
00223 }
00224 if {$ok} {
00225 lappend command [expr {316 + 100 * $x}] \
00226 [expr {316 - 100 * $y}]
00227 set lastx $x
00228 set lasty $y
00229 }
00230 }
00231 if {[llength $command] >= 7} {
00232 if {$id == 0} {
00233 lappend command -fill \#cccccc
00234 } else {
00235 lappend command -fill \#cc0000
00236 }
00237 lappend command -tags id$id
00238 eval $command
00239 }
00240 return
00241 }
Definition at line 300 of file tkmap.tcl.
00300 {
00301 variable showMapScheduled
00302 if {[info exists showMapScheduled]} {
00303 after cancel $showMapScheduled
00304 unset showMapScheduled
00305 }
00306 set showMapScheduled [after 500 showMap2]
00307 return
00308 }
Definition at line 309 of file tkmap.tcl.
00309 {
00310 variable showMapScheduled
00311 if {[info exists showMapScheduled]} {
00312 after cancel $showMapScheduled
00313 unset showMapScheduled
00314 }
00315 variable projection
00316 variable fromProjCmd
00317 variable toProjCmd
00318 variable reader
00319 if {[info exists reader]} {
00320 ncar780_0::cancelReadMap $reader
00321 unset reader
00322 }
00323 .c delete all
00324
00325 foreach {toProjCmd fromProjCmd} [makeProjCmds $projection] break
00326 for {set m -180} {$m <= 180} {incr m 15} {
00327 set plist {}
00328 for {set p -89} {$p <= 89} {incr p} {
00329 lappend plist $m $p
00330 }
00331 plot 0 -90.0 $m 90.0 $m $plist
00332 }
00333 for {set p -75} {$p <= 75} {incr p 15} {
00334 set plist {}
00335 for {set m -180} {$m <= 180} {incr m} {
00336 lappend plist $m $p
00337 }
00338 plot 0 $p -180.0 $p 180.0 $plist
00339 }
00340 set reader [ncar780_0::readMap plot done]
00341 return
00342 }
Variable Documentation