Class JmolMolecularRenderer
java.lang.Object
org.episteme.natural.ui.viewers.chemistry.backends.JmolMolecularRenderer
- All Implemented Interfaces:
MolecularRenderer
Jmol-based molecular renderer backend.
Jmol is an open-source Java viewer for chemical structures in 3D. This backend wraps the Jmol API to provide advanced molecular visualization features including:
- High-quality ray-traced rendering
- Script-based automation
- Support for many file formats (PDB, CIF, MOL, XYZ, etc.)
- Advanced selection and coloring
- Animation and measurement tools
Requires Jmol library (jmol-*.jar) on the classpath.
* @see Jmol Project- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the current view.voidDraw a single atom.voidDraw a bond between two atoms.voidexecuteScript(String script) Executes a Jmol script command.Returns the backend type of this renderer.Gets the Jmol viewer instance for advanced control.Retrieves the native component (e.g.booleanChecks if Jmol is available and initialized.voidLoads a molecular structure from inline data.voidLoads a molecular structure from a file path.renderImage(int width, int height) Renders a ray-traced image of the current view.voidsetBackgroundColor(javafx.scene.paint.Color color) Set background color of the viewer.voidsetStyle(RenderStyle style) Set global rendering style.
-
Constructor Details
-
JmolMolecularRenderer
public JmolMolecularRenderer()Creates a new Jmol-based renderer. Falls back gracefully if Jmol is not available.
-
-
Method Details
-
isAvailable
public boolean isAvailable()Checks if Jmol is available and initialized. -
clear
public void clear()Description copied from interface:MolecularRendererClears the current view.- Specified by:
clearin interfaceMolecularRenderer
-
setStyle
Description copied from interface:MolecularRendererSet global rendering style.- Specified by:
setStylein interfaceMolecularRenderer- Parameters:
style- The style to apply.
-
drawAtom
Description copied from interface:MolecularRendererDraw a single atom.- Specified by:
drawAtomin interfaceMolecularRenderer- Parameters:
atom- The atom data model.
-
drawBond
Description copied from interface:MolecularRendererDraw a bond between two atoms.- Specified by:
drawBondin interfaceMolecularRenderer- Parameters:
bond- The bond data model.
-
setBackgroundColor
public void setBackgroundColor(javafx.scene.paint.Color color) Description copied from interface:MolecularRendererSet background color of the viewer.- Specified by:
setBackgroundColorin interfaceMolecularRenderer- Parameters:
color- JavaFX Color (Implementations may convert this).
-
getViewComponent
Description copied from interface:MolecularRendererRetrieves the native component (e.g. SubScene for JavaFX, JPanel for Swing/Jmol).- Specified by:
getViewComponentin interfaceMolecularRenderer- Returns:
- The UI component.
-
getBackend
Description copied from interface:MolecularRendererReturns the backend type of this renderer.- Specified by:
getBackendin interfaceMolecularRenderer- Returns:
- The backend enum.
-
executeScript
Executes a Jmol script command.- Parameters:
script- The Jmol script to execute
-
loadFile
Loads a molecular structure from a file path.- Parameters:
filePath- Path to structure file (PDB, CIF, MOL, XYZ, etc.)
-
loadData
-
renderImage
Renders a ray-traced image of the current view.- Parameters:
width- Image widthheight- Image height- Returns:
- Path to rendered image, or null if failed
-
getJmolViewer
Gets the Jmol viewer instance for advanced control.- Returns:
- The JmolViewer object, or null if not initialized
-