- Timestamp:
- Feb 9, 2016, 10:23:21 PM (9 years ago)
- Location:
- branches/blt4_geovis
- Files:
-
- 8 edited
- 7 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4_geovis
- Property svn:mergeinfo changed
/branches/geomap merged: 5971,5990-5991,5993
- Property svn:mergeinfo changed
-
branches/blt4_geovis/gui/scripts/geomaplayer.tcl
r5964 r5994 27 27 28 28 private variable _provider "" 29 private variable _placardstyle_default {fill: #B6B6B688; text-fill: #000000; text-size: 12.0;} 29 30 30 31 public variable label "" … … 33 34 public variable visibility "true" 34 35 public variable opacity "1.0" 36 public variable placardattributes "" 37 public variable placardstyle "" 38 public variable placardpadding 5 35 39 36 40 private method Provider { provider } … … 51 55 Provider $provider 52 56 57 set placardstyle ${_placardstyle_default} 58 53 59 eval configure $args 54 60 } … … 82 88 83 89 if {[string compare "" $label] == 0} { 84 error "bad value: \"$label\": should be a non-empty string"90 error "bad value: \"$label\": label should be a non-empty string" 85 91 } 86 92 } … … 93 99 94 100 if {[string compare "" $description] == 0} { 95 error "bad value: \"$description\": should be a non-empty string"101 error "bad value: \"$description\": description should be a non-empty string" 96 102 } 97 103 } … … 104 110 105 111 if {[string compare "" $attribution] == 0} { 106 error "bad value: \"$attribution\": should be a non-empty string"112 error "bad value: \"$attribution\": attribution should be a non-empty string" 107 113 } 108 114 } … … 115 121 116 122 if {[string is bool $visibility] == 0} { 117 error "bad value: \"$visibility\": should be a boolean"123 error "bad value: \"$visibility\": visibility should be a boolean" 118 124 } 119 125 } … … 126 132 127 133 if {[string is double $opacity] == 0} { 128 error "bad value: \"$opacity\": should be a double"134 error "bad value: \"$opacity\": opacity should be a double" 129 135 } 130 136 131 137 if {[expr {$opacity < 0.0}] == 1 || [expr {$opacity > 1.0}] == 1} { 132 error "bad value: \"$opacity\": should be in range \[0.0,1.0\]" 138 error "bad value: \"$opacity\": opacity should be in range \[0.0,1.0\]" 139 } 140 } 141 142 143 # ---------------------------------------------------------------------- 144 # placardattributes: key value list of attributes to show in the placard 145 # ---------------------------------------------------------------------- 146 itcl::configbody Rappture::GeoMapLayer::placardattributes { 147 148 if { [expr {[llength $placardattributes] % 2}] != 0 } { 149 error "bad value \"$placardattributes\": uneven number of placard attributes" 150 } 151 152 regsub -all "\[ \t\r\n\]+" [string trim $placardattributes] " " placardattributes 153 } 154 155 156 # ---------------------------------------------------------------------- 157 # placardstyle: CSS formatted style definition for text and background 158 # ---------------------------------------------------------------------- 159 itcl::configbody Rappture::GeoMapLayer::placardstyle { 160 161 if {[string equal $placardstyle ""]} { 162 # blank value sets style back to the default 163 set placardstyle ${_placardstyle_default} 164 } 165 166 regsub -all "\[ \t\r\n\]+" [string trim $placardstyle] " " placardstyle 167 } 168 169 170 # ---------------------------------------------------------------------- 171 # placardpadding: pixels between attribute labels and edge of the backing quad 172 # ---------------------------------------------------------------------- 173 itcl::configbody Rappture::GeoMapLayer::placardpadding { 174 175 if {[string is integer $placardpadding] == 0} { 176 error "bad value \"$placardpadding\": placardpadding should be a positive integer" 177 } 178 179 if {$placardpadding < 0} { 180 error "bad value \"$placardpadding\": placardpadding should be a positive integer" 133 181 } 134 182 } … … 213 261 visible $visibility \ 214 262 opacity $opacity \ 215 263 placard [list \ 264 attrlist $placardattributes\ 265 style $placardstyle\ 266 padding $placardpadding\ 267 ] 216 268 } 217 269 default { -
branches/blt4_geovis/gui/scripts/map.tcl
- Property svn:mergeinfo changed
/branches/geomap/gui/scripts/map.tcl (added) merged: 5990
r5965 r5994 31 31 32 32 public method addViewpoint { name props } 33 public method deleteViewpoint { viewpointName } 33 34 public method earthfile {} 35 public method getPlacardConfig { layerName } 34 36 public method hints { args } 35 37 public method isGeocentric {} … … 45 47 public method setExtents { xmin ymin xmax ymax {srs "wgs84"} } 46 48 public method setLabel { label } 49 public method setPlacardConfig { layerName attrlist style padding } 47 50 public method setProjection { projection } 48 51 public method setStyle { style } … … 203 206 } 204 207 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 205 215 } 206 216 $_tree set $child "driver" "debug" … … 578 588 # layer names 579 589 # layer settings layerName 580 # 590 # ---------------------------------------------------------------------- 581 591 itcl::body Rappture::Map::layer {option args} { 582 592 set result "" … … 601 611 } 602 612 613 614 itcl::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 633 itcl::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 } 603 640 604 641 # ---------------------------------------------------------------------- … … 686 723 } 687 724 725 itcl::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 688 733 # ---------------------------------------------------------------------- 689 734 # USAGE: type <layerName> - Property svn:mergeinfo changed
-
branches/blt4_geovis/gui/scripts/mapviewer.tcl
- Property svn:mergeinfo changed
/branches/geomap/gui/scripts/mapviewer.tcl (added) merged: 5990
r5964 r5994 1427 1427 1428 1428 itcl::body Rappture::MapViewer::EnablePanningMouseBindings {} { 1429 if { $_useServerManip} {1429 if {1 || $_useServerManip} { 1430 1430 bind $itk_component(view) <ButtonPress-1> \ 1431 1431 [itcl::code $this MouseClick 1 %x %y] … … 1451 1451 1452 1452 itcl::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} { 1461 1454 # Bindings for rotation via mouse 1462 1455 bind $itk_component(view) <ButtonPress-2> \ … … 1466 1459 bind $itk_component(view) <ButtonRelease-2> \ 1467 1460 [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] 1468 1468 } 1469 1469 } … … 1476 1476 1477 1477 itcl::body Rappture::MapViewer::EnableZoomMouseBindings {} { 1478 if { $_useServerManip} {1478 if {1 || $_useServerManip} { 1479 1479 bind $itk_component(view) <ButtonPress-3> \ 1480 1480 [itcl::code $this MouseClick 3 %x %y] … … 1770 1770 itcl::body Rappture::MapViewer::Pan {option x y} { 1771 1771 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 return1781 }1782 1772 "click" { 1783 1773 set _click(x) $x … … 1813 1803 $itk_component(view) configure -cursor "" 1814 1804 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 1815 1815 } 1816 1816 default { … … 2884 2884 SendCmd "map layer opacity $style(-opacity) $layer" 2885 2885 } 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] 2886 2891 } 2887 2892 - Property svn:mergeinfo changed
-
branches/blt4_geovis/gui/scripts/visviewer.tcl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/blt4_geovis/gui/test/geomaplayer.test
r5964 r5994 45 45 # ?-attribution <attrib>? \ 46 46 # ?-visibility <visibility>? \ 47 # ?-opacity <opacity>? 47 # ?-opacity <opacity>? \ 48 # ?-placardattributes <attributes>? \ 49 # ?-placardstyle <style>? \ 50 # ?-placardpadding <padding>? 48 51 #---------------------------------------------------------- 49 52 test geomaplayer-1.1 {Rappture::GeoMapLayer, 0 arguments} { … … 56 59 57 60 61 #---------------------------------------------------------- 62 # export command 63 #---------------------------------------------------------- 64 65 set l1 [Rappture::GeoMapLayer #auto $provider] 66 58 67 test geomaplayer-11.0 {Rappture::GeoMapLayer, export (default format)} { 59 set l [Rappture::GeoMapLayer #auto $provider] 60 set t [$l export] 68 set t [$l1 export] 61 69 list [catch {lindex [$t dump 0] 3} msg] $msg 62 } {0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/ label {} description {} visible true opacity 1.0 }}70 } {0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/ label {} description {} visible true opacity 1.0 placard {attrlist {} style {fill: #B6B6B688; text-fill: #000000; text-size: 12.0;} padding 5}}} 63 71 64 72 test geomaplayer-11.1 {Rappture::GeoMapLayer, export bad format} { 65 set l [Rappture::GeoMapLayer #auto $provider] 66 list [catch {$l export -format blahh} msg] $msg 73 list [catch {$l1 export -format blahh} msg] $msg 67 74 } {1 {bad format "blahh": should be one of blt_tree}} 68 75 69 76 test geomaplayer-11.2 {Rappture::GeoMapLayer, export -format blt_tree} { 70 set l [Rappture::GeoMapLayer #auto $provider] 71 set t [$l export -format blt_tree] 77 set t [$l1 export -format blt_tree] 72 78 list [catch {lindex [$t dump 0] 3} msg] $msg 73 } {0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/ label {} description {} visible true opacity 1.0}} 79 } {0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/ label {} description {} visible true opacity 1.0 placard {attrlist {} style {fill: #B6B6B688; text-fill: #000000; text-size: 12.0;} padding 5}}} 80 81 82 #---------------------------------------------------------- 83 # -placardattributes flag validation 84 #---------------------------------------------------------- 85 86 set l2 [Rappture::GeoMapLayer #auto $provider] 87 88 test geomaplayer-12.1 {-placardattributes string} { 89 set err [catch {$l2 configure -placardattributes {name Name aland "Land Area"}} msg] 90 catch {$l2 cget -placardattributes} stored 91 list $err $msg $stored 92 } {0 {} {name Name aland "Land Area"}} 93 94 test geomaplayer-12.2 {-placardattributes string with extra spaces} { 95 set err [catch {$l2 configure -placardattributes "name Name\naland LandArea"} msg] 96 catch {$l2 cget -placardattributes} stored 97 list $err $msg $stored 98 } {0 {} {name Name aland LandArea}} 99 100 101 102 #---------------------------------------------------------- 103 # -placardstyle flag validation 104 #---------------------------------------------------------- 105 106 test geomaplayer-13.1 {-placardstyle string} { 107 set err [catch {$l2 configure -placardstyle {fill: #00FF0088;}} msg] 108 catch {$l2 cget -placardstyle} stored 109 list $err $msg $stored 110 } {0 {} {fill: #00FF0088;}} 111 112 test geomaplayer-13.2 {-placardstyle string with extra spaces} { 113 set err [catch {$l2 configure -placardstyle "fill:\t#00FF0088;"} msg] 114 catch {$l2 cget -placardstyle} stored 115 list $err $msg $stored 116 } {0 {} {fill: #00FF0088;}} 117 118 test geomaplayer-13.3 {-placardstyle empty string sets widget default} { 119 set err [catch {$l2 configure -placardstyle ""} msg] 120 catch {$l2 cget -placardstyle} stored 121 list $err $msg $stored 122 } {0 {} {fill: #B6B6B688; text-fill: #000000; text-size: 12.0;}} 123 124 125 #---------------------------------------------------------- 126 # -placardpadding flag validation 127 #---------------------------------------------------------- 128 129 test geomaplayer-14.1 {-placardpadding integer} { 130 set err [catch {$l2 configure -placardpadding 7} msg] 131 catch {$l2 cget -placardpadding} stored 132 list $err $msg $stored 133 } {0 {} 7} 134 135 test geomaplayer-14.2 {-placardpadding double} { 136 list [catch {$l2 configure -placardpadding 8.0} msg] $msg 137 } {1 {bad value "8.0": placardpadding should be a positive integer}} 138 139 test geomaplayer-14.3 {-placardpadding negative integer} { 140 list [catch {$l2 configure -placardpadding -5} msg] $msg 141 } {1 {bad value "-5": placardpadding should be a positive integer}} 142 74 143 75 144 -
branches/blt4_geovis/gui/test/geomaplayerimage.test
r5964 r5994 71 71 set t [$l export -format blt_tree] 72 72 list [catch {lindex [$t dump 0] 3} msg] $msg 73 } {0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/ label {} description {} visible true opacity 1.0 coverage false}}73 } {0 {type image driver xyz cache true attribution {} xyz.url http://myurl.com/ label {} description {} visible true opacity 1.0 placard {attrlist {} style {fill: #B6B6B688; text-fill: #000000; text-size: 12.0;} padding 5} coverage false}} 74 74 75 75 -
branches/blt4_geovis/lang/tcl/pkgIndex.tcl.in
- Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset
for help on using the changeset viewer.