Changeset 5955 for branches/geomap


Ignore:
Timestamp:
Jan 14, 2016, 7:08:06 PM (9 years ago)
Author:
dkearney
Message:

merging changesets r5928 through r5954 from trunk

Location:
branches/geomap
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/geomap

  • branches/geomap/gui/scripts/map.tcl

    r5949 r5955  
    4343    public method setAttribution { attribution }
    4444    public method setCamera { camera }
    45     public method setExtents { xmin ymin xmax ymax }
     45    public method setExtents { xmin ymin xmax ymax {srs "wgs84"} }
    4646    public method setLabel { label }
    4747    public method setProjection { projection }
     
    259259                # FIXME: Add test for valid file path
    260260                $_tree set $child "ogr.url" $file
     261            }
     262            foreach key { connection geometry geometry_url layer ogr_driver build_spatial_index } {
     263                set value [$layers get $layer.ogr.$key]
     264                if { $value != "" } {
     265                    $_tree set $child "ogr.$key" $value
     266                }
    261267            }
    262268            $_tree set $child "driver" "ogr"
     
    431437}
    432438
    433 itcl::body Rappture::Map::setExtents { xmin ymin xmax ymax } {
    434     $_tree set root "extents" "$xmin $ymin $xmax $ymax"
     439itcl::body Rappture::Map::setExtents { xmin ymin xmax ymax {srs "wgs84"} } {
     440    $_tree set root "extents" [list $xmin $ymin $xmax $ymax $srs]
    435441}
    436442
     
    458464itcl::body Rappture::Map::viewpoints {} {
    459465    set list {}
    460     foreach node [$_tree children root->"viewpoints"] {
    461         lappend list [$_tree label $node]
     466    catch {
     467        foreach node [$_tree children root->"viewpoints"] {
     468            lappend list [$_tree label $node]
     469        }
    462470    }
    463471    return $list
     
    601609itcl::body Rappture::Map::selectors { layerName } {
    602610    set list {}
    603     foreach node [$_tree children root->"layers"->"$layerName"->"selectors"] {
    604         lappend list [$_tree label $node]
     611    catch {
     612        foreach node [$_tree children root->"layers"->"$layerName"->"selectors"] {
     613            lappend list [$_tree label $node]
     614        }
    605615    }
    606616    return $list
  • branches/geomap/gui/scripts/mapviewer.tcl

    r5949 r5955  
    6363    public method scale {args}
    6464    public method select {option {args ""}}
     65    public method setSelectCallback {cmd}
    6566
    6667    public method send { cmd }
     
    9495    private method DoRotate {}
    9596    private method DoSelect {}
     97    private method DoSelectCallback {option {args ""}}
    9698    private method DrawLegend { colormap min max }
    9799    private method EarthFile {}
     
    116118    private method ReceiveMapInfo { args }
    117119    private method ReceiveScreenInfo { args }
     120    private method ReceiveSelect { option {args ""} }
    118121    private method RequestLegend { colormap w h }
    119122    private method Rotate {option x y}
     
    142145                                        # layer in the server.
    143146    private variable _viewpoints;
     147    private variable _selectCallback "";
    144148    private variable _click;            # info used for rotate operations
    145149    private variable _view;             # view params for 3D view
     
    218222    $_parser alias camera   [itcl::code $this camera]
    219223    $_parser alias screen   [itcl::code $this ReceiveScreenInfo]
    220     $_parser alias select   [itcl::code $this select]
     224    $_parser alias select   [itcl::code $this ReceiveSelect]
    221225
    222226    # Millisecond delay before animated wait dialog appears
     
    267271    }
    268272
    269     # Note: grid types are "geodetic", "utm" and "mgrs"
     273    # Note: grid types are "shader", "geodetic", "utm" and "mgrs"
    270274    # Currently only work in geocentric maps
    271275    array set _settings [subst {
     
    275279        coords-visible         1
    276280        grid                   0
    277         grid-type              "geodetic"
     281        grid-type              "shader"
    278282        legend                 1
    279283        terrain-ambient        0.03
     
    938942}
    939943
    940 # ----------------------------------------------------------------------
    941 # USAGE: select clear
    942 # USAGE: select feature
    943 # USAGE: select annotation
    944 # ----------------------------------------------------------------------
    945 itcl::body Rappture::MapViewer::select {option {args ""}} {
     944itcl::body Rappture::MapViewer::setSelectCallback {cmd} {
     945    set _selectCallback $cmd
     946}
     947
     948itcl::body Rappture::MapViewer::DoSelectCallback {option {args ""}} {
     949    if { $_selectCallback != "" } {
     950        set cmd [concat $_selectCallback $option $args]
     951        uplevel #0 $cmd
     952    }
     953}
     954
     955# ----------------------------------------------------------------------
     956# USAGE: ReceiveSelect clear
     957# USAGE: ReceiveSelect feature <args...>
     958# USAGE: ReceiveSelect annotation <args...>
     959# ----------------------------------------------------------------------
     960itcl::body Rappture::MapViewer::ReceiveSelect {option {args ""}} {
    946961    DebugTrace "Enter"
    947962    switch $option {
     
    950965        }
    951966        "clear" {
    952              puts stderr "select clear"
     967            puts stderr "select clear"
    953968        }
    954969        "feature" {
    955              puts stderr "select feature $args"
     970            puts stderr "select feature $args"
     971        }
     972    }
     973    eval DoSelectCallback $option $args
     974}
     975
     976# ----------------------------------------------------------------------
     977# USAGE: select clear
     978# USAGE: select feature <args...>
     979# USAGE: select annotation <args...>
     980#
     981# Clients use this method to notify the map widget of a selection event
     982# originating from outside the map
     983# ----------------------------------------------------------------------
     984itcl::body Rappture::MapViewer::select {option {args ""}} {
     985    switch $option {
     986        "annotation" {
     987            SendCmd "select annotation $args"
     988        }
     989        "clear" {
     990            SendCmd "select clear"
     991        }
     992        "feature" {
     993            SendCmd "select feature $args"
     994        }
     995        default {
     996            puts stderr "Unknown select option \"$option\""
    956997        }
    957998    }
     
    13151356    set _first ""
    13161357    set haveTerrain 0
     1358    #SendCmd "map layer visible 0"
    13171359    foreach dataobj [get -objects] {
    13181360        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
     
    25402582            set selectors [list]
    25412583            foreach selector [$dataobj selectors $layer] {
    2542                array set sinfo [$dataobj selector $layer $selector]
     2584                array set sinfo [$dataobj selector $layer $selector]
    25432585                DebugTrace "$selector: [array get sinfo]"
    25442586                lappend selectors [array get sinfo]
     
    25532595            }
    25542596            set format ""
    2555             set tmsType ""
    2556             set cmd [list map layer add $layer feature $info(driver) $format $tmsType $info(ogr.url) $info(cache) $info(stylesheet) $script $selectors]
    2557             if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    2558                 lappend cmd $style(-minrange) $style(-maxrange)
    2559             }
    2560             SendFiles $info(ogr.url)
     2597            set wfsType ""
     2598            if { [info exists info(ogr.connection)] } {
     2599                set cmd [list map layer add $layer feature db $format $info(ogr.layer) $info(ogr.connection) $info(cache) $info(stylesheet) $script $selectors]
     2600                if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2601                    lappend cmd $style(-minrange) $style(-maxrange)
     2602                }
     2603            } else {
     2604                set cmd [list map layer add $layer feature $info(driver) $format $wfsType $info(ogr.url) $info(cache) $info(stylesheet) $script $selectors]
     2605                if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
     2606                    lappend cmd $style(-minrange) $style(-maxrange)
     2607                }
     2608                SendFiles $info(ogr.url)
     2609            }
    25612610            SendCmd $cmd
    25622611        }
     
    27202769            array set style {
    27212770                -clamping terrain
    2722                 -clamptechnique gpu
     2771                -clamptechnique drape
    27232772                -color white
    27242773                -minbias 1000
Note: See TracChangeset for help on using the changeset viewer.