Changeset 5896


Ignore:
Timestamp:
Oct 1, 2015, 2:55:15 PM (9 years ago)
Author:
ldelgass
Message:

If map layer url begins with "local://", transfer files to render server.

File:
1 edited

Legend:

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

    r5892 r5896  
    116116    private method Rotate {option x y}
    117117    private method Select {option x y}
     118    private method SendFiles { path }
    118119    private method SetHeading { {value 0} }
    119120    private method SetLayerOpacity { dataobj layer {value 100} }
     
    23372338}
    23382339
     2340itcl::body Rappture::MapViewer::SendFiles { path } {
     2341    if {[string range $path 0 7] != "local://"} {
     2342        return
     2343    }
     2344    DebugTrace "Local path: $path"
     2345    set path [string range $path 8 end]
     2346    set basename [file rootname $path]
     2347    set files [glob -path $basename .*]
     2348    foreach file $files {
     2349        set name $file
     2350        set type [file type $file]
     2351        set size [file size $file]
     2352        set f [open $file "r"]
     2353        fconfigure $f -translation binary -encoding binary
     2354        set data [read $f]
     2355        close $f
     2356        SendCmd [list file put $name $type $size]
     2357        SendData $data
     2358    }
     2359}
     2360
    23392361itcl::body Rappture::MapViewer::SetLayerStyle { dataobj layer } {
    23402362    array set info [$dataobj layer $layer]
     
    23702392                    "colorramp" {
    23712393                        set cmapName $layer
     2394                        SendFiles $info(colorramp.url)
    23722395                        SendCmd [list colormap define $cmapName $info(colorramp.colormap)]
    23732396                        SendCmd [list map layer add $layer image colorramp \
     
    23792402                    }
    23802403                    "gdal" {
     2404                        SendFiles $info(gdal.url)
    23812405                        SendCmd [list map layer add $layer image gdal \
    23822406                                     $info(gdal.url) $info(cache) $coverage]
     
    24122436                switch -- $info(driver)  {
    24132437                    "gdal" {
     2438                        SendFiles $info(gdal.url)
    24142439                        SendCmd [list map layer add $layer elevation gdal \
    24152440                                     $info(gdal.url) $info(cache)]
     
    24642489                lappend cmd $style(-minrange) $style(-maxrange)
    24652490            }
     2491            SendFiles $info(ogr.url)
    24662492            SendCmd $cmd
    24672493        }
     
    24892515            switch -- $info(driver)  {
    24902516                "ogr" {
     2517                    SendFiles $info(ogr.url)
    24912518                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    24922519                        SendCmd [list map layer add $layer line ogr {} {} $info(ogr.url) $info(cache) $r $g $b $style(-width) $style(-cap) $style(-join) $style(-stipplepattern) $style(-stipplefactor) $style(-clamping) $style(-clamptechnique) $style(-minrange) $style(-maxrange)]
     
    25372564            switch -- $info(driver)  {
    25382565                "ogr" {
     2566                    SendFiles $info(ogr.url)
    25392567                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    25402568                        SendCmd [list map layer add $layer point ogr {} {} $info(ogr.url) $info(cache) $r $g $b $style(-size) $style(-minrange) $style(-maxrange)]
     
    25882616            switch -- $info(driver)  {
    25892617                "ogr" {
     2618                    SendFiles $info(ogr.url)
    25902619                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    25912620                        SendCmd [list map layer add $layer icon ogr {} {} $info(ogr.url) $info(cache) $style(-icon) $style(-scale) $style(-heading) $style(-declutter) $style(-placement) $style(-align) $style(-minrange) $style(-maxrange)]
     
    26402669            switch -- $info(driver)  {
    26412670                "ogr" {
     2671                    SendFiles $info(ogr.url)
    26422672                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    26432673                        SendCmd [list map layer add $layer polygon ogr {} {} $info(ogr.url) $info(cache) $r $g $b $style(-strokewidth) $strokeR $strokeG $strokeB $style(-clamping) $style(-clamptechnique) $style(-minrange) $style(-maxrange)]
     
    27042734            switch -- $info(driver)  {
    27052735                "ogr" {
     2736                    SendFiles $info(ogr.url)
    27062737                    if {[info exists style(-minrange)] && [info exists style(-maxrange)]} {
    27072738                        SendCmd [list map layer add $layer text ogr {} {} $info(ogr.url) $info(cache) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $style(-halowidth) $style(-fontsize) $style(-removedupes) $style(-declutter) $style(-align) $style(-xoffset) $style(-yoffset) $style(-minrange) $style(-maxrange)]
Note: See TracChangeset for help on using the changeset viewer.