Changeset 2088


Ignore:
Timestamp:
Feb 9, 2011 11:57:06 AM (13 years ago)
Author:
gah
Message:

fixes for vtkviewer widget

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/drawing3d.tcl

    r1929 r2088  
    106106        ymin    yaxis.min
    107107        ymax    yaxis.max
     108        zlabel  zaxis.label
     109        zdesc   zaxis.description
     110        zunits  zaxis.units
     111        zscale  zaxis.scale
     112        zmin    zaxis.min
     113        zmax    zaxis.max
    108114    } {
    109115        set str [$_drawing3d get $path]
     
    242248# ----------------------------------------------------------------------
    243249itcl::body Rappture::Drawing3d::hints { {keyword ""} } {
     250    if 0 {
    244251    if {[info exists _hints(xlabel)] && "" != $_hints(xlabel)
    245252        && [info exists _hints(xunits)] && "" != $_hints(xunits)} {
     
    250257        set _hints(ylabel) "$_hints(ylabel) ($_hints(yunits))"
    251258    }
    252    
     259    }
    253260    if {[info exists _hints(group)] && [info exists _hints(label)]} {
    254261        # pop-up help for each curve
  • trunk/gui/scripts/resultviewer.tcl

    r1930 r2088  
    151151# ----------------------------------------------------------------------
    152152itcl::body Rappture::ResultViewer::plot {option args} {
     153    puts stderr "plot option=$option args=$args"
    153154    switch -- $option {
    154155        add {
     
    180181                    eval lappend settings $opts
    181182
     183                    puts stderr "_plotAdd $dobj $settings"
     184
    182185                    _plotAdd $dobj $settings
    183186                }
     
    188191        }
    189192        clear {
     193            puts stderr "in plot clear mode=$_mode"
    190194            # clear the contents of the current mode
    191195            if {"" != $_mode} {
     196                puts stderr "in plot clear mode=$_mode"
    192197                $_mode2widget($_mode) delete
    193198            }
     
    219224        ::Rappture::Drawing3d {
    220225            set mode "vtkviewer"
     226            puts stderr mode2widget=[array names _mode2widget]
    221227            if {![info exists _mode2widget($mode)]} {
    222                 set w $itk_interior.xy
    223                 Rappture::VtkViewer $w
     228                set w $itk_interior.vtkviewer
     229                catch { Rappture::VtkViewer $w }
    224230                set _mode2widget($mode) $w
    225231            }
     
    228234            set mode "histogram"
    229235            if {![info exists _mode2widget($mode)]} {
    230                 set w $itk_interior.xy
     236                set w $itk_interior.histogram
    231237                Rappture::HistogramResult $w
    232238                set _mode2widget($mode) $w
     
    389395    }
    390396
    391     # are we plotting in a new mode? then change widgets
     397    # Are we plotting in a new mode? then change widgets
    392398    if {$_mode2widget($mode) != [pack slaves $itk_interior]} {
    393399        # remove any current window
     
    397403        pack $_mode2widget($mode) -expand yes -fill both
    398404
     405        puts stderr "_mode=$_mode mode=$mode"
    399406        set _mode $mode
    400407        $_dispatcher event -idle !scale
  • trunk/gui/scripts/vtkviewer.tcl

    r1929 r2088  
    4545    private variable _lights       ;# list of lights for each renderer
    4646    private variable _click        ;# info used for _move operations
    47     private variable _slicer       ;# vtk transform used for 3D slice plane
    4847    private variable _limits       ;# autoscale min/max for all axes
    4948    private variable _view         ;# view params for 3D view
     
    7978    protected method Zoom {option}
    8079    protected method Move {option x y}
    81     protected method Slice {option args}
    8280    protected method _3dView {theta phi}
    8381    protected method _fixLimits {}
    84     protected method Slicertip {axis}
    8582    protected method _color2rgb {color}
    8683    protected method SetActorProperties { actor style }
     
    8986    private method GetLimits {}
    9087    private method BuildCameraTab {}
    91     private method BuildCutplanesTab {}
    9288    private method BuildViewTab {}
    9389    private method BuildVolumeTab {}
     
    108104    pack propagate $itk_component(hull) no
    109105
    110     set _slicer(xplane) ""
    111     set _slicer(yplane) ""
    112     set _slicer(zplane) ""
    113     set _slicer(xslice) ""
    114     set _slicer(yslice) ""
    115     set _slicer(zslice) ""
    116     set _slicer(readout) ""
    117106    set _view(theta) 0
    118107    set _view(phi) 0
     
    225214    $_axesWidget SetOrientationMarker $_axesActor
    226215    $_axesWidget SetInteractor $_interactor
    227     $_axesWidget SetEnabled 1
    228     $_axesWidget SetInteractive 0
     216    #$_axesWidget SetEnabled 1
     217    #$_axesWidget SetInteractive 0
    229218    $_axesWidget SetViewport .7 0 1.0 0.3
    230219
    231     $_cubeAxesActor SetXTitle "X Axis (units)"
    232     $_cubeAxesActor SetYTitle "Y Axis (units)"
    233 
    234220    BuildViewTab
     221    if 0 {
    235222    BuildVolumeTab
    236     BuildCutplanesTab
    237223    BuildCameraTab
    238 
     224    }
    239225    set v0 0
    240226    set v1 1
     
    244230    $_lookup Build
    245231
    246 
    247     #
    248     # 3D CUT PLANES
    249     #
    250     foreach axis {x y z} norm {{1 0 0} {0 1 0} {0 0 1}} {
    251 
    252         set plane [vtkPlane $this-${axis}cutplane]
    253         eval $plane SetNormal $norm
    254         set _slicer(${axis}plane) $plane
    255        
    256         set cutter [vtkCutter $this-${axis}cutter]
    257         $cutter SetCutFunction $plane
    258        
    259         set mapper [vtkPolyDataMapper  $this-${axis}cutmapper]
    260         $mapper SetInput [$cutter GetOutput]
    261         $mapper SetScalarRange $v0 $v1
    262         $mapper SetLookupTable $_lookup
    263        
    264         #lappend _obj2vtk($dataobj) $cutplane $cutter $mapper
    265        
    266         set actor [vtkActor $this-${axis}actor]
    267         $actor VisibilityOn
    268         $actor SetMapper $mapper
    269         $actor SetPosition 0 0 0
    270         [$actor GetProperty] SetColor 0 0 0
    271         set _slicer(${axis}slice) $actor
    272        
    273         $_renderer AddActor $actor
    274         lappend _actors $actor
    275         #lappend _obj2vtk($dataobj) $actor
    276     }
    277    
    278     #
    279     # CUT PLANE READOUT
    280     #
    281     set mapper [vtkTextMapper $this-text]
    282     set props [$mapper GetTextProperty]
    283     #eval $props SetColor [_color2rgb $itk_option(-plotforeground)]
    284     $props SetVerticalJustificationToTop
    285     set _slicer(readout) $mapper
    286            
    287     set actor [vtkActor2D $this-texta]
    288     $actor SetMapper $mapper
    289     set coords [$actor GetPositionCoordinate]
    290     $coords SetCoordinateSystemToNormalizedDisplay
    291     $coords SetValue 0.02 0.98
    292            
    293     $_renderer AddActor $actor
    294     lappend _actors $actor
    295     #lappend _obj2vtk($dataobj) $mapper $actor
    296 
    297     # turn off all slicers by default
    298     foreach axis {x y z} {
    299         $itk_component(${axis}CutScale) configure -state normal
    300         $itk_component(${axis}CutScale) set 50
    301         Slice move $axis 50
    302         Slice axis $axis off
    303     }
    304 
    305232    set lightKit [vtkLightKit $this-LightKit]
    306233    $lightKit AddLightsToRenderer $_renderer
     
    309236    # Create a picture for download snapshots
    310237    #
    311     set _download [image create picture]
     238    set _download [image create photo]
    312239
    313240    eval itk_initialize $args
     
    446373    switch $option {
    447374        coming {
    448             if {[catch {$_download snap $itk_component(area)} errs] != 0 } {
    449                 global errorInfo
    450                 puts stderr "$errorInfo"
    451                 $_download blank #000000
     375            if {[catch {
     376                blt::winop snap $itk_component(plotarea) $_download
     377            }]} {
     378                $_download configure -width 1 -height 1
     379                $_download put #000000
    452380            }
    453381        }
     
    504432        set _obj2vtk($dataobj) ""
    505433    }
    506     set _slicer(xplane) ""
    507     set _slicer(yplane) ""
    508     set _slicer(zplane) ""
    509     set _slicer(xslice) ""
    510     set _slicer(yslice) ""
    511     set _slicer(zslice) ""
    512     set _slicer(readout) ""
    513434}
    514435
     
    605526}
    606527
    607 # ----------------------------------------------------------------------
    608 # USAGE: Slice axis x|y|z ?on|off|toggle?
    609 # USAGE: Slice move x|y|z <newval>
    610 #
    611 # Called automatically when the user drags the slider to move the
    612 # cut plane that slices 3D data.  Gets the current value from the
    613 # slider and moves the cut plane to the appropriate point in the
    614 # data set.
    615 # ----------------------------------------------------------------------
    616 itcl::body Rappture::VtkViewer::Slice {option args} {
    617     if {$_slicer(xplane) == ""} {
    618         # no slicer? then bail out!
    619         return
    620     }
    621     switch -- $option {
    622         axis {
    623             if {[llength $args] < 1 || [llength $args] > 2} {
    624                 error "wrong # args: should be \"Slice axis x|y|z ?on|off|toggle?\""
    625             }
    626             set axis [lindex $args 0]
    627             set op [lindex $args 1]
    628             if {$op == ""} { set op "on" }
    629 
    630             set current $_settings($this-${axis}cutplane)
    631             if {$op == "toggle"} {
    632                 set op [expr $current==0]
    633             }
    634 
    635             if {$op} {
    636                 $itk_component(${axis}CutScale) configure -state normal
    637                 $_slicer(${axis}slice) VisibilityOn
    638                 $itk_component(${axis}CutButton) select
    639             } else {
    640                 $itk_component(${axis}CutScale) configure -state disabled
    641                 $_slicer(${axis}slice) VisibilityOff
    642                 $itk_component(${axis}CutButton) deselect
    643             }
    644             $_window Render
    645         }
    646         move {
    647             if {[llength $args] != 2} {
    648                 error "wrong # args: should be \"Slice move x|y|z newval\""
    649             }
    650             set axis [lindex $args 0]
    651             set newval [lindex $args 1]
    652 
    653             set xm [expr {0.5*($_limits(xMax)+$_limits(xMin))}]
    654             set ym [expr {0.5*($_limits(yMax)+$_limits(yMin))}]
    655             set zm [expr {0.5*($_limits(zMax)+$_limits(zMin))}]
    656 
    657             set newval [expr {0.01*($newval-50)
    658                 *($_limits(${axis}Max)-$_limits(${axis}Min))
    659                   + 0.5*($_limits(${axis}Max)+$_limits(${axis}Min))}]
    660 
    661             # show the current value in the readout
    662             if {$_slicer(readout) != ""} {
    663                 $_slicer(readout) SetInput "$axis = $newval"
    664             }
    665 
    666             # keep a little inside the volume, or the slice will disappear!
    667             if {$newval == $_limits(${axis}Min)} {
    668                 set range [expr {$_limits(${axis}Max)-$_limits(${axis}Min)}]
    669                 set newval [expr {$newval + 1e-6*$range}]
    670             }
    671 
    672             # xfer new value to the proper dimension and move the cut plane
    673             set ${axis}m $newval
    674             $_slicer(${axis}plane) SetOrigin $xm $ym $zm
    675 
    676             $_window Render
    677         }
    678         default {
    679             error "bad option \"$option\": should be axis or move"
    680         }
    681     }
    682 }
    683528
    684529# ----------------------------------------------------------------------
     
    730575    $this-vtkRenderWindow2 Render
    731576    }
    732 }
    733 
    734 # ----------------------------------------------------------------------
    735 # USAGE: Slicertip <axis>
    736 #
    737 # Used internally to generate a tooltip for the x/y/z slicer controls.
    738 # Returns a message that includes the current slicer value.
    739 # ----------------------------------------------------------------------
    740 itcl::body Rappture::VtkViewer::Slicertip {axis} {
    741     set val [$itk_component(${axis}slicer) get]
    742     set val [expr {0.01*($val-50)
    743         *($_limits(${axis}Max)-$_limits(${axis}Min))
    744           + 0.5*($_limits(${axis}Max)+$_limits(${axis}Min))}]
    745     return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val"
    746577}
    747578
     
    826657    ComputeLimits
    827658    $_cubeAxesActor SetCamera [$_renderer GetActiveCamera]
    828     puts stderr limits=[GetLimits]
    829659    eval $_cubeAxesActor SetBounds [GetLimits]
    830660
     
    890720            SetActorProperties $actor $style
    891721            set mapper [$dataobj data $comp]
    892             $this-xcutter SetInput [$mapper GetInput]
    893             #$_cubeAxesActor SetCamera [$_renderer GetActiveCamera]
    894             #eval $_cubeAxesActor SetBounds [$actor GetBounds]
    895 
    896 
    897             if 0 {
    898             #
    899             # Add color contours.
    900             #
    901             if {$firstobj} {
    902                 if {$_dims == "3D"} {
    903                     pack $itk_component(slicers) -side bottom -padx 4 -pady 4
    904                     pack $itk_component(reset) -side left
    905                     pack $itk_component(zoomin) -side left
    906                     pack $itk_component(zoomout) -side left
    907 
    908                     #
    909                     # 3D DATA SET
    910                     #
    911                     set mesh [$dataobj mesh $comp]
    912                     if {"" == $mesh} {
    913                         set x [expr {[winfo rootx $itk_component(area)]+10}]
    914                         set y [expr {[winfo rooty $itk_component(area)]+10}]
    915                         Rappture::Tooltip::cue @$x,$y "This data requires the visualization server, and that appears to be down.  Please try your simulation again later."
    916                         return
    917                     }
    918                     switch -- [$mesh GetClassName] {
    919                       vtkPoints {
    920                         # handle cloud of 3D points
    921                         set pd $this-polydata
    922                         vtkPolyData $pd
    923                         $pd SetPoints $mesh
    924                         [$pd GetPointData] SetScalars [$dataobj values $comp]
    925 
    926                         set tr $this-triangles
    927                         vtkDelaunay3D $tr
    928                         $tr SetInput $pd
    929                         $tr SetTolerance 0.0000000000001
    930                         set source [$tr GetOutput]
    931 
    932                         set mp $this-mapper
    933                         vtkPolyDataMapper $mp
    934 
    935                         lappend _obj2vtk($dataobj) $pd $tr $mp
    936                       }
    937                       vtkUnstructuredGrid {
    938                         # handle 3D grid with connectivity
    939                         set gr $this-grdata
    940                         vtkUnstructuredGrid $gr
    941                         $gr ShallowCopy $mesh
    942                         [$gr GetPointData] SetScalars [$dataobj values $comp]
    943                         set source $gr
    944 
    945                         lappend _obj2vtk($dataobj) $gr
    946                       }
    947                       vtkRectilinearGrid {
    948                         # handle 3D grid with connectivity
    949                         set gr $this-grdata
    950                         vtkRectilinearGrid $gr
    951                         $gr ShallowCopy $mesh
    952                         [$gr GetPointData] SetScalars [$dataobj values $comp]
    953                         set source $gr
    954 
    955                         lappend _obj2vtk($dataobj) $gr
    956                       }
    957                       default {
    958                         error "don't know how to handle [$mesh GetClassName] data"
    959                       }
    960                     }
    961 
    962                     #
    963                     # 3D ISOSURFACES
    964                     #
    965                     set iso $this-iso
    966                     vtkContourFilter $iso
    967                       $iso SetInput $source
    968 
    969                     set mp $this-isomap
    970                     vtkPolyDataMapper $mp
    971                       $mp SetInput [$iso GetOutput]
    972 
    973                     set ac $this-isoactor
    974                     vtkActor $ac
    975                       $ac SetMapper $mp
    976                       [$ac GetProperty] SetOpacity 0.3
    977                       [$ac GetProperty] SetDiffuse 0.5
    978                       [$ac GetProperty] SetAmbient 0.7
    979                       [$ac GetProperty] SetSpecular 10.0
    980                       [$ac GetProperty] SetSpecularPower 200.0
    981                     $_renderer AddActor $ac
    982 
    983                     lappend _obj2vtk($dataobj) $iso $mp $ac
    984                     lappend _actors $ac
    985 
    986                     catch {unset style}
    987                     array set style [lindex [$dataobj components -style $comp] 0]
    988                     if {[info exists style(-color)]} {
    989                         $mp ScalarVisibilityOff  ;# take color from actor
    990                         eval [$ac GetProperty] SetColor [_color2rgb $style(-color)]
    991                     }
    992 
    993                     if {[info exists style(-opacity)]} {
    994                         [$ac GetProperty] SetOpacity $style(-opacity)
    995                     }
    996 
    997                     set levels 5
    998                     if {[info exists style(-levels)]} {
    999                         set levels $style(-levels)
    1000                     }
    1001                     if {$levels == 1} {
    1002                         $iso SetValue 0 [expr {0.5*($v1-$v0)+$v0}]
    1003                     } else {
    1004                         $iso GenerateValues [expr {$levels+2}] $v0 $v1
    1005                     }
    1006 
    1007                     #
    1008                     # 3D CUT PLANES
    1009                     #
    1010                     if {$id == 0} {
    1011                         foreach axis {x y z} norm {{1 0 0} {0 1 0} {0 0 1}} {
    1012                             set pl $this-${axis}cutplane$id
    1013                             vtkPlane $pl
    1014                             eval $pl SetNormal $norm
    1015                             set _slicer(${axis}plane) $pl
    1016 
    1017                             set ct $this-${axis}cutter$id
    1018                             vtkCutter $ct
    1019                             $ct SetInput $source
    1020                             $ct SetCutFunction $pl
    1021 
    1022                             set mp $this-${axis}cutmapper$id
    1023                             vtkPolyDataMapper $mp
    1024                             $mp SetInput [$ct GetOutput]
    1025                             $mp SetScalarRange $v0 $v1
    1026                             $mp SetLookupTable $lu
    1027 
    1028                             lappend _obj2vtk($dataobj) $pl $ct $mp
    1029 
    1030                             set ac $this-${axis}actor$id
    1031                             vtkActor $ac
    1032                             $ac VisibilityOff
    1033                             $ac SetMapper $mp
    1034                             $ac SetPosition 0 0 0
    1035                             [$ac GetProperty] SetColor 0 0 0
    1036                             set _slicer(${axis}slice) $ac
    1037 
    1038                             $_renderer AddActor $ac
    1039                             lappend _actors $ac
    1040                             lappend _obj2vtk($dataobj) $ac
    1041                         }
    1042 
    1043                         #
    1044                         # CUT PLANE READOUT
    1045                         #
    1046                         set tx $this-text$id
    1047                         vtkTextMapper $tx
    1048                         set tp [$tx GetTextProperty]
    1049                         eval $tp SetColor [_color2rgb $itk_option(-plotforeground)]
    1050                         $tp SetVerticalJustificationToTop
    1051                         set _slicer(readout) $tx
    1052 
    1053                         set txa $this-texta$id
    1054                         vtkActor2D $txa
    1055                         $txa SetMapper $tx
    1056                         [$txa GetPositionCoordinate] \
    1057                             SetCoordinateSystemToNormalizedDisplay
    1058                         [$txa GetPositionCoordinate] SetValue 0.02 0.98
    1059 
    1060                         $_renderer AddActor $txa
    1061                         lappend _actors $txa
    1062 
    1063                         lappend _obj2vtk($dataobj) $tx $txa
    1064 
    1065                         # turn off all slicers by default
    1066                         foreach axis {x y z} {
    1067                             $itk_component(${axis}slicer) configure -state normal
    1068                             $itk_component(${axis}slicer) set 50
    1069                             Slice move $axis 50
    1070                             Slice axis $axis off
    1071                         }
    1072                     }
    1073 
    1074                 } else {
    1075                     pack forget $itk_component(slicers)
    1076                     pack $itk_component(reset) -side top
    1077                     pack $itk_component(zoomin) -side top
    1078                     pack $itk_component(zoomout) -side top
    1079 
    1080                     set pd $this-polydata$id
    1081                     vtkPolyData $pd
    1082                     $pd SetPoints [$dataobj mesh $comp]
    1083                     [$pd GetPointData] SetScalars [$dataobj values $comp]
    1084 
    1085                     set tr $this-triangles$id
    1086                     vtkDelaunay2D $tr
    1087                     $tr SetInput $pd
    1088                     $tr SetTolerance 0.0000000000001
    1089                     set source [$tr GetOutput]
    1090 
    1091                     set mp $this-mapper$id
    1092                     vtkPolyDataMapper $mp
    1093                     $mp SetInput $source
    1094                     $mp SetScalarRange $v0 $v1
    1095                     $mp SetLookupTable $lu
    1096 
    1097                     set ac $this-actor$id
    1098                     vtkActor $ac
    1099                     $ac SetMapper $mp
    1100                     $ac SetPosition 0 0 0
    1101                     [$ac GetProperty] SetColor 0 0 0
    1102                     $_renderer AddActor $ac
    1103                     lappend _actors $ac
    1104 
    1105                     lappend _obj2vtk($dataobj) $pd $tr $mp $ac
    1106                 }
    1107             } else {
    1108                 #
    1109                 # Add color lines
    1110                 #
    1111                 set cf $this-clfilter$id
    1112                 vtkContourFilter $cf
    1113                 $cf SetInput $source
    1114                 $cf GenerateValues 20 $v0 $v1
    1115 
    1116                 set mp $this-clmapper$id
    1117                 vtkPolyDataMapper $mp
    1118                 $mp SetInput [$cf GetOutput]
    1119                 $mp SetScalarRange $v0 $v1
    1120                 $mp SetLookupTable $lu
    1121 
    1122                 set ac $this-clactor$id
    1123                 vtkActor $ac
    1124                 $ac SetMapper $mp
    1125                 [$ac GetProperty] SetColor 1 1 1
    1126                 $ac SetPosition 0 0 0
    1127                 $_renderer AddActor $ac
    1128                 lappend _actors $ac
    1129 
    1130                 lappend _obj2vtk($dataobj) $cf $mp $ac
    1131             }
    1132 
    1133             #
    1134             # Add an outline around the data
    1135             #
    1136             if {$id == 0} {
    1137                 set olf $this-olfilter$id
    1138                 vtkOutlineFilter $olf
    1139                 $olf SetInput $source
    1140 
    1141                 set olm $this-olmapper$id
    1142                 vtkPolyDataMapper $olm
    1143                 $olm SetInput [$olf GetOutput]
    1144 
    1145                 set ola $this-olactor$id
    1146                 vtkActor $ola
    1147                 $ola SetMapper $olm
    1148                 eval [$ola GetProperty] SetColor [_color2rgb $itk_option(-plotforeground)]
    1149                 $_renderer AddActor $ola
    1150                 lappend _actors $ola
    1151 
    1152                 lappend _obj2vtk($dataobj) $olf $olm $ola
    1153 
    1154                 if {$_dims == "3D"} {
    1155                     # pick a good scale factor for text
    1156                     if {$xr < $yr} {
    1157                         set tscale [expr {0.1*$xr}]
    1158                     } else {
    1159                         set tscale [expr {0.1*$yr}]
    1160                     }
    1161 
    1162                     foreach {i axis px py pz rx ry rz} {
    1163                         0  x   $xm   0   0   90   0   0
    1164                         1  y     0 $ym   0   90 -90   0
    1165                         2  z   $x1   0 $zm   90   0 -45
    1166                     } {
    1167                         set length "[expr {[set ${axis}1]-[set ${axis}0]}]"
    1168 
    1169                         set vtx $this-${axis}label$id
    1170                         vtkVectorText $vtx
    1171                         $vtx SetText "$axis"
    1172 
    1173                         set vmp $this-${axis}lmap$id
    1174                         vtkPolyDataMapper $vmp
    1175                         $vmp SetInput [$vtx GetOutput]
    1176 
    1177                         set vac $this-${axis}lact$id
    1178                         vtkActor $vac
    1179                         $vac SetMapper $vmp
    1180                         $vac SetPosition [expr $px] [expr $py] [expr $pz]
    1181                         $vac SetOrientation $rx $ry $rz
    1182                         $vac SetScale $tscale
    1183                         $_renderer AddActor $vac
    1184 
    1185                         lappend _obj2vtk($dataobj) $vtx $vmp $vac
    1186                         lappend _actors $vac
    1187 
    1188                         $vmp Update
    1189                         foreach {xx0 xx1 yy0 yy1 zz0 zz1} [$vac GetBounds] break
    1190                         switch -- $axis {
    1191                           x {
    1192                             set dx [expr {-0.5*($xx1-$xx0)}]
    1193                             set dy 0
    1194                             set dz [expr {1.3*($zz0-$zz1)}]
    1195                           }
    1196                           y {
    1197                             set dx 0
    1198                             set dy [expr {0.5*($yy1-$yy0)}]
    1199                             set dz [expr {$zz0-$zz1}]
    1200                           }
    1201                           z {
    1202                             set dx [expr {0.2*$tscale}]
    1203                             set dy $dx
    1204                             set dz [expr {-0.5*($zz1-$zz0)}]
    1205                           }
    1206                         }
    1207                         $vac AddPosition $dx $dy $dz
    1208                     }
    1209                 }
    1210             }
    1211 
    1212             #
    1213             # Add a legend with the scale.
    1214             #
    1215             if {$id == 0} {
    1216                 set lg $this-legend$id
    1217                 vtkScalarBarActor $lg
    1218                 $lg SetLookupTable $lu
    1219                 [$lg GetPositionCoordinate] SetCoordinateSystemToNormalizedViewport
    1220                 [$lg GetPositionCoordinate] SetValue 0.1 0.1
    1221                 $lg SetOrientationToHorizontal
    1222                 $lg SetWidth 0.8
    1223                 $lg SetHeight 1.0
    1224 
    1225                 set tp [$lg GetLabelTextProperty]
    1226                 eval $tp SetColor [_color2rgb $itk_option(-plotforeground)]
    1227                 $tp BoldOff
    1228                 $tp ItalicOff
    1229                 $tp ShadowOff
    1230                 #eval $tp SetShadowColor [_color2rgb gray]
    1231 
    1232                 if 0 {
    1233                 $this-vtkRenderer2 AddActor2D $lg
    1234                 lappend _actors $lg
    1235                 lappend _obj2vtk($dataobj) $lg
    1236                 }
    1237             }
    1238             }
    1239722            incr id
    1240723        }
    1241724        set firstobj 0
     725    }
     726    set top [lindex [get] end]
     727    foreach axis { x y z } {
     728        set title [$top hints ${axis}label]
     729        set units [$top hints ${axis}units]
     730        set method Set[string toupper $axis]Title
     731        set label "$title"
     732        if { $units != "" } {
     733            append label " ($units)"
     734        }           
     735        $_cubeAxesActor $method $label
    1242736    }
    1243737    _fixLimits
     
    1245739    $_interactor Start
    1246740    $_window Render
     741
    1247742
    1248743    #
     
    1273768        wireframe       0
    1274769        volume          1
    1275         legend          1
    1276770        particles       1
    1277771        lic             1
     
    1286780        -title "View Settings" \
    1287781        -icon [Rappture::icon wrench]]
     782    set inner $tab
     783    if 0 {
    1288784    blt::scrollset $tab.ss \
    1289785        -xscrollbar $tab.ss.xs \
     
    1295791    set inner [blt::tk::frame $tab.ss.frame]
    1296792    $inner configure -borderwidth 4
    1297 
     793    }
    1298794    set ::Rappture::VtkViewer::_settings($this-isosurface) 0
    1299795    checkbutton $inner.isosurface \
     
    1321817        -font "Arial 9"
    1322818
    1323     checkbutton $inner.legend \
    1324         -text "Legend" \
    1325         -variable [itcl::scope _settings($this-legend)] \
    1326         -command [itcl::code $this FixSettings legend] \
    1327         -font "Arial 9"
    1328 
    1329     checkbutton $inner.volume \
    1330         -text "Volume" \
    1331         -variable [itcl::scope _settings($this-volume)] \
    1332         -command [itcl::code $this FixSettings volume] \
    1333         -font "Arial 9"
    1334 
    1335819    blt::table $inner \
    1336820        0,0 $inner.axes  -columnspan 2 -anchor w \
    1337821        1,0 $inner.edges  -columnspan 2 -anchor w \
    1338         2,0 $inner.wireframe  -columnspan 2 -anchor w \
    1339         3,0 $inner.volume  -columnspan 2 -anchor w \
    1340         4,0 $inner.legend  -columnspan 2 -anchor w
    1341 
    1342     if 0 {
    1343     bind $inner <Map> [itcl::code $this GetVolumeInfo $inner]
    1344     }
     822        2,0 $inner.wireframe  -columnspan 2 -anchor w
     823
    1345824    blt::table configure $inner r* -resize none
    1346825    blt::table configure $inner r5 -resize expand
     
    1359838        -title "Volume Settings" \
    1360839        -icon [Rappture::icon volume-on]]
     840    set inner $tab
     841    if 0 {
    1361842    blt::scrollset $tab.ss \
    1362843        -xscrollbar $tab.ss.xs \
     
    1368849    set inner [blt::tk::frame $tab.ss.frame]
    1369850    $inner configure -borderwidth 4
    1370 
     851    }
    1371852    set fg [option get $itk_component(hull) font Font]
    1372853    #set bfg [option get $itk_component(hull) boldFont Font]
     
    1415896}
    1416897
    1417 itcl::body Rappture::VtkViewer::BuildCutplanesTab {} {
    1418 
    1419     set tab [$itk_component(main) insert end \
    1420         -title "Cutplane Settings" \
    1421         -icon [Rappture::icon cutbutton]]
    1422     blt::scrollset $tab.ss \
    1423         -xscrollbar $tab.ss.xs \
    1424         -yscrollbar $tab.ss.ys \
    1425         -window $tab.ss.frame
    1426     pack $tab.ss -fill both -expand yes
    1427     blt::tk::scrollbar $tab.ss.xs               
    1428     blt::tk::scrollbar $tab.ss.ys               
    1429     set inner [blt::tk::frame $tab.ss.frame]
    1430     $inner configure -borderwidth 4
    1431 
    1432     # X-value slicer...
    1433     itk_component add xCutButton {
    1434         Rappture::PushButton $inner.xbutton \
    1435             -onimage [Rappture::icon x-cutplane] \
    1436             -offimage [Rappture::icon x-cutplane] \
    1437             -command [itcl::code $this FixSettings xcutplane] \
    1438             -variable [itcl::scope _settings($this-xcutplane)]
    1439     }
    1440     Rappture::Tooltip::for $itk_component(xCutButton) \
    1441         "Toggle the X cut plane on/off"
    1442 
    1443     itk_component add xCutScale {
    1444         ::scale $inner.xval -from 100 -to 0 \
    1445             -width 10 -orient vertical -showvalue off -state disabled \
    1446             -borderwidth 1 -highlightthickness 0 \
    1447             -command [itcl::code $this Slice move x]
    1448     } {
    1449         usual
    1450         ignore -borderwidth -highlightthickness
    1451     }
    1452     # Set the default cutplane value before disabling the scale.
    1453     $itk_component(xCutScale) set 50
    1454     $itk_component(xCutScale) configure -state disabled
    1455     Rappture::Tooltip::for $itk_component(xCutScale) \
    1456         "@[itcl::code $this SlicerTip x]"
    1457 
    1458     # Y-value slicer...
    1459     itk_component add yCutButton {
    1460         Rappture::PushButton $inner.ybutton \
    1461             -onimage [Rappture::icon y-cutplane] \
    1462             -offimage [Rappture::icon y-cutplane] \
    1463             -command [itcl::code $this FixSettings ycutplane] \
    1464             -variable [itcl::scope _settings($this-ycutplane)]
    1465     }
    1466     Rappture::Tooltip::for $itk_component(yCutButton) \
    1467         "Toggle the Y cut plane on/off"
    1468 
    1469     itk_component add yCutScale {
    1470         ::scale $inner.yval -from 100 -to 0 \
    1471             -width 10 -orient vertical -showvalue off -state disabled \
    1472             -borderwidth 1 -highlightthickness 0 \
    1473             -command [itcl::code $this Slice move y]
    1474     } {
    1475         usual
    1476         ignore -borderwidth -highlightthickness
    1477     }
    1478     Rappture::Tooltip::for $itk_component(yCutScale) \
    1479         "@[itcl::code $this SlicerTip y]"
    1480     # Set the default cutplane value before disabling the scale.
    1481     $itk_component(yCutScale) set 50
    1482     $itk_component(yCutScale) configure -state disabled
    1483 
    1484     # Z-value slicer...
    1485     itk_component add zCutButton {
    1486         Rappture::PushButton $inner.zbutton \
    1487             -onimage [Rappture::icon z-cutplane] \
    1488             -offimage [Rappture::icon z-cutplane] \
    1489             -command [itcl::code $this FixSettings zcutplane] \
    1490             -variable [itcl::scope _settings($this-zcutplane)]
    1491     }
    1492     Rappture::Tooltip::for $itk_component(zCutButton) \
    1493         "Toggle the Z cut plane on/off"
    1494 
    1495     itk_component add zCutScale {
    1496         ::scale $inner.zval -from 100 -to 0 \
    1497             -width 10 -orient vertical -showvalue off -state disabled \
    1498             -borderwidth 1 -highlightthickness 0 \
    1499             -command [itcl::code $this Slice move z]
    1500     } {
    1501         usual
    1502         ignore -borderwidth -highlightthickness
    1503     }
    1504     $itk_component(zCutScale) set 50
    1505     $itk_component(zCutScale) configure -state disabled
    1506     #$itk_component(zCutScale) configure -state disabled
    1507     Rappture::Tooltip::for $itk_component(zCutScale) \
    1508         "@[itcl::code $this SlicerTip z]"
    1509 
    1510     blt::table $inner \
    1511         1,1 $itk_component(xCutButton) \
    1512         1,2 $itk_component(yCutButton) \
    1513         1,3 $itk_component(zCutButton) \
    1514         0,1 $itk_component(xCutScale) \
    1515         0,2 $itk_component(yCutScale) \
    1516         0,3 $itk_component(zCutScale)
    1517 
    1518     blt::table configure $inner r0 r1 c* -resize none
    1519     blt::table configure $inner r2 c4 -resize expand
    1520     blt::table configure $inner c0 -width 2
    1521     blt::table configure $inner c1 c2 c3 -padx 2
    1522 }
    1523 
    1524 itcl::body Rappture::VtkViewer::BuildCameraTab {} {
    1525     set tab [$itk_component(main) insert end \
    1526         -title "Camera Settings" \
    1527         -icon [Rappture::icon camera]]
    1528     blt::scrollset $tab.ss \
    1529         -xscrollbar $tab.ss.xs \
    1530         -yscrollbar $tab.ss.ys \
    1531         -window $tab.ss.frame
    1532     blt::tk::scrollbar $tab.ss.xs               
    1533     blt::tk::scrollbar $tab.ss.ys               
    1534     pack $tab.ss -fill both -expand yes
    1535     set inner [blt::tk::frame $tab.ss.frame]
    1536     $inner configure -borderwidth 4
    1537 
    1538     set labels { phi theta psi pan-x pan-y zoom }
    1539     set row 0
    1540     foreach tag $labels {
    1541         label $inner.${tag}label -text $tag -font "Arial 9"
    1542         entry $inner.${tag} -font "Arial 9"  -bg white \
    1543             -textvariable [itcl::scope _settings($this-$tag)]
    1544         bind $inner.${tag} <KeyPress-Return> \
    1545             [itcl::code $this camera set ${tag}]
    1546         blt::table $inner \
    1547             $row,0 $inner.${tag}label -anchor e -pady 2 \
    1548             $row,1 $inner.${tag} -anchor w -pady 2
    1549         blt::table configure $inner r$row -resize none
    1550         incr row
    1551     }
    1552     blt::table configure $inner c0 c1 -resize none
    1553     blt::table configure $inner c2 -resize expand
    1554     blt::table configure $inner r$row -resize expand
    1555 }
    1556898
    1557899# ----------------------------------------------------------------------
     
    1618960            $_window Render
    1619961        }
    1620         "legend" {
    1621             if { $_settings($this-legend) } {
    1622                 blt::table $itk_component(plotarea) \
    1623                     0,0 $itk_component(3dview) -fill both \
    1624                     1,0 $itk_component(legend) -fill x
    1625                 blt::table configure $itk_component(plotarea) r1 -resize none
    1626             } else {
    1627                 blt::table forget $itk_component(legend)
    1628             }
    1629         }
    1630         "volume" {
    1631         }
    1632         "xcutplane" - "ycutplane" - "zcutplane" {
    1633             set axis [string range $what 0 0]
    1634             set bool $_settings($this-$what)
    1635             if { $bool } {
    1636                 $itk_component(${axis}CutScale) configure -state normal \
    1637                     -troughcolor white
    1638             } else {
    1639                 $itk_component(${axis}CutScale) configure -state disabled \
    1640                     -troughcolor grey82
    1641             }
    1642         }
    1643962        default {
    1644963            error "don't know how to fix $what"
    1645964        }
    1646965    }
    1647 }
    1648 
    1649 if 0 {
    1650     #
    1651     # Create slicer controls...
    1652     #
    1653     itk_component add slicers {
    1654         frame $itk_component(controls).slicers
    1655     } {
    1656         usual
    1657         rename -background -controlbackground controlBackground Background
    1658     }
    1659     pack $itk_component(slicers) -side bottom -padx 4 -pady 4
    1660     grid rowconfigure $itk_component(slicers) 1 -weight 1
    1661 
    1662     #
    1663     # X-value slicer...
    1664     #
    1665     itk_component add xslice {
    1666         label $itk_component(slicers).xslice \
    1667             -borderwidth 1 -relief raised -padx 1 -pady 1 \
    1668             -bitmap [Rappture::icon x]
    1669     } {
    1670         usual
    1671         ignore -borderwidth
    1672         rename -highlightbackground -controlbackground controlBackground Background
    1673     }
    1674     bind $itk_component(xslice) <ButtonPress> \
    1675         [itcl::code $this Slice axis x toggle]
    1676     Rappture::Tooltip::for $itk_component(xslice) \
    1677         "Toggle the X cut plane on/off"
    1678     grid $itk_component(xslice) -row 0 -column 0 -sticky ew -padx 1
    1679 
    1680     itk_component add xslicer {
    1681         ::scale $itk_component(slicers).xval -from 100 -to 0 \
    1682             -width 10 -orient vertical -showvalue off -state disabled \
    1683             -borderwidth 1 -highlightthickness 0 \
    1684             -command [itcl::code $this Slice move x]
    1685     } {
    1686         usual
    1687         ignore -borderwidth
    1688         ignore -highlightthickness
    1689         rename -highlightbackground -controlbackground controlBackground Background
    1690         rename -troughcolor -controldarkbackground controlDarkBackground Background
    1691     }
    1692     grid $itk_component(xslicer) -row 1 -column 0 -padx 1
    1693     Rappture::Tooltip::for $itk_component(xslicer) \
    1694         "@[itcl::code $this Slicertip x]"
    1695 
    1696     #
    1697     # Y-value slicer...
    1698     #
    1699     itk_component add yslice {
    1700         label $itk_component(slicers).yslice \
    1701             -borderwidth 1 -relief raised -padx 1 -pady 1 \
    1702             -bitmap [Rappture::icon y]
    1703     } {
    1704         usual
    1705         ignore -borderwidth
    1706         rename -highlightbackground -controlbackground controlBackground Background
    1707     }
    1708     bind $itk_component(yslice) <ButtonPress> \
    1709         [itcl::code $this Slice axis y toggle]
    1710     Rappture::Tooltip::for $itk_component(yslice) \
    1711         "Toggle the Y cut plane on/off"
    1712     grid $itk_component(yslice) -row 0 -column 1 -sticky ew -padx 1
    1713 
    1714     itk_component add yslicer {
    1715         ::scale $itk_component(slicers).yval -from 100 -to 0 \
    1716             -width 10 -orient vertical -showvalue off -state disabled \
    1717             -borderwidth 1 -highlightthickness 0 \
    1718             -command [itcl::code $this Slice move y]
    1719     } {
    1720         usual
    1721         ignore -borderwidth
    1722         ignore -highlightthickness
    1723         rename -highlightbackground -controlbackground controlBackground Background
    1724         rename -troughcolor -controldarkbackground controlDarkBackground Background
    1725     }
    1726     grid $itk_component(yslicer) -row 1 -column 1 -padx 1
    1727     Rappture::Tooltip::for $itk_component(yslicer) \
    1728         "@[itcl::code $this Slicertip y]"
    1729 
    1730     #
    1731     # Z-value slicer...
    1732     #
    1733     itk_component add zslice {
    1734         label $itk_component(slicers).zslice \
    1735             -borderwidth 1 -relief raised -padx 1 -pady 1 \
    1736             -bitmap [Rappture::icon z]
    1737     } {
    1738         usual
    1739         ignore -borderwidth
    1740         rename -highlightbackground -controlbackground controlBackground Background
    1741     }
    1742     grid $itk_component(zslice) -row 0 -column 2 -sticky ew -padx 1
    1743     bind $itk_component(zslice) <ButtonPress> \
    1744         [itcl::code $this Slice axis z toggle]
    1745     Rappture::Tooltip::for $itk_component(zslice) \
    1746         "Toggle the Z cut plane on/off"
    1747 
    1748     itk_component add zslicer {
    1749         ::scale $itk_component(slicers).zval -from 100 -to 0 \
    1750             -width 10 -orient vertical -showvalue off -state disabled \
    1751             -borderwidth 1 -highlightthickness 0 \
    1752             -command [itcl::code $this Slice move z]
    1753     } {
    1754         usual
    1755         ignore -borderwidth
    1756         ignore -highlightthickness
    1757         rename -highlightbackground -controlbackground controlBackground Background
    1758         rename -troughcolor -controldarkbackground controlDarkBackground Background
    1759     }
    1760     grid $itk_component(zslicer) -row 1 -column 2 -padx 1
    1761     Rappture::Tooltip::for $itk_component(zslicer) \
    1762         "@[itcl::code $this Slicertip z]"
    1763 
    1764966}
    1765967
  • trunk/packages/vizservers/configure

    r2073 r2088  
    82288228
    82298229
     8230for ac_header in <opencv/cv.h opencv/highgui.h
     8231do :
     8232  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
     8233ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
     8234if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
     8235  cat >>confdefs.h <<_ACEOF
     8236#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
     8237_ACEOF
     8238
     8239fi
     8240
     8241done
     8242
     8243{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cvLoadImage in -lcv" >&5
     8244$as_echo_n "checking for cvLoadImage in -lcv... " >&6; }
     8245if ${ac_cv_lib_cv_cvLoadImage+:} false; then :
     8246  $as_echo_n "(cached) " >&6
     8247else
     8248  ac_check_lib_save_LIBS=$LIBS
     8249LIBS="-lcv  $LIBS"
     8250cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     8251/* end confdefs.h.  */
     8252
     8253/* Override any GCC internal prototype to avoid an error.
     8254   Use char because int might match the return type of a GCC
     8255   builtin and then its argument prototype would still apply.  */
     8256#ifdef __cplusplus
     8257extern "C"
     8258#endif
     8259char cvLoadImage ();
     8260int
     8261main ()
     8262{
     8263return cvLoadImage ();
     8264  ;
     8265  return 0;
     8266}
     8267_ACEOF
     8268if ac_fn_cxx_try_link "$LINENO"; then :
     8269  ac_cv_lib_cv_cvLoadImage=yes
     8270else
     8271  ac_cv_lib_cv_cvLoadImage=no
     8272fi
     8273rm -f core conftest.err conftest.$ac_objext \
     8274    conftest$ac_exeext conftest.$ac_ext
     8275LIBS=$ac_check_lib_save_LIBS
     8276fi
     8277{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cv_cvLoadImage" >&5
     8278$as_echo "$ac_cv_lib_cv_cvLoadImage" >&6; }
     8279if test "x$ac_cv_lib_cv_cvLoadImage" = xyes; then :
     8280  cat >>confdefs.h <<_ACEOF
     8281#define HAVE_LIBCV 1
     8282_ACEOF
     8283
     8284  LIBS="-lcv $LIBS"
     8285
     8286fi
     8287
     8288
    82308289for ac_header in ffmpeg/avcodec.h libavcodec/avcodec.h ffmpeg/avformat.h libavformat/avformat.h ffmpeg/avutil.h libavutil/avutil.h
    82318290do :
     
    82508309
    82518310done
    8252 
    82538311
    82548312{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for avcodec_alloc_frame in -lavcodec" >&5
  • trunk/packages/vizservers/configure.in

    r2073 r2088  
    232232AC_SUBST(DX_LIB_SPEC)
    233233
     234AC_CHECK_HEADERS([<opencv/cv.h opencv/highgui.h])
     235AC_CHECK_LIB([cv], [cvLoadImage])
     236
    234237AC_CHECK_HEADERS([ffmpeg/avcodec.h libavcodec/avcodec.h ffmpeg/avformat.h libavformat/avformat.h ffmpeg/avutil.h libavutil/avutil.h],,,[
    235238#define SIZEOF_LONG ${ac_cv_sizeof_long}
     
    242245#endif
    243246])
    244 
    245247AC_CHECK_LIB([avcodec], [avcodec_alloc_frame])
    246248AC_CHECK_LIB([avformat], [avformat_alloc_context])
  • trunk/packages/vizservers/nanovis/Makefile.in

    r2041 r2088  
    3535DX_INC_SPEC      = @DX_INC_SPEC@
    3636DX_LIB_SPEC      = @DX_LIB_SPEC@ -lDXcallm
    37 FF_LIB_SPEC     = -lavformat -lavcodec -lavutil
    38 # might also need -lavutil
     37FF_LIB_SPEC     = @LIBS@
     38
    3939GL_INC_SPEC     = -I/usr/include/GL
    4040GL_LIB_SPEC     = -lGL -lglut -lGLEW -lGLU
  • trunk/packages/vizservers/nanovis/nvconf.h.in

    r2073 r2088  
    4040#undef HAVE_LIBAVUTIL_AVUTIL_H
    4141
     42/* Define to 1 if you have the `cv' library (-lcv). */
     43#undef HAVE_LIBCV
     44
    4245/* Define to 1 if you have the <memory.h> header file. */
    4346#undef HAVE_MEMORY_H
     
    4851/* Define to 1 if you have the <netinet/in.h> header file. */
    4952#undef HAVE_NETINET_IN_H
     53
     54/* Define to 1 if you have the <opencv/highgui.h> header file. */
     55#undef HAVE_OPENCV_HIGHGUI_H
    5056
    5157/* Define to 1 if you have the <rappture.h> header file. */
Note: See TracChangeset for help on using the changeset viewer.