Changeset 3416 for trunk/gui/scripts/vtkheightmapviewer.tcl
- Timestamp:
- Mar 2, 2013, 9:11:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkheightmapviewer.tcl
r3413 r3416 941 941 $_arcball quaternion $q 942 942 if {$_settings(isHeightmap) } { 943 SendCmd "camera reset"944 943 if { $_view(ortho)} { 945 944 SendCmd "camera mode ortho" … … 947 946 SendCmd "camera mode persp" 948 947 } 948 SendCmd "camera reset" 949 DoRotate 949 950 } 950 DoRotate951 951 PanCamera 952 952 } … … 1070 1070 $_arcball quaternion $q 1071 1071 if {$_settings(isHeightmap) } { 1072 SendCmd "camera reset"1073 1072 if { $_view(ortho)} { 1074 1073 SendCmd "camera mode ortho" … … 1076 1075 SendCmd "camera mode persp" 1077 1076 } 1077 SendCmd "camera reset" 1078 DoRotate 1078 1079 } 1079 DoRotate1080 1080 PanCamera 1081 1081 InitSettings axisXGrid axisYGrid axisZGrid \ … … 1172 1172 ypan 0 1173 1173 } 1174 SendCmd "camera reset all"1175 1174 if { $_first != "" } { 1176 1175 set location [$_first hints camera] … … 1181 1180 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1182 1181 $_arcball quaternion $q 1183 DoRotate 1182 SendCmd "camera reset" 1183 if {$_settings(isHeightmap) } { 1184 DoRotate 1185 } 1184 1186 } 1185 1187 } … … 1523 1525 "isHeightmap" { 1524 1526 set bool $_settings(isHeightmap) 1527 incr _buffering 1528 if { $_buffering == 1 } { 1529 set _outbuf "" 1530 } 1525 1531 if { $bool } { 1526 1532 $itk_component(lighting) configure -state normal 1533 if {$_view(ortho)} { 1534 SendCmd "camera mode ortho" 1535 } else { 1536 SendCmd "camera mode persp" 1537 } 1527 1538 } else { 1528 1539 $itk_component(lighting) configure -state disabled … … 1562 1573 set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)] 1563 1574 $_arcball quaternion $q 1564 if {$_view(ortho)} {1565 SendCmd "camera mode ortho"1566 } else {1567 SendCmd "camera mode persp"1568 }1569 1575 SendCmd "camera orient $q" 1570 1576 } else { … … 1574 1580 bind $c <ButtonRelease-1> {} 1575 1581 SendCmd "camera mode image" 1582 } 1583 incr _buffering -1 1584 if { $_buffering == 0 } { 1585 sendto $_outbuf 1586 set _outbuf "" 1576 1587 } 1577 1588 } … … 2050 2061 foreach comp [$dataobj components] { 2051 2062 set tag $dataobj-$comp 2052 set contents [ConvertToVtkData $dataobj $comp]2053 #set contents [$dataobj vtkdata $comp]2063 #set contents [ConvertToVtkData $dataobj $comp] 2064 set contents [$dataobj vtkdata $comp] 2054 2065 append bytes "$contents\n\n" 2055 2066 } … … 2138 2149 SendCmd "heightmap wireframe $_settings(wireframe) $tag" 2139 2150 SendCmd "heightmap colormap $_currentColormap $tag" 2151 set color [$itk_component(isolinecolor) value] 2152 SendCmd "heightmap isolinecolor [Color2RGB $color] $tag" 2140 2153 } 2141 2154 … … 2175 2188 # DrawLegend -- 2176 2189 # 2177 # Draws the legend in it's own canvas which resides to the right 2178 # of the contour plot area. 2179 # 2180 itcl::body Rappture::VtkHeightmapViewer::DrawLegend { name } { 2190 # Draws the legend in the own canvas on the right side of the plot area. 2191 # 2192 itcl::body Rappture::VtkHeightmapViewer::DrawLegend { fname } { 2181 2193 set c $itk_component(view) 2182 2194 set w [winfo width $c] … … 2185 2197 set lineht [font metrics $font -linespace] 2186 2198 2187 if { $ name == "component" } {2199 if { $fname == "component" } { 2188 2200 set title "" 2189 2201 } else { 2190 if { [info exists _fields($ name)] } {2191 foreach { title units } $_fields($ name) break2202 if { [info exists _fields($fname)] } { 2203 foreach { title units } $_fields($fname) break 2192 2204 if { $units != "" } { 2193 2205 set title [format "%s (%s)" $title $units] 2194 2206 } 2195 2207 } else { 2196 set title $ name2208 set title $fname 2197 2209 } 2198 2210 } … … 2302 2314 itcl::body Rappture::VtkHeightmapViewer::SetIsolineTip { x y value } { 2303 2315 set c $itk_component(view) 2304 set w [winfo width $c]2305 set h [winfo height $c]2306 set font "Arial 8"2307 set lineht [font metrics $font -linespace]2308 2309 if { [info exists _fields($_title)] } {2310 foreach { title units } $_fields($_title) break2311 if { $units != "" } {2312 set title [format "%s (%s)" $title $units]2313 }2314 } else {2315 set title $_title2316 }2317 set imgHeight [image height $_image(legend)]2318 set coords [$c coords colormap]2319 set imgX [expr $w - [image width $_image(legend)] - 2]2320 set imgY [expr $y - 2 * ($lineht + 2)]2321 2322 2316 .rappturetooltip configure -icon "" 2323 2317 2324 # Compute the value of the point2325 set t ipx [expr $x + 15]2326 set t ipy [expr $y - 5]2318 # Compute the position of the tip 2319 set tx [expr $x + 15] 2320 set ty [expr $y - 5] 2327 2321 Rappture::Tooltip::text $c "Isoline $value" 2328 Rappture::Tooltip::tooltip show $c +$t ipx,+$tipy2322 Rappture::Tooltip::tooltip show $c +$tx,+$ty 2329 2323 } 2330 2324 … … 2364 2358 set lineht [font metrics $font -linespace] 2365 2359 2366 set imgHeight [image height $_image(legend)] 2367 set coords [$c coords colormap] 2368 set imgX [expr $w - [image width $_image(legend)] - 2] 2369 set imgY [expr $y - 2 * ($lineht + 2)] 2360 set ih [image height $_image(legend)] 2361 set iy [expr $y - ($lineht + 2)] 2370 2362 2371 2363 if { [info exists _fields($_title)] } { … … 2377 2369 set title $_title 2378 2370 } 2371 # If there's a legend title, increase the offset by the line height. 2372 if { $title != "" } { 2373 incr iy $lineht 2374 } 2375 2379 2376 # Make a swatch of the selected color 2380 if { [catch { $_image(legend) get 10 $i mgY} pixel] != 0 } {2381 #puts stderr "out of range: $i mgY"2377 if { [catch { $_image(legend) get 10 $iy } pixel] != 0 } { 2378 #puts stderr "out of range: $iy" 2382 2379 return 2383 2380 } 2381 2384 2382 if { ![info exists _image(swatch)] } { 2385 2383 set _image(swatch) [image create photo -width 24 -height 24] … … 2393 2391 if { [info exists _limits(v)] } { 2394 2392 foreach { vmin vmax } $_limits(v) break 2395 set t [expr 1.0 - (double($i mgY) / double($imgHeight-1))]2393 set t [expr 1.0 - (double($iy) / double($ih-1))] 2396 2394 set value [expr $t * ($vmax - $vmin) + $vmin] 2397 2395 } else {
Note: See TracChangeset
for help on using the changeset viewer.