/usr/lib/grass64/etc/dm/chart.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 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | # 4 Sept 2005
# panel for d.vect.chart
# Michael Barton, Arizona State University
namespace eval DmChart {
variable array opt # chart options
variable count 1
}
proc DmChart::create { tree parent } {
variable opt
variable count
global dmpath
set node "chart:$count"
set frm [ frame .charticon$count]
set fon [font create -size 10]
set check [checkbutton $frm.check -font $fon \
-variable DmChart::opt($count,_check) \
-height 1 -padx 0 -width 0]
image create photo chartico -file "$dmpath/chart.gif"
set ico [label $frm.ico -image chartico -bd 1 -relief raised]
pack $check $ico -side left
$tree insert end $parent $node \
-text "chart $count"\
-window $frm \
-drawcross auto
set opt($count,_check) 1
set opt($count,map) ""
set opt($count,type_point) 1
set opt($count,type_line) 1
set opt($count,type_boundary) 1
set opt($count,type_centroid) 1
set opt($count,type_area) 0
set opt($count,layer) 1
set opt($count,ctype) "pie"
set opt($count,columns) ""
set opt($count,sizecol) ""
set opt($count,csize) 40
set opt($count,cscale) 1
set opt($count,ocolor) "black"
set opt($count,fcolors) ""
incr count
return $node
}
proc DmChart::set_option { node key value } {
variable opt
set id [Dm::node_id $node]
set opt($id,$key) $value
}
proc DmChart::select_map { id } {
variable tree
variable node
set m [GSelect vector]
if { $m != "" } {
set DmChart::opt($id,map) $m
Dm::autoname "chart for $m"
}
}
proc DmChart::show_columns { id } {
variable opt
global bgcolor
set mapname $opt($id,map)
set layernum $opt($id,layer)
exec $env(GISBASE)/etc/grass-xterm-wrapper -bg $bgcolor -title "$mapname columns" \
-geometry 40x25-10+30 -sb -hold -e v.info -c map=$mapname \
layer=$layernum &
}
# chart options
proc DmChart::options { id frm } {
variable opt
global dmpath
global bgcolor
# vector name
set row [ frame $frm.map ]
Button $row.a -text [G_msg "Vector map to chart:"] \
-command "DmChart::select_map $id"
Entry $row.b -width 40 -text " $opt($id,map)" \
-textvariable DmChart::opt($id,map) \
-background white
Button $row.c -text [G_msg "Help"] \
-image [image create photo -file "$dmpath/grass.gif"] \
-command "run g.manual d.vect.chart" \
-background $bgcolor \
-helptext [G_msg "Help"]
pack $row.a $row.b $row.c -side left
pack $row -side top -fill both -expand yes
# vector type
set row [ frame $frm.type ]
Label $row.a -text [G_msg "Vector type:"]
checkbutton $row.b -text [G_msg "points"] -variable DmChart::opt($id,type_point)
checkbutton $row.c -text [G_msg "lines"] -variable DmChart::opt($id,type_line)
checkbutton $row.d -text [G_msg "boundaries"] -variable DmChart::opt($id,type_boundary)
checkbutton $row.e -text [G_msg "centroids"] -variable DmChart::opt($id,type_centroid)
checkbutton $row.f -text [G_msg "areas"] -variable DmChart::opt($id,type_area)
pack $row.a $row.b $row.c $row.d $row.e $row.f -side left
pack $row -side top -fill both -expand yes
# attributes1
set row [ frame $frm.attr1 ]
Label $row.a -text "Attribute to chart: layer"
LabelEntry $row.b -textvariable DmChart::opt($id,layer) -width 5 \
-entrybg white
Label $row.c -text [G_msg " show attribute columns"]
Button $row.d -text [G_msg "columns"] \
-image [image create photo -file "$dmpath/columns.gif"] \
-command "DmChart::show_columns $id" \
-background $bgcolor \
-helptext [G_msg "Show columns"]
pack $row.a $row.b $row.c $row.d -side left
pack $row -side top -fill both -expand yes
# attributes2
set row [ frame $frm.attr2 ]
Label $row.a -text " columns to chart (col1,col2,...) "
LabelEntry $row.b -textvariable DmChart::opt($id,columns) -width 35 \
-entrybg white
pack $row.a $row.b -side left
pack $row -side top -fill both -expand yes
# attributes3
set row [ frame $frm.attr3 ]
Label $row.a -text " colors for columns (clr1,clr2,...)"
LabelEntry $row.b -textvariable DmChart::opt($id,fcolors) -width 35 \
-entrybg white -padx 2
pack $row.a $row.b -side left
pack $row -side top -fill both -expand yes
# attributes4
set row [ frame $frm.attr4 ]
Label $row.a -text " column for variable chart size"
LabelEntry $row.b -textvariable DmChart::opt($id,sizecol) -width 12 \
-entrybg white -padx 9
Label $row.c -text " scale factor"
LabelEntry $row.d -textvariable DmChart::opt($id,cscale) -width 4 \
-entrybg white
pack $row.a $row.b $row.c $row.d -side left
pack $row -side top -fill both -expand yes
# chart options1
set row [ frame $frm.chopt1 ]
Label $row.a -text [G_msg "Chart type:"]
ComboBox $row.b -padx 2 -width 4 -textvariable DmChart::opt($id,ctype) \
-values {"pie" "bar"} -entrybg white
Label $row.c -text " fixed chart size (if size column not used)"
LabelEntry $row.d -textvariable DmChart::opt($id,csize) -width 4 \
-entrybg white
pack $row.a $row.b $row.c $row.d -side left
pack $row -side top -fill both -expand yes
# chart options2
set row [ frame $frm.chopt2 ]
Label $row.a -text [G_msg " chart outline color:"]
ComboBox $row.b -padx 0 -width 10 -textvariable DmChart::opt($id,ocolor) \
-values {"white" "grey" "gray" "black" "brown" "red" "orange" \
"yellow" "green" "aqua" "cyan" "indigo" "blue" "purple" "violet" "magenta"} \
-entrybg white
pack $row.a $row.b -side left
pack $row -side top -fill both -expand yes
}
proc DmChart::save { tree depth node } {
variable opt
set id [Dm::node_id $node]
foreach key { _check map layer ctype columns sizecol csize cscale ocolor fcolors \
type_point type_line type_boundary type_centroid type_area } {
Dm::rc_write $depth "$key $opt($id,$key)"
}
}
proc DmChart::display { node } {
variable opt
set line ""
set input ""
global dmpath
set cmd ""
set tree $Dm::tree
set id [Dm::node_id $node]
if { ! ( $opt($id,_check) ) } { return }
if { $opt($id,map) == "" } { return }
if { $opt($id,columns) == "" } { return }
if { !$opt($id,type_point) && !$opt($id,type_line) &&
!$opt($id,type_boundary) && !$opt($id,type_centroid) &&
!$opt($id,type_area) } { return }
# combine vector types
set type ""
if { $opt($id,type_point) } { append type "point" }
if { $opt($id,type_line) && "$type" != "" } {
append type ",line"
} elseif { $opt($id,type_line) && "$type" == "" } {
append type "line"}
if { $opt($id,type_boundary) && "$type" != "" } {
append type ",boundary"
} elseif { $opt($id,type_boundary) && "$type" == "" } {
append type "boundary"}
if { $opt($id,type_centroid) && "$type" != "" } {
append type ",centroid"
} elseif { $opt($id,type_centroid) && "$type" == "" } {
append type "centroid"}
if { $opt($id,type_area) && "$type" != "" } {
append type ",area"
} elseif { $opt($id,type_area) && "$type" == "" } {
append type "area"}
#create d.vect.chart command
set cmd "d.vect.chart map=$opt($id,map) type=$type \
layer=$opt($id,layer) columns=$opt($id,columns) \
ctype=$opt($id,ctype) ocolor=$opt($id,ocolor) "
# sizecol
if { $opt($id,sizecol) != "" } {
append cmd " sizecol=$opt($id,sizecol)"
}
# csize
if { $opt($id,csize) != "" } {
append cmd " size=$opt($id,csize)"
}
# cscale
if { $opt($id,cscale) != "" } {
append cmd " scale=$opt($id,cscale)"
}
# fcolors
if { $opt($id,fcolors) != "" } {
append cmd " colors=$opt($id,fcolors)"
}
run_panel $cmd
}
proc DmChart::print { file node } {
variable opt
set tree $Dm::tree
set id [Dm::node_id $node]
if { ! ( $opt($id,_check) ) } { return }
if { $opt($id,map) == "" } { return }
puts $file "chart $opt($id,map)"
}
proc DmChart::duplicate { tree parent node id } {
variable opt
variable count
global dmpath
set node "chart:$count"
set frm [ frame .charticon$count]
set fon [font create -size 10]
set check [checkbutton $frm.check -font $fon \
-variable DmChart::opt($count,_check) \
-height 1 -padx 0 -width 0]
image create photo chartico -file "$dmpath/legend.gif"
set ico [label $frm.ico -image chartico -bd 1 -relief raised]
pack $check $ico -side left
if { $opt($id,map) == ""} {
$tree insert end $parent $node \
-text "chart $count" \
-window $frm \
-drawcross auto
} else {
$tree insert end $parent $node \
-text "chart for $opt($id,map)" \
-window $frm \
-drawcross auto
}
set opt($count,_check) $opt($id,_check)
set opt($count,map) "$opt($id,map)"
set opt($count,type_point) "$opt($id,type_point)"
set opt($count,type_line) "$opt($id,type_line)"
set opt($count,type_boundary) "$opt($id,type_boundary)"
set opt($count,type_centroid) "$opt($id,type_centroid)"
set opt($count,type_area) "$opt($id,type_area)"
set opt($count,layer) "$opt($id,layer)"
set opt($count,ctype) "$opt($id,ctype)"
set opt($count,columns) "$opt($id,columns)"
set opt($count,sizecol) "$opt($id,sizecol)"
set opt($count,csize) "$opt($id,csize)"
set opt($count,cscale) "$opt($id,cscale)"
set opt($count,color) "$opt($id,oolor)"
set opt($count,color) "$opt($id,folors)"
incr count
return $node
}
|