G'day
Eric suggested that the atom click also return, in some fashion, distance and angle data. for example, the distance would be the distance from the clicked atom to the previously clicked atom; the angle would include the previous two clicked atoms. the picking mode would not affect this data flow, which is a key element - as a developer, I could store all of this information for later use without having to deal with setting modes, unsetting modes, etc.
How about just returning a data structure that has *everything* known about the atom: id, name, type, coordinates, distances/angles to bonded neighbours, etc.. That way the simple stuff is covered immediately. For displaying to the user and for non-bonded distances/angles (including torsion angles) then the routine will have to, somehow (modes or click-patterns), know what it is that the user is asking for.
I'm a developer but not a Jmol developer, so the usual caveats apply...
What might be more robust is to have the callback simply return an atom ID (String, say, "<applet_id>.<structure_id>.<atom_id>") and have Jmol provide a public interface that can be queried from Javascript, e.g.
String getAtomName(String structure_id, atom_id)
float[] getAtomCoordinates(String structure_id, String atom_id)
float getAtomDistance(
String structure_id1, String atom_id_1,
String structure_id2, String atom_id_2
[, String units])
float getAtomAngle(
String structure_id1, String atom_id_1,
String structure_id2, String atom_id_2,
String structure_id3, String atom_id_3)
float getAtomTorsion(
String structure_id1, String atom_id_1,
String structure_id2, String atom_id_2,
String structure_id3, String atom_id_3)
String structure_id4, String atom_id_4)
etc.The problem with stuffing a whole lot of values into a single return string/datastructure is that these could change from one version of Jmol to the next possibly breaking your Javascript code. The above interface would be more stable from one release to the next.
OTOH, the approach I'm suggesting relies more on two-way Java-Javascript communication which has its problems.
Anyhow, just a suggestion.
Chris.
------------------------------------------------------- This SF.net email is sponsored by: 2005 Windows Mobile Application Contest Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones for the chance to win $25,000 and application distribution. Enter today at http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click _______________________________________________ Jmol-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-users

