generated by zdoc.tcl on Thu Feb 14 16:15:15 MET 2002

tclIsosurface.tcl



isosurface
Comments  
Arguments  
Used by  
Uses  
    global setRestLength
    global setMetricParameters
    global resetMetricParameters
    global fuseContour
    

}


isosurface::installIsocontourDisplayMenu
Comments  
Arguments viewer
camera
contour
bg
Used by isosurface::installIsocontourMenu
Uses modules::selectColor
proc isosurface::installIsocontourDisplayMenu { viewer camera contour bg } {
    global showVertex

    menubutton $viewer.context.display -text "Display" -menu $viewer.context.display.m -anchor w -bg $bg
    set mdisplay [menu $viewer.context.display.m -bg $bg ]
    $mdisplay add command -label "Line Color..." -command "set col \[ modules::selectColor  \[ $contour -lineColor\] \]; $contour -lineColor \[lindex \$col 0\] \[lindex \$col 1\] \[lindex \$col 2\] "
    $mdisplay add cascade -label "Line Size..." -menu   $mdisplay.sub2
    set m2 [menu  $mdisplay.sub2 -tearoff 0]
    $m2 add command -label "1" -command "$contour -lineWidth 1"
    $m2 add command -label "2" -command "$contour -lineWidth 2"
    $m2 add command -label "3" -command "$contour -lineWidth 3"
    $m2 add command -label "4" -command "$contour -lineWidth 4"

    $mdisplay add cascade -label "Show Vertex" -menu   $mdisplay.sub3
    menu  $mdisplay.sub3 -tearoff 0 -postcommand "scan \[$contour -vertexMode \] {%s} a; switch \$a { show {set isosurface::showVertex show} hide {set isosurface::showVertex hide}}"
    $mdisplay.sub3 add radio -selectcolor "black" -label "Show Vertices" -variable isosurface::showVertex -value "show" -command "$contour -vertexMode show"
    $mdisplay.sub3 add radio  -selectcolor "black" -label "Hide Vertices" -variable isosurface::showVertex -value "hide" -command "$contour -vertexMode hide"

    $mdisplay add cascade -label "Vertex Size" -menu   $mdisplay.sub4
    set m4 [menu  $mdisplay.sub4 -tearoff 0]
    $m4 add command -label "1" -command "$contour -vertexSize 1"
    $m4 add command -label "2" -command "$contour -vertexSize 2"
    $m4 add command -label "3" -command "$contour -vertexSize 3"
    $m4 add command -label "4" -command "$contour -vertexSize 4"
    $m4 add command -label "5" -command "$contour -vertexSize 5"
    
    $mdisplay add command -label "Vertex Color..." -command "set col \[ modules::selectColor  \[ $contour -vertexColor\] \]; $contour -vertexColor \[lindex \$col 0\] \[lindex \$col 1\] \[lindex \$col 2\] "
    pack  $viewer.context.display -side left
}


isosurface::installIsocontourFileMenu
Comments  
Arguments viewer
camera
contour
bg
Used by isosurface::installIsocontourMenu
Uses  
proc isosurface::installIsocontourFileMenu { viewer camera contour bg} {
    menubutton $viewer.context.file -text "File" -menu $viewer.context.file.m -anchor w -bg $bg
    set mfile [menu $viewer.context.file.m -bg $bg]
    $mfile add command -label "Load Contour..."  -command  "[$camera -scene] -load \[tk_getOpenFile -filetypes {{\"Contour\" {* } } } -parent . -title {Select a Lines3D}\] "
    $mfile add command -label "Save Isocontour" -command "$contour -save"
    $mfile add command -label "Save Isocontour as..." -command "isosurface::saveOption $contour {{\"Contour\" {* } } } {Select a Contour name}"
    $mfile add separator
    $mfile add command -label "Destroy" -command "$contour -destroy"
    pack  $viewer.context.file -side left
}


isosurface::installIsocontourMenu
Comments  
Arguments viewer
camera
contour
bg
Used by  
Uses isosurface::installIsocontourDisplayMenu
isosurface::installIsocontourFileMenu
proc isosurface::installIsocontourMenu { viewer camera contour bg } {
    isosurface::installIsocontourFileMenu $viewer $camera $contour $bg
    isosurface::installIsocontourDisplayMenu $viewer $camera $contour $bg
    #Defines the menu call with the right button
    set popup [menu $viewer.popup -tearoff 0 -bg "white" -postcommand "scan \[$contour -selectionMode \] {%s} isosurface::selectionMode;scan \[$camera -motionMode \] {%s} isosurface::motionMode " ]
    $popup add command -label "Left Button" -state disabled -command {}
    $popup add radio -selectcolor "black" -label "Select Object" -variable isosurface::selectionMode -value "object" -command "$contour -selectionMode object  $camera"
    $popup add radio -selectcolor "black" -label "Select Vertex" -variable isosurface::selectionMode -value "vertex" -command "$contour -selectionMode vertex  $camera"
    $popup add command -label "Middle Button" -state disabled -command {}
    $popup add radio -selectcolor "black" -label "Move Isocontour" -variable isosurface::motionMode -value "object" -command "$camera -motionMode object"
    $popup add radio -selectcolor "black" -label "Move Camera" -variable isosurface::motionMode -value "camera" -command "$camera -motionMode camera"
    $popup add separator
    
    bind [$camera -widget]  <Button-3> "tk_popup $popup %X %Y"
}


isosurface::saveOption
Comments  
Arguments object
fileType
windowTitle
Used by  
Uses  
proc isosurface::saveOption { object fileType windowTitle} {
    set root .contourSave
    if {![winfo exists $root]} {
    set bg "#A0D0A0"
    set bg2  "#80C080"
    toplevel $root -bg $bg
    wm title $root "Contour Save"
    frame $root.f -bg $bg

    foreach f [$object -saveOption] {
        set name $root.f.[string tolower $f]
        set $f.save [$object -saveOption $f]
        checkbutton $name  -text $f -variable $f.save -relief flat -bg $bg -onvalue {true} -offvalue {false}
        if {[$object -saveOption $f]}  {
        $name select
        } else {
        $name deselect
        }
        pack $name -side top -expand true -fill both
    }
    pack $root.f -side top
    frame $root.buttons -bg $bg
    button $root.buttons.save -text "Save" -command "destroy $root;  foreach f \[$object -saveOption\] {$object -saveOption \$f \[subst $\\{\$f.save\\} \]}; $object -save \[ tk_getSaveFile -filetypes \{$fileType\} -title \{$windowTitle\}\]" -bg $bg
    button $root.buttons.destroy -text "Dismiss" -command "destroy $root" -bg $bg
    pack $root.buttons.save  $root.buttons.destroy -side left -expand true -fill both -padx 20 -pady 10
    pack $root.buttons -expand true -fill both
    }
}


isosurface::uninstallIsocontourMenu
Comments  
Arguments viewer
camera
line
Used by  
Uses  
proc isosurface::uninstallIsocontourMenu { viewer camera line} {
    # remove frame children
    set list [winfo children $viewer.context]
    foreach w $list { destroy $w}
    pack $viewer.context -fill x
    #remove popup
    destroy  $viewer.popup
    #reset selection mode
    $camera -motionMode camera
    #unbind popup
    bind [$camera -widget] <Button-3> ""
}