Ignore:
Timestamp:
Sep 9, 2011, 1:37:32 PM (13 years ago)
Author:
gah
Message:

create vtkstreamlinesviewer client

File:
1 edited

Legend:

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

    r2144 r2504  
     1
    12# ----------------------------------------------------------------------
    23#  COMPONENT: field - extracts data from an XML description of a field
     
    2829    public method controls {option args}
    2930    public method hints {{key ""}}
     31    public method style { cname }
    3032    public method isunirect2d {}
    3133    public method isunirect3d {}
    3234    public method extents {{what -overall}}
    3335    public method flowhints { cname }
     36    public method type {}
     37
    3438    protected method _build {}
    3539    protected method _getValue {expr}
     
    4549    private variable _comp2xy    ;# maps component name => x,y vectors
    4650    private variable _comp2vtk   ;# maps component name => vtkFloatArray
     51    private variable _comp2vtkstreamlines   ;# maps component name => vtkFloatArray
    4752    private variable _comp2dx    ;# maps component name => OpenDX data
    4853    private variable _comp2unirect2d ;# maps component name => unirect2d obj
     
    5156    private variable _comp2cntls ;# maps component name => x,y control points
    5257    private variable _comp2extents
     58    private variable _type ""
    5359    private variable _comp2flowhints
    5460    private common _counter 0    ;# counter for unique vector names
     
    183189        return [lindex $_comp2xy($what) 0]  ;# return xv
    184190    }
     191    if { [info exists _comp2vtkstreamlines($what)] } {
     192        error "mesh: not implemented for streamlines"
     193        return [$mobj mesh]
     194    }
    185195    if { [info exists _comp2vtk($what)] } {
    186196        set mobj [lindex $_comp2vtk($what) 0]
     
    215225        return [lindex $_comp2xy($what) 1]  ;# return yv
    216226    }
     227    if { [info exists _comp2vtkstreamlines($what)] } {
     228        # FIXME: Need to process the vtk file data to pull out the field's
     229        # values.
     230        error "vtkstreamlines: values not implements"
     231        return [lindex $_comp2vtkstreamlines($what) 1]
     232    }
    217233    if { [info exists _comp2vtk($what)] } {
    218234        return [lindex $_comp2vtk($what) 1]  ;# return vtkFloatArray
     
    244260    if { [info exists _comp2vtk($what)] } {
    245261        return ""
     262    }
     263    if { [info exists _comp2vtkstreamlines($what)] } {
     264        # Return the contents of the vtk file.
     265        return $_comp2vtkstreamlines($what)
    246266    }
    247267    if {[info exists _comp2dx($what)]} {
     
    547567    catch {unset _comp2dims}
    548568    catch {unset _comp2style}
     569    array unset _comp2vtkstreamlines
    549570    array unset _comp2unirect2d
    550571    array unset _comp2unirect3d
    551572    array unset _comp2extents
     573    array unset _dataobj2type
    552574    #
    553575    # Scan through the components of the field and create
     
    564586            set type "points-on-mesh"
    565587        } elseif {[$_field element $cname.vtk] != ""} {
    566             set type "vtk"
     588            if { [$_field get "about.viewer"] == "streamlines" } {
     589                set type "vtkstreamlines"
     590            } else {
     591                set type "vtk"
     592            }
    567593        } elseif {[$_field element $cname.opendx] != ""} {
    568594            set type "opendx"
     
    579605        }
    580606        set _comp2extents($cname) $extents
    581 
     607        set _type $type
    582608        if {$type == "1D"} {
    583609            #
     
    739765            set _comp2style($cname) [$_field get $cname.style]
    740766            incr _counter
     767        } elseif {$type == "vtkstreamlines"} {
     768            set _comp2dims($cname) "3D"
     769            set _comp2vtkstreamlines($cname) [$_field get $cname.vtk]
     770            set _comp2style($cname) [$_field get $cname.style]
     771            incr _counter
    741772        } elseif {$type == "dx"} {
    742773            #
     
    848879
    849880#
     881# style  --
     882#
     883# Returns the style associated with a component of the field. 
     884#
     885itcl::body Rappture::Field::style { cname } {
     886    if { [info exists _comp2style($cname)] } {
     887        return $_comp2style($cname)
     888    }
     889    return ""
     890}
     891
     892#
     893# type  --
     894#
     895# Returns the style associated with a component of the field. 
     896#
     897itcl::body Rappture::Field::type {} {
     898    return $_type
     899}
     900
     901#
    850902# extents --
    851903#
Note: See TracChangeset for help on using the changeset viewer.