- Timestamp:
- May 6, 2016, 7:05:00 AM (9 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/map.tcl
r6264 r6318 31 31 32 32 public method addLayer { type name paramArray driver driverParamArray {stylesheet {}} {script {}} {selectors {}} } 33 public method addSelector { layerName selectorName paramArray } 33 34 public method addViewpoint { name props } 34 35 public method clearExtents {} 35 36 public method deleteLayer { layerName } 37 public method deleteSelector { layerName selectorName } 36 38 public method deleteViewpoint { viewpointName } 39 public method dirty { key args } { 40 if {[llength $args] == 0} { 41 if { [info exists _dirty($key)] } { 42 return $_dirty($key) 43 } else { 44 return 0 45 } 46 } else { 47 set _dirty($key) [lindex $args 0] 48 } 49 } 37 50 public method getPlacardConfig { layerName } 38 51 public method hasLayer { layerName } … … 50 63 public method setAttribution { attribution } 51 64 public method setCamera { camera } 65 public method setColormap { layerName colormap } 52 66 public method setDescription { description } 53 67 public method setExtents { xmin ymin xmax ymax {srs "wgs84"} } … … 55 69 public method setPlacardConfig { layerName attrlist style padding } 56 70 public method setProjection { projection } 71 public method setScript { layerName script } 57 72 public method setStyle { style } 73 public method setStylesheet { layerName stylesheet } 58 74 public method setToolInfo { id name command title revision } 59 75 public method setType { type } … … 70 86 private variable _tree ""; # Tree of information about the map. 71 87 private variable _isValid 0; 88 private variable _dirty; 89 array set _dirty { 90 viewpoints 0 91 } 72 92 private common _nextSelector 0; 73 93 private common _layerTypes … … 765 785 } 766 786 } 787 set _dirty($id) 1 767 788 return $id 768 789 } … … 804 825 } 805 826 $_tree delete $id 827 array unset _dirty $layerName 806 828 } 807 829 … … 868 890 } 869 891 892 itcl::body Rappture::Map::setScript { layerName script } { 893 set id [$_tree findchild root->"layers" $layerName] 894 if { $id < 0 } { 895 error "unknown layer \"$layerName\"" 896 } 897 $_tree set $id "script" $script 898 set _dirty($layerName) 1 899 } 900 901 itcl::body Rappture::Map::setStylesheet { layerName stylesheet } { 902 set id [$_tree findchild root->"layers" $layerName] 903 if { $id < 0 } { 904 error "unknown layer \"$layerName\"" 905 } 906 $_tree set $id "stylesheet" $stylesheet 907 set _dirty($layerName) 1 908 } 909 910 itcl::body Rappture::Map::setColormap { layerName colormap } { 911 set id [$_tree findchild root->"layers" $layerName] 912 if { $id < 0 } { 913 error "unknown layer \"$layerName\"" 914 } 915 $_tree set $id "colorramp.colormap" $colormap 916 set _dirty($layerName) 1 917 } 918 870 919 # ---------------------------------------------------------------------- 871 920 # USAGE: selectors … … 904 953 return 1 905 954 } 955 } 956 957 itcl::body Rappture::Map::addSelector { layerName name params } { 958 set nodeid $name 959 set layerid [$_tree findchild root->"layers" $layerName] 960 if { $layerid < 0 } { 961 error "unknown layer \"$layerName\"" 962 } 963 if {[hasSelector $layerName $nodeid]} { 964 error "Selector '$nodeid' already exists" 965 } 966 set parent [$_tree findchild root->"layers"->"$layerName" "selectors"] 967 if { $parent == "" } { 968 set parent [$_tree insert $layerid -label "selectors"] 969 } 970 set child [$_tree insert $parent -label $nodeid] 971 array set info $params 972 foreach key { name style styleExpression query queryBounds queryOrderBy } { 973 if { [info exists info($key)] && 974 $info($key) != ""} { 975 $_tree set $child $key $info($key) 976 } 977 } 978 set _dirty($layerName) 1 979 } 980 981 itcl::body Rappture::Map::deleteSelector { layerName selectorName } { 982 set id [$_tree findchild root->"layers"->"$layerName"->"selectors" $selectorName] 983 if { $id < 0 } { 984 error "unknown selector \"$selectorName\"" 985 } 986 $_tree delete $id 987 set _dirty($layerName) 1 906 988 } 907 989 … … 971 1053 $_tree set $child z $info(altitude) 972 1054 } 1055 set _dirty(viewpoints) 1 973 1056 } 974 1057 … … 979 1062 } 980 1063 $_tree delete $id 1064 set _dirty(viewpoints) 1 981 1065 } 982 1066 -
trunk/gui/scripts/mapviewer.tcl
r6304 r6318 1467 1467 set _layers($tag) 1 1468 1468 SetLayerStyle $dataobj $layer 1469 } 1469 } elseif { [$dataobj dirty $layer] } { 1470 # Recreate layer 1471 # FIXME: retain layer order 1472 SendCmd "map layer delete $tag" 1473 SetLayerStyle $dataobj $layer 1474 } 1475 $dataobj dirty $layer 0 1470 1476 # Don't change visibility of shared/base layers 1471 1477 if { !$info(shared) } {
Note: See TracChangeset
for help on using the changeset viewer.