Changeset 5031


Ignore:
Timestamp:
Feb 18, 2015 1:03:57 PM (5 years ago)
Author:
ldelgass
Message:

event compression for selection updates

File:
1 edited

Legend:

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

    r5027 r5031  
    8989    private method DoResize {}
    9090    private method DoRotate {}
     91    private method DoSelect {}
    9192    private method EarthFile {}
    9293    private method EventuallyHandleMotionEvent { x y }
     
    9495    private method EventuallyResize { w h }
    9596    private method EventuallyRotate { dx dy }
     97    private method EventuallySelect { x y }
    9698    private method GetImage { args }
    9799    private method GetNormalizedMouse { x y }
     
    130132    private variable _pan;
    131133    private variable _rotate;
     134    private variable _select;
    132135    private variable _motion;
    133136    private variable _settings
     
    185188    $_dispatcher dispatch $this !rotate "[itcl::code $this DoRotate]; list"
    186189
     190    # Select event
     191    $_dispatcher register !select
     192    $_dispatcher dispatch $this !select "[itcl::code $this DoSelect]; list"
     193
    187194    # <Motion> event
    188195    $_dispatcher register !motion
     
    223230        elevation       0
    224231        pending         0
     232    }
     233    array set _select {
     234        compress        1
     235        delay           100
     236        pending         0
     237        x               0
     238        y               0
    225239    }
    226240    # This array holds the Viewpoint parameters that the
     
    393407        bind $itk_component(view) <ButtonRelease-1> \
    394408            [itcl::code $this Pan release %x %y]
    395         bind $itk_component(view) <Button-1> \
     409        bind $itk_component(view) <ButtonPress-1> \
    396410            +[itcl::code $this SendCmd "map setpos %x %y"]
    397411        bind $itk_component(view) <Double-1> \
     
    563577}
    564578
     579itcl::body Rappture::MapViewer::DoSelect {} {
     580    SendCmd "map box update $_select(x) $_select(y)"
     581    set _select(x) 0
     582    set _select(y) 0
     583    set _select(pending) 0
     584}
     585
    565586itcl::body Rappture::MapViewer::EventuallyResize { w h } {
    566587    set _width $w
     
    602623        set _rotate(pending) 1
    603624        $_dispatcher event -after $_rotate(delay) !rotate
     625    }
     626}
     627
     628itcl::body Rappture::MapViewer::EventuallySelect { x y } {
     629    set _select(x) $x
     630    set _select(y) $y
     631    if { !$_select(compress) } {
     632        DoSelect
     633        return
     634    }
     635    if { !$_select(pending) } {
     636        set _select(pending) 1
     637        $_dispatcher event -after $_select(delay) !select
    604638    }
    605639}
     
    14661500        "drag" {
    14671501            if {$_b1mode == "select"} {
    1468                 SendCmd "map box update $x $y"
     1502                EventuallySelect $x $y
    14691503            }
    14701504        }
     
    17111745            -resolution 0.1 \
    17121746            -variable [itcl::scope _settings(time)] \
     1747            -width 10 \
    17131748            -showvalue on \
    17141749            -command [itcl::code $this AdjustSetting time]
     
    18741909        -from -180 -to 180 -orient horizontal \
    18751910        -variable [itcl::scope _view(heading)] \
     1911        -width 10 \
    18761912        -showvalue on \
    18771913        -command [itcl::code $this camera set heading]
     
    18881924        -from -10 -to -90 -orient horizontal \
    18891925        -variable [itcl::scope _view(pitch)] \
     1926        -width 10 \
    18901927        -showvalue on \
    18911928        -command [itcl::code $this camera set pitch]
     
    22662303                    -orient horizontal -showvalue off \
    22672304                    -variable [itcl::scope _opacity($layer)] \
     2305                    -width 10 \
    22682306                    -command [itcl::code $this \
    22692307                                  SetLayerOpacity $dataobj $layer]
Note: See TracChangeset for help on using the changeset viewer.