/usr/lib/grass64/etc/dm/gridline.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 | # 30 August 2005
# panel for grid and line overlays
# Michael Barton, Arizona State University
namespace eval DmGridline {
variable array opt # grid and line options
variable count 1
}
proc DmGridline::create { tree parent } {
variable opt
variable count
global dmpath
set node "gridline:$count"
set frm [ frame .gridicon$count]
set fon [font create -size 10]
set check [checkbutton $frm.check -font $fon \
-variable DmGridline::opt($count,_check) \
-height 1 -padx 0 -width 0]
image create photo gico -file "$dmpath/grid.gif"
set gdico [label $frm.gdico -image gico -bd 1 -relief raised]
pack $check $gdico -side left
$tree insert end $parent $node \
-text "gridline $count"\
-window $frm \
-drawcross auto
set opt($count,_check) 1
set opt($count,gridline) "gridline"
set opt($count,gridcolor) \#AAAAAA
set opt($count,gridborder) \#000000
set opt($count,gridsize) 100
set opt($count,gridorigin) "0,0"
set opt($count,griddraw) 1
set opt($count,gridgeod) 0
set opt($count,borderdraw) 1
set opt($count,textdraw) 1
set opt($count,rhumbdraw) 0
set opt($count,rhumbcoor) ""
set opt($count,rhumbcolor) "black"
set opt($count,geoddraw) 0
set opt($count,geodcoor) ""
set opt($count,geodcolor) "black"
set opt($count,geodtxtcolor) "none"
incr count
return $node
}
proc DmGridline::set_option { node key value } {
variable opt
set id [Dm::node_id $node]
set opt($id,$key) $value
}
# display gridline options
proc DmGridline::options { id frm } {
variable opt
global dmpath
global bgcolor
# grid options 1
set row [ frame $frm.grid1 ]
Label $row.a -text "Grid options: "
checkbutton $row.b -text [G_msg "draw grid"] -variable DmGridline::opt($id,griddraw)
checkbutton $row.c -text [G_msg "geodetic grid"] -variable DmGridline::opt($id,gridgeod)
SelectColor $row.d -type menubutton -variable DmGridline::opt($id,gridcolor)
Label $row.e -text [G_msg " grid color "]
Button $row.f -text [G_msg "Help"] \
-image [image create photo -file "$dmpath/grass.gif"] \
-command "run g.manual d.grid" \
-background $bgcolor \
-helptext [G_msg "Help for grids"]
Label $row. -text [G_msg " grid color"]
pack $row.a $row.b $row.c $row.d $row.e $row.f -side left
pack $row -side top -fill both -expand yes
# grid options 2
set row [ frame $frm.grid2 ]
Label $row.a -text [G_msg " "]
checkbutton $row.b -text [G_msg "draw grid border"] -variable DmGridline::opt($id,borderdraw)
checkbutton $row.c -text [G_msg "draw border text"] -variable DmGridline::opt($id,textdraw)
Label $row.d -text [G_msg " border & text color"]
SelectColor $row.e -type menubutton -variable DmGridline::opt($id,gridborder)
pack $row.a $row.b $row.c $row.d $row.e -side left
pack $row -side top -fill both -expand yes
# grid options 3
set row [ frame $frm.grid3 ]
Label $row.a -text " grid size"
LabelEntry $row.b -textvariable DmGridline::opt($id,gridsize) -width 10 \
-entrybg white
Label $row.c -text " grid origin (x,y)"
LabelEntry $row.d -textvariable DmGridline::opt($id,gridorigin) -width 29 \
-entrybg white
pack $row.a $row.b $row.c $row.d -side left
pack $row -side top -fill both -expand yes
set row [ frame $frm.line ]
Label $row.a -text "Geodesic and rhumblines for latlong locations only"
pack $row.a -side left
pack $row -side top -fill both -expand yes
# geodesic line options 1
set row [ frame $frm.geod1 ]
Label $row.a -text " "
checkbutton $row.b -text [G_msg "draw geodesic line"] -variable DmGridline::opt($id,geoddraw)
Button $row.c -text [G_msg "Help"] \
-image [image create photo -file "$dmpath/grass.gif"] \
-command "run g.manual d.geodesic" \
-background $bgcolor \
-helptext [G_msg "Help for geodesic lines"]
Label $row.d -text " line color"
ComboBox $row.e -padx 2 -width 10 -textvariable DmGridline::opt($id,geodcolor) \
-values {"white" "grey" "gray" "black" "brown" "red" "orange" \
"yellow" "green" "aqua" "cyan" "indigo" "blue" "purple" "violet" "magenta"} \
-entrybg white
Label $row.f -text " text color"
ComboBox $row.g -padx 2 -width 10 -textvariable DmGridline::opt($id,geodtxtcolor) \
-values {"white" "grey" "gray" "black" "brown" "red" "orange" \
"yellow" "green" "aqua" "cyan" "indigo" "blue" "purple" "violet" "magenta"} \
-entrybg white
pack $row.a $row.b $row.c $row.d $row.e $row.f $row.g -side left
pack $row -side top -fill both -expand yes
# geodesic line options 2
set row [ frame $frm.geod2 ]
Label $row.a -text " line endpoints (x1,y1,x2,y2)"
LabelEntry $row.b -textvariable DmGridline::opt($id,geodcoor) -width 39 \
-entrybg white
pack $row.a $row.b -side left
pack $row -side top -fill both -expand yes
# rhumbline options 1
set row [ frame $frm.rhumb1 ]
Label $row.a -text " "
checkbutton $row.b -text [G_msg "draw rhumbline"] -variable DmGridline::opt($id,rhumbdraw)
Button $row.c -text [G_msg "Help"] \
-image [image create photo -file "$dmpath/grass.gif"] \
-command "run g.manual d.rhumbline" \
-background $bgcolor \
-helptext [G_msg "Help for rhumblines"]
Label $row.d -text " line color"
ComboBox $row.e -padx 2 -width 10 -textvariable DmGridline::opt($id,rhumbcolor) \
-values {"white" "grey" "gray" "black" "brown" "red" "orange" \
"yellow" "green" "aqua" "cyan" "indigo" "blue" "purple" "violet" "magenta"} \
-entrybg white
pack $row.a $row.b $row.c $row.d $row.e -side left
pack $row -side top -fill both -expand yes
# rhumbline options 2
set row [ frame $frm.rhumb2 ]
Label $row.a -text " line endpoints (x1,y1,x2,y2)"
LabelEntry $row.b -textvariable DmGridline::opt($id,rhumbcoor) -width 39 \
-entrybg white
pack $row.a $row.b -side left
pack $row -side top -fill both -expand yes
}
proc DmGridline::save { tree depth node } {
variable opt
set id [Dm::node_id $node]
foreach key { _check gridcolor gridborder gridsize gridorigin griddraw gridgeod \
borderdraw textdraw rhumbdraw rhumbcoor geoddraw geodcoor geodcolor \
geodtxtcolor} {
Dm::rc_write $depth "$key $opt($id,$key)"
}
}
proc DmGridline::display { node } {
variable opt
global dmpath
set tree $Dm::tree
set id [Dm::node_id $node]
set cmd ""
set cmd2 ""
set cmd3 ""
if { ! ( $opt($id,_check) ) } { return }
# set hex colors to rgb
set gridcolor [Dm::color $opt($id,gridcolor)]
set gridborder [Dm::color $opt($id,gridborder)]
# d.grid command
if { $opt($id,griddraw) || $opt($id,borderdraw) } {
set cmd "d.grid size=$opt($id,gridsize) origin=$opt($id,gridorigin) \
color=$gridcolor bordercolor=$gridborder" \
}
if { $opt($id,gridgeod) && $cmd != "" } {append cmd " -g"}
if { !$opt($id,griddraw) && $cmd != "" } {append cmd " -n"}
if { !$opt($id,borderdraw) && $cmd != "" } {append cmd " -b"}
if { !$opt($id,textdraw) && $cmd != "" } {append cmd " -t"}
# d.geodesic command
if { $opt($id,geoddraw) } {
set cmd2 "d.geodesic coor=$opt($id,geodcoor) \
lcolor=$opt($id,geodcolor) \
tcolor=$opt($id,geodtxtcolor)" }
# d.rhumbline command
if { $opt($id,rhumbdraw) } {
set cmd3 "d.rhumbline coor=$opt($id,rhumbcoor) \
lcolor=$opt($id,rhumbcolor) " }
if { $cmd != "" } { run_panel $cmd }
if { $cmd2 != "" } { run_panel $cmd2 }
if { $cmd3 != "" } { run_panel $cmd3 }
}
proc DmGridline::print { file node } {
variable opt
set tree $Dm::tree
set id [Dm::node_id $node]
if { ! ( $opt($id,_check) ) } { return }
if { $opt($id,gridline) == "" } { return }
puts $file "gridline $opt($id,gridline)"
}
proc DmGridline::duplicate { tree parent node id } {
variable opt
variable count
global dmpath
set node "gridline:$count"
set frm [ frame .gridlineicon$count]
set fon [font create -size 10]
set check [checkbutton $frm.check -font $fon \
-variable DmGridline::opt($count,_check) \
-height 1 -padx 0 -width 0]
image create photo gico -file "$dmpath/grid.gif"
set gdico [label $frm.gdico -image gico -bd 1 -relief raised]
pack $check $gdico -side left
if { $opt($id,gridline) == ""} {
$tree insert end $parent $node \
-text "gridline $count" \
-window $frm \
-drawcross auto
} else {
$tree insert end $parent $node \
-text "$opt($id,gridline)" \
-window $frm \
-drawcross auto
}
set opt($count,_check) $opt($id,_check)
set opt($count,gridcolor) "$opt($id,gridcolor)"
set opt($count,gridborder) $opt($id,gridborder)
set opt($count,gridorigin) $opt($id,gridorigin)
set opt($count,griddraw) $opt($id,griddraw)
set opt($count,gridgeod) $opt($id,gridgeod)
set opt($count,gridsize) $opt($id,gridsize)
set opt($count,borderdraw) $opt($id,borderdraw)
set opt($count,rhumbdraw) $opt($id,rhumbdraw)
set opt($count,rhumbcoor) $opt($id,rhumbcoor)
set opt($count,rhumbcolor) $opt($id,rhumbcolor)
set opt($count,geoddraw) $opt($id,geoddraw)
set opt($count,geodcoor) $opt($id,geodcoor)
set opt($count,geodtxtcolor) $opt($id,geodtxtcolor)
set opt($count,geodcolor) $opt($id,geodcolor)
set opt($count,rhumbdraw) 0
set opt($count,rhumbcoor) ""
incr count
return $node
}
|