Changeset 6495


Ignore:
Timestamp:
Aug 22, 2016 2:34:51 PM (7 years ago)
Author:
ldelgass
Message:

Add model layer type for OSG 3D models.

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r6493 r6495  
    105105        "elevation"     1
    106106        "feature"       2
    107         "polygon"       3
    108         "point"         4
    109         "icon"          5
    110         "line"          6
    111         "label"         7
     107        "model"         3
     108        "polygon"       4
     109        "point"         5
     110        "icon"          6
     111        "line"          7
     112        "label"         8
    112113    }
    113114    array set _mapTypes {
     
    173174itcl::body Rappture::Map::parseXML { xmlobj path } {
    174175    set map [$xmlobj element -as object $path]
     176    set elemType [$xmlobj element -as type $path]
     177    if {$elemType != "map"} {
     178        puts stderr "ERROR: Invalid map XML: \"$elemType\""
     179        return
     180    }
    175181
    176182    # Set global map properties
     
    379385            }
    380386            $_tree set $child "driver" "ogr"
     387        }
     388        set osg [$layers element -as type $layer.osg]
     389        if { $osg != "" } {
     390            foreach key { url } {
     391                set value [$layers get $layer.osg.$key]
     392                $_tree set $child "osg.$key" $value
     393            }
     394            set file [$layers get $layer.osg.file]
     395            if { $file != "" } {
     396                $_tree set $child "osg.url" $file
     397            }
     398            $_tree set $child "osg.x" 0.0
     399            $_tree set $child "osg.y" 0.0
     400            $_tree set $child "osg.z" 0.0
     401            foreach key { x y z rotx roty rotz paged } {
     402                set value [$layers get $layer.osg.$key]
     403                if { $value != "" } {
     404                    $_tree set $child "osg.$key" $value
     405                }
     406            }
     407            $_tree set $child "driver" "osg"
    381408        }
    382409        set tfs [$layers element -as type $layer.tfs]
     
    735762            }
    736763        }
     764        "osg" {
     765            array set params $driverParamArray
     766            foreach key { url } {
     767                set value $params($key)
     768                $_tree set $child "osg.$key" $value
     769            }
     770            $_tree set $child "osg.x" 0.0
     771            $_tree set $child "osg.y" 0.0
     772            $_tree set $child "osg.z" 0.0
     773            foreach key { x y z rotx roty rotz paged } {
     774                if {[info exists params($key)]} {
     775                    set value $params($key)
     776                    if { $value != "" } {
     777                        $_tree set $child "osg.$key" $value
     778                    }
     779                }
     780            }
     781        }
    737782        "tfs" {
    738783            array set params $driverParamArray
     
    12341279            }
    12351280        }
    1236         "image" - "elevation" - "feature" {
     1281        "image" - "elevation" - "feature" - "model" {
    12371282        }
    12381283        default {
  • trunk/gui/scripts/mapviewer.tcl

    r6494 r6495  
    28042804                set verticalDatum $info(verticalDatum)
    28052805            }
    2806             switch -- $info(driver)  {
     2806            switch -- $info(driver) {
    28072807                "gdal" {
    28082808                    SendFiles $info(gdal.url)
     
    29022902            SendCmd "map layer opacity $style(-opacity) $tag"
    29032903        }
     2904        "model" {
     2905            switch -- $info(driver) {
     2906                "osg" {
     2907                    SendFiles $info(osg.url)
     2908                    SendCmd [list map layer add $tag model simple $info(osg.url) $info(osg.x) $info(osg.y) $info(osg.z)]
     2909                }
     2910            }
     2911        }
    29042912        "line" {
    29052913            array set style {
     
    29232931            set _opacity($tag) [expr $style(-opacity) * 100]
    29242932            foreach {r g b} [Color2RGB $style(-color)] {}
    2925             switch -- $info(driver)  {
     2933            switch -- $info(driver) {
    29262934                "ogr" {
    29272935                    SendFiles $info(ogr.url)
     
    29722980            set _opacity($tag) [expr $style(-opacity) * 100]
    29732981            foreach {r g b} [Color2RGB $style(-color)] {}
    2974             switch -- $info(driver)  {
     2982            switch -- $info(driver) {
    29752983                "ogr" {
    29762984                    SendFiles $info(ogr.url)
     
    30243032            }
    30253033            set _opacity($tag) [expr $style(-opacity) * 100]
    3026             switch -- $info(driver)  {
     3034            switch -- $info(driver) {
    30273035                "ogr" {
    30283036                    SendFiles $info(ogr.url)
     
    30773085            foreach {r g b} [Color2RGB $style(-color)] {}
    30783086            foreach {strokeR strokeG strokeB} [Color2RGB $style(-strokecolor)] {}
    3079             switch -- $info(driver)  {
     3087            switch -- $info(driver) {
    30803088                "ogr" {
    30813089                    SendFiles $info(ogr.url)
     
    31423150            foreach {fgR fgG fgB} [Color2RGB $style(-color)] {}
    31433151            foreach {bgR bgG bgB} [Color2RGB $style(-halocolor)] {}
    3144             switch -- $info(driver)  {
     3152            switch -- $info(driver) {
    31453153                "ogr" {
    31463154                    SendFiles $info(ogr.url)
Note: See TracChangeset for help on using the changeset viewer.