Changeset 4630 for trunk/gui/scripts


Ignore:
Timestamp:
Sep 4, 2014, 11:20:03 AM (10 years ago)
Author:
ldelgass
Message:

Update map viewer for new 0.5.0 protocol

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/mapviewer.tcl

    r4577 r4630  
    882882        "coords" {
    883883            set len [llength $args]
    884             if {$len == 4} {
    885                 puts stderr "Map coords out of range"
    886             } elseif {$len < 6} {
    887                 foreach { x y z } [lrange $args 1 end] break
    888                 puts stderr "Map coords: $x $y $z"
     884            if {$len < 5} {
     885                error "Bad map coords response"
     886            } else {
     887                set token [lindex $args 1]
     888            }
     889            if {$len == 5} {
     890                puts stderr "\[$token\] Map coords out of range"
    889891            } elseif {$len < 7} {
    890                 foreach { x y z screenX screenY } [lrange $args 1 end] break
    891                 puts stderr "Map coords($screenX,$screenY): $x $y $z"
     892                foreach { x y z } [lrange $args 2 end] break
     893                puts stderr "\[$token\] Map coords: $x $y $z"
     894            } elseif {$len < 8} {
     895                foreach { x y z screenX screenY } [lrange $args 2 end] break
     896                puts stderr "\[$token\] Map coords($screenX,$screenY): $x $y $z"
    892897            } else {
    893                 foreach { x y z screenX screenY srs vert } [lrange $args 1 end] break
    894                 puts stderr "Map coords($screenX,$screenY): $x $y $z {$srs} {$vert}"
     898                foreach { x y z screenX screenY srs vert } [lrange $args 2 end] break
     899                puts stderr "\[$token\] Map coords($screenX,$screenY): $x $y $z {$srs} {$vert}"
    895900            }
    896901        }
     
    917922        "coords" {
    918923            set len [llength $args]
    919             if {$len == 5} {
    920                 puts stderr "Screen coords out of range"
     924            if {$len < 6} {
     925                error "Bad screen coords response"
    921926            } else {
    922                 foreach { x y z worldX worldY worldZ } [lrange $args 1 end] break
    923                 puts stderr "Screen coords($worldX,$worldY,$worldZ): $x $y $z"
     927                set token [lindex $args 1]
     928            }
     929            if {$len == 6} {
     930                puts stderr "\[$token\] Screen coords out of range"
     931            } else {
     932                foreach { x y z worldX worldY worldZ } [lrange $args 2 end] break
     933                puts stderr "\[$token\] Screen coords($worldX,$worldY,$worldZ): $x $y $z"
    924934            }
    925935        }
Note: See TracChangeset for help on using the changeset viewer.