On 02/22/2010 05:34 PM, rob yang wrote:
> Rolf, I did look at Jena3D before to see if someone else has already invented
> the wheel, but from what I can tell, Jena3D uses the browser file tag to
> upload to the server 1st, and then displays jmol applet loading these files
> from the server. So in other words, I thought it was a
> "browser->server->jmol" pipeline. But if I didn't read it right, I am curious
> to hear more about the "Jmol->browser->server" implementation that you are
> referring to.
Yes, you are right. For file upload Jena3D uses "Browser->Server->Jmol".
This is necessary to allow local file viewing with the unsigned applet.
The "Jmol->Browser->Server->Browser" pipeline is used for getting a
snapshot of the current view from the unsigned applet into the browser.
The problem here is to display the snapshot in the browser, so that the
user can save the image manually.
The command 'jmolGetPropertyAsString("image")' generates a base64
encoded JPEG image and puts it into a Javascript variable.
Firefox and other browsers could display this image directly, but not
IE. Although there are also workarounds for IE I prefered installing a
single reliable method for all browsers. So the Javascript variable is
actually a form parameter. And after Jmol generated the image the form
is sent to the server. The server decodes the base64 and sends back the
plain JPEG image which is displayed in the browser.
So what is needed is a form definition. Then the parameters must be set,
especially the image data. And finally the form must be submitted.
This all happens within the "onClick" definition of the "snapshot"
button within Jena3D:
<input class="jmol" type="button" id="snapshot" value="snapshot"
onClick='document.getElementById("bounce_image").target=Math.random();
document.getElementById("IMAGE_DATA").value=jmolGetPropertyAsString("image");
document.getElementById("IMAGE_WIDTH").value=jmolEvaluate("_width");
document.getElementById("IMAGE_HEIGHT").value=jmolEvaluate("_height");
document.getElementById("bounce_image").submit()'>
> Namely, I wonder if the route of passing the file contents of jmol to browser
> and then browser to server is do-able.
>
So you would have to replace the command
'jmolGetPropertyAsString("image")' by a command to get the file content.
If you were lucky it would be 'jmolGetPropertyAsString("file")'. I don't
know it. But I am rather sure that there is some way to get the file
information into a Javascript variable.
The only problem I observed here was the data size. There seems to be
some system dependent security restriction in the amount of data
transferred from Jmol to the browser.
Regards,
Rolf
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users