/usr/lib/grass64/etc/gm/group.tcl is in grass-gui 6.4.3-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | ###############################################################
# group.tcl - group layer creation and management procedures
# for GRASS GIS Manager
# January 2006 Michael Barton, Arizona State University
###############################################################
namespace eval GmGroup {
variable array opt
variable count 1
variable array tree # mon
variable nvelev ""
variable nvcolor ""
variable nvpoints ""
variable nvlines ""
}
proc GmGroup::create { tree parent } {
variable opt
variable count
set fon [font create -size 10]
set frm [ frame .groupicon$count ]
set check [checkbutton $frm.check -text "" -font $fon \
-variable GmGroup::opt($count,_check) \
-height 1]
set image [label $frm.image -image [Bitmap::get folder] ]
pack $check $image -side left
set node "group:$count"
#insert new layer
if {[$tree selection get] != "" } {
set sellayer [$tree index [$tree selection get]]
} else {
set sellayer "end"
}
$tree insert $sellayer $parent $node \
-text "group $count" \
-window $frm \
-drawcross auto \
-open 1
set opt($count,_check) 1
set opt($count,treeimagepath) $image
incr count
return $node
}
proc GmGroup::save { tree depth node } {
variable opt
global mon
if { $node != "root" } {
set id [GmTree::node_id $node]
GmTree::rc_write $depth _check $opt($id,_check)
}
foreach n [$tree nodes $node] {
GmTree::save_node $depth $n
}
}
proc GmGroup::display { node mod } {
variable opt
variable tree
global mon
global drawprog
global commandlist
set commandlist {}
set tree($mon) $GmTree::tree($mon)
set layers ""
if { $node != "root" } {
set id [GmTree::node_id $node]
if { ! ( $opt($id,_check) ) } { return }
}
#invert layer list to put first tree node as top map layer
foreach n [$tree($mon) nodes $node] {
set layers [linsert $layers 0 $n]
}
# display each node/layer
foreach n $layers {
GmTree::display_node $n $mod
incr drawprog
}
}
###############################################################################
# display background maps for digitizing in v.digit
proc GmGroup::vdigit_display { vectmap } {
variable opt
variable tree
variable bg_command
global mon
global drawprog
global commandlist
set bg_command ""
# display selected layers to create a display command list if needed
if {[llength $commandlist] == 0} {
MapCanvas::request_redraw $mon 1
vwait commandlist
}
# if the layer being digitized is the only one displayed, then don't
# make it a background layer too. This avoids a black background.
set mapname [lindex [split [lindex [split [lindex $commandlist 0] ] 1] =] 1]
if {[llength $commandlist] == 1 && $mapname == $vectmap} {
return $bg_command
}
# add each command in display command list to background commands
foreach cmd $commandlist {
append bg_command "$cmd;"
}
# get rid of the ; at the end of the background command list
set bg_command [string trimright $bg_command ";"]
return $bg_command
}
###############################################################################
proc GmGroup::nvdisplay { node } {
variable opt
variable tree
variable nvelev
variable nvcolor
variable nvpoints
variable nvlines
global mon
global drawprog
global devnull
#global commandlist
#
#if {[llength $commandlist] == 0} {
# MapCanvas::request_redraw $mon 1
# vwait commandlist
#}
set tree($mon) $GmTree::tree($mon)
if { $node != "root" } {
set id [GmTree::node_id $node]
if { ! ( $opt($id,_check) ) } { return }
}
foreach n [$tree($mon) nodes $node] {
GmGroup::nviz $n
incr drawprog
}
if { $nvelev!= "" } {
set cmd [list nviz elevation=$nvelev color=$nvcolor]
if {$nvlines != ""} {
lappend cmd vector=$nvlines
}
if {$nvpoints != ""} {
lappend cmd points=$nvpoints
}
if {[catch {eval exec "$cmd 2> $devnull &"} error]} {
GmLib::errmsg $error
}
} else {
return
}
set nvelev ""
set nvcolor ""
set nvlines ""
set nvpoints ""
}
# display raster maps in NVIZ (base maps for elevation and drape maps for color)
proc GmGroup::nviz { node } {
variable opt
variable tree
variable nvelev
variable nvcolor
variable nvpoints
variable nvlines
global mon
global drawprog
global devnull
#set id [GmTree::node_id $node]
set vect ""
set vecttype ""
set type [GmTree::node_type $node]
switch $type {
"group" {
GmGroup::nvdisplay $node
}
"raster" {
set surf [GmRaster::addelev $node]
if {$surf == ""} {return}
set clr [GmRaster::addcolor $node]
if {$clr == ""} {set clr $surf}
# test whether surf and clr are valid files
if {[catch {set rexist [eval exec "r.info map=$surf 2> $devnull"]} error]} {
return
} else {
if { $rexist == "" } {return}
}
if {[catch {set rexist [eval exec "r.info map=$clr 2> $devnull"]} error]} {
set clr $surf
} else {
if {$rexist == "" } {set clr $surf}
}
# add surf and clr to list of maps to display in nviz
if {$nvelev == "" } {
set nvelev $surf
} else {
append nvelev ",$surf"
}
if {$nvcolor == "" } {
set nvcolor $clr
} else {
append nvcolor ",$clr"
}
}
"vector" {
set vect [GmVector::addvect $node]
if {$vect == ""} {return}
# test whether vect is a valid file
if {[catch {set vexist [eval exec "v.info map=$vect 2> $devnull"]} error]} {
return
} else {
if {$vexist != ""} {
set vecttype [GmVector::vecttype $vect]
} else {
return
}
}
if {$vecttype == "points"} {
# display vector in nviz as points
if {$nvpoints == "" } {
set nvpoints $vect
} else {
append nvpoints ",$vect"
}
} else {
# display vector in nviz as lines
if {$nvlines == "" } {
set nvlines $vect
} else {
append nvlines ",$vect"
}
}
}
}
}
###############################################################################
proc GmGroup::set_option { node key value } {
variable opt
set id [GmTree::node_id $node]
set opt($id,$key) $value
}
proc GmGroup::open { id } {
variable opt
$GmGroup::opt($id,treeimagepath) configure -image [Bitmap::get openfold]
}
proc GmGroup::close { id } {
variable opt
$GmGroup::opt($id,treeimagepath) configure -image [Bitmap::get folder]
}
proc GmGroup::duplicate { tree parent_node sel id } {
puts "Duplicate for Groups not yet implemented."
}
|