Changeset 5078 for trunk


Ignore:
Timestamp:
Mar 5, 2015 2:18:14 AM (5 years ago)
Author:
ldelgass
Message:

Isosurface viewer: complete the set of style settings and UI control overrides.

File:
1 edited

Legend:

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

    r5077 r5078  
    8787    private method GetImage { args }
    8888    private method GetVtkData { args }
    89     private method InitSettings { args  }
     89    private method InitSettings { args }
    9090    private method IsValidObject { dataobj }
    9191    private method LeaveLegend {}
     
    293293    array set _changed {
    294294        -colormap                0
     295        -cutplaneedges           0
     296        -cutplanelighting        0
     297        -cutplaneopacity         0
     298        -cutplanepreinterp       0
     299        -cutplanesvisible        0
     300        -cutplanewireframe       0
     301        -isosurfaceedges         0
     302        -isosurfacelighting      0
    295303        -isosurfaceopacity       0
    296         -cutplaneopacity         0
     304        -isosurfacevisible       0
     305        -isosurfacewireframe     0
    297306        -numcontours             0
     307        -outline                 0
     308        -xcutplaneposition       0
     309        -xcutplanevisible        0
     310        -ycutplaneposition       0
     311        -ycutplanevisible        0
     312        -zcutplaneposition       0
     313        -zcutplanevisible        0
    298314    }
    299315    array set _widget {
     
    14161432        }
    14171433        "-cutplaneedges" {
     1434            set _changed($what) 1
    14181435            set bool $_settings($what)
    14191436            SendCmd "cutplane edges $bool"
    14201437        }
    14211438        "-cutplanelighting" {
     1439            set _changed($what) 1
    14221440            set bool $_settings($what)
    14231441            SendCmd "cutplane lighting $bool"
     
    14291447        }
    14301448        "-cutplanepreinterp" {
     1449            set _changed($what) 1
    14311450            set bool $_settings($what)
    14321451            SendCmd "cutplane preinterp $bool"
    14331452        }
    14341453        "-cutplanesvisible" {
     1454            set _changed($what) 1
    14351455            set bool $_settings($what)
    14361456            SendCmd "cutplane visible 0"
     
    14491469        }
    14501470        "-cutplanewireframe" {
     1471            set _changed($what) 1
    14511472            set bool $_settings($what)
    14521473            SendCmd "cutplane wireframe $bool"
     
    15171538        }
    15181539        "-isosurfaceedges" {
     1540            set _changed($what) 1
    15191541            set bool $_settings($what)
    15201542            SendCmd "contour3d edges $bool"
    15211543        }
    15221544        "-isosurfacelighting" {
     1545            set _changed($what) 1
    15231546            set bool $_settings($what)
    15241547            SendCmd "contour3d lighting $bool"
     
    15301553        }
    15311554        "-isosurfacevisible" {
     1555            set _changed($what) 1
    15321556            set bool $_settings($what)
    15331557            SendCmd "contour3d visible 0"
     
    15461570        }
    15471571        "-isosurfacewireframe" {
     1572            set _changed($what) 1
    15481573            set bool $_settings($what)
    15491574            SendCmd "contour3d wireframe $bool"
     
    15721597        }
    15731598        "-outline" {
     1599            set _changed($what) 1
    15741600            set bool $_settings($what)
    15751601            SendCmd "outline visible 0"
     
    15931619        }
    15941620        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
     1621            set _changed($what) 1
    15951622            set axis [string tolower [string range $what 1 1]]
    15961623            set bool $_settings($what)
     
    16051632        }
    16061633        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
     1634            set _changed($what) 1
    16071635            set axis [string tolower [string range $what 1 1]]
    16081636            set pos [expr $_settings($what) * 0.01]
     
    22602288    array set style {
    22612289        -color                  BCGYR
     2290        -cutplaneedges          0
     2291        -cutplanelighting       1
     2292        -cutplaneopacity        1.0
     2293        -cutplanepreinterp      1
    22622294        -cutplanesvisible       0
     2295        -cutplanewireframe      0
    22632296        -edgecolor              black
    22642297        -edges                  0
     
    22912324    # the code to handle aberrant cases.
    22922325
     2326    if { $_changed(-isosurfaceedges) } {
     2327        set style(-edges) $_settings(-isosurfaceedges)
     2328    }
     2329    if { $_changed(-isosurfacelighting) } {
     2330        set style(-lighting) $_settings(-isosurfacelighting)
     2331    }
    22932332    if { $_changed(-isosurfaceopacity) } {
    22942333        set style(-opacity) $_settings(-isosurfaceopacity)
     2334    }
     2335    if { $_changed(-isosurfacewireframe) } {
     2336        set style(-wireframe) $_settings(-isosurfacewireframe)
    22952337    }
    22962338    if { $_changed(-numcontours) } {
     
    23142356        EventuallyChangeContourLevels
    23152357    }
    2316     set _settings(-isosurfacevisible) $style(-isosurfacevisible)
    2317     set _settings(-cutplanesvisible)  $style(-cutplanesvisible)
    2318     set _settings(-xcutplanevisible)  $style(-xcutplanevisible)
    2319     set _settings(-ycutplanevisible)  $style(-ycutplanevisible)
    2320     set _settings(-zcutplanevisible)  $style(-zcutplanevisible)
    2321     set _settings(-xcutplaneposition) $style(-xcutplaneposition)
    2322     set _settings(-ycutplaneposition) $style(-ycutplaneposition)
    2323     set _settings(-zcutplaneposition) $style(-zcutplaneposition)
     2358    foreach setting {-outline -isosurfacevisible -cutplanesvisible \
     2359                     -xcutplanevisible -ycutplanevisible -zcutplanevisible \
     2360                     -xcutplaneposition -ycutplaneposition -zcutplaneposition \
     2361                     -cutplaneedges -cutplanelighting -cutplaneopacity \
     2362                     -cutplanepreinterp -cutplanewireframe} {
     2363        if {$_changed($setting)} {
     2364            # User-modified UI setting overrides style
     2365            set style($setting) $_settings($setting)
     2366        } else {
     2367            # Set UI control to style setting (tool provided or default)
     2368            set _settings($setting) $style($setting)
     2369        }
     2370    }
    23242371
    23252372    SendCmd "cutplane add $tag"
    23262373    SendCmd "cutplane color [Color2RGB $itk_option(-plotforeground)] $tag"
    23272374    foreach axis {x y z} {
    2328         set pos [expr $_settings(-${axis}cutplaneposition) * 0.01]
    2329         set visible $_settings(-${axis}cutplanevisible)
     2375        set pos [expr $style(-${axis}cutplaneposition) * 0.01]
     2376        set visible $style(-${axis}cutplanevisible)
    23302377        SendCmd "cutplane slice $axis $pos $tag"
    23312378        SendCmd "cutplane axis $axis $visible $tag"
    23322379    }
    2333     SendCmd "cutplane opacity $_settings(-cutplaneopacity) $tag"
     2380    SendCmd "cutplane edges $style(-cutplaneedges) $tag"
     2381    SendCmd "cutplane lighting $style(-cutplanelighting) $tag"
     2382    SendCmd "cutplane opacity $style(-cutplaneopacity) $tag"
     2383    SendCmd "cutplane preinterp $style(-cutplanepreinterp) $tag"
     2384    SendCmd "cutplane wireframe $style(-cutplanewireframe) $tag"
    23342385    SendCmd "cutplane visible $style(-cutplanesvisible) $tag"
    23352386
     
    23372388    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
    23382389    SendCmd "outline visible $style(-outline) $tag"
    2339     set _settings(-outline) $style(-outline)
    23402390
    23412391    GenerateContourList
     
    23442394    SendCmd "contour3d edges $style(-edges) $tag"
    23452395    set _settings(-isosurfaceedges) $style(-edges)
    2346     #SendCmd "contour3d color [Color2RGB $settings(-color)] $tag"
     2396    #SendCmd "contour3d color [Color2RGB $style(-color)] $tag"
    23472397    SendCmd "contour3d lighting $style(-lighting) $tag"
    23482398    set _settings(-isosurfacelighting) $style(-lighting)
Note: See TracChangeset for help on using the changeset viewer.