Changeset 3272 for branches


Ignore:
Timestamp:
Jan 31, 2013 9:13:15 AM (11 years ago)
Author:
gah
Message:

add outline mode, fix limits in triangle mesh

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Rappture 1.2/gui/scripts/field.tcl

    r3271 r3272  
    334334# ----------------------------------------------------------------------
    335335itcl::body Rappture::Field::limits {which} {
    336 
    337336    set min ""
    338337    set max ""
    339338    blt::vector tmp zero
     339
    340340    foreach cname [array names _comp2dims] {
    341341        switch -- $_comp2dims($cname) {
    342342            1D {
    343343                switch -- $which {
    344                     x - xlin { set pos 0; set log 0; set axis xaxis }
    345                     xlog { set pos 0; set log 1; set axis xaxis }
    346                     y - ylin - v - vlin { set pos 1; set log 0; set axis yaxis }
    347                     ylog - vlog { set pos 1; set log 1; set axis yaxis }
     344                    x - xlin {
     345                        set pos 0; set log 0; set axis x
     346                    }
     347                    xlog {
     348                        set pos 0; set log 1; set axis x
     349                    }
     350                    y - ylin - v - vlin {
     351                        set pos 1; set log 0; set axis y
     352                    }
     353                    ylog - vlog {
     354                        set pos 1; set log 1; set axis y
     355                    }
    348356                    default {
    349357                        error "bad option \"$which\": should be x, xlin, xlog, y, ylin, ylog, v, vlin, vlog"
     
    361369                    tmp expr {abs(tmp)}             ;# get the abs value
    362370                    tmp expr {tmp + zero*max(tmp)}  ;# replace 0's with abs max
    363                     set vmin [blt::vector expr min(tmp)]
    364                     set vmax [blt::vector expr max(tmp)]
     371                    set axisMin [blt::vector expr min(tmp)]
     372                    set axisMax [blt::vector expr max(tmp)]
    365373                } else {
    366                     set vmin $vec(min)
    367                     set vmax $vec(max)
     374                    set axisMin $vec(min)
     375                    set axisMax $vec(max)
    368376                }
    369377
    370378                if {"" == $min} {
    371                     set min $vmin
    372                 } elseif {$vmin < $min} {
    373                     set min $vmin
     379                    set min $axisMin
     380                } elseif {$axisMin < $min} {
     381                    set min $axisMin
    374382                }
    375383                if {"" == $max} {
    376                     set max $vmax
    377                 } elseif {$vmax > $max} {
    378                     set max $vmax
     384                    set max $axisMax
     385                } elseif {$axisMax > $max} {
     386                    set max $axisMax
    379387                }
    380388            }
     
    382390                if {[info exists _comp2unirect2d($cname)]} {
    383391                    set limits [$_comp2unirect2d($cname) limits $which]
    384                     foreach {vmin vmax} $limits break
    385                     set axis vaxis
     392                    foreach {axisMin axisMax} $limits break
     393                    set axis v
    386394                } elseif {[info exists _comp2unirect3d($cname)]} {
    387395                    set limits [$_comp2unirect3d($cname) limits $which]
    388                     foreach {vmin vmax} $limits break
    389                     set axis vaxis
     396                    foreach {axisMin axisMax} $limits break
     397                    set axis v
    390398                } elseif {[info exists _comp2vtk($cname)]} {
    391399                    foreach {xv yv} $_comp2vtk($cname) break
    392400                    switch -- $which {
    393401                        x - xlin - xlog {
    394                             foreach {vmin vmax} [$xv limits x] break
    395                             set axis xaxis
     402                            foreach {axisMin axisMax} [$xv limits x] break
     403                            set axis x
    396404                        }
    397405                        y - ylin - ylog {
    398                             foreach {vmin vmax} [$xv limits y] break
    399                             set axis yaxis
     406                            foreach {axisMin axisMax} [$xv limits y] break
     407                            set axis y
    400408                        }
    401409                        z - zlin - zlog {
    402                             foreach {vmin vmax} [$xv limits z] break
    403                             set axis zaxis
     410                            foreach {axisMin axisMax} [$xv limits z] break
     411                            set axis z
    404412                        }
    405413                        v - vlin - vlog {
    406414                            catch {unset style}
    407415                            array set style $_comp2style($cname)
    408                             if {[info exists style(-min)] && [info exists style(-max)]} {
     416                            if {[info exists style(-min)] &&
     417                                [info exists style(-max)]} {
    409418                                # This component has its own hard-coded
    410419                                # min/max range.  Ignore it for overall limits.
    411                                 set vmin $min
    412                                 set vmax $max
     420                                set axisMin $min
     421                                set axisMax $max
    413422                            } else {
    414                                 foreach {vmin vmax} [$yv GetRange] break
     423                                foreach {axisMin axisMax} [$yv GetRange] break
    415424                            }
    416                             set axis vaxis
     425                            set axis v
    417426                        }
    418427                        default {
     
    424433                    switch -- $which {
    425434                        x - xlin - xlog {
    426                             set axis xaxis
    427                             foreach {vmin vmax} [$mesh limits x] break
     435                            set axis x
     436                            foreach {axisMin axisMax} [$mesh limits x] break
    428437                        }
    429438                        y - ylin - ylog {
    430                             foreach {vmin vmax} [$mesh limits y] break
    431                             set axis yaxis
     439                            foreach {axisMin axisMax} [$mesh limits y] break
     440                            set axis y
    432441                        }
    433442                        z - zlin - zlog {
    434                             foreach {vmin vmax} [$mesh limits z] break
    435                             set axis zaxis
     443                            foreach {axisMin axisMax} [$mesh limits z] break
     444                            set axis z
    436445                        }
    437446                        v - vlin - vlog {
    438                             set vmin [$vector min]
    439                             set vmax [$vector max]
    440                             set axis vaxis
     447                            set axisMin [$vector min]
     448                            set axisMax [$vector max]
     449                            set axis v
    441450                        }
    442451                    }
     
    445454                    switch -- $which {
    446455                        x - xlin - xlog {
    447                             set axis xaxis
    448                             set vmax $limits(xmax)
    449                             set vmin $limits(xmin)
     456                            set axis x
     457                            set axisMax $limits(xmax)
     458                            set axisMin $limits(xmin)
    450459                        }
    451460                        y - ylin - ylog {
    452                             set axis yaxis
    453                             set vmax $limits(ymax)
    454                             set vmin $limits(ymin)
     461                            set axis y
     462                            set axisMax $limits(ymax)
     463                            set axisMin $limits(ymin)
    455464                        }
    456465                        z - zlin - zlog {
    457                             set axis yaxis
    458                             set vmax $limits(zmax)
    459                             set vmin $limits(zmin)
     466                            set axis y
     467                            set axisMax $limits(zmax)
     468                            set axisMin $limits(zmin)
    460469                        }
    461470                        v - vlin - vlog {
    462                             set axis vaxis
    463                             set vmax $limits(vmax)
    464                             set vmin $limits(vmin)
     471                            set axis v
     472                            set axisMax $limits(vmax)
     473                            set axisMin $limits(vmin)
    465474                        }
    466475                    }
    467476                } else {
    468                     set vmin 0  ;# HACK ALERT! must be OpenDX data
    469                     set vmax 1
    470                     set axis vaxis
     477                    set axisMin 0  ;# HACK ALERT! must be OpenDX data
     478                    set axisMax 1
     479                    set axis v
    471480                }
    472481            }
    473482        }
    474         if { "" == $min || $vmin < $min } {
    475             set min $vmin
    476         }
    477         if { "" == $max || $vmax > $max } {
    478             set max $vmax
     483        if { "" == $min || $axisMin < $min } {
     484            set min $axisMin
     485        }
     486        if { "" == $max || $axisMax > $max } {
     487            set max $axisMax
    479488        }
    480489    }
    481490    blt::vector destroy tmp zero
    482     set val [$_field get $axis.min]
     491    set val [$_field get "${axis}axis.min"]
    483492    if {"" != $val && "" != $min} {
    484493        if {$val > $min} {
     
    488497    }
    489498
    490     set val [$_field get $axis.max]
     499    set val [$_field get "${axis}axis.max"]
    491500    if {"" != $val && "" != $max} {
    492501        if {$val < $max} {
Note: See TracChangeset for help on using the changeset viewer.