Re: ION data reuse [message #28489] |
Mon, 10 December 2001 14:36  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
Although I am not 100% sure, what little I do understand about ION Script
leads me to believe that it isn't possible to share data between two
separate calls to <ION_IMAGE>. I can think of two ways to get around this
limitation and I would guess that you already have thought of them.
You could render both images in the same image, placing a band of color
between them that matches your page background giving the illusion of two
images. Another option would be to write the 2 images to a temp directory,
send a delete command to "at" (spawn, 'echo "rm -f /tmp/'+filename+'" | at
now + 5 minutes') and use the <ION_DATA_OUT> tag to create your HTML page
and link to your newly created images. I take the latter approach with VRML
models and it works quite well.
for example:
<ION_BODY>
<ION_DATA_OUT PRE="FALSE" ASTEXT="FALSE" DEBUG="FALSE">
<IDL>
;read in data
;plot image to Z buffer or IDL_grBuffer
;create a file name
file1='/tmp/'+STRING(FIX(10000. * RANDOMU(s)),
FORMAT='(I5.5)')+'.wrl'
;write it to disk
;do it again for the 2nd image
file2='/tmp/'+STRING(FIX(10000. * RANDOMU(s)),
FORMAT='(I5.5)')+'.wrl'
;submit the rm commands to at
spawn, 'echo "rm -f '+file1+'" | at now + 1 minute'
spawn, 'echo "rm -f '+file2+'" | at now + 1 minute'
;create the web page
print, '<HTML>'
print, '<HEAD>'
print, ' '
print, '</HEAD>'
print, '<BODY bgcolor="#dddddd" link="#FF0000" vlink="#b23e3b">'
print, '<FONT face="Arial, Helvetica, sans-serif" size="2">'
print, '<IMG src="'+file1+'"width="411" height="288" alt="my plot
1">'
print, '<IMG src="'+file2+'"width="411" height="288" alt="my plot
2">'
print, '</FONT>'
print, '</BODY>'
print, '</HTML>'
</IDL>
</ION_DATA_OUT>
</ION_BODY>
If you do figure out how to extend the scope of data read within ION_IMAGE
tags to outside the tags, please post it!
-Rick Towler
"Ken Mankoff" <mankoff@lasp.colorado.edu> wrote in message
news:Pine.LNX.4.33.0112071206530.21824-100000@snoe.colorado. edu...
> Hi,
>
> I would like to produce two images in an ION page, but use the same
> dataset for each image. This dataset is large, and I only want to load it
> once. Here is the current setup:
>
> 1) user fills out a form specifying lat/lon boundaries. Submit button
> loads a new ION page
>
> 2) ION page loads lat/lon region from global file, displays. All this
> happens in an <ION_IMAGE> tag
>
> 3) Repeat (2), but do some additional processing before displaying.
>
> Since the exact same lat/lon region is read off disk in (2) and (3), it in
> inefficient. Does anyone know how to load it only once?
>
> Thanks,
> -k.
>
> --
> Ken Mankoff
> LASP://303.492.3264
> http://lasp.colorado.edu/~mankoff/
>
|
|
|
Re: ION data reuse [message #28701 is a reply to message #28489] |
Fri, 04 January 2002 11:00  |
Ken Mankoff
Messages: 158 Registered: February 2000
|
Senior Member |
|
|
On Mon, 10 Dec 2001, Rick Towler wrote:
> Although I am not 100% sure, what little I do understand about ION Script
> leads me to believe that it isn't possible to share data between two
> separate calls to <ION_IMAGE>. I can think of two ways to get around this
> limitation and I would guess that you already have thought of them.
>
> You could render both images in the same image, placing a band of color
> between them that matches your page background giving the illusion of two
> images. Another option would be to write the 2 images to a temp directory,
> send a delete command to "at" (spawn, 'echo "rm -f /tmp/'+filename+'" | at
> now + 5 minutes') and use the <ION_DATA_OUT> tag to create your HTML page
> and link to your newly created images. I take the latter approach with VRML
> models and it works quite well.
Hi Rick, ng
Thanks for the suggestion. That is working for me now, but it was
difficult to get it working. The ION/webserver process needs to have the
ability to write to disc *and* spawn processes *and* the location that the
IDL process writes needs to be accessible by the web server for the
regular <IMG> tags... But it does work (thanks to my sysadmin).
I *think* there is a third way to get shared data. Currently, the HTML
page that is on the recieving end of the SUBMIT button has the following:
<VARIABLE_DECL NAME="var" VALUE="$Form.var" TYPE="INT" PERSIST="TRUE />
And I can use $var in multiple <ION_IMAGE> tags.
The third method would involve using an intermediate page with a
<META REFRESH=0 ...> tag, and a hidden form var. This page would fill the
form var based upon the original pages form submission values, and then a
second later refresh to the final destination page. The final destination
page has a persistent variable (filled by the intermediate page) that is
usable across multiple <ION_IMAGE> tags.
The problem with this is that i *hate* websites that use REFRESH=0,
because then my back button doesnt work as expected...
I wont try implementing this anytime soon, but its food for thought...
-k.
p.s. If you want to see the site, you can get to it here:
http://lasp.colorado.edu/marsrobot/
click on "VirtualMars"
--
Ken Mankoff
LASP://303.492.3264
http://lasp.colorado.edu/~mankoff/
|
|
|