|
From: Joerg K. W. <we...@in...> - 2003-06-25 07:31:22
|
Hello,
> how can use 3D viewer in JOELib?
> regards
two ways:
1. call simple application
joelib-dir> sh viewer.sh yourMoleculeFile.extension
JOElib will load the given yourMoleculeFile and detects the file format
from the given extension.
To get an overview over the implementation have a look at:
joelib.gui.molviewer.java3d.ViewerFrame
2. create your own application (embed 3D viewer in your JFrame)
the relevant class is:
joelib.gui.molviewer.java3d.graphics3D.JPanel3D
and
joelib.gui.molviewer.java3d.util.MolViewerEventAdapter
when you want to catch clicked atoms and bonds.
private JPanel3D molPanel; //a private global variable
private CentralLookup lookup; //a private global variable
...
lookup = CentralLookup.getLookup();
molPanel = new JPanel3D();
CentralDisplayAdapter c = new CentralDisplayAdapter(molPanel);
lookup.addObject("CentralDisplay", c);
molPanel.addMolViewerEventListener(new MolViewerEventAdapter());
// now you can add the molPanel to your frame, e.g.
// this.add(molPanel, BorderLayout.CENTER);
...
// how to change molecules and options ???
molPanel.setRenderStyle(RenderStyle.BALL_AND_STICK);
molPanel.setRenderStyle(RenderStyle.STICK);
molPanel.setRenderStyle(RenderStyle.WIRE);
// when changing atoms or delete bonds or something you should use
molPanel.clear();
molPanel.addMolecule(changedMolecule);
...
// for more examples have a look at
//joelib.gui.molviewer.java3d.ViewerFrame
// e.g. adding H's, delete H's, change atomPropertyColoring, ....
the event adapter class catches the events and prints them to the
standard output.
If you want your own methods you can simply create your class
cp MolViewerEventAdapter MyMolViewerEventAdapter
with a replaced functionality in the methods:
atomPicked and bondPicked !
and use instead
molPanel.addMolViewerEventListener(new MyMolViewerEventAdapter());
> M.Karthikeyan
Regards, Joerg
P.S.: I've found a bug in stripSalts and more serious in deleteBond in
the JOEMol class, because i've changed some time ago the return value of
getContigousFragments(), so be aware that i've fixed it, but it's not
checked in until now.
P.P.S.: I've activated the JNI interface to Ghemical to calculate
Tripos5.2 MM and minimize molecule energy (rotatable bonds).
Unfortunately this works only under Windows/Cygwin and Linux/IBM-SDK,
because SUN's JDK causes some internal JNI exceptions (JDK BUG!!!).
Let's see if this will be stable enough to make it available with JOELib.
--
Dipl. Chem. Joerg K. Wegner
Univ. Tuebingen, Computer Architecture, Sand 1, D-72076 Tuebingen, Germany
Tel. (+49/0) 7071 29 78970, Fax (+49/0) 7071 29 5091
E-Mail: mailto:we...@in...
WWW: http://www-ra.informatik.uni-tuebingen.de
|