Ignore:
Timestamp:
Feb 5, 2010 10:26:35 AM (14 years ago)
Author:
dkearney
Message:

examples of using a view in tcl and c, update tcl and c view apis

Location:
trunk/examples/objects
Files:
17 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/objects/api/tcl/view

    r1645 r1655  
    1212    property <key> ?<val>?
    1313    propremove <key>
    14 
    15     plot    <name> -at "row,col" -table <table> {"x1" "y1" "s1" ...}
    16     volume  <name> -at "row,col" -table <table> {"x1" "y1" "z1" "d1" ...}
    17     surface <name> -at "row,col" -table <table> {"x1" "y1" "d1" ...}
    18     image   <object> -at "row,col"
    19     note    <object> -at "row,col"
    20 
    2114    vvalue ?<hints>?
    2215    random
     
    2720    is
    2821
     22    plot   <name> -at "row,col" -table <table> {"x1" "y1" "s1" ...}
     23    surf2d <name> -at "row,col" -table <table> {"x1" "y1" "d1" ...}
     24    surf3d <name> -at "row,col" -table <table> {"x1" "y1" "z1" "d1" ...}
     25    image  <object> -at "row,col"
     26    note   <object> -at "row,col"
     27
     28
    2929---------------------------------------
    3030Rappture::View <name> -rows <rows> -cols <cols>
    3131    Purpose: construct a view for displaying data
    32     Input Arguments: 1 manditory, 2 optional
     32    Input Arguments: 1 required, 2 optional
    3333        1. name - name of the view
    3434        2. rows - number of rows in the view, default is 1
     
    5252    Code Example:
    5353    {{{
    54         set p [Rappture::Plot]
    55         $p name
    56         # ""
    57         $p name "fdfactor"
    58         $p name
     54        set v [Rappture::View "fdfplots"]
     55        $v name
     56        # "fdfplots"
     57        $v name "fdfactor"
     58        $v name
    5959        # "fdfactor"
    6060    }}}
     
    7171    Code Example:
    7272    {{{
    73         set p [Rappture::Plot]
    74         $p path
     73        set v [Rappture::View "fdfplots"]
     74        $v path
    7575        # ""
    76         $p path "output"
    77         $p path
     76        $v path "output"
     77        $v path
    7878        # "output"
    7979    }}}
     
    8989    Code Example:
    9090    {{{
    91         set p [Rappture::Plot]
    92         $p label
     91        set v [Rappture::View "fdfplots"]
     92        $v label
    9393        # ""
    94         $p label "Fermi-Dirac Factor"
    95         $p label
     94        $v label "Fermi-Dirac Factor"
     95        $v label
    9696        # "Fermi-Dirac Factor"
    9797    }}}
     
    102102        1. val - new description
    103103    Return Value: description of the object
    104     Notes: if no description is set, an empty string will be returned
    105            the description is used by the graphical user
    106            interface to describe what type of data is being
    107            requested and how the input is used.
    108            val, if provided, is used to set the object description
    109     Code Example:
    110     {{{
    111         set p [Rappture::Plot]
    112         $p desc
     104    Notes: if no description is set, an empty string will be
     105           returned the description is used by the graphical
     106           user interface to describe what type of data is
     107           being requested and how the input is used.  val, if
     108           provided, is used to set the object description
     109
     110    Code Example:
     111    {{{
     112        set v [Rappture::View "fdfplots"]
     113        $v desc
    113114        # ""
    114         $p desc "A plot of the Fermi-Dirac Factor"
    115         $p desc
     115        $v desc "A plot of the Fermi-Dirac Factor"
     116        $v desc
    116117        # "A plot of the Fermi-Dirac Factor"
    117118    }}}
     
    127128    Code Example:
    128129    {{{
    129         set p [Rappture::Plot]
    130         $p hints
     130        set v [Rappture::View "fdfplots"]
     131        $v hints
    131132        # ""
    132         $p hints "no hints"
    133         $p hints
     133        $v hints "no hints"
     134        $v hints
    134135        # "no hints"
    135136    }}}
     
    144145    Code Example:
    145146    {{{
    146         set p [Rappture::Plot]
    147         $p property "name"
     147        set v [Rappture::View "fdfplots"]
     148        $v property "label"
    148149        # ""
    149         $p property "name" "fdfactor"
    150         # "fdfactor"
    151         $p name
    152         # "fdfactor"
     150        $v property "label" "Fermi-Dirac Factor"
     151        # "Fermi-Dirac Factor"
     152        $v name
     153        # "Fermi-Dirac Factor"
    153154    }}}
    154155
     
    161162    Code Example:
    162163    {{{
    163         set p [Rappture::Plot]
    164         $p name "fdfactor"
    165         $p property "name"
     164        set v [Rappture::View "fdfplots"]
     165        $v name "fdfactor"
     166        $v property "name"
    166167        # "fdfactor"
    167         $p propremove "name"
     168        $v propremove "name"
    168169        # "fdfactor"
    169         $p property "name"
     170        $v property "name"
    170171        # ""
    171     }}}
    172 
    173 plot <name> -at "row,col" -table <table> {"x1" "y1" "s1" "x2" "y2" "s2" ...}
    174     Purpose: populate a view object with a plot
    175     Input Arguments: 2 required, 2 optional
    176         1. name - name of the plot
    177         2. -at - position of the plot within the view, row and column number
    178         3. -table - name of the table holding the data.
    179         4. {"x1" "y1" "s1" ...} - x and y column names, followed by the style
    180     Return Value: None
    181     Notes: plots can be grouped together by specifying
    182            multiple x,y pairs within the list of columns
    183            from the last argument. eg:
    184            {"x1" "y1" "s1" "x2" "y2" "s2"}
    185     Code Example:
    186     {{{
    187         set results [Rappture::Table "dataTable"]
    188         $results column "Xvals" "X Values"
    189         $results column "Squared" "X Squared"
    190         $results column "Cubed" "X Cubed"
    191 
    192         # create a view with two curves grouped on a single plot
    193         # 1) x vs x^2
    194         # 2) x vs x^3
    195         set v1 [Rappture::View fdfview1]
    196         $v1 plot "fdfPlot1" -table "dataTable" \
    197             {"Xvals" "Squared" "g:o" "Xvals" "Cubed" "b-o"}
    198 
    199         # create a view with two plots, one stacked on top of the other
    200         # 1) x vs x^2
    201         # 2) x vs x^3
    202         set v2 [Rappture::View fdfview2 -rows 2 -cols 1]
    203         $v2 plot "fdfPlot2" -at "1,1" -table "dataTable" \
    204             {"Xvals" "Squared" "g:o"}
    205         $v2 plot "fdfPlot3" -at "2,1" -table "dataTable" \
    206             {"Xvals" "Cubed" "b-o"}
    207 
    208         # create a view with two plots side by side
    209         # 1) x vs x^2   2) x vs x^3
    210         set v3 [Rappture::View fdfview3 -rows 1 -cols 2]
    211         $v3 plot "fdfPlot4" -at "1,1" -table "dataTable" \
    212             {"Xvals" "Squared" "g:o"}
    213         $v3 plot "fdfPlot5" -at "1,2" -table "dataTable" \
    214             {"Xvals" "Cubed" "b-o"}
    215     }}}
    216 
    217 volume  <name> -at "row,col" -table <table> {"x1" "y1" "z1" "d1",...}
    218     Purpose: populate a view object with a volume
    219     Input Arguments: 2 required, 2 optional
    220         1. name - name of the volume
    221         2. -at - position of the plot within the view, row and column number
    222         3. -table - name of the table holding the data.
    223         4. {"x1" "y1" "z1" "d1",...} - x, y, z, and data column names
    224     Return Value: None
    225     Notes: volumes can be grouped together by specifying
    226            multiple x,y,z triplets within the list of columns
    227            from the last argument. eg:
    228            {"x1" "y1" "z1" "d1" "x2" "y2" "z2" "d2"}
    229     ToDo:
    230         1. how to specify transfer function ranges
    231         2. how to specify uni rect grid instead of explicit points
    232             - three values in the coords columns is assumed to be
    233               the min, max, and step for that direction of the
    234               uniform rectangular grid?
    235     Code Example:
    236     {{{
    237         set results [Rappture::Table "dataTable"]
    238         $results column "Xcoords" "X coordinates"
    239         $results column "Ycoords" "Y coordinates"
    240         $results column "Zcoords" "Z coordinates"
    241         $results column "Data1" "Data Set #1"
    242         $results column "Data2" "Data Set #2"
    243 
    244         # create a view with two volumes in a single visualization window
    245         set v1 [Rappture::View fdfview1]
    246         $v1 volume "fdfVol1" -table "dataTable" \
    247             {"Xcoords" "Ycoords" "Zcoords" "Data1" \
    248              "Xcoords" "Ycoords" "Zcoords" "Data2"}
    249 
    250         # create a view with two volumes in different visualization windows
    251         # one stacked on top of the other
    252         set v2 [Rappture::View fdfview2 -rows 2 -cols 1]
    253         $v2 volume "fdfVol2" -at "1,1" -table "dataTable" \
    254             {"Xcoords" "Ycoords" "Zcoords" "Data1"}
    255         $v2 volume "fdfVol3" -at "2,1" -table "dataTable" \
    256             {"Xcoords" "Ycoords" "Zcoords" "Data2"}
    257 
    258         # create a view with two volumes in different visualization windows
    259         # side by side
    260         set v3 [Rappture::View fdfview3 -rows 1 -cols 2]
    261         $v3 volume "fdfVol4" -at "1,1" -table "dataTable" \
    262             {"Xcoords" "Ycoords" "Zcoords" "Data1"}
    263         $v3 volume "fdfVol5" -at "1,2" -table "dataTable" \
    264             {"Xcoords" "Ycoords" "Zcoords" "Data2"}
    265     }}}
    266 
    267 surface <name> -at "row,col" -table <table> {"x1" "y1" "d1" ...}
    268     Purpose: populate a view object with a surface plot
    269     Input Arguments: 2 required, 2 optional
    270         1. name - name of the volume
    271         2. -at - position of the plot within the view, row and column number
    272         3. -table - name of the table holding the data.
    273         4. {"x1" "y1" "d1",...} - x, y, and data column names
    274     Return Value: None
    275     Notes: surface plots can be grouped together by specifying
    276            multiple x,y pairs within the list of columns
    277            from the last argument. eg:
    278            {"x1" "y1" "d1" "x2" "y2" "d2"}
    279     ToDo:
    280         1. how to specify transfer function ranges
    281         2. how to specify uni rect grid instead of explicit points
    282             - three values in the coords columns is assumed to be
    283               the min, max, and step for that direction of the
    284               uniform rectangular grid?
    285     Code Example:
    286     {{{
    287         set results [Rappture::Table "dataTable"]
    288         $results column "Xcoords" "X coordinates"
    289         $results column "Ycoords" "Y coordinates"
    290         $results column "Data1" "Data Set #1"
    291         $results column "Data2" "Data Set #2"
    292 
    293         # create a view with two surface plots in a single visualization window
    294         set v1 [Rappture::View fdfview1]
    295         $v1 surface "fdfSurf1" -table "dataTable" \
    296             {"Xcoords" "Ycoords" "Data1" \
    297              "Xcoords" "Ycoords" "Data2"}
    298 
    299         # create a view with two volumes in different visualization windows
    300         # one stacked on top of the other
    301         set v2 [Rappture::View fdfview2 -rows 2 -cols 1]
    302         $v2 surface "fdfSurf2" -at "1,1" -table "dataTable" \
    303             {"Xcoords" "Ycoords" "Data1"}
    304         $v2 surface "fdfSurf3" -at "2,1" -table "dataTable" \
    305             {"Xcoords" "Ycoords" "Data2"}
    306 
    307         # create a view with two volumes in different visualization windows
    308         # side by side
    309         set v3 [Rappture::View fdfview3 -rows 1 -cols 2]
    310         $v3 surface "fdfSurf4" -at "1,1" -table "dataTable" \
    311             {"Xcoords" "Ycoords" "Data1"}
    312         $v3 surface "fdfSurf5" -at "1,2" -table "dataTable" \
    313             {"Xcoords" "Ycoords" "Data2"}
    314     }}}
    315 
    316 image <object> -at "row,col"
    317     Purpose: populate a view object with an image
    318     Input Arguments: 1 required, 1 optional
    319         1. object - object representing the image
    320         2. -at - position of the image within the view, row and column number
    321     Return Value: None
    322     Code Example:
    323     {{{
    324         set i1 [Rappture::Image "image1" -label "ilabel1" -desc "idesc1"]
    325         set i2 [Rappture::Image "image2" -label "ilabel2" -desc "idesc2"]
    326 
    327         # create a view with two images in different windows
    328         # one stacked on top of the other
    329         set v1 [Rappture::View fdfview1 -rows 2 -cols 1]
    330         $v1 image $i1 -at "1,1"
    331         $v1 image $i2 -at "2,1"
    332 
    333         # create a view with two images in different windows
    334         # side by side
    335         set v2 [Rappture::View fdfview2 -rows 1 -cols 2]
    336         $v2 image $i1 -at "1,1"
    337         $v2 image $i2 -at "1,2"
    338     }}}
    339 
    340 note <object> -at "row,col"
    341     Purpose: populate a view object with a note
    342     Input Arguments: 1 required, 1 optional
    343         1. object - object representing the note
    344         2. -at - position of the note within the view, row and column number
    345     Return Value: None
    346     Code Example:
    347     {{{
    348         set i1 [Rappture::Note "note1" -label "nlabel1" -desc "ndesc1"]
    349         set i2 [Rappture::Note "note2" -label "nlabel2" -desc "ndesc2"]
    350 
    351         # create a view with two notes in different windows
    352         # one stacked on top of the other
    353         set v1 [Rappture::View fdfview1 -rows 2 -cols 1]
    354         $v1 note $n1 -at "1,1"
    355         $v1 note $n2 -at "2,1"
    356 
    357         # create a view with two notes in different windows
    358         # side by side
    359         set v2 [Rappture::View fdfview2 -rows 1 -cols 2]
    360         $v2 note $i1 -at "1,1"
    361         $v2 note $i2 -at "1,2"
    362172    }}}
    363173
     
    719529    }}}
    720530
    721 
    722531is
    723532    Purpose: return an integer tag describing the object.
     
    726535    Notes: None
    727536    Code Example:
     537
     538plot <name> -at "row,col" -table <table> {"x1" "y1" "s1" "x2" "y2" "s2" ...}
     539    Purpose: populate a view object with a plot
     540    Input Arguments: 2 required, 2 optional
     541        1. name - name of the plot
     542        2. -at - position of the plot within the view, row and column number
     543        3. -table - name of the table holding the data.
     544        4. {"x1" "y1" "s1" ...} - x and y column names, followed by the style
     545    Return Value: None
     546    Notes: plots can be grouped together by specifying
     547           multiple x,y pairs within the list of columns
     548           from the last argument. eg:
     549           {"x1" "y1" "s1" "x2" "y2" "s2"}
     550    Code Example:
     551    {{{
     552        set results [Rappture::Table "dataTable"]
     553        $results column "Xvals" "X Values"
     554        $results column "Squared" "X Squared"
     555        $results column "Cubed" "X Cubed"
     556
     557        # create a view with two curves grouped on a single plot
     558        # 1) x vs x^2
     559        # 2) x vs x^3
     560        set v1 [Rappture::View fdfview1]
     561        $v1 plot "fdfPlot1" -table "dataTable" \
     562            {"Xvals" "Squared" "g:o" "Xvals" "Cubed" "b-o"}
     563
     564        # create a view with two plots, one stacked on top of the other
     565        # 1) x vs x^2
     566        # 2) x vs x^3
     567        set v2 [Rappture::View fdfview2 -rows 2 -cols 1]
     568        $v2 plot "fdfPlot2" -at "1,1" -table "dataTable" \
     569            {"Xvals" "Squared" "g:o"}
     570        $v2 plot "fdfPlot3" -at "2,1" -table "dataTable" \
     571            {"Xvals" "Cubed" "b-o"}
     572
     573        # create a view with two plots side by side
     574        # 1) x vs x^2   2) x vs x^3
     575        set v3 [Rappture::View fdfview3 -rows 1 -cols 2]
     576        $v3 plot "fdfPlot4" -at "1,1" -table "dataTable" \
     577            {"Xvals" "Squared" "g:o"}
     578        $v3 plot "fdfPlot5" -at "1,2" -table "dataTable" \
     579            {"Xvals" "Cubed" "b-o"}
     580    }}}
     581
     582surf2d <name> -at "row,col" -table <table> {"x1" "y1" "d1" ...}
     583    Purpose: populate a view object with a 2 dimensional surface plot
     584    Input Arguments: 2 required, 2 optional
     585        1. name - name of the 2 dimensional surface
     586        2. -at - position of the plot within the view, row and column number
     587        3. -table - name of the table holding the data.
     588        4. {"x1" "y1" "d1",...} - x, y, and data column names.
     589            data column is used for both height and color.
     590    Return Value: None
     591    Notes: surface plots can be grouped together by specifying
     592           multiple x,y pairs within the list of columns
     593           from the last argument. eg:
     594           {"x1" "y1" "d1" "x2" "y2" "d2"}
     595    ToDo:
     596        1. how to specify transfer function ranges
     597        2. how to specify uni rect grid instead of explicit points
     598            - three values in the coords columns is assumed to be
     599              the min, max, and step for that direction of the
     600              uniform rectangular grid?
     601    Code Example:
     602    {{{
     603        set results [Rappture::Table "dataTable"]
     604        $results column "Xcoords" "X coordinates"
     605        $results column "Ycoords" "Y coordinates"
     606        $results column "Data1" "Data Set #1"
     607        $results column "Data2" "Data Set #2"
     608
     609        # create a view with two 2d surface plots in a single visualization window
     610        set v1 [Rappture::View fdfview1]
     611        $v1 surf2d "fdfSurf1" -table "dataTable" \
     612            {"Xcoords" "Ycoords" "Data1" \
     613             "Xcoords" "Ycoords" "Data2"}
     614
     615        # create a view with two 2d surface plots in different visualization windows
     616        # one stacked on top of the other
     617        set v2 [Rappture::View fdfview2 -rows 2 -cols 1]
     618        $v2 surf2d "fdfSurf2" -at "1,1" -table "dataTable" \
     619            {"Xcoords" "Ycoords" "Data1"}
     620        $v2 surf2d "fdfSurf3" -at "2,1" -table "dataTable" \
     621            {"Xcoords" "Ycoords" "Data2"}
     622
     623        # create a view with two 2d surface plots in different visualization windows
     624        # side by side
     625        set v3 [Rappture::View fdfview3 -rows 1 -cols 2]
     626        $v3 surf2d "fdfSurf4" -at "1,1" -table "dataTable" \
     627            {"Xcoords" "Ycoords" "Data1"}
     628        $v3 surf2d "fdfSurf5" -at "1,2" -table "dataTable" \
     629            {"Xcoords" "Ycoords" "Data2"}
     630    }}}
     631
     632surf3d <name> -at "row,col" -table <table> {"x1" "y1" "z1" "d1",...}
     633    Purpose: populate a view object with a 3 dimensional surface
     634    Input Arguments: 2 required, 2 optional
     635        1. name - name of the 3 dimensional surface
     636        2. -at - position of the plot within the view, row and column number
     637        3. -table - name of the table holding the data.
     638        4. {"x1" "y1" "z1" "d1",...} - x, y, z, and data column names
     639    Return Value: None
     640    Notes: 3d surfaces can be grouped together by specifying
     641           multiple x,y,z triplets within the list of columns
     642           from the last argument. eg:
     643           {"x1" "y1" "z1" "d1" "x2" "y2" "z2" "d2"}
     644    ToDo:
     645        1. how to specify transfer function ranges
     646        2. how to specify uni rect grid instead of explicit points
     647            - three values in the coords columns is assumed to be
     648              the min, max, and step for that direction of the
     649              uniform rectangular grid?
     650    Code Example:
     651    {{{
     652        set results [Rappture::Table "dataTable"]
     653        $results column "Xcoords" "X coordinates"
     654        $results column "Ycoords" "Y coordinates"
     655        $results column "Zcoords" "Z coordinates"
     656        $results column "Data1" "Data Set #1"
     657        $results column "Data2" "Data Set #2"
     658
     659        # create a view with two 3d surfaces in a single visualization window
     660        set v1 [Rappture::View fdfview1]
     661        $v1 surf3d "fdfVol1" -table "dataTable" \
     662            {"Xcoords" "Ycoords" "Zcoords" "Data1" \
     663             "Xcoords" "Ycoords" "Zcoords" "Data2"}
     664
     665        # create a view with two 3d surfaces in different visualization windows
     666        # one stacked on top of the other
     667        set v2 [Rappture::View fdfview2 -rows 2 -cols 1]
     668        $v2 surf3d "fdfVol2" -at "1,1" -table "dataTable" \
     669            {"Xcoords" "Ycoords" "Zcoords" "Data1"}
     670        $v2 surf3d "fdfVol3" -at "2,1" -table "dataTable" \
     671            {"Xcoords" "Ycoords" "Zcoords" "Data2"}
     672
     673        # create a view with two 3d surfaces in different visualization windows
     674        # side by side
     675        set v3 [Rappture::View fdfview3 -rows 1 -cols 2]
     676        $v3 surf3d "fdfVol4" -at "1,1" -table "dataTable" \
     677            {"Xcoords" "Ycoords" "Zcoords" "Data1"}
     678        $v3 surf3d "fdfVol5" -at "1,2" -table "dataTable" \
     679            {"Xcoords" "Ycoords" "Zcoords" "Data2"}
     680    }}}
     681
     682image <object> -at "row,col"
     683    Purpose: populate a view object with an image
     684    Input Arguments: 1 required, 1 optional
     685        1. object - object representing the image
     686        2. -at - position of the image within the view, row and column number
     687    Return Value: None
     688    Code Example:
     689    {{{
     690        set i1 [Rappture::Image "image1" -label "ilabel1" -desc "idesc1"]
     691        set i2 [Rappture::Image "image2" -label "ilabel2" -desc "idesc2"]
     692
     693        # create a view with two images in different windows
     694        # one stacked on top of the other
     695        set v1 [Rappture::View fdfview1 -rows 2 -cols 1]
     696        $v1 image $i1 -at "1,1"
     697        $v1 image $i2 -at "2,1"
     698
     699        # create a view with two images in different windows
     700        # side by side
     701        set v2 [Rappture::View fdfview2 -rows 1 -cols 2]
     702        $v2 image $i1 -at "1,1"
     703        $v2 image $i2 -at "1,2"
     704    }}}
     705
     706note <object> -at "row,col"
     707    Purpose: populate a view object with a note
     708    Input Arguments: 1 required, 1 optional
     709        1. object - object representing the note
     710        2. -at - position of the note within the view, row and column number
     711    Return Value: None
     712    Code Example:
     713    {{{
     714        set i1 [Rappture::Note "note1" -label "nlabel1" -desc "ndesc1"]
     715        set i2 [Rappture::Note "note2" -label "nlabel2" -desc "ndesc2"]
     716
     717        # create a view with two notes in different windows
     718        # one stacked on top of the other
     719        set v1 [Rappture::View fdfview1 -rows 2 -cols 1]
     720        $v1 note $n1 -at "1,1"
     721        $v1 note $n2 -at "2,1"
     722
     723        # create a view with two notes in different windows
     724        # side by side
     725        set v2 [Rappture::View fdfview2 -rows 1 -cols 2]
     726        $v2 note $i1 -at "1,1"
     727        $v2 note $i2 -at "1,2"
     728    }}}
     729
Note: See TracChangeset for help on using the changeset viewer.