Changeset 4633


Ignore:
Timestamp:
Sep 10, 2014, 1:55:49 PM (10 years ago)
Author:
ldelgass
Message:

test pins

File:
1 edited

Legend:

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

    r4630 r4633  
    8282    protected method MouseScroll { direction }
    8383    protected method Pan {option x y}
     84    protected method Pin {option x y}
    8485    protected method Rebuild {}
    8586    protected method ReceiveMapInfo { args }
     
    137138    private variable _sendEarthFile 0
    138139    private variable _useServerManip 0
     140    private variable _labelCount 0
    139141}
    140142
     
    179181    # to update the Lat/Long coordinate display
    180182    array set _motion {
    181         compress        0
     183        compress        1
    182184        delay           100
    183         enable          0
     185        enable          1
    184186        pending         0
    185187        x               0
     
    358360            [itcl::code $this camera go %x %y 0.4]
    359361
     362        # Pin placemark annotations
     363        bind $itk_component(view) <Control-ButtonPress-1> \
     364            +[itcl::code $this Pin add %x %y]
     365        bind $itk_component(view) <Control-ButtonPress-3> \
     366            +[itcl::code $this Pin delete %x %y]
     367
    360368        # Bindings for rotation via mouse
    361369        bind $itk_component(view) <ButtonPress-2> \
     
    394402                [itcl::code $this EventuallyHandleMotionEvent %x %y]
    395403        }
     404        #bind $itk_component(view) <Motion> \
     405        #    +[itcl::code $this SendCmd "map pin hover %x %y"]
    396406    }
    397407
     
    455465        set sendResize 0
    456466    }
    457     set _start [clock clicks -milliseconds]
     467    #set _start [clock clicks -milliseconds]
    458468    if {$sendResize} {
    459469        SendCmd "screen size $_width $_height"
     
    847857
    848858# ----------------------------------------------------------------------
    849 # USAGE: ReceiveImage -bytes <size> -type <type> -token <token>
     859# USAGE: ReceiveImage -type <type> -token <token> -bytes <size>
    850860#
    851861# Invoked automatically whenever the "image" command comes in from
     
    857867    set readyForNextFrame 1
    858868    array set info {
     869        -bytes 0
    859870        -token "???"
    860         -bytes 0
    861871        -type image
    862872    }
     
    878888        return
    879889    }
     890    set timeReceived [clock clicks -milliseconds]
     891    set elapsed [expr $timeReceived - $_start]
    880892    set option [lindex $args 0]
    881893    switch -- $option {
     
    888900            }
    889901            if {$len == 5} {
    890                 puts stderr "\[$token\] Map coords out of range"
     902                puts stderr "\[$token - $elapsed\] Map coords out of range"
    891903            } elseif {$len < 7} {
    892904                foreach { x y z } [lrange $args 2 end] break
    893                 puts stderr "\[$token\] Map coords: $x $y $z"
     905                puts stderr "\[$token - $elapsed\] Map coords: $x $y $z"
    894906            } elseif {$len < 8} {
    895907                foreach { x y z screenX screenY } [lrange $args 2 end] break
    896                 puts stderr "\[$token\] Map coords($screenX,$screenY): $x $y $z"
     908                puts stderr "\[$token - $elapsed\] Map coords($screenX,$screenY): $x $y $z"
    897909            } else {
    898910                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}"
     911                puts stderr "\[$token - $elapsed\] Map coords($screenX,$screenY): $x $y $z {$srs} {$vert}"
    900912            }
    901913        }
     
    11561168
    11571169itcl::body Rappture::MapViewer::MouseMotion {} {
    1158     SendCmd "mouse motion $_motion(x) $_motion(y)"
     1170    #SendCmd "mouse motion $_motion(x) $_motion(y)"
     1171    SendCmd "map pin hover $_motion(x) $_motion(y)"
    11591172    set _motion(pending) 0
    11601173}
     
    12861299        default {
    12871300            error "bad option \"$option\": should be click, drag, release"
     1301        }
     1302    }
     1303}
     1304
     1305itcl::body Rappture::MapViewer::Pin {option x y} {
     1306    set _click(x) $x
     1307    set _click(y) $y
     1308    switch -- $option {
     1309        "add" {
     1310            incr _labelCount
     1311            set label "Label $_labelCount"
     1312            SendCmd [list "map" "pin" "add" $x $y $label]
     1313        }
     1314        "delete" {
     1315            SendCmd "map pin delete $x $y"
    12881316        }
    12891317    }
Note: See TracChangeset for help on using the changeset viewer.