Changeset 5850
- Timestamp:
- Aug 28, 2015 10:12:22 AM (9 years ago)
- Location:
- branches/uq
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uq
-
branches/uq/examples/zoo/field/field.py
r5534 r5850 141 141 """ 142 142 143 if vizmethod == "dx":144 #145 # Generate a uniform 3D mesh in OpenDX format...146 #147 f3d = rx['output.field(f3d)']148 f3d['about.label'] = "3D Field"149 f3d['component.style'] = "-color blue:yellow:red -levels 6"150 151 dx = """object 1 class gridpositions counts 5 5 2152 origin 0 0 0153 delta 1 0 0154 delta 0 1 0155 delta 0 0 1156 object 2 class gridconnections counts 5 5 2157 object 3 class array type double rank 0 items 50 data follows158 """159 160 xx, yy, zz = np.mgrid[xmin:xmax:5j, ymin:ymax:5j, 0:1:2j]161 pts = formula(xx, yy, zz)162 # Axis ordering for OpenDX is reversed (z fastest)163 dx += '\n'.join(map(str, (pts.ravel())))164 165 dx += """attribute "dep" string "positions"166 object "regular positions regular connections" class field167 component "positions" value 1168 component "connections" value 2169 component "data" value 3"""170 171 data = Rappture.encoding.encode(dx, Rappture.RPENC_ZB64)172 f3d['component.dx'] = data173 174 175 143 rx.close() -
branches/uq/examples/zoo/field/field.tcl
r3692 r5850 115 115 } 116 116 117 if {$vizmethod == "dx"} {118 #119 # Generate a uniform 3D mesh in OpenDX format...120 #121 $driver put output.field(f3d).about.label "3D Field"122 $driver put output.field(f3d).component.style "-color blue:yellow:red -levels 6"123 124 set dx "object 1 class gridpositions counts 5 5 2125 origin 0 0 0126 delta 1 0 0127 delta 0 1 0128 delta 0 0 1129 object 2 class gridconnections counts 5 5 2130 object 3 class array type double rank 0 items 50 data follows131 "132 # Axis ordering for OpenDX is reversed (z fastest)133 for {set x 0} {$x < 5} {incr x} {134 for {set y 0} {$y < 5} {incr y} {135 for {set z 0} {$z < 2} {incr z} {136 set fval [expr $formula]137 append dx "$fval\n"138 }139 }140 }141 append dx {attribute "dep" string "positions"142 object "regular positions regular connections" class field143 component "positions" value 1144 component "connections" value 2145 component "data" value 3}146 147 set data [Rappture::encoding::encode -as zb64 $dx]148 $driver put output.field(f3d).component.dx $data149 }150 151 117 # 152 118 # Save the updated XML describing the run... -
branches/uq/examples/zoo/field/tool.xml
r5534 r5850 46 46 <value>unstructured</value> 47 47 </option> 48 <option>49 <about>50 <label>Volume (OpenDX)</label>51 <description>Renders a 3D volume using the deprecated OpenDX mesh/field format.</description>52 </about>53 <value>dx</value>54 </option>55 48 <default>grid</default> 56 49 </choice> -
branches/uq/examples/zoo/mesh/mesh.m
r3752 r5850 93 93 0, 0); 94 94 95 case 'generic'96 mesh = 'output.mesh';97 rpLibPutString(lib, 'output.mesh.about.label', \98 'nodes and elements mesh', 0);99 rpLibPutString(lib, 'output.mesh.dim', '2', 0);100 rpLibPutString(lib, 'output.mesh.units', 'm', 0);101 rpLibPutString(lib, 'output.mesh.hide', 'yes', 0);102 103 f = fopen('triangles.txt');104 triangles = fscanf(f, '%d');105 fclose(f);106 107 % TO BE COMPLETED108 109 95 case 'unstructured' 110 96 mesh = 'output.mesh'; -
branches/uq/examples/zoo/mesh/mesh.py
r5627 r5850 84 84 mesh.put('unstructured.triangles', 'triangles.txt', type='file') 85 85 86 if meshtype == 'generic':87 mesh['about.label'] = "nodes and elements mesh"88 with open('points.txt') as f:89 data = f.read()90 for i, line in enumerate(data.split('\n')):91 if line == '':92 break93 x, y = line.split()94 mesh['node(%s)' % i] = "%s %s" % (x, y)95 with open('triangles.txt') as f:96 data = f.read()97 for i, line in enumerate(data.split('\n')):98 if line == '':99 break100 x, y, z = line.split()101 mesh['element(%s).nodes' % i] = "%s %s %s" % (x, y, z)102 103 86 if meshtype == 'unstructured': 104 87 mesh['about.label'] = "Unstructured Grid" -
branches/uq/examples/zoo/mesh/mesh.tcl
r5679 r5850 117 117 triangles.txt 118 118 } 119 "generic" {120 set mesh output.mesh121 122 $driver put $mesh.about.label "Mesh"123 $driver put $mesh.about.description "nodes and elements mesh"124 $driver put $mesh.dim 2125 $driver put $mesh.units "m"126 $driver put $mesh.hide $hide127 128 set count 0129 set f [open "points.txt" "r"]130 set points [read $f]131 close $f132 foreach { x y } $points {133 $driver put $mesh.node($count) "$x $y"134 incr count135 }136 set count 0137 set f [open "triangles.txt" "r"]138 set triangles [read $f]139 close $f140 foreach { a b c } $triangles {141 $driver put $mesh.element($count).nodes "$a $b $c"142 incr count143 }144 }145 119 "unstructured" { 146 120 set mesh output.mesh -
branches/uq/examples/zoo/mesh/tool.xml
r5679 r5850 65 65 <option> 66 66 <about> 67 <label>general nodes and elements description</label>68 <description>Unstructured 2 dimensional grid of cells using nodes and elements.</description>69 </about>70 <value>generic</value>71 </option>72 <option>73 <about>74 67 <label>VTK mesh</label> 75 68 <description>Partial VTK file representing the mesh.</description> -
branches/uq/examples/zoo/mesh/tool_octave.xml
- Property svn:mime-type changed from application/xml to text/xml
r3752 r5850 58 58 <option> 59 59 <about> 60 <label>general nodes and elements description</label>61 <description>Unstructured 2 dimensional grid of cells using nodes and elements.</description>62 </about>63 <value>generic</value>64 </option>65 <option>66 <about>67 60 <label>VTK mesh</label> 68 61 <description>Partial VTK file representing the mesh.</description> -
branches/uq/gui/apps/execute.tcl
r5679 r5850 32 32 Rappture::resources::load 33 33 34 # Parse command line options 35 # ---------------------------------------------------------------------- 36 Rappture::getopts argv params { 37 value -tool "" 38 value -status "" 39 value -output "" 40 value -cleanup no 41 } 42 34 43 # load the XML info in the driver file 35 44 if {[catch {Rappture::library $driverxml} result]} { … … 41 50 42 51 # If tool.xml is not specified, try to find it the way Rappture would. 52 if {$params(-tool) ne ""} { 53 set toolxml $params(-tool) 54 } 43 55 if {$toolxml eq ""} { 44 56 if {[file isfile tool.xml]} { … … 120 132 } 121 133 122 # Parse command line options to see134 # Apply effects of all other command line options 123 135 # ---------------------------------------------------------------------- 124 Rappture::getopts argv params {125 value -status ""126 value -output ""127 value -cleanup no128 }129 130 136 if {$params(-status) ne ""} { 131 137 set LogFid [open $params(-status) w] -
branches/uq/gui/scripts/drawing.tcl
r5679 r5850 93 93 } 94 94 foreach {key path} { 95 camera about.camera 96 color about.color 95 97 group about.group 96 98 label about.label 97 color about.color98 camera about.camera99 99 type about.type 100 xdesc xaxis.description 101 ydesc yaxis.description 102 zdesc zaxis.description 100 103 xlabel xaxis.label 101 xdesc xaxis.description 104 ylabel yaxis.label 105 zlabel zaxis.label 106 xscale xaxis.scale 107 yscale yaxis.scale 108 zscale zaxis.scale 102 109 xunits xaxis.units 103 xscale xaxis.scale 110 yunits yaxis.units 111 zunits zaxis.units 104 112 xmin xaxis.min 105 113 xmax xaxis.max 106 ylabel yaxis.label107 ydesc yaxis.description108 yunits yaxis.units109 yscale yaxis.scale110 114 ymin yaxis.min 111 115 ymax yaxis.max 112 zlabel zaxis.label113 zdesc zaxis.description114 zunits zaxis.units115 zscale zaxis.scale116 116 zmin zaxis.min 117 117 zmax zaxis.max -
branches/uq/gui/scripts/field.tcl
r5679 r5850 651 651 # ---------------------------------------------------------------------- 652 652 itcl::body Rappture::Field::InitHints {} { 653 # Order of duplicate keys matters here: later entries override 654 # earlier ones. For example: camera.position is deprecated in 655 # favor of about.camera, so about.camera is listed after 656 # camera.position 653 657 foreach {key path} { 654 658 camera camera.position 659 camera about.camera 655 660 color about.color 656 default about.default657 661 group about.group 658 662 label about.label … … 1142 1146 } 1143 1147 1148 # 1149 # FIXME: Allowing a VTK file to be used as a Field <component> means 1150 # there can be multiple VTK fields with different association, type, and 1151 # number of components (array elements) within a single Rappture::Field. 1152 # This breaks the concept of the Field object since the <component>'s 1153 # <association>, <elemtype> and <elemsize> can't be set to a single 1154 # value in this case. 1155 # 1156 # Rappture needs a Dataset object with a single Mesh and multiple Fields. 1157 # 1144 1158 itcl::body Rappture::Field::ReadVtkDataSet { cname contents } { 1145 1159 package require vtk … … 1191 1205 lappend limits y [list $ymin $ymax] 1192 1206 lappend limits z [list $zmin $zmax] 1207 set vmin 0 1208 set vmax 1 1209 set foundDefaultArray 0 1193 1210 set dataAttrs [$dataset GetPointData] 1194 1211 if { $dataAttrs == ""} { 1195 puts stderr " WARNING: No point data foundin \"$_path\""1212 puts stderr "ERROR: Can't get point data attributes in \"$_path\"" 1196 1213 rename $reader "" 1197 1214 return 0 1198 1215 } 1199 set vmin 01200 set vmax 11201 1216 set numArrays [$dataAttrs GetNumberOfArrays] 1202 if { $numArrays > 0 } { 1203 for {set i 0} {$i < [$dataAttrs GetNumberOfArrays] } {incr i} { 1204 set array [$dataAttrs GetArray $i] 1205 set fname [$dataAttrs GetArrayName $i] 1206 foreach {min max} [$array GetRange -1] break 1207 if {$i == 0} { 1208 set vmin $min 1209 set vmax $max 1210 } 1217 for {set i 0} {$i < $numArrays} {incr i} { 1218 set array [$dataAttrs GetArray $i] 1219 set fname [$dataAttrs GetArrayName $i] 1220 foreach {min max} [$array GetRange -1] break 1221 if {!$foundDefaultArray} { 1222 set vmin $min 1223 set vmax $max 1224 set foundDefaultArray 1 1225 } 1226 lappend limits $fname [list $min $max] 1227 set _fld2Units($fname) "" 1228 set _fld2Label($fname) $fname 1229 # Let the VTK file override the <elemsize> 1230 set _fld2Components($fname) [$array GetNumberOfComponents] 1231 lappend _comp2fldName($cname) $fname 1232 } 1233 # FIXME: Can't properly handle field names that are re-used in point data 1234 # cell data and/or field data even though this is permitted in VTK. 1235 # For now, we'll use the first field found of point, cell, then field data 1236 set dataAttrs [$dataset GetCellData] 1237 if { $dataAttrs == ""} { 1238 puts stderr "ERROR: Can't get cell data attributes found in \"$_path\"" 1239 rename $reader "" 1240 return 0 1241 } 1242 set numArrays [$dataAttrs GetNumberOfArrays] 1243 for {set i 0} {$i < $numArrays} {incr i} { 1244 set array [$dataAttrs GetArray $i] 1245 set fname [$dataAttrs GetArrayName $i] 1246 foreach {min max} [$array GetRange -1] break 1247 if {!$foundDefaultArray} { 1248 set vmin $min 1249 set vmax $max 1250 set foundDefaultArray 1 1251 } 1252 if {[info exists _fld2Components($fname)]} { 1253 puts stderr "WARNING: Re-use of field name within cell data attributes" 1254 } else { 1211 1255 lappend limits $fname [list $min $max] 1212 1256 set _fld2Units($fname) "" 1213 1257 set _fld2Label($fname) $fname 1214 # Let the VTK file override the < type> designated.1258 # Let the VTK file override the <elemsize> 1215 1259 set _fld2Components($fname) [$array GetNumberOfComponents] 1216 1260 lappend _comp2fldName($cname) $fname 1217 1261 } 1218 1262 } 1219 1263 set dataAttrs [$dataset GetFieldData] 1264 if { $dataAttrs == ""} { 1265 puts stderr "ERROR: Can't get field data attributes found in \"$_path\"" 1266 rename $reader "" 1267 return 0 1268 } 1269 set numArrays [$dataAttrs GetNumberOfArrays] 1270 for {set i 0} {$i < $numArrays} {incr i} { 1271 set array [$dataAttrs GetArray $i] 1272 set fname [$dataAttrs GetArrayName $i] 1273 foreach {min max} [$array GetRange -1] break 1274 if {!$foundDefaultArray} { 1275 set vmin $min 1276 set vmax $max 1277 set foundDefaultArray 1 1278 } 1279 if {[info exists _fld2Components($fname)]} { 1280 puts stderr "WARNING: Re-use of field name within field data attributes" 1281 } else { 1282 lappend limits $fname [list $min $max] 1283 set _fld2Units($fname) "" 1284 set _fld2Label($fname) $fname 1285 # Let the VTK file override the <elemsize> 1286 set _fld2Components($fname) [$array GetNumberOfComponents] 1287 lappend _comp2fldName($cname) $fname 1288 } 1289 } 1290 # This is set to the range of the first array found 1220 1291 lappend limits v [list $vmin $vmax] 1221 1292 set _comp2limits($cname) $limits -
branches/uq/gui/scripts/flowvisviewer.tcl
r5679 r5850 3 3 # COMPONENT: flowvisviewer - 3D flow rendering 4 4 # 5 # This widget performs volume and flow rendering on 3D scalar/vector datasets.5 # This widget performs volume and flow rendering on 3D vector datasets. 6 6 # It connects to the Nanovis server running on a rendering farm, 7 7 # transmits data, and displays the results. 8 8 # ====================================================================== 9 9 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 2004-201 2HUBzero Foundation, LLC10 # Copyright (c) 2004-2015 HUBzero Foundation, LLC 11 11 # 12 12 # See the file "license.terms" for information on usage and … … 172 172 set _serverType "nanovis" 173 173 174 # Draw legend event 174 #DebugOn 175 EnableWaitDialog 900 176 177 # Rebuild event 178 $_dispatcher register !rebuild 179 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 180 181 # Resize event 182 $_dispatcher register !resize 183 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 184 185 # Legend event 175 186 $_dispatcher register !legend 176 187 $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list" … … 180 191 $_dispatcher dispatch $this !send_transfunc \ 181 192 "[itcl::code $this SendTransferFunctions]; list" 182 183 # Rebuild event184 $_dispatcher register !rebuild185 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"186 187 # Resize event188 $_dispatcher register !resize189 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"190 193 191 194 $_dispatcher register !play … … 212 215 # Initialize the view to some default parameters. 213 216 array set _view { 214 -qw 0.853553215 -qx -0.353553216 -qy 0.353553217 -qz 0.146447218 -xpan 0219 -ypan 0220 -zoom 1.0217 -qw 0.853553 218 -qx -0.353553 219 -qy 0.353553 220 -qz 0.146447 221 -xpan 0 222 -ypan 0 223 -zoom 1.0 221 224 } 222 225 set _arcball [blt::arcball create 100 100] … … 266 269 }] 267 270 268 itk_component add 3dview {271 itk_component add view { 269 272 label $itk_component(plotarea).view -image $_image(plot) \ 270 273 -highlightthickness 0 -borderwidth 0 … … 273 276 ignore -highlightthickness -borderwidth -background 274 277 } 275 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]278 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 276 279 277 280 set f [$itk_component(main) component controls] … … 317 320 -onimage [Rappture::icon volume-on] \ 318 321 -offimage [Rappture::icon volume-off] \ 319 - command [itcl::code $this AdjustSetting -volume] \320 - variable [itcl::scope _settings(-volume)]322 -variable [itcl::scope _settings(-volume)] \ 323 -command [itcl::code $this AdjustSetting -volume] 321 324 } 322 325 $itk_component(volume) select … … 362 365 # the server. So the panewindow uses the tiny size. 363 366 set w 10000 364 pack forget $itk_component( 3dview)367 pack forget $itk_component(view) 365 368 blt::table $itk_component(plotarea) \ 366 0,0 $itk_component( 3dview) -fill both -reqwidth $w \369 0,0 $itk_component(view) -fill both -reqwidth $w \ 367 370 1,0 $itk_component(legend) -fill x 368 371 blt::table configure $itk_component(plotarea) r1 -resize none … … 511 514 blt::table configure $itk_component(flowcontrols) r0 -pady 1 512 515 # Bindings for rotation via mouse 513 bind $itk_component( 3dview) <ButtonPress-1> \516 bind $itk_component(view) <ButtonPress-1> \ 514 517 [itcl::code $this Rotate click %x %y] 515 bind $itk_component( 3dview) <B1-Motion> \518 bind $itk_component(view) <B1-Motion> \ 516 519 [itcl::code $this Rotate drag %x %y] 517 bind $itk_component( 3dview) <ButtonRelease-1> \520 bind $itk_component(view) <ButtonRelease-1> \ 518 521 [itcl::code $this Rotate release %x %y] 519 522 520 bind $itk_component( 3dview) <Configure> \523 bind $itk_component(view) <Configure> \ 521 524 [itcl::code $this EventuallyResize %w %h] 522 525 523 526 # Bindings for panning via mouse 524 bind $itk_component( 3dview) <ButtonPress-2> \527 bind $itk_component(view) <ButtonPress-2> \ 525 528 [itcl::code $this Pan click %x %y] 526 bind $itk_component( 3dview) <B2-Motion> \529 bind $itk_component(view) <B2-Motion> \ 527 530 [itcl::code $this Pan drag %x %y] 528 bind $itk_component( 3dview) <ButtonRelease-2> \531 bind $itk_component(view) <ButtonRelease-2> \ 529 532 [itcl::code $this Pan release %x %y] 530 533 531 534 # Bindings for panning via keyboard 532 bind $itk_component( 3dview) <KeyPress-Left> \535 bind $itk_component(view) <KeyPress-Left> \ 533 536 [itcl::code $this Pan set -10 0] 534 bind $itk_component( 3dview) <KeyPress-Right> \537 bind $itk_component(view) <KeyPress-Right> \ 535 538 [itcl::code $this Pan set 10 0] 536 bind $itk_component( 3dview) <KeyPress-Up> \539 bind $itk_component(view) <KeyPress-Up> \ 537 540 [itcl::code $this Pan set 0 -10] 538 bind $itk_component( 3dview) <KeyPress-Down> \541 bind $itk_component(view) <KeyPress-Down> \ 539 542 [itcl::code $this Pan set 0 10] 540 bind $itk_component( 3dview) <Shift-KeyPress-Left> \543 bind $itk_component(view) <Shift-KeyPress-Left> \ 541 544 [itcl::code $this Pan set -2 0] 542 bind $itk_component( 3dview) <Shift-KeyPress-Right> \545 bind $itk_component(view) <Shift-KeyPress-Right> \ 543 546 [itcl::code $this Pan set 2 0] 544 bind $itk_component( 3dview) <Shift-KeyPress-Up> \547 bind $itk_component(view) <Shift-KeyPress-Up> \ 545 548 [itcl::code $this Pan set 0 -2] 546 bind $itk_component( 3dview) <Shift-KeyPress-Down> \549 bind $itk_component(view) <Shift-KeyPress-Down> \ 547 550 [itcl::code $this Pan set 0 2] 548 551 549 552 # Bindings for zoom via keyboard 550 bind $itk_component( 3dview) <KeyPress-Prior> \553 bind $itk_component(view) <KeyPress-Prior> \ 551 554 [itcl::code $this Zoom out] 552 bind $itk_component( 3dview) <KeyPress-Next> \555 bind $itk_component(view) <KeyPress-Next> \ 553 556 [itcl::code $this Zoom in] 554 557 555 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"558 bind $itk_component(view) <Enter> "focus $itk_component(view)" 556 559 557 560 if {[string equal "x11" [tk windowingsystem]]} { 558 561 # Bindings for zoom via mouse 559 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out]560 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in]562 bind $itk_component(view) <4> [itcl::code $this Zoom out] 563 bind $itk_component(view) <5> [itcl::code $this Zoom in] 561 564 } 562 565 … … 565 568 eval itk_initialize $args 566 569 567 EnableWaitDialog 900568 570 Connect 569 571 } … … 626 628 # ---------------------------------------------------------------------- 627 629 # USAGE: get ?-objects? 628 # USAGE: get ?-image 3dview|legend?630 # USAGE: get ?-image view|legend? 629 631 # 630 632 # Clients use this to query the list of objects being plotted, in … … 656 658 -image { 657 659 if {[llength $args] != 2} { 658 error "wrong # args: should be \"get -image 3dview|legend\""660 error "wrong # args: should be \"get -image view|legend\"" 659 661 } 660 662 switch -- [lindex $args end] { 661 3dview {663 view { 662 664 return $_image(plot) 663 665 } … … 666 668 } 667 669 default { 668 error "bad image name \"[lindex $args end]\": should be 3dview or legend"670 error "bad image name \"[lindex $args end]\": should be view or legend" 669 671 } 670 672 } … … 679 681 # USAGE: delete ?<dataobj1> <dataobj2> ...? 680 682 # 681 # Clients use this to delete a dataobj from the plot. If no dataobjs 682 # are specified, then all dataobjs are deleted. No data objects are 683 # deleted. They are only removed from the display list. 684 # 683 # Clients use this to delete a dataobj from the plot. If no dataobjs 684 # are specified, then all dataobjs are deleted. No data objects are 685 # deleted. They are only removed from the display list. 685 686 # ---------------------------------------------------------------------- 686 687 itcl::body Rappture::FlowvisViewer::delete {args} { … … 881 882 } 882 883 883 set w [winfo width $itk_component( 3dview)]884 set h [winfo height $itk_component( 3dview)]884 set w [winfo width $itk_component(view)] 885 set h [winfo height $itk_component(view)] 885 886 EventuallyResize $w $h 886 887 } … … 891 892 # isconnected -- 892 893 # 893 # 894 # Indicates if we are currently connected to the visualization server. 894 895 # 895 896 itcl::body Rappture::FlowvisViewer::isconnected {} { … … 907 908 # Disconnect -- 908 909 # 909 # Clients use this method to disconnect from the current rendering 910 # server. 910 # Clients use this method to disconnect from the current rendering server. 911 911 # 912 912 itcl::body Rappture::FlowvisViewer::Disconnect {} { … … 1033 1033 # ReceiveLegend -- 1034 1034 # 1035 # 1036 # 1037 # 1038 # 1039 # 1035 # The procedure is the response from the render server to each "legend" 1036 # command. The server sends back a "legend" command invoked our 1037 # the slave interpreter. The purpose is to collect data of the image 1038 # representing the legend in the canvas. In addition, the 1039 # active transfer function is displayed. 1040 1040 # 1041 1041 itcl::body Rappture::FlowvisViewer::ReceiveLegend { tag vmin vmax size } { … … 1053 1053 # ReceiveData -- 1054 1054 # 1055 # 1056 # 1057 # 1058 # 1059 # 1060 # 1061 # 1062 # 1055 # The procedure is the response from the render server to each "data 1056 # follows" command. The server sends back a "data" command invoked our 1057 # the slave interpreter. The purpose is to collect the min/max of the 1058 # volume sent to the render server. Since the client (flowvisviewer) 1059 # doesn't parse 3D data formats, we rely on the server (nanovis) to 1060 # tell us what the limits are. Once we've received the limits to all 1061 # the data we've sent (tracked by _recvdDatasets) we can then determine 1062 # what the transfer functions are for these volumes. 1063 1063 # 1064 1064 # … … 1104 1104 # ---------------------------------------------------------------------- 1105 1105 itcl::body Rappture::FlowvisViewer::Rebuild {} { 1106 set w [winfo width $itk_component( 3dview)]1107 set h [winfo height $itk_component( 3dview)]1106 set w [winfo width $itk_component(view)] 1107 set h [winfo height $itk_component(view)] 1108 1108 if { $w < 2 || $h < 2 } { 1109 1109 update … … 1215 1215 NameTransferFunction $dataobj $cname 1216 1216 } 1217 set _reset 0 1217 1218 } 1218 1219 … … 1246 1247 StopBufferingCommands 1247 1248 blt::busy release $itk_component(hull) 1248 set _reset 01249 1249 } 1250 1250 … … 1344 1344 switch -- $option { 1345 1345 click { 1346 $itk_component( 3dview) configure -cursor fleur1346 $itk_component(view) configure -cursor fleur 1347 1347 set _click(x) $x 1348 1348 set _click(y) $y … … 1352 1352 Rotate click $x $y 1353 1353 } else { 1354 set w [winfo width $itk_component( 3dview)]1355 set h [winfo height $itk_component( 3dview)]1354 set w [winfo width $itk_component(view)] 1355 set h [winfo height $itk_component(view)] 1356 1356 if {$w <= 0 || $h <= 0} { 1357 1357 return … … 1380 1380 release { 1381 1381 Rotate drag $x $y 1382 $itk_component( 3dview) configure -cursor ""1382 $itk_component(view) configure -cursor "" 1383 1383 catch {unset _click} 1384 1384 } … … 1399 1399 itcl::body Rappture::FlowvisViewer::Pan {option x y} { 1400 1400 # Experimental stuff 1401 set w [winfo width $itk_component( 3dview)]1402 set h [winfo height $itk_component( 3dview)]1401 set w [winfo width $itk_component(view)] 1402 set h [winfo height $itk_component(view)] 1403 1403 if { $option == "set" } { 1404 1404 set x [expr $x / double($w)] … … 1414 1414 set _click(x) $x 1415 1415 set _click(y) $y 1416 $itk_component( 3dview) configure -cursor hand11416 $itk_component(view) configure -cursor hand1 1417 1417 } 1418 1418 if { $option == "drag" || $option == "release" } { … … 1428 1428 } 1429 1429 if { $option == "release" } { 1430 $itk_component( 3dview) configure -cursor ""1430 $itk_component(view) configure -cursor "" 1431 1431 } 1432 1432 } … … 1501 1501 if { $_settings($what) } { 1502 1502 blt::table $itk_component(plotarea) \ 1503 0,0 $itk_component( 3dview) -fill both \1503 0,0 $itk_component(view) -fill both \ 1504 1504 1,0 $itk_component(legend) -fill x 1505 1505 blt::table configure $itk_component(plotarea) r1 -resize none … … 1616 1616 # NameTransferFunction -- 1617 1617 # 1618 # 1619 # 1620 # 1621 # 1622 # 1618 # Creates a transfer function name based on the <style> settings in the 1619 # library run.xml file. This placeholder will be used later to create 1620 # and send the actual transfer function once the data info has been sent 1621 # to us by the render server. [We won't know the volume limits until the 1622 # server parses the 3D data and sends back the limits via ReceiveData.] 1623 1623 # 1624 1624 itcl::body Rappture::FlowvisViewer::NameTransferFunction { dataobj cname } { … … 1642 1642 # ComputeTransferFunction -- 1643 1643 # 1644 # 1645 # 1646 # 1647 # 1648 # 1644 # Computes and sends the transfer function to the render server. It's 1645 # assumed that the volume data limits are known and that the global 1646 # transfer-functions slider values have been set up. Both parts are 1647 # needed to compute the relative value (location) of the marker, and 1648 # the alpha map of the transfer function. 1649 1649 # 1650 1650 itcl::body Rappture::FlowvisViewer::ComputeTransferFunction { tf } { … … 2634 2634 } 2635 2635 "next" { 2636 if { ![winfo viewable $itk_component( 3dview)] } {2636 if { ![winfo viewable $itk_component(view)] } { 2637 2637 flow stop 2638 2638 return … … 2949 2949 # BuildVolumeComponents -- 2950 2950 # 2951 # 2952 # 2953 # 2954 # 2955 # 2956 # 2951 # This is called from the "scale" method which is called when a new 2952 # dataset is added or deleted. It repopulates the dropdown menu of 2953 # volume component names. It sets the current component to the first 2954 # component in the list (of components found). Finally, if there is 2955 # only one component, don't display the label or the combobox in the 2956 # volume settings tab. 2957 2957 # 2958 2958 itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} { … … 2968 2968 # GetDatasetsWithComponents -- 2969 2969 # 2970 # 2971 # 2972 # 2973 # 2970 # Returns a list of all the datasets (known by the combination of their 2971 # data object and component name) that match the given component name. 2972 # For example, this is used where we want to change the settings of 2973 # volumes that have the current component. 2974 2974 # 2975 2975 itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } { -
branches/uq/gui/scripts/molvisviewer.tcl
r5679 r5850 8 8 # ====================================================================== 9 9 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 2004-201 2HUBzero Foundation, LLC10 # Copyright (c) 2004-2015 HUBzero Foundation, LLC 11 11 # 12 12 # See the file "license.terms" for information on usage and … … 26 26 Rappture::resources::register \ 27 27 molvis_server Rappture::MolvisViewer::SetServerList 28 }29 30 set debug 031 proc debug { args } {32 global debug33 if { $debug } {34 puts stderr "[info level -1]: $args"35 }36 28 } 37 29 … … 160 152 set _serverType "pymol" 161 153 154 #DebugOn 155 162 156 # Register events to the dispatcher. Base class expects !rebuild 163 157 # event to be registered. … … 236 230 }] 237 231 238 itk_component add 3dview {232 itk_component add view { 239 233 label $itk_component(plotarea).view -image $_image(plot) \ 240 234 -highlightthickness 0 -borderwidth 0 … … 243 237 ignore -highlightthickness -borderwidth -background 244 238 } 245 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]239 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 246 240 247 241 set f [$itk_component(main) component controls] … … 318 312 BuildSettingsTab 319 313 320 # HACK ALERT. Initially force a requested width of the 3dview label.321 322 # It's a chicken-and-the-egg problem. The size of the 3dview label is set314 # HACK ALERT. Initially force a requested width of the view label. 315 316 # It's a chicken-and-the-egg problem. The size of the view label is set 323 317 # from the size of the image retrieved from the server. But the size of 324 318 # the image is specified by the viewport which is the size of the label. … … 330 324 # (that's why we're using the blt::table to manage the geometry). It has 331 325 # to be big, because we don't know how big the user may want to stretch 332 # the window. This at least forces the sidebarframe to give the 3dview326 # the window. This at least forces the sidebarframe to give the view 333 327 # the maximum size available, which is perfect for an initially closed 334 328 # sidebar. 335 329 336 330 blt::table $itk_component(plotarea) \ 337 0,0 $itk_component( 3dview) -fill both -reqwidth 10000331 0,0 $itk_component(view) -fill both -reqwidth 10000 338 332 # 339 333 # RENDERING AREA … … 344 338 if { $_useVmouseEvents } { 345 339 # set up bindings to bridge mouse events to server 346 bind $itk_component( 3dview) <ButtonPress> \340 bind $itk_component(view) <ButtonPress> \ 347 341 [itcl::code $this Vmouse click %b %s %x %y] 348 bind $itk_component( 3dview) <ButtonRelease> \342 bind $itk_component(view) <ButtonRelease> \ 349 343 [itcl::code $this Vmouse release %b %s %x %y] 350 bind $itk_component( 3dview) <B1-Motion> \344 bind $itk_component(view) <B1-Motion> \ 351 345 [itcl::code $this Vmouse drag 1 %s %x %y] 352 bind $itk_component( 3dview) <B2-Motion> \346 bind $itk_component(view) <B2-Motion> \ 353 347 [itcl::code $this Vmouse drag 2 %s %x %y] 354 bind $itk_component( 3dview) <B3-Motion> \348 bind $itk_component(view) <B3-Motion> \ 355 349 [itcl::code $this Vmouse drag 3 %s %x %y] 356 bind $itk_component( 3dview) <Motion> \350 bind $itk_component(view) <Motion> \ 357 351 [itcl::code $this Vmouse move 0 %s %x %y] 358 352 } else { 359 353 # set up bindings for rotation with mouse 360 bind $itk_component( 3dview) <ButtonPress-1> \354 bind $itk_component(view) <ButtonPress-1> \ 361 355 [itcl::code $this Rotate click %x %y] 362 bind $itk_component( 3dview) <B1-Motion> \356 bind $itk_component(view) <B1-Motion> \ 363 357 [itcl::code $this Rotate drag %x %y] 364 bind $itk_component( 3dview) <ButtonRelease-1> \358 bind $itk_component(view) <ButtonRelease-1> \ 365 359 [itcl::code $this Rotate release %x %y] 366 360 367 361 # set up bindings for panning with mouse 368 bind $itk_component( 3dview) <ButtonPress-2> \362 bind $itk_component(view) <ButtonPress-2> \ 369 363 [itcl::code $this Pan click %x %y] 370 bind $itk_component( 3dview) <B2-Motion> \364 bind $itk_component(view) <B2-Motion> \ 371 365 [itcl::code $this Pan drag %x %y] 372 bind $itk_component( 3dview) <ButtonRelease-2> \366 bind $itk_component(view) <ButtonRelease-2> \ 373 367 [itcl::code $this Pan release %x %y] 374 368 375 369 # scroll wheel zoom 376 370 if {[string equal "x11" [tk windowingsystem]]} { 377 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out 2]378 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in 2]371 bind $itk_component(view) <4> [itcl::code $this Zoom out 2] 372 bind $itk_component(view) <5> [itcl::code $this Zoom in 2] 379 373 } 380 374 } 381 375 382 376 # Set up bindings for panning with keyboard 383 bind $itk_component( 3dview) <KeyPress-Left> \377 bind $itk_component(view) <KeyPress-Left> \ 384 378 [itcl::code $this Pan set -10 0] 385 bind $itk_component( 3dview) <KeyPress-Right> \379 bind $itk_component(view) <KeyPress-Right> \ 386 380 [itcl::code $this Pan set 10 0] 387 bind $itk_component( 3dview) <KeyPress-Up> \381 bind $itk_component(view) <KeyPress-Up> \ 388 382 [itcl::code $this Pan set 0 -10] 389 bind $itk_component( 3dview) <KeyPress-Down> \383 bind $itk_component(view) <KeyPress-Down> \ 390 384 [itcl::code $this Pan set 0 10] 391 bind $itk_component( 3dview) <Shift-KeyPress-Left> \385 bind $itk_component(view) <Shift-KeyPress-Left> \ 392 386 [itcl::code $this Pan set -50 0] 393 bind $itk_component( 3dview) <Shift-KeyPress-Right> \387 bind $itk_component(view) <Shift-KeyPress-Right> \ 394 388 [itcl::code $this Pan set 50 0] 395 bind $itk_component( 3dview) <Shift-KeyPress-Up> \389 bind $itk_component(view) <Shift-KeyPress-Up> \ 396 390 [itcl::code $this Pan set 0 -50] 397 bind $itk_component( 3dview) <Shift-KeyPress-Down> \391 bind $itk_component(view) <Shift-KeyPress-Down> \ 398 392 [itcl::code $this Pan set 0 50] 399 393 400 394 # Set up bindings for zoom with keyboard 401 bind $itk_component( 3dview) <KeyPress-Prior> \395 bind $itk_component(view) <KeyPress-Prior> \ 402 396 [itcl::code $this Zoom out 2] 403 bind $itk_component( 3dview) <KeyPress-Next> \397 bind $itk_component(view) <KeyPress-Next> \ 404 398 [itcl::code $this Zoom in 2] 405 399 406 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"407 408 bind $itk_component( 3dview) <Configure> \400 bind $itk_component(view) <Enter> "focus $itk_component(view)" 401 402 bind $itk_component(view) <Configure> \ 409 403 [itcl::code $this EventuallyResize %w %h] 410 bind $itk_component( 3dview) <Unmap> \404 bind $itk_component(view) <Unmap> \ 411 405 [itcl::code $this Unmap] 412 bind $itk_component( 3dview) <Map> \406 bind $itk_component(view) <Map> \ 413 407 [itcl::code $this Map] 414 408 … … 468 462 } 469 463 set _dobj2raise($dataobj) $params(-raise) 470 debug"setting parameters for $dataobj"464 DebugTrace "setting parameters for $dataobj" 471 465 472 466 if { [isconnected] } { … … 726 720 727 721 itcl::body Rappture::MolvisViewer::SendCmd { cmd } { 728 debug"cmd: ($cmd)"722 DebugTrace "cmd: ($cmd)" 729 723 730 724 if { $_state(server) != $_state(client) } { … … 758 752 } 759 753 set data [ReceiveBytes $size] 760 # debug"success: reading $size bytes from proxy"754 #DebugTrace "success: reading $size bytes from proxy" 761 755 if { [string match "print*" $cacheid] } { 762 756 # $frame is the token that we sent to the proxy. … … 765 759 } else { 766 760 set _imagecache($tag) $data 767 # debug"CACHED: $tag,$cacheid"761 #DebugTrace "CACHED: $tag,$cacheid" 768 762 $_image(plot) configure -data $data 769 763 set _image(id) $tag … … 872 866 # ---------------------------------------------------------------------- 873 867 itcl::body Rappture::MolvisViewer::Rebuild {} { 874 debug"Enter"868 DebugTrace "Enter" 875 869 set changed 0 876 870 … … 1112 1106 # Set or restore viewing parameters. We do this for the first 1113 1107 # model and assume this works for everything else. 1114 set w [winfo width $itk_component( 3dview)]1115 set h [winfo height $itk_component( 3dview)]1108 set w [winfo width $itk_component(view)] 1109 set h [winfo height $itk_component(view)] 1116 1110 SendCmd "reset" 1117 1111 SendCmd "screen $w $h" … … 1119 1113 SendCmd "pan $_view(xpan) $_view(ypan)" 1120 1114 SendCmd "zoom $_view(zoom)" 1121 debug"rotate $_view(mx) $_view(my) $_view(mz)"1115 DebugTrace "rotate $_view(mx) $_view(my) $_view(mz)" 1122 1116 1123 1117 SendCmd "raw -defer {zoom complete=1}" … … 1151 1145 blt::busy release $itk_component(hull) 1152 1146 1153 debug"Exit"1147 DebugTrace "Exit" 1154 1148 } 1155 1149 … … 1246 1240 } 1247 1241 if { $option == "click" } { 1248 $itk_component( 3dview) configure -cursor hand11242 $itk_component(view) configure -cursor hand1 1249 1243 } 1250 1244 if { $option == "drag" || $option == "release" } { … … 1259 1253 set _mevent(y) $y 1260 1254 if { $option == "release" } { 1261 $itk_component( 3dview) configure -cursor ""1255 $itk_component(view) configure -cursor "" 1262 1256 } 1263 1257 } … … 1313 1307 unset _rocker(afterid) 1314 1308 } 1315 if { ![winfo viewable $itk_component( 3dview)] } {1309 if { ![winfo viewable $itk_component(view)] } { 1316 1310 return 1317 1311 } … … 1385 1379 } 1386 1380 if { $option == "click" } { 1387 $itk_component( 3dview) configure -cursor fleur1381 $itk_component(view) configure -cursor fleur 1388 1382 } 1389 1383 if { $option == "drag" || $option == "release" } { … … 1394 1388 return 1395 1389 } 1396 set w [winfo width $itk_component( 3dview)]1397 set h [winfo height $itk_component( 3dview)]1390 set w [winfo width $itk_component(view)] 1391 set h [winfo height $itk_component(view)] 1398 1392 if {$w <= 0 || $h <= 0} { 1399 1393 return … … 1430 1424 #SendCmd "rotate $mx $my $mz" 1431 1425 EventuallyRotate $mx $my $mz 1432 debug"rotate $_view(mx) $_view(my) $_view(mz)"1426 DebugTrace "rotate $_view(mx) $_view(my) $_view(mz)" 1433 1427 } 1434 1428 set _mevent(x) $x … … 1436 1430 set _mevent(time) $now 1437 1431 if { $option == "release" } { 1438 $itk_component( 3dview) configure -cursor ""1432 $itk_component(view) configure -cursor "" 1439 1433 } 1440 1434 } … … 1458 1452 switch -- $option { 1459 1453 click { 1460 $itk_component( 3dview) configure -cursor fleur1454 $itk_component(view) configure -cursor fleur 1461 1455 set _click(x) $x 1462 1456 set _click(y) $y … … 1468 1462 Rotate.old click $x $y 1469 1463 } else { 1470 set w [winfo width $itk_component( 3dview)]1471 set h [winfo height $itk_component( 3dview)]1464 set w [winfo width $itk_component(view)] 1465 set h [winfo height $itk_component(view)] 1472 1466 if {$w <= 0 || $h <= 0} { 1473 1467 return … … 1527 1521 EventuallyRotate $a $b $c 1528 1522 #SendCmd "rotate $a $b $c" 1529 debug"x,y: $x $y: rotate $_view(vx) $_view(vy) $_view(vz)"1523 DebugTrace "x,y: $x $y: rotate $_view(vx) $_view(vy) $_view(vz)" 1530 1524 set _click(x) $x 1531 1525 set _click(y) $y … … 1534 1528 release { 1535 1529 Rotate.old drag $x $y 1536 $itk_component( 3dview) configure -cursor ""1530 $itk_component(view) configure -cursor "" 1537 1531 catch {unset _click} 1538 1532 } … … 1692 1686 DoResize 1693 1687 SendCmd "rotate $_view(mx) $_view(my) $_view(mz)" 1694 debug"rotate $_view(mx) $_view(my) $_view(mz)"1688 DebugTrace "rotate $_view(mx) $_view(my) $_view(mz)" 1695 1689 SendCmd "pan $_view(xpan) $_view(ypan)" 1696 1690 SendCmd "zoom $_view(zoom)" -
branches/uq/gui/scripts/nanovisviewer.tcl
r5679 r5850 8 8 # ====================================================================== 9 9 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 2004-201 2HUBzero Foundation, LLC10 # Copyright (c) 2004-2015 HUBzero Foundation, LLC 11 11 # 12 12 # See the file "license.terms" for information on usage and … … 153 153 set _serverType "nanovis" 154 154 155 # Draw legend event 155 #DebugOn 156 EnableWaitDialog 900 157 158 # Rebuild event 159 $_dispatcher register !rebuild 160 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list" 161 162 # Resize event 163 $_dispatcher register !resize 164 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list" 165 166 # Legend event 156 167 $_dispatcher register !legend 157 168 $_dispatcher dispatch $this !legend "[itcl::code $this FixLegend]; list" … … 161 172 $_dispatcher dispatch $this !send_transfunc \ 162 173 "[itcl::code $this SendTransferFunctions]; list" 163 164 # Rebuild event165 $_dispatcher register !rebuild166 $_dispatcher dispatch $this !rebuild "[itcl::code $this Rebuild]; list"167 168 # Resize event169 $_dispatcher register !resize170 $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"171 174 172 175 # … … 179 182 # Initialize the view to some default parameters. 180 183 array set _view { 181 -qw 0.853553182 -qx -0.353553183 -qy 0.353553184 -qz 0.146447185 -xpan 0186 -ypan 0187 -zoom 1.0184 -qw 0.853553 185 -qx -0.353553 186 -qy 0.353553 187 -qz 0.146447 188 -xpan 0 189 -ypan 0 190 -zoom 1.0 188 191 } 189 192 set _arcball [blt::arcball create 100 100] … … 192 195 set _limits(vmin) 0.0 193 196 set _limits(vmax) 1.0 194 set _reset 1195 197 196 198 array set _settings [subst { … … 223 225 }] 224 226 225 itk_component add 3dview {227 itk_component add view { 226 228 label $itk_component(plotarea).view -image $_image(plot) \ 227 229 -highlightthickness 0 -borderwidth 0 … … 230 232 ignore -highlightthickness -borderwidth -background 231 233 } 232 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]234 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 233 235 234 236 set f [$itk_component(main) component controls] … … 274 276 -onimage [Rappture::icon volume-on] \ 275 277 -offimage [Rappture::icon volume-off] \ 276 - command [itcl::code $this AdjustSetting -volume] \277 - variable [itcl::scope _settings(-volume)]278 -variable [itcl::scope _settings(-volume)] \ 279 -command [itcl::code $this AdjustSetting -volume] 278 280 } 279 281 $itk_component(volume) select … … 319 321 # the server. So the panewindow uses the tiny size. 320 322 set w 10000 321 pack forget $itk_component( 3dview)323 pack forget $itk_component(view) 322 324 blt::table $itk_component(plotarea) \ 323 0,0 $itk_component( 3dview) -fill both -reqwidth $w \325 0,0 $itk_component(view) -fill both -reqwidth $w \ 324 326 1,0 $itk_component(legend) -fill x 325 327 blt::table configure $itk_component(plotarea) r1 -resize none 326 328 327 329 # Bindings for rotation via mouse 328 bind $itk_component( 3dview) <ButtonPress-1> \330 bind $itk_component(view) <ButtonPress-1> \ 329 331 [itcl::code $this Rotate click %x %y] 330 bind $itk_component( 3dview) <B1-Motion> \332 bind $itk_component(view) <B1-Motion> \ 331 333 [itcl::code $this Rotate drag %x %y] 332 bind $itk_component( 3dview) <ButtonRelease-1> \334 bind $itk_component(view) <ButtonRelease-1> \ 333 335 [itcl::code $this Rotate release %x %y] 334 bind $itk_component( 3dview) <Configure> \336 bind $itk_component(view) <Configure> \ 335 337 [itcl::code $this EventuallyResize %w %h] 336 338 337 339 # Bindings for panning via mouse 338 bind $itk_component( 3dview) <ButtonPress-2> \340 bind $itk_component(view) <ButtonPress-2> \ 339 341 [itcl::code $this Pan click %x %y] 340 bind $itk_component( 3dview) <B2-Motion> \342 bind $itk_component(view) <B2-Motion> \ 341 343 [itcl::code $this Pan drag %x %y] 342 bind $itk_component( 3dview) <ButtonRelease-2> \344 bind $itk_component(view) <ButtonRelease-2> \ 343 345 [itcl::code $this Pan release %x %y] 344 346 345 347 # Bindings for panning via keyboard 346 bind $itk_component( 3dview) <KeyPress-Left> \348 bind $itk_component(view) <KeyPress-Left> \ 347 349 [itcl::code $this Pan set -10 0] 348 bind $itk_component( 3dview) <KeyPress-Right> \350 bind $itk_component(view) <KeyPress-Right> \ 349 351 [itcl::code $this Pan set 10 0] 350 bind $itk_component( 3dview) <KeyPress-Up> \352 bind $itk_component(view) <KeyPress-Up> \ 351 353 [itcl::code $this Pan set 0 -10] 352 bind $itk_component( 3dview) <KeyPress-Down> \354 bind $itk_component(view) <KeyPress-Down> \ 353 355 [itcl::code $this Pan set 0 10] 354 bind $itk_component( 3dview) <Shift-KeyPress-Left> \356 bind $itk_component(view) <Shift-KeyPress-Left> \ 355 357 [itcl::code $this Pan set -2 0] 356 bind $itk_component( 3dview) <Shift-KeyPress-Right> \358 bind $itk_component(view) <Shift-KeyPress-Right> \ 357 359 [itcl::code $this Pan set 2 0] 358 bind $itk_component( 3dview) <Shift-KeyPress-Up> \360 bind $itk_component(view) <Shift-KeyPress-Up> \ 359 361 [itcl::code $this Pan set 0 -2] 360 bind $itk_component( 3dview) <Shift-KeyPress-Down> \362 bind $itk_component(view) <Shift-KeyPress-Down> \ 361 363 [itcl::code $this Pan set 0 2] 362 364 363 365 # Bindings for zoom via keyboard 364 bind $itk_component( 3dview) <KeyPress-Prior> \366 bind $itk_component(view) <KeyPress-Prior> \ 365 367 [itcl::code $this Zoom out] 366 bind $itk_component( 3dview) <KeyPress-Next> \368 bind $itk_component(view) <KeyPress-Next> \ 367 369 [itcl::code $this Zoom in] 368 370 369 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"371 bind $itk_component(view) <Enter> "focus $itk_component(view)" 370 372 371 373 if {[string equal "x11" [tk windowingsystem]]} { 372 374 # Bindings for zoom via mouse 373 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out]374 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in]375 bind $itk_component(view) <4> [itcl::code $this Zoom out] 376 bind $itk_component(view) <5> [itcl::code $this Zoom in] 375 377 } 376 378 … … 378 380 379 381 eval itk_initialize $args 380 381 EnableWaitDialog 900382 382 Connect 383 383 } … … 435 435 # ---------------------------------------------------------------------- 436 436 # USAGE: get ?-objects? 437 # USAGE: get ?-image 3dview|legend?437 # USAGE: get ?-image view|legend? 438 438 # 439 439 # Clients use this to query the list of objects being plotted, in … … 465 465 -image { 466 466 if {[llength $args] != 2} { 467 error "wrong # args: should be \"get -image 3dview|legend\""467 error "wrong # args: should be \"get -image view|legend\"" 468 468 } 469 469 switch -- [lindex $args end] { 470 3dview {470 view { 471 471 return $_image(plot) 472 472 } … … 475 475 } 476 476 default { 477 error "bad image name \"[lindex $args end]\": should be 3dview or legend"477 error "bad image name \"[lindex $args end]\": should be view or legend" 478 478 } 479 479 } … … 488 488 # USAGE: delete ?<dataobj1> <dataobj2> ...? 489 489 # 490 # Clients use this to delete a dataobj from the plot. If no dataobjs 491 # are specified, then all dataobjs are deleted. No data objects are 492 # deleted. They are only removed from the display list. 493 # 490 # Clients use this to delete a dataobj from the plot. If no dataobjs 491 # are specified, then all dataobjs are deleted. No data objects are 492 # deleted. They are only removed from the display list. 494 493 # ---------------------------------------------------------------------- 495 494 itcl::body Rappture::NanovisViewer::delete {args} { … … 647 646 } 648 647 649 set w [winfo width $itk_component( 3dview)]650 set h [winfo height $itk_component( 3dview)]648 set w [winfo width $itk_component(view)] 649 set h [winfo height $itk_component(view)] 651 650 EventuallyResize $w $h 652 651 } … … 657 656 # isconnected -- 658 657 # 659 # 658 # Indicates if we are currently connected to the visualization server. 660 659 # 661 660 itcl::body Rappture::NanovisViewer::isconnected {} { … … 673 672 # Disconnect -- 674 673 # 675 # Clients use this method to disconnect from the current rendering 676 # server. 674 # Clients use this method to disconnect from the current rendering server. 677 675 # 678 676 itcl::body Rappture::NanovisViewer::Disconnect {} { … … 814 812 # ReceiveLegend -- 815 813 # 816 # 817 # 818 # 819 # 820 # 814 # The procedure is the response from the render server to each "legend" 815 # command. The server sends back a "legend" command invoked our 816 # the slave interpreter. The purpose is to collect data of the image 817 # representing the legend in the canvas. In addition, the 818 # active transfer function is displayed. 821 819 # 822 820 itcl::body Rappture::NanovisViewer::ReceiveLegend { tf vmin vmax size } { … … 834 832 # ReceiveData -- 835 833 # 836 # 837 # 838 # 839 # 840 # 841 # 842 # 843 # 834 # The procedure is the response from the render server to each "data 835 # follows" command. The server sends back a "data" command invoked our 836 # the slave interpreter. The purpose is to collect the min/max of the 837 # volume sent to the render server. Since the client (nanovisviewer) 838 # doesn't parse 3D data formats, we rely on the server (nanovis) to 839 # tell us what the limits are. Once we've received the limits to all 840 # the data we've sent (tracked by _recvdDatasets) we can then determine 841 # what the transfer functions are for these volumes. 844 842 # 845 843 # … … 893 891 # ---------------------------------------------------------------------- 894 892 itcl::body Rappture::NanovisViewer::Rebuild {} { 895 set w [winfo width $itk_component( 3dview)]896 set h [winfo height $itk_component( 3dview)]893 set w [winfo width $itk_component(view)] 894 set h [winfo height $itk_component(view)] 897 895 if { $w < 2 || $h < 2 } { 898 896 update … … 1004 1002 } 1005 1003 } 1004 set _reset 0 1006 1005 } 1007 1006 … … 1025 1024 StopBufferingCommands 1026 1025 blt::busy release $itk_component(hull) 1027 set _reset 01028 1026 } 1029 1027 … … 1123 1121 switch -- $option { 1124 1122 click { 1125 $itk_component( 3dview) configure -cursor fleur1123 $itk_component(view) configure -cursor fleur 1126 1124 set _click(x) $x 1127 1125 set _click(y) $y … … 1131 1129 Rotate click $x $y 1132 1130 } else { 1133 set w [winfo width $itk_component( 3dview)]1134 set h [winfo height $itk_component( 3dview)]1131 set w [winfo width $itk_component(view)] 1132 set h [winfo height $itk_component(view)] 1135 1133 if {$w <= 0 || $h <= 0} { 1136 1134 return … … 1159 1157 release { 1160 1158 Rotate drag $x $y 1161 $itk_component( 3dview) configure -cursor ""1159 $itk_component(view) configure -cursor "" 1162 1160 catch {unset _click} 1163 1161 } … … 1178 1176 itcl::body Rappture::NanovisViewer::Pan {option x y} { 1179 1177 # Experimental stuff 1180 set w [winfo width $itk_component( 3dview)]1181 set h [winfo height $itk_component( 3dview)]1178 set w [winfo width $itk_component(view)] 1179 set h [winfo height $itk_component(view)] 1182 1180 if { $option == "set" } { 1183 1181 set x [expr $x / double($w)] … … 1193 1191 set _click(x) $x 1194 1192 set _click(y) $y 1195 $itk_component( 3dview) configure -cursor hand11193 $itk_component(view) configure -cursor hand1 1196 1194 } 1197 1195 if { $option == "drag" || $option == "release" } { … … 1207 1205 } 1208 1206 if { $option == "release" } { 1209 $itk_component( 3dview) configure -cursor ""1207 $itk_component(view) configure -cursor "" 1210 1208 } 1211 1209 } … … 1273 1271 if { $_settings($what) } { 1274 1272 blt::table $itk_component(plotarea) \ 1275 0,0 $itk_component( 3dview) -fill both \1273 0,0 $itk_component(view) -fill both \ 1276 1274 1,0 $itk_component(legend) -fill x 1277 1275 blt::table configure $itk_component(plotarea) r1 -resize none … … 1371 1369 # NameTransferFunction -- 1372 1370 # 1373 # 1374 # 1375 # 1376 # 1377 # 1371 # Creates a transfer function name based on the <style> settings in the 1372 # library run.xml file. This placeholder will be used later to create 1373 # and send the actual transfer function once the data info has been sent 1374 # to us by the render server. [We won't know the volume limits until the 1375 # server parses the 3D data and sends back the limits via ReceiveData.] 1378 1376 # 1379 1377 # FIXME: The current way we generate transfer-function names completely … … 1398 1396 # ComputeTransferFunction -- 1399 1397 # 1400 # 1401 # 1402 # 1403 # 1404 # 1398 # Computes and sends the transfer function to the render server. It's 1399 # assumed that the volume data limits are known and that the global 1400 # transfer-functions slider values have been set up. Both parts are 1401 # needed to compute the relative value (location) of the marker, and 1402 # the alpha map of the transfer function. 1405 1403 # 1406 1404 itcl::body Rappture::NanovisViewer::ComputeTransferFunction { tf } { -
branches/uq/gui/scripts/visviewer.tcl
r5679 r5850 43 43 #private variable _idleTimeout 0; # No timeout 44 44 45 protected variable _debug 0 45 46 protected variable _serverType "???";# Type of server. 46 47 protected variable _sid "" ; # socket connection to server … … 84 85 protected method ColorsToColormap { colors } 85 86 protected method Connect { servers } 87 protected method DebugOff {} { 88 set _debug 0 89 } 90 protected method DebugOn {} { 91 set _debug 1 92 } 93 protected method DebugTrace { args } { 94 if { $_debug } { 95 puts stderr "[info level -1]: $args" 96 } 97 } 86 98 protected method DisableWaitDialog {} 87 99 protected method Disconnect {} -
branches/uq/gui/scripts/vtkglyphviewer.tcl
r5679 r5850 132 132 private variable _start 0 133 133 private variable _title "" 134 135 private common _downloadPopup; # download options from popup136 private common _hardcopy137 134 private variable _width 0 138 135 private variable _height 0 … … 143 140 private variable _field "" 144 141 private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar) 145 private variable _fieldNames {}146 142 private variable _fields 147 143 private variable _curFldName "" 148 144 private variable _curFldLabel "" 145 146 private common _downloadPopup; # download options from popup 147 private common _hardcopy 149 148 } 150 149 … … 1552 1551 } 1553 1552 # Set the legend on the first heightmap dataset. 1554 if { $_currentColormap != "" 1553 if { $_currentColormap != "" } { 1555 1554 set cmap $_currentColormap 1556 1555 if { ![info exists _colormaps($cmap)] } { -
branches/uq/gui/scripts/vtkheightmapviewer.tcl
r5679 r5850 143 143 private variable _isolines 144 144 private variable _contourList "" 145 146 private common _downloadPopup; # download options from popup147 private common _hardcopy148 145 private variable _width 0 149 146 private variable _height 0 … … 153 150 private variable _rotatePending 0 154 151 private variable _legendPending 0 155 private variable _fieldNames {}156 152 private variable _fields 157 153 private variable _curFldName "" 158 154 private variable _curFldLabel "" 159 155 private variable _colorMode "scalar";# Mode of colormap (vmag or scalar) 156 157 private common _downloadPopup; # download options from popup 158 private common _hardcopy 160 159 } 161 160 … … 942 941 # controls on the axis settings tab if necessary. 943 942 # -Leif 944 SendCmd "axis exp 0 0 0 1"943 #SendCmd "axis exp 0 0 0 1" 945 944 946 945 SendCmd "axis lrot z 90" … … 1042 1041 if { $_reset } { 1043 1042 SendCmd "axis tickpos outside" 1044 SendCmd "axis lformat all %g"1043 #SendCmd "axis lformat all %g" 1045 1044 1046 1045 foreach axis { x y z } { … … 1490 1489 ResetAxes 1491 1490 SendCmd "dataset scalar $_curFldName" 1492 SendCmd "heightmap colormode scalar $_curFldName" 1491 SendCmd "heightmap colormode $_colorMode $_curFldName" 1492 UpdateContourList 1493 SendCmd "heightmap contourlist [list $_contourList]" 1493 1494 Zoom reset 1494 UpdateContourList1495 1495 DrawLegend 1496 1496 } … … 1724 1724 } 1725 1725 # Set the legend on the first heightmap dataset. 1726 if { $_currentColormap != "" 1726 if { $_currentColormap != "" } { 1727 1727 set cmap $_currentColormap 1728 1728 if { ![info exists _colormaps($cmap)] } { -
branches/uq/gui/scripts/vtkimageviewer.tcl
r5679 r5850 138 138 private variable _isolines 139 139 private variable _contourList "" 140 141 private common _downloadPopup; # download options from popup142 private common _hardcopy143 140 private variable _width 0 144 141 private variable _height 0 … … 148 145 private variable _rotatePending 0 149 146 private variable _legendPending 0 150 private variable _fieldNames {}151 147 private variable _fields 152 148 private variable _curFldName "" 153 149 private variable _curFldLabel "" 154 150 private variable _colorMode "scalar";# Mode of colormap (vmag or scalar) 151 152 private common _downloadPopup; # download options from popup 153 private common _hardcopy 155 154 } 156 155 -
branches/uq/gui/scripts/vtkisosurfaceviewer.tcl
r5679 r5850 153 153 private variable _currentLimits "" 154 154 private variable _widget 155 156 private common _downloadPopup; # download options from popup157 private common _hardcopy158 155 private variable _width 0 159 156 private variable _height 0 … … 164 161 private variable _field "" 165 162 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 166 private variable _fieldNames {}167 163 private variable _fields 168 164 private variable _curFldName "" 169 165 private variable _curFldLabel "" 170 171 166 private variable _mouseOver ""; # what called LegendRangeAction, vmin or vmax 172 167 private variable _customRangeClick 1; # what called ToggleCustomRange 168 169 private common _downloadPopup; # download options from popup 170 private common _hardcopy 173 171 } 174 172 … … 1670 1668 } 1671 1669 # Set the legend on the first isosurface dataset. 1672 if { $_currentColormap != "" 1670 if { $_currentColormap != "" } { 1673 1671 set cmap $_currentColormap 1674 1672 if { ![info exists _colormaps($cmap)] } { -
branches/uq/gui/scripts/vtkmeshviewer.tcl
r5679 r5850 113 113 private variable _start 0 114 114 private variable _title "" 115 116 private common _downloadPopup; # download options from popup117 private common _hardcopy118 115 private variable _width 0 119 116 private variable _height 0 … … 123 120 private variable _rotateDelay 150 124 121 private variable _opacityDelay 150 122 123 private common _downloadPopup; # download options from popup 124 private common _hardcopy 125 125 } 126 126 … … 860 860 } 861 861 if {"" != $_first} { 862 set location [$_first hints camera]863 if { $location != "" } {864 array set view $location865 }866 867 862 foreach axis { x y z } { 868 863 set label [$_first label ${axis}] -
branches/uq/gui/scripts/vtkstreamlinesviewer.tcl
r5679 r5850 66 66 private method BuildAxisTab {} 67 67 private method BuildCameraTab {} 68 private method BuildColormap { name colors}68 private method BuildColormap { name } 69 69 private method BuildCutplaneTab {} 70 70 private method BuildDownloadPopup { widget command } 71 71 private method BuildStreamsTab {} 72 private method Build VolumeTab {}72 private method BuildSurfaceTab {} 73 73 private method DrawLegend {} 74 74 private method Combo { option } … … 102 102 private method RequestLegend {} 103 103 private method Rotate {option x y} 104 private method SetColormap { dataobj comp } 105 private method ChangeColormap { dataobj comp color } 104 private method SetCurrentColormap { color } 106 105 private method SetLegendTip { x y } 107 106 private method SetObjectStyle { dataobj comp } … … 121 120 private variable _colormaps ; # contains all the colormaps 122 121 ; # in the server. 123 private variable _ dataset2style ;# maps dataobj-component to transfunc122 private variable _currentColormap "" 124 123 125 124 private variable _click ; # info used for rotate operations … … 127 126 private variable _view ; # view params for 3D view 128 127 private variable _settings 129 private variable _style; # Array of current component styles.130 private variable _initialStyle; # Array of initial component styles.131 128 private variable _reset 1; # Connection to server has been reset. 132 129 … … 135 132 private variable _title "" 136 133 private variable _seeds 137 138 private common _downloadPopup; # download options from popup139 private common _hardcopy140 134 private variable _width 0 141 135 private variable _height 0 … … 145 139 private variable _cutplanePending 0 146 140 private variable _legendPending 0 147 private variable _vectorFields148 private variable _scalarFields149 141 private variable _fields 150 142 private variable _curFldName "" … … 153 145 private variable _numSeeds 200 154 146 private variable _colorMode "vmag";# Mode of colormap (vmag or scalar) 147 148 private common _downloadPopup; # download options from popup 149 private common _hardcopy 155 150 } 156 151 … … 245 240 -streamlinesnumseeds 200 246 241 -streamlinesopacity 100 247 -streamlines scale 1242 -streamlineslength 70 248 243 -streamlinesseedsvisible 0 249 244 -streamlinesvisible 1 250 - volumeedges0251 - volumelighting1252 - volumeopacity40253 - volumevisible1254 - volumewireframe0245 -surfaceedges 0 246 -surfacelighting 1 247 -surfaceopacity 40 248 -surfacevisible 1 249 -surfacewireframe 0 255 250 -xgrid 0 256 251 -ygrid 0 … … 330 325 Rappture::Tooltip::for $itk_component(zoomout) "Zoom out" 331 326 332 itk_component add volume {333 Rappture::PushButton $f. volume \327 itk_component add surface { 328 Rappture::PushButton $f.surface \ 334 329 -onimage [Rappture::icon volume-on] \ 335 330 -offimage [Rappture::icon volume-off] \ 336 -variable [itcl::scope _settings(- volumevisible)] \337 -command [itcl::code $this AdjustSetting - volumevisible]338 } 339 $itk_component( volume) select340 Rappture::Tooltip::for $itk_component( volume) \341 " Don't display the volume"342 pack $itk_component( volume) -padx 2 -pady 2331 -variable [itcl::scope _settings(-surfacevisible)] \ 332 -command [itcl::code $this AdjustSetting -surfacevisible] 333 } 334 $itk_component(surface) select 335 Rappture::Tooltip::for $itk_component(surface) \ 336 "Show/Hide the boundary surface" 337 pack $itk_component(surface) -padx 2 -pady 2 343 338 344 339 itk_component add streamlines { … … 351 346 $itk_component(streamlines) select 352 347 Rappture::Tooltip::for $itk_component(streamlines) \ 353 " Toggle the streamlines on/off"348 "Show/Hide the streamlines" 354 349 pack $itk_component(streamlines) -padx 2 -pady 2 355 350 … … 362 357 } 363 358 Rappture::Tooltip::for $itk_component(cutplane) \ 364 "Show/Hide cutplanes"359 "Show/Hide the cutplanes" 365 360 pack $itk_component(cutplane) -padx 2 -pady 2 366 361 367 368 362 if { [catch { 369 Build VolumeTab363 BuildSurfaceTab 370 364 BuildStreamsTab 371 365 BuildCutplaneTab … … 852 846 array unset _colormaps 853 847 array unset _seeds 854 array unset _dataset2style855 848 } 856 849 … … 1013 1006 } 1014 1007 if {"" != $_first} { 1015 set location [$_first hints camera]1016 if { $location != "" } {1017 array set view $location1018 }1019 1008 foreach axis { x y z } { 1020 1009 set label [$_first hints ${axis}label] … … 1031 1020 array unset _fields 1032 1021 set _curFldName "" 1022 set _curFldLabel "" 1033 1023 foreach cname [$_first components] { 1034 1024 foreach fname [$_first fieldnames $cname] { … … 1047 1037 -command [itcl::code $this Combo invoke] 1048 1038 set _fields($fname) [list $label $units $components] 1049 if { $_curFldName == "" } {1039 if { $_curFldName == "" && $components == 3 } { 1050 1040 set _curFldName $fname 1051 1041 set _curFldLabel $label … … 1061 1051 -streamlineslighting \ 1062 1052 -streamlinescolormap -field \ 1063 - volumevisible -volumeedges -volumelighting -volumeopacity \1064 - volumewireframe \1053 -surfacevisible -surfaceedges -surfacelighting -surfaceopacity \ 1054 -surfacewireframe \ 1065 1055 -cutplanevisible \ 1066 1056 -cutplanexposition -cutplaneyposition -cutplanezposition \ … … 1343 1333 set bool $_settings($what) 1344 1334 SendCmd "cutplane visible $bool" 1335 if { $bool } { 1336 Rappture::Tooltip::for $itk_component(cutplane) \ 1337 "Hide the cutplanes" 1338 } else { 1339 Rappture::Tooltip::for $itk_component(cutplane) \ 1340 "Show the cutplanes" 1341 } 1345 1342 } 1346 1343 "-cutplanewireframe" { … … 1439 1436 set colormap [$itk_component(colormap) value] 1440 1437 set _settings($what) $colormap 1441 foreach dataset [CurrentDatasets -visible $_first] { 1442 foreach {dataobj comp} [split $dataset -] break 1443 ChangeColormap $dataobj $comp $colormap 1444 } 1438 SetCurrentColormap $colormap 1445 1439 set _legendPending 1 1446 1440 } … … 1450 1444 SendCmd "streamlines opacity $sval" 1451 1445 } 1452 "-streamlines scale" {1446 "-streamlineslength" { 1453 1447 set val $_settings($what) 1454 set sval [expr { 0.01 * double($val) }] 1455 SendCmd "streamlines scale $sval $sval $sval" 1448 set sval [expr { (0.01 * double($val)) / 0.7 }] 1449 foreach axis {x y z} { 1450 foreach {min max} $_limits($axis) break 1451 set ${axis}len [expr double($max) - double($min)] 1452 } 1453 set length [expr { $sval * ($xlen + $ylen + $zlen) } ] 1454 SendCmd "streamlines length $length" 1456 1455 } 1457 1456 "-streamlineslighting" { … … 1459 1458 SendCmd "streamlines lighting $bool" 1460 1459 } 1461 "- volumeopacity" {1460 "-surfaceopacity" { 1462 1461 set val $_settings($what) 1463 1462 set sval [expr { 0.01 * double($val) }] 1464 1463 SendCmd "polydata opacity $sval" 1465 1464 } 1466 "- volumewireframe" {1465 "-surfacewireframe" { 1467 1466 set bool $_settings($what) 1468 1467 SendCmd "polydata wireframe $bool" 1469 1468 } 1470 "- volumevisible" {1469 "-surfacevisible" { 1471 1470 set bool $_settings($what) 1472 1471 SendCmd "polydata visible $bool" 1473 1472 if { $bool } { 1474 Rappture::Tooltip::for $itk_component( volume) \1475 "Hide the volume"1473 Rappture::Tooltip::for $itk_component(surface) \ 1474 "Hide the boundary surface" 1476 1475 } else { 1477 Rappture::Tooltip::for $itk_component( volume) \1478 "Show the volume"1479 } 1480 } 1481 "- volumelighting" {1476 Rappture::Tooltip::for $itk_component(surface) \ 1477 "Show the boundary surface" 1478 } 1479 } 1480 "-surfacelighting" { 1482 1481 set bool $_settings($what) 1483 1482 SendCmd "polydata lighting $bool" 1484 1483 } 1485 "- volumeedges" {1484 "-surfaceedges" { 1486 1485 set bool $_settings($what) 1487 1486 SendCmd "polydata edges $bool" … … 1514 1513 } 1515 1514 # Set the legend on the first streamlines dataset. 1516 foreach dataset [CurrentDatasets -visible $_first] { 1517 foreach {dataobj comp} [split $dataset -] break 1518 if { [info exists _dataset2style($dataset)] } { 1519 SendCmd \ 1520 "legend $_dataset2style($dataset) $_colorMode $_curFldName {} $w $h 0" 1521 break; 1522 } 1523 } 1524 } 1525 1526 # 1527 # ChangeColormap -- 1528 # 1529 itcl::body Rappture::VtkStreamlinesViewer::ChangeColormap {dataobj comp color} { 1530 set tag $dataobj-$comp 1531 if { ![info exist _style($tag)] } { 1532 error "no initial colormap" 1533 } 1534 array set style $_style($tag) 1535 set style(-color) $color 1536 set _style($tag) [array get style] 1537 SetColormap $dataobj $comp 1538 } 1539 1540 # 1541 # SetColormap -- 1542 # 1543 itcl::body Rappture::VtkStreamlinesViewer::SetColormap { dataobj comp } { 1544 array set style { 1545 -color BCGYR 1546 -levels 6 1547 -opacity 1.0 1548 } 1549 set tag $dataobj-$comp 1550 if { ![info exists _initialStyle($tag)] } { 1551 # Save the initial component style. 1552 set _initialStyle($tag) [$dataobj style $comp] 1553 } 1554 1555 # Override defaults with initial style defined in xml. 1556 array set style $_initialStyle($tag) 1557 1558 if { ![info exists _style($tag)] } { 1559 set _style($tag) [array get style] 1560 } 1561 # Override initial style with current style. 1562 array set style $_style($tag) 1563 1564 set name "$style(-color):$style(-levels):$style(-opacity)" 1515 if { $_currentColormap != "" } { 1516 set cmap $_currentColormap 1517 if { ![info exists _colormaps($cmap)] } { 1518 BuildColormap $cmap 1519 set _colormaps($cmap) 1 1520 } 1521 #SendCmd "legend $cmap $_colorMode $_curFldName {} $w $h 0" 1522 SendCmd "legend2 $cmap $w $h" 1523 } 1524 } 1525 1526 # 1527 # SetCurrentColormap -- 1528 # 1529 itcl::body Rappture::VtkStreamlinesViewer::SetCurrentColormap { name } { 1530 # Keep track of the colormaps that we build. 1565 1531 if { ![info exists _colormaps($name)] } { 1566 BuildColormap $name [array get style]1532 BuildColormap $name 1567 1533 set _colormaps($name) 1 1568 1534 } 1569 if { ![info exists _dataset2style($tag)] || 1570 $_dataset2style($tag) != $name } { 1571 SendCmd "streamlines colormap $name $tag" 1572 SendCmd "cutplane colormap $name $tag" 1573 set _dataset2style($tag) $name 1574 } 1535 set _currentColormap $name 1536 SendCmd "streamlines colormap $_currentColormap" 1537 SendCmd "cutplane colormap $_currentColormap" 1575 1538 } 1576 1539 … … 1578 1541 # BuildColormap -- 1579 1542 # 1580 itcl::body Rappture::VtkStreamlinesViewer::BuildColormap { name styles } { 1581 array set style $styles 1582 set cmap [ColorsToColormap $style(-color)] 1543 itcl::body Rappture::VtkStreamlinesViewer::BuildColormap { name } { 1544 set cmap [ColorsToColormap $name] 1583 1545 if { [llength $cmap] == 0 } { 1584 1546 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1585 1547 } 1586 if { ![info exists _settings(-volumeopacity)] } {1587 set _settings(-volumeopacity) $style(-opacity)1588 }1589 set max $_settings(-volumeopacity)1590 1591 1548 set amap "0.0 1.0 1.0 1.0" 1592 1549 SendCmd "colormap add $name { $cmap } { $amap }" … … 1615 1572 } 1616 1573 1617 itcl::body Rappture::VtkStreamlinesViewer::Build VolumeTab {} {1574 itcl::body Rappture::VtkStreamlinesViewer::BuildSurfaceTab {} { 1618 1575 1619 1576 set fg [option get $itk_component(hull) font Font] … … 1621 1578 1622 1579 set inner [$itk_component(main) insert end \ 1623 -title " Volume Settings" \1580 -title "Boundary Surface Settings" \ 1624 1581 -icon [Rappture::icon volume-on]] 1625 1582 $inner configure -borderwidth 4 1626 1583 1627 checkbutton $inner. volume \1628 -text "Show Volume" \1629 -variable [itcl::scope _settings(- volumevisible)] \1630 -command [itcl::code $this AdjustSetting - volumevisible] \1584 checkbutton $inner.surface \ 1585 -text "Show Surface" \ 1586 -variable [itcl::scope _settings(-surfacevisible)] \ 1587 -command [itcl::code $this AdjustSetting -surfacevisible] \ 1631 1588 -font "Arial 9" 1632 1589 1633 1590 checkbutton $inner.wireframe \ 1634 1591 -text "Show Wireframe" \ 1635 -variable [itcl::scope _settings(- volumewireframe)] \1636 -command [itcl::code $this AdjustSetting - volumewireframe] \1592 -variable [itcl::scope _settings(-surfacewireframe)] \ 1593 -command [itcl::code $this AdjustSetting -surfacewireframe] \ 1637 1594 -font "Arial 9" 1638 1595 1639 1596 checkbutton $inner.lighting \ 1640 1597 -text "Enable Lighting" \ 1641 -variable [itcl::scope _settings(- volumelighting)] \1642 -command [itcl::code $this AdjustSetting - volumelighting] \1598 -variable [itcl::scope _settings(-surfacelighting)] \ 1599 -command [itcl::code $this AdjustSetting -surfacelighting] \ 1643 1600 -font "Arial 9" 1644 1601 1645 1602 checkbutton $inner.edges \ 1646 1603 -text "Show Edges" \ 1647 -variable [itcl::scope _settings(- volumeedges)] \1648 -command [itcl::code $this AdjustSetting - volumeedges] \1604 -variable [itcl::scope _settings(-surfaceedges)] \ 1605 -command [itcl::code $this AdjustSetting -surfaceedges] \ 1649 1606 -font "Arial 9" 1650 1607 1651 1608 label $inner.opacity_l -text "Opacity" -font "Arial 9" 1652 1609 ::scale $inner.opacity -from 0 -to 100 -orient horizontal \ 1653 -variable [itcl::scope _settings(- volumeopacity)] \1610 -variable [itcl::scope _settings(-surfaceopacity)] \ 1654 1611 -width 10 \ 1655 1612 -showvalue off \ 1656 -command [itcl::code $this AdjustSetting - volumeopacity]1613 -command [itcl::code $this AdjustSetting -surfaceopacity] 1657 1614 1658 1615 blt::table $inner \ … … 1720 1677 -command [itcl::code $this AdjustSetting -streamlinesnumseeds] 1721 1678 1722 label $inner.scale_l -text " Scale" -font "Arial 9"1679 label $inner.scale_l -text "Length" -font "Arial 9" 1723 1680 ::scale $inner.scale -from 1 -to 100 -orient horizontal \ 1724 -variable [itcl::scope _settings(-streamlines scale)] \1681 -variable [itcl::scope _settings(-streamlineslength)] \ 1725 1682 -width 10 \ 1726 1683 -showvalue off \ 1727 -command [itcl::code $this AdjustSetting -streamlines scale]1684 -command [itcl::code $this AdjustSetting -streamlineslength] 1728 1685 1729 1686 label $inner.field_l -text "Color by" -font "Arial 9" … … 1753 1710 3,0 $inner.opacity_l -anchor w -pady 2 \ 1754 1711 3,1 $inner.opacity -fill x -pady 2 \ 1755 5,0 $inner.lighting -anchor w -pady 2 -cspan 2 \1756 6,0 $inner.seeds -anchor w -pady 2 -cspan 2 \1757 7,0 $inner.density_l -anchor w -pady 2 \1758 7,1 $inner.density -fill x -pady 2 \1712 4,0 $inner.lighting -anchor w -pady 2 -cspan 2 \ 1713 5,0 $inner.seeds -anchor w -pady 2 -cspan 2 \ 1714 6,0 $inner.density_l -anchor w -pady 2 \ 1715 6,1 $inner.density -fill x -pady 2 \ 1759 1716 1760 1717 blt::table configure $inner r* c* -resize none 1761 blt::table configure $inner r 10c1 c2 -resize expand1718 blt::table configure $inner r7 c1 c2 -resize expand 1762 1719 } 1763 1720 … … 2135 2092 # Parse style string. 2136 2093 set tag $dataobj-$comp 2137 set style [$dataobj style $comp] 2138 array set settings { 2139 -color \#808080 2094 array set style { 2095 -color BCGYR 2096 -constcolor white 2097 -edgecolor black 2140 2098 -edges 0 2141 - edgecolor black2099 -lighting 1 2142 2100 -linewidth 1.0 2143 - opacity 0.42144 - wireframe02145 - lighting 12101 -mode lines 2102 -numseeds 200 2103 -opacity 1.0 2146 2104 -seeds 1 2147 2105 -seedcolor white 2106 -streamlineslength 0.7 2107 -surfacecolor white 2108 -surfaceedgecolor black 2109 -surfaceedges 0 2110 -surfacelighting 1 2111 -surfaceopacity 0.4 2112 -surfacevisible 1 2113 -surfacewireframe 0 2148 2114 -visible 1 2149 2115 } 2116 array set style [$dataobj style $comp] 2150 2117 if { $dataobj != $_first } { 2151 set settings(-opacity) 1 2152 } 2153 array set settings $style 2118 set style(-opacity) 1.0 2119 } 2154 2120 StartBufferingCommands 2155 2121 SendCmd "streamlines add $tag" 2156 SendCmd "streamlines seed visible off $tag" 2122 SendCmd "streamlines color [Color2RGB $style(-constcolor)] $tag" 2123 SendCmd "streamlines edges $style(-edges) $tag" 2124 SendCmd "streamlines linecolor [Color2RGB $style(-edgecolor)] $tag" 2125 SendCmd "streamlines linewidth $style(-linewidth) $tag" 2126 SendCmd "streamlines lighting $style(-lighting) $tag" 2127 SendCmd "streamlines opacity $style(-opacity) $tag" 2128 SendCmd "streamlines seed color [Color2RGB $style(-seedcolor)] $tag" 2129 SendCmd "streamlines seed visible $style(-seeds) $tag" 2130 SendCmd "streamlines visible $style(-visible) $tag" 2157 2131 set seeds [$dataobj hints seeds] 2158 2132 if { $seeds != "" && ![info exists _seeds($dataobj)] } { 2159 2133 set length [string length $seeds] 2160 SendCmd "streamlines seed fmesh 200data follows $length $tag"2134 SendCmd "streamlines seed fmesh $style(-numseeds) data follows $length $tag" 2161 2135 SendData $seeds 2162 2136 set _seeds($dataobj) 1 2163 2137 } 2138 set _settings(-streamlineslighting) $style(-lighting) 2139 $itk_component(streammode) value $style(-mode) 2140 AdjustSetting -streamlinesmode 2141 set _settings(-streamlinesnumseeds) $style(-numseeds) 2142 set _settings(-streamlinesopacity) [expr $style(-opacity) * 100.0] 2143 set _settings(-streamlineslength) [expr $style(-streamlineslength) * 100.0] 2144 set _settings(-streamlinesseedsvisible) $style(-seeds) 2145 set _settings(-streamlinesvisible) $style(-visible) 2146 2164 2147 SendCmd "cutplane add $tag" 2148 2165 2149 SendCmd "polydata add $tag" 2150 SendCmd "polydata color [Color2RGB $style(-surfacecolor)] $tag" 2166 2151 SendCmd "polydata colormode constant {} $tag" 2167 set _settings(-volumeedges) $settings(-edges) 2168 set _settings(-volumelighting) $settings(-lighting) 2169 set _settings(-volumeopacity) $settings(-opacity) 2170 set _settings(-volumewireframe) $settings(-wireframe) 2171 set _settings(-volumeopacity) [expr $settings(-opacity) * 100.0] 2152 SendCmd "polydata edges $style(-surfaceedges) $tag" 2153 SendCmd "polydata linecolor [Color2RGB $style(-surfaceedgecolor)] $tag" 2154 SendCmd "polydata lighting $style(-surfacelighting) $tag" 2155 SendCmd "polydata opacity $style(-surfaceopacity) $tag" 2156 SendCmd "polydata wireframe $style(-surfacewireframe) $tag" 2157 SendCmd "polydata visible $style(-surfacevisible) $tag" 2158 set _settings(-surfaceedges) $style(-surfaceedges) 2159 set _settings(-surfacelighting) $style(-surfacelighting) 2160 set _settings(-surfaceopacity) [expr $style(-surfaceopacity) * 100.0] 2161 set _settings(-surfacewireframe) $style(-surfacewireframe) 2162 set _settings(-surfacevisible) $style(-surfacevisible) 2172 2163 StopBufferingCommands 2173 SetColormap $dataobj $comp 2164 SetCurrentColormap $style(-color) 2165 $itk_component(colormap) value $style(-color) 2174 2166 } 2175 2167 -
branches/uq/gui/scripts/vtksurfaceviewer.tcl
r5679 r5850 134 134 private variable _isolines 135 135 private variable _contourList "" 136 137 private common _downloadPopup; # download options from popup138 private common _hardcopy139 136 private variable _width 0 140 137 private variable _height 0 … … 143 140 private variable _legendPending 0 144 141 private variable _field "" 145 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 146 private variable _fieldNames {} 142 private variable _colorMode "scalar"; # Mode of colormap (vmag or scalar) 147 143 private variable _fields 148 144 private variable _curFldName "" 149 145 private variable _curFldLabel "" 146 147 private common _downloadPopup; # download options from popup 148 private common _hardcopy 150 149 } 151 150 … … 1322 1321 #SendCmd "contour2d colormode $_colorMode $_curFldName" 1323 1322 SendCmd "polydata colormode $_colorMode $_curFldName" 1323 UpdateContourList 1324 SendCmd "contour2d contourlist [list $_contourList]" 1324 1325 SendCmd "camera reset" 1325 UpdateContourList1326 1326 DrawLegend 1327 1327 } … … 1465 1465 } 1466 1466 # Set the legend on the first heightmap dataset. 1467 if { $_currentColormap != "" 1467 if { $_currentColormap != "" } { 1468 1468 set cmap $_currentColormap 1469 1469 if { ![info exists _colormaps($cmap)] } { … … 2333 2333 -activeforeground $itk_option(-plotforeground) \ 2334 2334 -font "Arial 8" \ 2335 -command [itcl::code $this LegendTitleAction save]2335 -command [itcl::code $this Combo invoke] 2336 2336 set _fields($fname) [list $label $units $components] 2337 2337 if { $_curFldName == "" } { -
branches/uq/gui/scripts/vtkviewer.tcl
r5679 r5850 67 67 private method BuildAxisTab {} 68 68 private method BuildCameraTab {} 69 private method BuildColormap { name styles}69 private method BuildColormap { name } 70 70 private method BuildCutawayTab {} 71 71 private method BuildDownloadPopup { widget command } … … 147 147 private variable _start 0 148 148 private variable _title "" 149 150 private common _downloadPopup; # download options from popup151 private common _hardcopy152 149 private variable _width 0 153 150 private variable _height 0 … … 162 159 private variable _rotateDelay 150 163 160 private variable _scaleDelay 100 161 162 private common _downloadPopup; # download options from popup 163 private common _hardcopy 164 164 } 165 165 … … 1090 1090 } 1091 1091 if {"" != $_first} { 1092 set location [$_first hints camera]1093 if { $location != "" } {1094 array set view $location1095 }1096 1097 1092 foreach axis { x y z } { 1098 1093 set label [$_first hints ${axis}label] … … 1808 1803 array set style { 1809 1804 -color BCGYR 1810 -levels 61811 -opacity 1.01812 1805 } 1813 1806 if {[$dataobj type $comp] == "molecule"} { … … 1829 1822 array set style $_style($tag) 1830 1823 1831 if { $style(-color) == "elementDefault" } { 1832 set name "$style(-color)" 1833 } else { 1834 set name "$style(-color):$style(-levels):$style(-opacity)" 1835 } 1824 set name "$style(-color)" 1836 1825 if { ![info exists _colormaps($name)] } { 1837 BuildColormap $name [array get style]1826 BuildColormap $name 1838 1827 set _colormaps($name) 1 1839 1828 } … … 1858 1847 # BuildColormap -- 1859 1848 # 1860 itcl::body Rappture::VtkViewer::BuildColormap { name styles} {1861 if { $name == 1849 itcl::body Rappture::VtkViewer::BuildColormap { name } { 1850 if { $name == "elementDefault" } { 1862 1851 return 1863 1852 } 1864 array set style $styles 1865 set cmap [ColorsToColormap $style(-color)] 1853 set cmap [ColorsToColormap $name] 1866 1854 if { [llength $cmap] == 0 } { 1867 1855 set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0" 1868 1856 } 1869 if { ![info exists _settings(polydata-opacity)] } {1870 set _settings(polydata-opacity) $style(-opacity)1871 }1872 set max $_settings(polydata-opacity)1873 1874 1857 set amap "0.0 1.0 1.0 1.0" 1875 1858 SendCmd "colormap add $name { $cmap } { $amap }" … … 2665 2648 -normscale 0 2666 2649 -opacity 1.0 2667 -orient Glyphs 02650 -orientglyphs 0 2668 2651 -outline 0 2669 2652 -ptsize 1.0 2670 2653 -quality 1 2671 -scale Mode "vcomp"2654 -scalemode "vcomp" 2672 2655 -shape "sphere" 2673 2656 -visible 1 … … 2678 2661 if {$shape != ""} { 2679 2662 set settings(-shape) $shape 2663 } 2664 # Backwards compat with camel case style option 2665 if { [info exists settings(-orientGlyphs)] } { 2666 set settings(-orientglyphs) $settings(-orientGlyphs) 2667 array unset settings -orientGlyphs 2668 } 2669 # Backwards compat with camel case style option 2670 if { [info exists settings(-scaleMode)] } { 2671 set settings(-scalemode) $settings(-scaleMode) 2672 array unset settings -scaleMode 2680 2673 } 2681 2674 SendCmd "outline add $tag" … … 2692 2685 # Omitting field name for gorient and smode commands 2693 2686 # defaults to active scalars or vectors depending on mode 2694 SendCmd "glyphs gorient $settings(-orient Glyphs) {} $tag"2695 SendCmd "glyphs smode $settings(-scale Mode) {} $tag"2687 SendCmd "glyphs gorient $settings(-orientglyphs) {} $tag" 2688 SendCmd "glyphs smode $settings(-scalemode) {} $tag" 2696 2689 SendCmd "glyphs edges $settings(-edges) $tag" 2697 2690 SendCmd "glyphs linecolor [Color2RGB $settings(-edgecolor)] $tag" -
branches/uq/gui/scripts/vtkvolumeviewer.tcl
r5679 r5850 537 537 # USAGE: delete ?<dataobj1> <dataobj2> ...? 538 538 # 539 # Clients use this to delete a dataobj from the plot. If no dataobjs 540 # are specified, then all dataobjs are deleted. No data objects are 541 # deleted. They are only removed from the display list. 542 # 539 # Clients use this to delete a dataobj from the plot. If no dataobjs 540 # are specified, then all dataobjs are deleted. No data objects are 541 # deleted. They are only removed from the display list. 543 542 # ---------------------------------------------------------------------- 544 543 itcl::body Rappture::VtkVolumeViewer::delete {args} { … … 818 817 # isconnected -- 819 818 # 820 # 819 # Indicates if we are currently connected to the visualization server. 821 820 # 822 821 itcl::body Rappture::VtkVolumeViewer::isconnected {} { … … 834 833 # Disconnect -- 835 834 # 836 # Clients use this method to disconnect from the current rendering 837 # server. 835 # Clients use this method to disconnect from the current rendering server. 838 836 # 839 837 itcl::body Rappture::VtkVolumeViewer::Disconnect {} { … … 1029 1027 } 1030 1028 if {"" != $_first} { 1031 set location [$_first hints camera]1032 if { $location != "" } {1033 array set view $location1034 }1035 1036 1029 foreach axis { x y z } { 1037 1030 set label [$_first hints ${axis}label] … … 1319 1312 # AdjustSetting -- 1320 1313 # 1321 # 1322 # 1323 # 1314 # Changes/updates a specific setting in the widget. There are 1315 # usually user-setable option. Commands are sent to the render 1316 # server. 1324 1317 # 1325 1318 itcl::body Rappture::VtkVolumeViewer::AdjustSetting {what {value ""}} { … … 1517 1510 # RequestLegend -- 1518 1511 # 1519 # 1520 # 1512 # Request a new legend from the server. The size of the legend 1513 # is determined from the height of the canvas. 1521 1514 # 1522 1515 itcl::body Rappture::VtkVolumeViewer::RequestLegend {} { … … 2414 2407 # GetDatasetsWithComponent -- 2415 2408 # 2416 # 2417 # 2418 # 2419 # 2409 # Returns a list of all the datasets (known by the combination of 2410 # their data object and component name) that match the given 2411 # component name. For example, this is used where we want to change 2412 # the settings of volumes that have the current component. 2420 2413 # 2421 2414 itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } { -
branches/uq/src/core/Makefile.in
r4545 r5850 36 36 -DRAPPTURE_VERSION=\"$(RAPPTURE_VERSION)\" 37 37 38 CC_SWITCHES = $(CFLAGS) $(CFLAGS_DEBUG) $(INCLUDES) $(DEFINES) 39 CXX_SWITCHES = $(CFLAGS) $(CFLAGS_DEBUG) $(INCLUDES) $(DEFINES) 38 CC_SWITCHES = $(CFLAGS) $(CFLAGS_DEBUG) $(INCLUDES) $(DEFINES) 39 CXX_SWITCHES = $(CFLAGS) $(CFLAGS_DEBUG) $(INCLUDES) $(DEFINES) 40 40 41 41 INCLUDES = \ … … 104 104 xerror.h 105 105 106 # Build the scew and b64 libraries directly into Rappture for now. 106 # Build the scew and b64 libraries directly into Rappture for now. 107 107 # Note: This works because of viewpath-ing. See the VPATH variable. 108 108 B64_OBJS = \ … … 153 153 RpDXWriter.h \ 154 154 RpDXWriterFInterface.h \ 155 RpDXWriterFStubs.h 155 RpDXWriterFStubs.h 156 156 OBJS += \ 157 157 RpDXWriter.o \ 158 RpDXWriterFInterface.o 158 RpDXWriterFInterface.o 159 159 endif 160 160 … … 192 192 .cc.o: 193 193 $(CXX) $(CXX_SWITCHES) -c $? 194 .c.o: 194 .c.o: 195 195 $(CCC) $(CC_SWITCHES) -c $? 196 196 -
branches/uq/src/core/RpBindingsDict.cc
r5679 r5850 26 26 * function's caller. 27 27 * 28 * Returns the key of the object in the dictionary 28 * Returns the key of the object in the dictionary 29 29 * On Error, returns 0 (which also means nothing can be stored at 0) 30 30 */ … … 120 120 * This function stores the RpUnits names specified by 'objectName' 121 121 * into the UnitsStr dictionary. This is helpful for writing bindings 122 * for languages that can not accept pointers to provide back to the 122 * for languages that can not accept pointers to provide back to the 123 123 * function's caller. 124 124 * … … 152 152 * This function retrieves the RpUnits name referenced to by 'objKey' 153 153 * from the UnitsStr dictionary. This is helpful for writing bindings 154 * for languages that can not accept pointers to provide back to the 154 * for languages that can not accept pointers to provide back to the 155 155 * function's caller. 156 156 * -
branches/uq/src/core/RpBuffer.cc
r5679 r5850 37 37 {} 38 38 39 40 39 /** 41 40 * Construct an empty Buffer of specified size. … … 48 47 {} 49 48 50 51 49 /** 52 50 * Construct a Buffer loaded with initial data. … … 89 87 } 90 88 91 92 89 Buffer 93 90 Buffer::operator+(const Buffer& b) const … … 98 95 } 99 96 100 101 97 Buffer& 102 98 Buffer::operator+=(const Buffer& b) … … 106 102 } 107 103 108 109 104 Buffer::~Buffer() 110 105 {} 111 112 106 113 107 bool … … 142 136 } 143 137 // Read the file contents directly onto the end of the old buffer. 144 numBytesRead = fread((char *)bytes() + oldSize, sizeof(char), 138 numBytesRead = fread((char *)bytes() + oldSize, sizeof(char), 145 139 stat.st_size, f); 146 140 fclose(f); 147 141 if (numBytesRead != (size_t)stat.st_size) { 148 status.addError("can't read %ld bytes from \"%s\": %s", stat.st_size, 142 status.addError("can't read %ld bytes from \"%s\": %s", stat.st_size, 149 143 path, strerror(errno)); 150 144 return false; … … 155 149 } 156 150 157 158 bool 159 Buffer::dump (Outcome &status, const char* path) 151 bool 152 Buffer::dump(Outcome &status, const char* path) 160 153 { 161 154 status.addContext("Rappture::Buffer::dump()"); … … 179 172 } 180 173 181 182 174 bool 183 175 Buffer::encode(Outcome &status, unsigned int flags) … … 218 210 return true; 219 211 } 220 221 212 222 213 bool … … 273 264 } 274 265 275 276 bool 277 Buffer::do_compress(Outcome& status, SimpleCharBuffer& bin, 266 bool 267 Buffer::do_compress(Outcome& status, SimpleCharBuffer& bin, 278 268 SimpleCharBuffer& bout) 279 269 { … … 419 409 } 420 410 421 422 411 bool 423 412 Buffer::do_base64_enc(Outcome& status, const SimpleCharBuffer& bin, … … 439 428 } 440 429 441 442 430 bool 443 431 Buffer::do_base64_dec(Outcome& status, const SimpleCharBuffer& bin, … … 458 446 } 459 447 460 461 } 462 463 464 448 } -
branches/uq/src/core/RpBuffer.h
r5679 r5850 25 25 }; 26 26 27 28 27 #ifdef __cplusplus 29 28 extern "C" { 30 29 #endif // ifdef __cplusplus 31 30 … … 44 43 */ 45 44 46 class Buffer : public SimpleCharBuffer {45 class Buffer : public SimpleCharBuffer { 47 46 public: 48 47 Buffer(); … … 74 73 75 74 bool do_compress(Outcome& status, SimpleCharBuffer& bin, 76 SimpleCharBuffer& bout 77 bool do_decompress( 78 SimpleCharBuffer& bout);75 SimpleCharBuffer& bout); 76 bool do_decompress(Outcome& status, SimpleCharBuffer& bin, 77 SimpleCharBuffer& bout); 79 78 bool do_base64_enc(Outcome& status, const SimpleCharBuffer& bin, 80 SimpleCharBuffer& bout 79 SimpleCharBuffer& bout); 81 80 bool do_base64_dec(Outcome& status, const SimpleCharBuffer& bin, 82 SimpleCharBuffer& bout 81 SimpleCharBuffer& bout); 83 82 }; 84 83 … … 86 85 87 86 #ifdef __cplusplus 88 87 } 89 88 #endif // ifdef __cplusplus 90 89 -
branches/uq/src/core/RpBufferCInterface.cc
r5679 r5850 249 249 flags |= RPENC_B64; 250 250 } 251 ((Rappture::Buffer*)buf->_buf)->encode(s, flags); 252 RpOutcomeToCOutcome(&s,&status); 253 return status; 254 } 255 256 RapptureOutcome 257 RapptureBufferDecode(RapptureBuffer* buf, int decompress, int base64 251 ((Rappture::Buffer*)buf->_buf)->encode(s, flags); 252 RpOutcomeToCOutcome(&s,&status); 253 return status; 254 } 255 256 RapptureOutcome 257 RapptureBufferDecode(RapptureBuffer* buf, int decompress, int base64) 258 258 { 259 259 Rappture::Outcome s; … … 289 289 290 290 #ifdef __cplusplus 291 291 } 292 292 #endif // ifdef __cplusplus -
branches/uq/src/core/RpBufferCInterface.h
r5679 r5850 1 2 1 /* 3 2 * ---------------------------------------------------------------------- … … 12 11 * ====================================================================== 13 12 */ 14 15 13 16 14 #ifndef _RAPPTURE_BUFFER_C_H … … 39 37 bool (*decode)(Outcome &result, bool, bool); 40 38 */ 41 } RapptureBuffer;39 } RapptureBuffer; 42 40 43 41 int RapptureBufferInit(RapptureBuffer* buf); … … 53 51 RapptureOutcome RapptureBufferDump(RapptureBuffer* buf, const char* filename); 54 52 RapptureOutcome RapptureBufferEncode(RapptureBuffer* buf, int compress, 55 int base64);56 RapptureOutcome RapptureBufferDecode(RapptureBuffer* buf, 57 int decompress, int base64);53 int base64); 54 RapptureOutcome RapptureBufferDecode(RapptureBuffer* buf, 55 int decompress, int base64); 58 56 59 57 #ifdef __cplusplus -
branches/uq/src/core/RpDict.h
r5679 r5850 22 22 /**************************************************************************/ 23 23 24 template < 25 26 24 template <typename KeyType, 25 typename ValType, 26 class _Compare=std::equal_to<KeyType> > 27 27 class RpDict; 28 28 29 template < 30 31 29 template <typename KeyType, 30 typename ValType, 31 class _Compare=std::equal_to<KeyType> > 32 32 class RpDictEntry; 33 33 34 template < 35 36 34 template <typename KeyType, 35 typename ValType, 36 class _Compare=std::equal_to<KeyType> > 37 37 class RpDictIterator; 38 39 38 40 39 /* … … 48 47 * because RpBindingsDict uses it. 49 48 */ 50 51 49 52 50 /**************************************************************************/ … … 93 91 private: 94 92 95 RpDict<KeyType,ValType,_Compare>& 96 tablePtr; /* pointer to the table we want to 93 RpDict<KeyType,ValType,_Compare>& 94 tablePtr; /* pointer to the table we want to 97 95 * iterate */ 98 96 int srchNextIndex; /* Index of next bucket to be 99 97 * enumerated after present one. */ 100 RpDictEntry<KeyType,ValType,_Compare>* 98 RpDictEntry<KeyType,ValType,_Compare>* 101 99 srchNextEntryPtr; /* Next entry to be enumerated in the 102 100 * the current bucket. */ 103 101 104 102 }; 105 106 103 107 104 template <typename KeyType, typename ValType, class _Compare> … … 113 110 // operator==(const RpDictEntry& entry) const; 114 111 // 115 //operator!=(const RpDictEntry& lhs, const RpDictEntry& rhs) const 112 //operator!=(const RpDictEntry& lhs, const RpDictEntry& rhs) const 116 113 //{ 117 114 // if (lhs.key != rhs.key) … … 189 186 }; 190 187 191 192 188 template <typename KeyType, typename ValType, class _Compare> 193 189 class RpDict … … 207 203 // 208 204 /*virtual*/ RpDict<KeyType,ValType,_Compare>& 209 set( 210 211 212 213 205 set(KeyType& key, 206 ValType& value, 207 RpDictHint hint=NULL, 208 int *newPtr=NULL, 209 bool ci=false); 214 210 215 211 // find an RpUnits object that should exist in RpUnitsTable 216 // 212 // 217 213 /*virtual*/ RpDictEntry<KeyType,ValType,_Compare>& 218 find( 219 220 bool ci=false);221 222 /*virtual*/ RpDictEntry<KeyType,ValType,_Compare>& operator[]( 214 find(KeyType& key, 215 RpDictHint hint = NULL, 216 bool ci=false); 217 218 /*virtual*/ RpDictEntry<KeyType,ValType,_Compare>& operator[](KeyType& key) 223 219 { 224 220 return find(key,NULL); 225 221 } 226 222 227 RpDict<KeyType,ValType,_Compare>& setCI( bool val);223 RpDict<KeyType,ValType,_Compare>& setCI(bool val); 228 224 bool getCI(); 229 225 RpDict<KeyType,ValType,_Compare>& toggleCI(); … … 263 259 } 264 260 265 // copy constructor 261 // copy constructor 266 262 // RpDict (const RpDict& dict); 267 263 … … 283 279 const int REBUILD_MULTIPLIER; 284 280 285 RpDictEntry<KeyType,ValType,_Compare> 281 RpDictEntry<KeyType,ValType,_Compare> 286 282 **buckets; /* Pointer to bucket array. Each 287 283 * element points to first entry in … … 314 310 315 311 RpDictEntry<KeyType,ValType,_Compare>* 316 search( KeyType& key, RpDictHint hint = NULL, bool ci = false);312 search(KeyType& key, RpDictHint hint = NULL, bool ci = false); 317 313 318 314 // static void RpDict::RebuildTable (); … … 326 322 }; 327 323 328 329 324 /*--------------------------------------------------------------------------*/ 330 325 /*--------------------------------------------------------------------------*/ … … 340 335 * Side Effects: 341 336 * none. 342 * 337 * 343 338 * 344 339 *************************************************************************/ 345 346 340 template <typename KeyType, typename ValType, class _Compare> 347 341 int … … 350 344 return numEntries; 351 345 } 352 353 346 354 347 /************************************************************************** … … 359 352 * 360 353 * Results: 361 * Returns a reference to the RpDict object allowing the user to chain 354 * Returns a reference to the RpDict object allowing the user to chain 362 355 * together different commands such as 363 356 * rpdict_obj.set(key).find(a).erase(a); … … 370 363 template <typename KeyType, typename ValType, class _Compare> 371 364 RpDict<KeyType,ValType,_Compare>& 372 RpDict<KeyType,ValType,_Compare>::set( 373 374 375 376 bool ci)365 RpDict<KeyType,ValType,_Compare>::set(KeyType& key, 366 ValType& value, 367 RpDictHint hint, 368 int* newPtr, 369 bool ci) 377 370 { 378 371 RpDictEntry<KeyType,ValType,_Compare> *hPtr = NULL; … … 466 459 *---------------------------------------------------------------------- 467 460 */ 468 469 461 template <typename KeyType, typename ValType, class _Compare> 470 462 RpDictEntry<KeyType,ValType,_Compare>& 471 RpDict<KeyType,ValType,_Compare>::find( 472 473 bool ci)463 RpDict<KeyType,ValType,_Compare>::find(KeyType& key, 464 RpDictHint hint, 465 bool ci) 474 466 { 475 467 RpDictEntry<KeyType,ValType,_Compare> *hPtr = NULL; … … 503 495 *---------------------------------------------------------------------- 504 496 */ 505 506 497 template <typename KeyType, typename ValType, class _Compare> 507 498 RpDictEntry<KeyType,ValType,_Compare>* 508 RpDict<KeyType,ValType,_Compare>::search( 509 510 bool ci)511 512 499 RpDict<KeyType,ValType,_Compare>::search(KeyType& key, 500 RpDictHint hint, 501 bool ci) 502 // bool ci, 503 // RpDictEntryList* entryList) 513 504 { 514 505 RpDictEntry<KeyType,ValType,_Compare> *hPtr = NULL; … … 572 563 } 573 564 574 575 576 565 /************************************************************************** 577 566 * … … 589 578 /* 590 579 template <typename KeyType,typename ValType,class _Compare> 591 RpDict<KeyType,ValType,_Compare>& 592 RpDictIterator<KeyType,ValType,_Compare>::getTable() 580 RpDict<KeyType,ValType,_Compare>& 581 RpDictIterator<KeyType,ValType,_Compare>::getTable() 593 582 { 594 583 return tablePtr; … … 606 595 * Side Effects: 607 596 * moves iterator to the beginning of the hash table. 608 * 597 * 609 598 * 610 599 *************************************************************************/ … … 630 619 * Side Effects: 631 620 * moves iterator to the next entry of the hash table if it exists. 632 * 621 * 633 622 * 634 623 *************************************************************************/ 635 636 624 template <typename KeyType,typename ValType,class _Compare> 637 625 RpDictEntry<KeyType,ValType,_Compare>* … … 669 657 template <typename KeyType, typename ValType, class _Compare> 670 658 RpDict<KeyType,ValType,_Compare>& 671 RpDict<KeyType,ValType,_Compare>::setCI( bool val)659 RpDict<KeyType,ValType,_Compare>::setCI(bool val) 672 660 { 673 661 caseInsensitive = val; … … 764 752 return *nullEntry; 765 753 } 766 767 754 768 755 /* … … 784 771 *---------------------------------------------------------------------- 785 772 */ 786 787 773 template <typename KeyType, typename ValType, class _Compare> 788 774 void … … 794 780 795 781 // check to see if the object is associated with a table 796 // if object is not associated with a table, there is no 782 // if object is not associated with a table, there is no 797 783 // need to try to remove it from the table. 798 784 if (tablePtr) { … … 804 790 805 791 // remove the entry from the buckets 806 // 792 // 807 793 // if entry is the first entry in the bucket 808 794 // move the bucket to point to the next entry … … 812 798 else { 813 799 // if the entry is not the first entry in the bucket 814 // search for the entry 800 // search for the entry 815 801 for (prevPtr = *bucketPtr; ; prevPtr = prevPtr->nextPtr) { 816 802 … … 821 807 prevPtr->nextPtr = nextPtr; 822 808 break; 823 } 809 } 824 810 } // end for loop 825 811 } // end else … … 843 829 } 844 830 845 846 831 /* 847 832 *---------------------------------------------------------------------- … … 859 844 *---------------------------------------------------------------------- 860 845 */ 861 862 846 template <typename KeyType, typename ValType, class _Compare> 863 847 const KeyType* … … 884 868 *---------------------------------------------------------------------- 885 869 */ 886 887 870 template <typename KeyType, typename ValType, class _Compare> 888 871 const ValType* … … 907 890 *---------------------------------------------------------------------- 908 891 */ 909 910 892 template <typename KeyType, typename ValType, class _Compare> 911 893 const ValType* … … 944 926 *---------------------------------------------------------------------- 945 927 */ 946 947 928 template <typename KeyType, typename ValType, class _Compare> 948 929 bool … … 954 935 return false; 955 936 } 956 957 937 958 938 /*************************************************************************/ … … 978 958 *---------------------------------------------------------------------- 979 959 */ 980 981 960 template <typename KeyType, typename ValType, class _Compare> 982 961 void 983 962 RpDict<KeyType,ValType,_Compare>::RebuildTable() 984 963 { 985 int oldSize=0, count=0, index=0; 964 int oldSize=0, count=0, index=0; 986 965 RpDictEntry<KeyType,ValType,_Compare> **oldBuckets = NULL; 987 966 RpDictEntry<KeyType,ValType,_Compare> **oldChainPtr = NULL, **newChainPtr = NULL; … … 996 975 */ 997 976 998 999 977 numBuckets *= 4; 1000 978 … … 1054 1032 *---------------------------------------------------------------------- 1055 1033 */ 1056 1057 1034 template <typename KeyType, typename ValType, class _Compare> 1058 1035 unsigned int … … 1082 1059 * I chose the one below (multiply by 9 and add new character) 1083 1060 * because of the following reasons: 1084 * 1061 * 1085 1062 * 1. Multiplying by 10 is perfect for keys that are decimal strings, 1086 1063 * and multiplying by 9 is just about as good. … … 1091 1068 * works well both for decimal and non-decimal strings. 1092 1069 */ 1093 1094 1095 1070 template <typename KeyType, typename ValType, class _Compare> 1096 1071 unsigned int … … 1158 1133 * --------------------------------------------------------------------- 1159 1134 */ 1160 1161 1135 template <typename KeyType, typename ValType, class _Compare> 1162 1136 int … … 1166 1140 } 1167 1141 1168 1169 1170 1142 #endif -
branches/uq/src/core/b64/cdecode.h
r5679 r5850 24 24 int base64_decode_value(char value_in); 25 25 26 int base64_decode_block(const char* code_in, const int length_in, 26 int base64_decode_block(const char* code_in, const int length_in, 27 27 char* plaintext_out, base64_decodestate* state_in); 28 28 -
branches/uq/src/core/b64/decode.h
r5679 r5850 22 22 base64_decodestate _state; 23 23 int _buffersize; 24 24 25 25 decoder(int buffersize_in = 4096) 26 26 : _buffersize(buffersize_in) -
branches/uq/src/core/b64/encode.h
r5679 r5850 15 15 { 16 16 17 extern "C" 17 extern "C" 18 18 { 19 19 #include "cencode.h" -
branches/uq/src/core/rappture_fortran.c
r5679 r5850 100 100 # define rp_lib_element_id RP_LIB_ELEMENT_ID 101 101 # define rp_lib_element_type RP_LIB_ELEMENT_TYPE 102 # define rp_lib_element_str RP_LIB_ELEMENT_STR 102 # define rp_lib_element_str RP_LIB_ELEMENT_STR 103 103 # define rp_lib_element_obj RP_LIB_ELEMENT_OBJ 104 104 # define rp_lib_child_num RP_LIB_CHILD_NUM … … 130 130 131 131 extern "C" 132 void rp_lib_element_comp( int* handle,133 134 135 136 int retText_len);137 138 extern "C" 139 void rp_lib_element_id( int* handle,140 141 142 143 int retText_len);144 145 extern "C" 146 void rp_lib_element_type( 147 148 149 150 int retText_len);151 152 extern "C" 153 void rp_lib_element_str( int* handle,154 char* path,155 156 157 158 159 int retText_len);160 161 extern "C" 162 int rp_lib_element_obj( int* handle,163 164 int path_len);165 166 extern "C" 167 int rp_lib_child_num( int* handle,168 char* path,169 170 171 extern "C" 172 int rp_lib_child_comp( 173 174 175 176 177 178 179 180 181 182 extern "C" 183 int rp_lib_child_id( 184 185 186 187 188 189 190 191 192 193 extern "C" 194 int rp_lib_child_type( 195 196 197 198 199 200 201 202 203 204 extern "C" 205 int rp_lib_child_str( 206 207 208 209 210 211 212 213 214 215 216 217 extern "C" 218 int rp_lib_child_obj( int* handle,219 char* path,220 char* type,221 222 int type_len223 ); 224 225 extern "C" 226 void rp_lib_get( int* handle, 227 char* path,228 char* retText,229 int path_len,230 int retText_len ); 231 232 extern "C" 233 double rp_lib_get_double( int* handle, 234 char* path,235 int path_len); 236 237 extern "C" 238 void rp_lib_put_str( int* handle, 239 char* path,240 char* value,241 int* append,242 int path_len,243 int value_len ); 244 245 extern "C" 246 void rp_lib_put_id_str( int* handle, 247 char* path,248 char* value,249 char* id,250 int* append,251 int path_len,252 int value_len,253 int id_len ); 254 255 extern "C" 256 void rp_lib_put_obj( int* handle, 257 char* path,258 int* valHandle,259 int* append,260 int path_len ); 261 262 extern "C" 263 void rp_lib_put_id_obj( int* handle, 264 char* path,265 int* valHandle,266 char* id,267 int* append,268 int path_len,269 int id_len ); 270 271 extern "C" 272 int rp_lib_remove( int* handle, 273 char* path,274 int path_len); 275 276 extern "C" 277 int rp_lib_xml_len( int* handle); 278 279 extern "C" 280 void rp_lib_xml( int* handle, 281 char* retText,282 int retText_len); 283 284 extern "C" 285 int rp_lib_write_xml( int* handle, 286 char* outFile,287 int outFile_len); 132 void rp_lib_element_comp(int* handle, 133 char* path, 134 char* retText, 135 int path_len, 136 int retText_len); 137 138 extern "C" 139 void rp_lib_element_id(int* handle, 140 char* path, 141 char* retText, 142 int path_len, 143 int retText_len); 144 145 extern "C" 146 void rp_lib_element_type(int* handle, 147 char* path, 148 char* retText, 149 int path_len, 150 int retText_len); 151 152 extern "C" 153 void rp_lib_element_str(int* handle, 154 char* path, 155 char* flavor, 156 char* retText, 157 int path_len, 158 int flavor_len, 159 int retText_len); 160 161 extern "C" 162 int rp_lib_element_obj(int* handle, 163 char* path, 164 int path_len); 165 166 extern "C" 167 int rp_lib_child_num(int* handle, 168 char* path, 169 int path_len); 170 171 extern "C" 172 int rp_lib_child_comp(int* handle, /* integer handle of library */ 173 char* path, /* DOM path of requested object */ 174 char* type, /* specific name of element */ 175 int* childNum, /* child number for iteration */ 176 char* retText, /* buffer to store return text */ 177 int path_len, /* length of path */ 178 int type_len, /* length of type */ 179 int retText_len /* length of return text buffer */ 180 ); 181 182 extern "C" 183 int rp_lib_child_id(int* handle, /* integer handle of library */ 184 char* path, /* DOM path of requested object */ 185 char* type, /* specific name of element */ 186 int* childNum, /* child number for iteration */ 187 char* retText, /* buffer to store return text */ 188 int path_len, /* length of path */ 189 int type_len, /* length of type */ 190 int retText_len /* length of return text buffer */ 191 ); 192 193 extern "C" 194 int rp_lib_child_type(int* handle, /* integer handle of library */ 195 char* path, /* DOM path of requested object */ 196 char* type, /* specific name of element */ 197 int* childNum, /* child number for iteration */ 198 char* retText, /* buffer to store return text */ 199 int path_len, /* length of path */ 200 int type_len, /* length of type */ 201 int retText_len /* length of return text buffer */ 202 ); 203 204 extern "C" 205 int rp_lib_child_str(int* handle, /* integer handle of library */ 206 char* path, /* DOM path of requested object */ 207 char* flavor, /* information you want returned*/ 208 char* type, /* specific name of element */ 209 int* childNum, /* child number for iteration */ 210 char* retText, /* buffer to store return text */ 211 int path_len, /* length of path */ 212 int flavor_len, /* length of flavor */ 213 int type_len, /* length of type */ 214 int retText_len /* length of return text buffer */ 215 ); 216 217 extern "C" 218 int rp_lib_child_obj(int* handle, 219 char* path, 220 char* type, 221 int path_len, 222 int type_len); 223 224 extern "C" 225 void rp_lib_get(int* handle, 226 char* path, 227 char* retText, 228 int path_len, 229 int retText_len); 230 231 extern "C" 232 double rp_lib_get_double(int* handle, 233 char* path, 234 int path_len); 235 236 extern "C" 237 void rp_lib_put_str(int* handle, 238 char* path, 239 char* value, 240 int* append, 241 int path_len, 242 int value_len); 243 244 extern "C" 245 void rp_lib_put_id_str(int* handle, 246 char* path, 247 char* value, 248 char* id, 249 int* append, 250 int path_len, 251 int value_len, 252 int id_len); 253 254 extern "C" 255 void rp_lib_put_obj(int* handle, 256 char* path, 257 int* valHandle, 258 int* append, 259 int path_len); 260 261 extern "C" 262 void rp_lib_put_id_obj(int* handle, 263 char* path, 264 int* valHandle, 265 char* id, 266 int* append, 267 int path_len, 268 int id_len); 269 270 extern "C" 271 int rp_lib_remove(int* handle, 272 char* path, 273 int path_len); 274 275 extern "C" 276 int rp_lib_xml_len(int* handle); 277 278 extern "C" 279 void rp_lib_xml(int* handle, 280 char* retText, 281 int retText_len); 282 283 extern "C" 284 int rp_lib_write_xml(int* handle, 285 char* outFile, 286 int outFile_len); 287 288 288 extern "C" 289 289 void rp_quit(); … … 306 306 307 307 // global vars 308 // dictionary to hold the python objects that 308 // dictionary to hold the python objects that 309 309 // cannot be sent to fortran 310 310 … … 313 313 int rapptureStarted = 0; 314 314 315 void rp_init() { 315 void rp_init() 316 { 316 317 // 317 318 PyObject* rpClass = NULL; 318 319 int retVal = 0; 319 320 320 321 // initialize the interpreter 321 322 Py_Initialize(); … … 329 330 } 330 331 331 int rp_lib(const char* filePath, int filePath_len) 332 int rp_lib(const char* filePath, int filePath_len) 332 333 { 333 334 PyObject* lib = NULL; … … 341 342 342 343 inFilePath = null_terminate((char*)filePath, filePath_len); 343 344 344 345 // error checking to make sure inText is valid??? 345 346 346 347 // grab the rappture class from the dictionary 347 348 rpClass = getObject(0); … … 367 368 368 369 int rp_lib_element_obj(int* handle, /* integer handle of library */ 369 char* path, /* null terminated path */ 370 int path_len 371 ) 370 char* path, /* null terminated path */ 371 int path_len) 372 372 { 373 373 int newObjHandle = -1; … … 388 388 if (lib) { 389 389 retObj = (PyObject*) rpElement(lib, inPath, flavor); 390 390 391 391 if (retObj) { 392 392 … … 406 406 } 407 407 408 void rp_lib_element_comp( 409 410 411 412 413 408 void rp_lib_element_comp(int* handle, /* integer handle of library */ 409 char* path, /* null terminated path */ 410 char* retText, /* return buffer for fortran*/ 411 int path_len, 412 int retText_len /* length of return text buffer */ 413 ) 414 414 { 415 415 char* inPath = NULL; … … 426 426 427 427 rp_lib_element_str(handle,inPath,"component",retText,path_len,10,retText_len); 428 429 if (inPath) { 430 free(inPath); 431 inPath = NULL; 432 } 433 434 } 435 436 void rp_lib_element_id( 437 438 439 440 441 )428 429 if (inPath) { 430 free(inPath); 431 inPath = NULL; 432 } 433 434 } 435 436 void rp_lib_element_id(int* handle, /* integer handle of library */ 437 char* path, /* null terminated path */ 438 char* retText, /* return buffer for fortran*/ 439 int path_len, 440 int retText_len /* length of return text buffer */ 441 ) 442 442 { 443 443 char* inPath = NULL; … … 459 459 } 460 460 461 void rp_lib_element_type( 462 463 464 465 466 461 void rp_lib_element_type(int* handle, /* integer handle of library */ 462 char* path, /* null terminated path */ 463 char* retText, /* return buffer for fortran*/ 464 int path_len, 465 int retText_len /* length of return text buffer */ 466 ) 467 467 { 468 468 char* inPath = NULL; … … 483 483 } 484 484 485 void rp_lib_element_str( 486 487 488 489 490 491 485 void rp_lib_element_str(int* handle, /* integer handle of library */ 486 char* path, /* null terminated path */ 487 char* flavor, /* null terminated flavor */ 488 char* retText, /* return buffer for fortran*/ 489 int path_len, 490 int flavor_len, 491 int retText_len /* length of return text buffer */ 492 492 ) 493 493 { … … 498 498 499 499 PyObject* lib = NULL; 500 500 501 501 char* retObj = NULL; 502 502 503 503 char* inPath = NULL; 504 504 char* inFlavor = NULL; … … 517 517 if (retObj) { 518 518 xmlText = retObj; 519 519 520 520 fortranify(xmlText, retText, retText_len); 521 521 522 522 /* 523 523 length_in = strlen(xmlText); … … 534 534 *(retText+length_out-1) = ' '; 535 535 */ 536 536 537 537 free(retObj); 538 538 retObj = NULL; 539 539 } 540 540 else { 541 541 542 542 } 543 543 } … … 546 546 } 547 547 } 548 548 549 549 if (inPath) { 550 550 free(inPath); … … 559 559 } 560 560 561 int rp_lib_child_num( int* handle, 562 char* path, 563 int path_len 564 ) 561 int rp_lib_child_num(int* handle, 562 char* path, 563 int path_len) 565 564 { 566 565 int numChildren = 0; … … 571 570 572 571 inPath = null_terminate(path,path_len); 573 572 574 573 if (rapptureStarted) { 575 574 if ((handle) && (*handle != 0)) { … … 583 582 } 584 583 else { 585 584 586 585 } 587 586 } … … 599 598 600 599 601 int rp_lib_child_comp (int* handle, /* integer handle of library */602 603 604 605 606 607 608 609 600 int rp_lib_child_comp(int* handle, /* integer handle of library */ 601 char* path, /* DOM path of requested object */ 602 char* type, /* specific name of element */ 603 int* childNum, /* child number for iteration */ 604 char* retText, /* buffer to store return text */ 605 int path_len, /* length of path */ 606 int type_len, /* length of type */ 607 int retText_len /* length of return text buffer */ 608 ) 610 609 { 611 610 int retVal = 0; … … 631 630 } 632 631 633 retVal = rp_lib_child_str( handle, 634 inPath, 635 "component", 636 inType, 637 childNum, 638 retText, 639 path_len, 640 10, 641 type_len, 642 retText_len 643 ); 632 retVal = rp_lib_child_str(handle, 633 inPath, 634 "component", 635 inType, 636 childNum, 637 retText, 638 path_len, 639 10, 640 type_len, 641 retText_len); 644 642 645 643 if (inPath) { … … 656 654 } 657 655 658 int rp_lib_child_id( 659 660 661 662 663 664 665 666 656 int rp_lib_child_id(int* handle, /* integer handle of library */ 657 char* path, /* DOM path of requested object */ 658 char* type, /* specific name of element */ 659 int* childNum, /* child number for iteration */ 660 char* retText, /* buffer to store return text */ 661 int path_len, /* length of path */ 662 int type_len, /* length of type */ 663 int retText_len /* length of return text buffer */ 664 ) 667 665 { 668 666 int retVal = 0; … … 687 685 } 688 686 689 retVal = rp_lib_child_str( handle, 690 inPath, 691 "id", 692 inType, 693 childNum, 694 retText, 695 path_len, 696 3, 697 type_len, 698 retText_len 699 ); 687 retVal = rp_lib_child_str(handle, 688 inPath, 689 "id", 690 inType, 691 childNum, 692 retText, 693 path_len, 694 3, 695 type_len, 696 retText_len); 700 697 701 698 if (inPath) { … … 712 709 } 713 710 714 int rp_lib_child_type (int* handle, /* integer handle of library */715 716 717 718 719 720 721 722 711 int rp_lib_child_type(int* handle, /* integer handle of library */ 712 char* path, /* DOM path of requested object */ 713 char* type, /* specific name of element */ 714 int* childNum, /* child number for iteration */ 715 char* retText, /* buffer to store return text */ 716 int path_len, /* length of path */ 717 int type_len, /* length of type */ 718 int retText_len /* length of return text buffer */ 719 ) 723 720 { 724 721 int retVal = 0; … … 743 740 } 744 741 745 retVal = rp_lib_child_str( handle, 746 inPath, 747 "type", 748 inType, 749 childNum, 750 retText, 751 path_len, 752 5, 753 type_len, 754 retText_len 755 ); 742 retVal = rp_lib_child_str(handle, 743 inPath, 744 "type", 745 inType, 746 childNum, 747 retText, 748 path_len, 749 5, 750 type_len, 751 retText_len); 756 752 757 753 if (inPath) { … … 768 764 } 769 765 770 int rp_lib_child_str (int* handle, /* integer handle of library */771 772 773 774 775 776 777 778 779 780 766 int rp_lib_child_str(int* handle, /* integer handle of library */ 767 char* path, /* DOM path of requested object */ 768 char* flavor, /* information you want returned*/ 769 char* type, /* specific name of element */ 770 int* childNum, /* child number for iteration */ 771 char* retText, /* buffer to store return text */ 772 int path_len, /* length of path */ 773 int flavor_len, /* length of flavor */ 774 int type_len, /* length of type */ 775 int retText_len /* length of return text buffer */ 776 ) 781 777 { 782 778 int retVal = 0; … … 787 783 PyObject* list = NULL; 788 784 PyObject* list_item = NULL; 789 785 790 786 char* xmlChild = NULL; 791 787 char* inPath = NULL; 792 788 char* inType = NULL; 793 789 char* inFlavor = NULL; 794 790 795 791 inPath = null_terminate(path,path_len); 796 792 inFlavor = null_terminate(flavor,flavor_len); … … 801 797 lib = getObject(*handle); 802 798 if (lib) { 803 if (objType(inFlavor) == 1) {799 if (objType(inFlavor) == 1) { 804 800 805 801 list = rpChildren_f(lib, inPath, inFlavor); … … 832 828 } 833 829 } 834 else {835 836 }837 830 } 838 831 } … … 855 848 } 856 849 857 858 850 return retVal; 859 851 } 860 852 861 int rp_lib_child_obj ( int* handle, 862 char* path, 863 char* type, 864 int path_len, 865 int type_len 866 ) 853 int rp_lib_child_obj(int* handle, 854 char* path, 855 char* type, 856 int path_len, 857 int type_len) 867 858 { 868 859 int newObjHandle = -1; … … 870 861 PyObject* lib = NULL; 871 862 PyObject* list = NULL; 872 863 873 864 char* inPath = NULL; 874 865 char* inType = NULL; … … 880 871 if ((handle) && (*handle != 0)) { 881 872 lib = getObject(*handle); 882 873 883 874 if (lib) { 884 875 list = rpChildren_f(lib, inPath, "object"); … … 889 880 // Py_DECREF(list); 890 881 } 891 else {892 893 }894 882 } 895 883 } … … 907 895 908 896 return newObjHandle; 909 910 } 911 912 913 void rp_lib_get( int* handle, /* integer handle of library */ 914 char* path, /* null terminated path */ 915 char* retText, /* return text buffer for fortran*/ 916 int path_len, 917 int retText_len /* length of return text buffer */ 918 ) 897 } 898 899 900 void rp_lib_get(int* handle, /* integer handle of library */ 901 char* path, /* null terminated path */ 902 char* retText, /* return text buffer for fortran*/ 903 int path_len, 904 int retText_len /* length of return text buffer */ 905 ) 919 906 { 920 907 // int length_in = 0; … … 924 911 925 912 PyObject* lib = NULL; 926 913 927 914 char* inPath = NULL; 928 915 … … 932 919 if ((handle) && (*handle != 0)) { 933 920 lib = getObject(*handle); 934 921 935 922 if (lib) { 936 // retObj is a borrowed object 923 // retObj is a borrowed object 937 924 // whose contents must not be modified 938 925 xmlText = rpGet(lib, inPath); 939 926 940 927 if (xmlText) { 941 928 942 929 fortranify(xmlText, retText, retText_len); 943 930 944 931 /* 945 932 length_in = strlen(xmlText); … … 957 944 */ 958 945 } 959 960 946 } 961 947 } … … 966 952 inPath = NULL; 967 953 } 968 969 } 970 971 double rp_lib_get_double( int* handle, /* integer handle of library */ 972 char* path, /* null terminated path */ 973 int path_len 974 ) 954 } 955 956 double rp_lib_get_double(int* handle, /* integer handle of library */ 957 char* path, /* null terminated path */ 958 int path_len) 975 959 { 976 960 double retVal = 0.0; … … 978 962 979 963 PyObject* lib = NULL; 980 964 981 965 char* inPath = NULL; 982 966 … … 988 972 if ((handle) && (*handle != 0)) { 989 973 lib = getObject(*handle); 990 974 991 975 if (lib) { 992 // retObj is a borrowed object 976 // retObj is a borrowed object 993 977 // whose contents must not be modified 994 978 xmlText = rpGet(lib, inPath); 995 979 996 980 if (xmlText) { 997 981 retVal = atof(xmlText); 998 982 } 999 1000 983 } 1001 984 } … … 1011 994 1012 995 1013 void rp_lib_put_str( int* handle, 1014 char* path, 1015 char* value, 1016 int* append, 1017 int path_len, 1018 int value_len 1019 ) 996 void rp_lib_put_str(int* handle, 997 char* path, 998 char* value, 999 int* append, 1000 int path_len, 1001 int value_len) 1020 1002 { 1021 1003 char* inPath = NULL; … … 1024 1006 inPath = null_terminate(path,path_len); 1025 1007 inValue = null_terminate(value,value_len); 1026 1027 1008 1028 1009 if (inPath) { … … 1054 1035 1055 1036 1056 void rp_lib_put_id_str ( int* handle, 1057 char* path, 1058 char* value, 1059 char* id, 1060 int* append, 1061 int path_len, 1062 int value_len, 1063 int id_len 1064 ) 1065 { 1066 PyObject* lib = NULL; 1067 1037 void rp_lib_put_id_str(int* handle, 1038 char* path, 1039 char* value, 1040 char* id, 1041 int* append, 1042 int path_len, 1043 int value_len, 1044 int id_len) 1045 { 1046 PyObject* lib = NULL; 1047 1068 1048 char* inPath = NULL; 1069 1049 char* inValue = NULL; … … 1077 1057 if ((handle) && (*handle != 0)) { 1078 1058 lib = getObject(*handle); 1079 1059 1080 1060 if (lib) { 1081 1061 rpPut(lib, inPath, inValue, inId, *append); … … 1098 1078 inId = NULL; 1099 1079 } 1100 1101 } 1102 1103 void rp_lib_put_obj( int* handle, 1104 char* path, 1105 int* valHandle, 1106 int* append, 1107 int path_len 1108 ) 1080 } 1081 1082 void rp_lib_put_obj(int* handle, 1083 char* path, 1084 int* valHandle, 1085 int* append, 1086 int path_len) 1109 1087 { 1110 1088 char* inPath = NULL; … … 1125 1103 } 1126 1104 1127 void rp_lib_put_id_obj ( int* handle, 1128 char* path, 1129 int* valHandle, 1130 char* id, 1131 int* append, 1132 int path_len, 1133 int id_len 1134 ) 1105 void rp_lib_put_id_obj(int* handle, 1106 char* path, 1107 int* valHandle, 1108 char* id, 1109 int* append, 1110 int path_len, 1111 int id_len) 1135 1112 { 1136 1113 PyObject* lib = NULL; 1137 1114 PyObject* value = NULL; 1138 1115 1139 1116 char* inPath = NULL; 1140 1117 char* inId = NULL; … … 1147 1124 lib = getObject(*handle); 1148 1125 value = getObject(*valHandle); 1149 1126 1150 1127 if (lib && value) { 1151 // retObj is a borrowed object 1128 // retObj is a borrowed object 1152 1129 // whose contents must not be modified 1153 1130 rpPutObj(lib, inPath, value, inId, *append); … … 1165 1142 inId = NULL; 1166 1143 } 1167 1168 } 1169 1170 int rp_lib_remove (int* handle, char* path, int path_len) 1144 } 1145 1146 int rp_lib_remove(int* handle, char* path, int path_len) 1171 1147 { 1172 1148 int newObjHandle = -1; … … 1174 1150 PyObject* lib = NULL; 1175 1151 PyObject* removedObj = NULL; 1176 1152 1177 1153 char* inPath = NULL; 1178 1154 … … 1185 1161 if (lib) { 1186 1162 removedObj = rpRemove(lib, inPath); 1187 1163 1188 1164 if (removedObj) { 1189 1165 newObjHandle = storeObject(removedObj); 1190 1166 // Py_DECREF(removedObj); 1191 1167 } 1192 1193 1168 } 1194 1169 } 1195 1170 } 1196 1171 1197 1172 if (inPath) { 1198 1173 free(inPath); … … 1203 1178 } 1204 1179 1205 int rp_lib_xml_len 1180 int rp_lib_xml_len(int* handle) 1206 1181 { 1207 1182 int length = -1; … … 1229 1204 } 1230 1205 1231 void 1206 void rp_lib_xml(int* handle, char* retText, int retText_len) 1232 1207 { 1233 1208 // int length_in = 0; … … 1237 1212 1238 1213 PyObject* lib = NULL; 1239 1214 1240 1215 if (rapptureStarted) { 1241 1216 if ((handle) && (*handle != 0)) { … … 1244 1219 if (lib) { 1245 1220 xmlText = rpXml(lib); 1246 1221 1247 1222 if (xmlText) { 1248 1223 … … 1266 1241 free(xmlText); 1267 1242 } 1268 1269 1243 } 1270 1244 } … … 1321 1295 1322 1296 RpDictEntry DICT_TEMPLATE *hPtr; 1323 // RpDictIterator DICT_TEMPLATE iter((RpDict&)*this); 1297 // RpDictIterator DICT_TEMPLATE iter((RpDict&)*this); 1324 1298 RpDictIterator DICT_TEMPLATE iter(fortObjDict); 1325 1326 hPtr = iter.first(); 1327 1299 1300 hPtr = iter.first(); 1301 1328 1302 while (hPtr) { 1329 1303 Py_DECREF(*(hPtr->getValue())); 1330 1304 hPtr->erase(); 1331 hPtr = iter.next(); 1305 hPtr = iter.next(); 1332 1306 } 1333 1307 … … 1341 1315 } 1342 1316 1343 void rp_result(int* handle) { 1317 void rp_result(int* handle) 1318 { 1344 1319 PyObject* lib = NULL; 1345 1320 … … 1353 1328 } 1354 1329 1355 int objType( char* flavor) 1330 int objType( char* flavor) 1356 1331 { 1357 1332 if (flavor == NULL) { … … 1359 1334 return 0; 1360 1335 } 1361 else if ((*flavor == 'o')&&(strncmp(flavor,"object", 6)==0)){1336 else if ((*flavor == 'o') && (strncmp(flavor,"object", 6) == 0)) { 1362 1337 // return a PyObject* 1363 1338 return 0; 1364 1339 } 1365 else if ( 1366 ((*flavor == 't')&&(strncmp(flavor,"type", 4) == 0)) 1367 ||((*flavor == 'i')&&(strncmp(flavor,"id", 2) == 0)) 1368 ||((*flavor == 'c')&&(strncmp(flavor,"component", 9) == 0))) 1340 else if (((*flavor == 't') && (strncmp(flavor,"type", 4) == 0)) || 1341 ((*flavor == 'i') && (strncmp(flavor,"id", 2) == 0)) || 1342 ((*flavor == 'c') && (strncmp(flavor,"component", 9) == 0))) 1369 1343 { 1370 1344 // return a char* … … 1378 1352 } 1379 1353 1380 int storeObject(PyObject* objectName) {1381 1354 int storeObject(PyObject* objectName) 1355 { 1382 1356 int retVal = -1; 1383 1357 int dictKey = fortObjDict.size(); … … 1388 1362 // no error checking to make sure it was successful in entering 1389 1363 // the new entry. 1390 fortObjDict.set(dictKey,objectName, &newEntry); 1391 } 1392 1364 fortObjDict.set(dictKey,objectName, &newEntry); 1365 } 1366 1393 1367 retVal = dictKey; 1394 1368 return retVal; 1395 1369 } 1396 1370 1397 PyObject* getObject(int objKey) {1398 1371 PyObject* getObject(int objKey) 1372 { 1399 1373 PyObject* retVal = *(fortObjDict.find(objKey).getValue()); 1400 1374 … … 1404 1378 1405 1379 return retVal; 1406 1407 } 1380 } -
branches/uq/src/core/scew_extras.c
r5679 r5850 119 119 } 120 120 121 122 121 XML_Char const* 123 scew_element_set_contents_binary( 124 125 unsigned int* nbytes)122 scew_element_set_contents_binary(scew_element* element, 123 XML_Char const* bytes, 124 unsigned int* nbytes) 126 125 { 127 126 XML_Char* out = NULL;
Note: See TracChangeset
for help on using the changeset viewer.