Dear all,
In my last email, I was wondering how to
retrieve variable content of the Jmol environment,
from a standalone java application.
It seems that methods like getAtomNumber
or getAtomPoint3f of the class
JmolViewer are able to return some data. But these
data are specific to objects like atoms, or bonds. However,
what I need is something slightly different.
In my Jmol application, I display a bound box
that can be rotated, scaled, translated, and
I want to get back the final volume, corner
coordinates ... These data are encapsulated in
some variables of my Jmol application.
But how can I get back them ?
Any help will be appreciated.
Thanks.
Eric
Le 10 mai 2014 à 19:41, eric henon a écrit :
> Dear Bob,
>
>
> Thank you for your reply, that works fine !
>
> Just a last question: how to get back jMol variable values into
> the parent java application ?
>
> Thanks in advance for your help.
> Eric
>
>>
>> Message: 2
>> Date: Mon, 5 May 2014 17:56:59 -0500
>> From: Robert Hanson <hans...@stolaf.edu>
>> Subject: Re: [Jmol-developers] Running Script commands directly from a
>> Java application
>> To: Jmol Developers <jmol-developers@lists.sourceforge.net>
>> Message-ID:
>> <CAF_YUvU3xKpVN4SSx=vNPLc2_cp=wb-jbq-hxuze0sutjao...@mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Sure. All the menus do this. The toolbar buttons in the Java application,
>> the surface tool dialog does this. File...Export...Gaussian has buttons. So
>> check out org.openscience.jmol.app and included classes. The template is
>> something like this:
>>
>> JButton goButton;
>> JmolViewer viewer;
>> ...
>> goButton = new JButton("Turn the background to red");
>> goButton.setActionCommand("background red");
>> goButton.addActionListener(this);
>> ...
>>
>> @Override
>> public void actionPerformed(ActionEvent e) {
>> Object source = e.getSource();
>> if (source == goButton) {
>> viewer.script(((JButton)goButton).getActionCommand());
>> }
>> }
>>
>>
>> Various ways to embellish upon that.
>>
>> Bob
>>
>>
>>
>>
>>
>>
>> On Mon, May 5, 2014 at 9:21 AM, eric henon <eric.he...@univ-reims.fr> wrote:
>>
>>> Dear all,
>>>
>>> Last year, I built an web application using the jmolApplet.
>>> This applet (JBox) allows for embedding a protein in a boundbox,
>>> which can interactively be translated, zoomed in, or
>>> even individually rotated about three axis.
>>>
>>> I would like now to built my own java application
>>> embedding jmol that would allow for the same possibilities
>>> (rotating, ... boundBox).
>>>
>>>
>>> I have already used the Integration.java example
>>> to create a JmolPanel. It works fine. However, instead of using the
>>> "text" AppConsole possibilities, I would like to add buttons
>>> in my own application that would automatically pass script commands
>>> (functions)
>>> directly to jmol. Is this possible ? Are there any example for something
>>> like that ?
>>>
>>> Thanks in advance.
>>> Eric
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Is your legacy SCM system holding you back? Join Perforce May 7 to find
>>> out:
>>> • 3 signs your SCM is hindering your productivity
>>> • Requirements for releasing software faster
>>> • Expert tips and advice for migrating your SCM now
>>> http://p.sf.net/sfu/perforce
>>> _______________________________________________
>>> Jmol-developers mailing list
>>> Jmol-developers@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>>>
>>
>>
>>
>> --
>> Robert M. Hanson
>> Larson-Anderson Professor of Chemistry
>> St. Olaf College
>> Northfield, MN
>> http://www.stolaf.edu/people/hansonr
>>
>>
>> If nature does not answer first what we want,
>> it is better to take what answer we get.
>>
>> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Thu, 8 May 2014 11:50:50 +0200
>> From: Angel Herr?ez <angel.herr...@uah.es>
>> Subject: Re: [Jmol-developers] What is the second Canvas2d for that
>> shows up below the active one when using JSmol?
>> To: <jmol-developers@lists.sourceforge.net>
>> Message-ID: <536b537a.7561.2d99d...@angel.herraez.uah.es>
>> Content-Type: text/plain; charset="US-ASCII"
>>
>> I'm having a similar problem as Jonathan's. Two canvas2d objects are
>> created.
>>
>> I believe there is something wrong with Jmol.getAppletHtml()
>> The problem does not happen when I use Jmol.getApplet() directly in the div.
>>
>> Note: I am using jquery-1.10.2.min.js plus JSmol.min.nojq.js
>>
>> Symptoms:
>>
>> - The page is taller (scroolbar) than its intended contents.
>>
>> - A square area below the actual JSmol square is sensitive to right-click
>> opening of the popup menu and also to zoom by mouse wheel.
>>
>> - Firefox Inspector gives this source code:
>> <div id="JmolOb_appletdiv" style="z-index: 15; width: 100%; height: 100%;
>> position: absolute; top: 0px; left: 0px; display: block;">
>> <script type="text/javascript"></script>
>> <canvas id="JmolOb_canvas2d" style="width: 100%; height: 100%;
>> z-index: 17;" width="400" height="400"></canvas>
>> <canvas id="JmolOb_canvas2d" style="width: 100%; height: 100%;"
>> width="400" height="400"></canvas>
>> </div>
>>
>>
>> This is my code in the page:
>>
>> <head>
>> <script>
>> /* viewerMolec is a global object-variable defined before, that holds many
>> parameters for the page.
>> */
>> viewerMolec.infoJmol = {
>> color: '#'+viewerCfg.bkg,
>> height: '100%',
>> width: '100%',
>> j2sPath: viewerMolec.pathJmol + 'j2s',
>> jarPath: viewerMolec.pathJmol + 'java',
>> jarFile: 'JmolAppletSigned0.jar',
>> isSigned: true,
>> serverURL: viewerMolec.pathJmol + 'php/jsmol.php',
>> loadstructcallback: 'viewer_OnModelLoad',
>> pickcallback: 'viewer_OnAtomOrBondPicked',
>> measureCallback: 'viewer_OnMeasures',
>> script: 'set frank off; /*etc*/ ',
>> zIndexBase: 15,
>> z: 15,
>> deferUncover:true,
>> coverImage:'cover.png',
>> use: 'html5'
>> };
>>
>> $(document).ready( function() {
>>
>> $('#viewerViewer').html(Jmol.getAppletHtml('JmolOb',viewerMolec.infoJmol))
>> ;
>> });
>> </script>
>>
>> <style>
>> #viewer { width:800px; height:400px; position:relative; }
>> #viewerTools { width:49%; height:100%; position:absolute; left:0; top:0;
>> overflow:hidden; }
>> #viewerViewer { width:50%; height:100%; position:absolute; left:50%; top:0; }
>> </style>
>> </head>
>>
>> <body>
>> <div id="viewer">
>> <div id="viewerTools">
>> // etc.
>> </div>
>> <div id="viewerViewer"><img src="cover.png">
>> </div>
>> </div>
>> </body>
>>
>>
>>
>>
>>
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Thu, 8 May 2014 10:06:54 -0500
>> From: Robert Hanson <hans...@stolaf.edu>
>> Subject: Re: [Jmol-developers] What is the second Canvas2d for that
>> shows up below the active one when using JSmol?
>> To: Jmol Developers <jmol-developers@lists.sourceforge.net>
>> Message-ID:
>> <caf_yuvw+uylr_1egwz601342cj3dd3wakff_8swoaj85hnd...@mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> That's not enough to go on. Yes, the applet is creating itself twice. As
>> described above, we need to check what is happening with
>>
>> proto._createCanvas2d
>>
>> You must determine why it is running twice.
>>
>> Also, correct your <img> tag. It is not closed.
>>
>>
>>
>>
>> On Thu, May 8, 2014 at 4:50 AM, Angel Herr?ez <angel.herr...@uah.es> wrote:
>>
>>> I'm having a similar problem as Jonathan's. Two canvas2d objects are
>>> created.
>>>
>>> I believe there is something wrong with Jmol.getAppletHtml()
>>> The problem does not happen when I use Jmol.getApplet() directly in the
>>> div.
>>>
>>> Note: I am using jquery-1.10.2.min.js plus JSmol.min.nojq.js
>>>
>>> Symptoms:
>>>
>>> - The page is taller (scroolbar) than its intended contents.
>>>
>>> - A square area below the actual JSmol square is sensitive to right-click
>>> opening of the popup menu and also to zoom by mouse wheel.
>>>
>>> - Firefox Inspector gives this source code:
>>> <div id="JmolOb_appletdiv" style="z-index: 15; width: 100%; height: 100%;
>>> position: absolute; top: 0px; left: 0px; display: block;">
>>> <script type="text/javascript"></script>
>>> <canvas id="JmolOb_canvas2d" style="width: 100%; height: 100%;
>>> z-index: 17;" width="400" height="400"></canvas>
>>> <canvas id="JmolOb_canvas2d" style="width: 100%; height: 100%;"
>>> width="400" height="400"></canvas>
>>> </div>
>>>
>>>
>>> This is my code in the page:
>>>
>>> <head>
>>> <script>
>>> /* viewerMolec is a global object-variable defined before, that holds many
>>> parameters for the page.
>>> */
>>> viewerMolec.infoJmol = {
>>> color: '#'+viewerCfg.bkg,
>>> height: '100%',
>>> width: '100%',
>>> j2sPath: viewerMolec.pathJmol + 'j2s',
>>> jarPath: viewerMolec.pathJmol + 'java',
>>> jarFile: 'JmolAppletSigned0.jar',
>>> isSigned: true,
>>> serverURL: viewerMolec.pathJmol + 'php/jsmol.php',
>>> loadstructcallback: 'viewer_OnModelLoad',
>>> pickcallback: 'viewer_OnAtomOrBondPicked',
>>> measureCallback: 'viewer_OnMeasures',
>>> script: 'set frank off; /*etc*/ ',
>>> zIndexBase: 15,
>>> z: 15,
>>> deferUncover:true,
>>> coverImage:'cover.png',
>>> use: 'html5'
>>> };
>>>
>>> $(document).ready( function() {
>>>
>>> $('#viewerViewer').html(Jmol.getAppletHtml('JmolOb',viewerMolec.infoJmol))
>>> ;
>>> });
>>> </script>
>>>
>>> <style>
>>> #viewer { width:800px; height:400px; position:relative; }
>>> #viewerTools { width:49%; height:100%; position:absolute; left:0; top:0;
>>> overflow:hidden; }
>>> #viewerViewer { width:50%; height:100%; position:absolute; left:50%;
>>> top:0; }
>>> </style>
>>> </head>
>>>
>>> <body>
>>> <div id="viewer">
>>> <div id="viewerTools">
>>> // etc.
>>> </div>
>>> <div id="viewerViewer"><img src="cover.png">
>>> </div>
>>> </div>
>>> </body>
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Is your legacy SCM system holding you back? Join Perforce May 7 to find
>>> out:
>>> • 3 signs your SCM is hindering your productivity
>>> • Requirements for releasing software faster
>>> • Expert tips and advice for migrating your SCM now
>>> http://p.sf.net/sfu/perforce
>>> _______________________________________________
>>> Jmol-developers mailing list
>>> Jmol-developers@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>>>
>>
>>
>>
>> --
>> Robert M. Hanson
>> Larson-Anderson Professor of Chemistry
>> St. Olaf College
>> Northfield, MN
>> http://www.stolaf.edu/people/hansonr
>>
>>
>> If nature does not answer first what we want,
>> it is better to take what answer we get.
>>
>> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>>
>> ------------------------------
>>
>> ------------------------------------------------------------------------------
>> Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
>> • 3 signs your SCM is hindering your productivity
>> • Requirements for releasing software faster
>> • Expert tips and advice for migrating your SCM now
>> http://p.sf.net/sfu/perforce
>>
>> ------------------------------
>>
>> _______________________________________________
>> Jmol-developers mailing list
>> Jmol-developers@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>>
>>
>> End of Jmol-developers Digest, Vol 96, Issue 1
>> **********************************************
>
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers