Changeset 5990 for branches/geomap


Ignore:
Timestamp:
Feb 9, 2016 9:35:12 PM (6 years ago)
Author:
dkearney
Message:

merging changes from trunk r5975, which include placard configuration, into geomap branch. not including merge info.

Location:
branches/geomap/gui/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/geomap/gui/scripts/map.tcl

    r5955 r5990  
    3131
    3232    public method addViewpoint { name props }
     33    public method deleteViewpoint { viewpointName }
    3334    public method earthfile {}
     35    public method getPlacardConfig { layerName }
    3436    public method hints { args }
    3537    public method isGeocentric {}
     
    4547    public method setExtents { xmin ymin xmax ymax {srs "wgs84"} }
    4648    public method setLabel { label }
     49    public method setPlacardConfig { layerName attrlist style padding }
    4750    public method setProjection { projection }
    4851    public method setStyle { style }
     
    203206            }
    204207            rename $styles ""
     208        }
     209        set placard [$layers element -as object $layer.placard]
     210        if {$placard != ""} {
     211            foreach key { attributes style padding } {
     212                set $key [$placard get $key]
     213            }
     214            setPlacardConfig $name $attributes $style $padding
    205215        }
    206216        $_tree set $child "driver" "debug"
     
    578588#       layer names
    579589#       layer settings layerName
    580 #
     590# ----------------------------------------------------------------------
    581591itcl::body Rappture::Map::layer {option args} {
    582592    set result ""
     
    601611}
    602612
     613
     614itcl::body Rappture::Map::setPlacardConfig { layerName attrlist style padding } {
     615    set id [$_tree findchild root->"layers" $layerName]
     616    if { $id < 0 } {
     617        error "unknown layer \"$layerName\""
     618    }
     619    array set placardConf {}
     620    foreach key { padding } {
     621        set placardConf($key) [set $key]
     622    }
     623    foreach key { attrlist style } {
     624        # Normalize whitespace
     625        set val [set $key]
     626        regsub -all "\[ \t\r\n\]+" [string trim $val] " " val
     627        set placardConf($key) $val
     628    }
     629    $_tree set $id "placard" [array get placardConf]
     630}
     631
     632
     633itcl::body Rappture::Map::getPlacardConfig { layerName } {
     634    set id [$_tree findchild root->"layers" $layerName]
     635    if { $id < 0 } {
     636        error "unknown layer \"$layerName\""
     637    }
     638    return [$_tree get $id "placard" ""]
     639}
    603640
    604641# ----------------------------------------------------------------------
     
    686723}
    687724
     725itcl::body Rappture::Map::deleteViewpoint { viewopintName } {
     726    set id [$_tree findchild root->"viewpoints" $viewpointName]
     727    if { $id < 0 } {
     728        error "unknown viewpoint \"$viewpointName\""
     729    }
     730    $_tree delete $id
     731}
     732
    688733# ----------------------------------------------------------------------
    689734# USAGE: type <layerName>
  • branches/geomap/gui/scripts/mapviewer.tcl

    r5955 r5990  
    14271427
    14281428itcl::body Rappture::MapViewer::EnablePanningMouseBindings {} {
    1429     if {$_useServerManip} {
     1429    if {1 || $_useServerManip} {
    14301430        bind $itk_component(view) <ButtonPress-1> \
    14311431            [itcl::code $this MouseClick 1 %x %y]
     
    14511451
    14521452itcl::body Rappture::MapViewer::EnableRotationMouseBindings {} {
    1453     if {$_useServerManip} {
    1454         bind $itk_component(view) <ButtonPress-2> \
    1455             [itcl::code $this Rotate click %x %y]
    1456         bind $itk_component(view) <B2-Motion> \
    1457             [itcl::code $this Rotate drag %x %y]
    1458         bind $itk_component(view) <ButtonRelease-2> \
    1459             [itcl::code $this Rotate release %x %y]
    1460     } else {
     1453    if {1 || $_useServerManip} {
    14611454        # Bindings for rotation via mouse
    14621455        bind $itk_component(view) <ButtonPress-2> \
     
    14661459        bind $itk_component(view) <ButtonRelease-2> \
    14671460            [itcl::code $this MouseRelease 2 %x %y]
     1461    } else {
     1462        bind $itk_component(view) <ButtonPress-2> \
     1463            [itcl::code $this Rotate click %x %y]
     1464        bind $itk_component(view) <B2-Motion> \
     1465            [itcl::code $this Rotate drag %x %y]
     1466        bind $itk_component(view) <ButtonRelease-2> \
     1467            [itcl::code $this Rotate release %x %y]
    14681468    }
    14691469}
     
    14761476
    14771477itcl::body Rappture::MapViewer::EnableZoomMouseBindings {} {
    1478     if {$_useServerManip} {
     1478    if {1 || $_useServerManip} {
    14791479        bind $itk_component(view) <ButtonPress-3> \
    14801480            [itcl::code $this MouseClick 3 %x %y]
     
    17701770itcl::body Rappture::MapViewer::Pan {option x y} {
    17711771    switch -- $option {
    1772         "set" {
    1773             set w [winfo width $itk_component(view)]
    1774             set h [winfo height $itk_component(view)]
    1775             set x [expr $x / double($w)]
    1776             set y [expr $y / double($h)]
    1777             if {[expr (abs($x) > 0.0 || abs($y) > 0.0)]} {
    1778                 SendCmd "camera pan $x $y"
    1779             }
    1780             return
    1781         }
    17821772        "click" {
    17831773            set _click(x) $x
     
    18131803            $itk_component(view) configure -cursor ""
    18141804            set _b1mode ""
     1805        }
     1806        "set" {
     1807            set w [winfo width $itk_component(view)]
     1808            set h [winfo height $itk_component(view)]
     1809            set x [expr $x / double($w)]
     1810            set y [expr $y / double($h)]
     1811            if {[expr (abs($x) > 0.0 || abs($y) > 0.0)]} {
     1812                SendCmd "camera pan $x $y"
     1813            }
     1814            return
    18151815        }
    18161816        default {
     
    28842884            SendCmd "map layer opacity $style(-opacity) $layer"
    28852885        }
     2886    }
     2887
     2888    if {[info exists info(placard)]} {
     2889        array set placard [$dataobj getPlacardConfig $layer]
     2890        SendCmd [list placard config $placard(attrlist) $placard(style) $placard(padding) $layer]
    28862891    }
    28872892
Note: See TracChangeset for help on using the changeset viewer.