Package org.jmol.api
Class JmolViewer
java.lang.Object
org.jmol.api.JmolViewer
- Direct Known Subclasses:
Viewer
JmolViewer is the main API for the Viewer class.
(Mosty) we try to not change this (much), whereas the varius
"public" methods of Viewer, ModelSet, and other classes are public
only for internal cross-package access, not for external use.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddSelectionListener(JmolSelectionListener listener) static JmolViewerallocateViewer(Object container, JmolAdapter jmolAdapter) a simpler optionstatic JmolViewerallocateViewer(Object display, JmolAdapter modelAdapter, String fullName, URL documentBase, URL codeBase, String commandOptions, JmolStatusListener statusListener) legacy onlyprotected static JmolViewerallocateViewer(Object display, JmolAdapter modelAdapter, String fullName, URL documentBase, URL codeBase, String commandOptions, JmolStatusListener statusListener, GenericPlatform implementedPlatform) This is the older main access point for creating an application or applet vwr.abstract voidcalcAtomsMinMax(javajs.util.BS bs, BoxInfo boxInfo) abstract booleanabstract voidabstract voidabstract StringclipImageOrPasteText(String text) abstract voiddeleteMeasurement(int i) voiddispose()abstract Stringabstract StringevalString(String strScript) abstract StringevalStringQuiet(String script) abstract ObjectevaluateExpression(Object expression) abstract SVevaluateExpressionAsVariable(Object expression) abstract StringextractMolData(String what) abstract intfindNearestAtomIndex(int x, int y) abstract StringgenerateOutputForExport(Map<String, Object> params) for POV-Rayabstract intabstract booleangetBoolean(int tok) abstract booleangetBooleanProperty(String propertyName) abstract javajs.util.P3abstract javajs.util.V3abstract Stringabstract Stringabstract javajs.util.BSgetElementsPresentBitSet(int modelIndex) abstract Stringabstract Stringabstract floatgetFloat(int tok) abstract byte[]getImageAsBytes(String type, int width, int height, int quality, String[] errMsg) abstract intgetInt(int tok) static Stringstatic Stringabstract shortabstract intabstract int[]abstract StringgetMeasurementStringValue(int i) abstract JmolAdapterabstract intabstract StringgetModelName(int modelIndex) abstract intgetModelNumber(int modelIndex) abstract StringgetModelNumberDotted(int modelIndex) abstract PropertiesgetModelProperties(int modelIndex) abstract Stringabstract Stringabstract Propertiesabstract intabstract StringgetOpenSmiles(javajs.util.BS atoms) abstract ObjectgetParameter(String name) abstract ObjectgetProperty(String returnType, String infoType, Object paramInfo) abstract intabstract ObjectgetScreenImageBuffer(Object g, boolean isImageWrite) abstract intabstract StringgetSetHistory(int howFarBack) abstract javajs.util.BSgetSmartsMatch(String smarts, javajs.util.BS bsSelected) abstract StringgetSmiles(javajs.util.BS atoms) abstract Stringabstract javajs.util.BSabstract voidabstract voidabstract booleanabstract StringloadInline(String strModel) abstract StringloadInline(String[] arrayModels) abstract StringloadInline(String[] arrayModels, boolean isAppend) abstract StringloadInline(String strModel, char newLine) abstract StringloadInline(List<Object> arrayData, boolean isAppend) NOTE: THIS METHOD DOES NOT PRESERVE THE STATEabstract StringloadInlineAppend(String strModel, boolean isAppend) abstract voidnotifyStatusReady(boolean isReady) abstract voidabstract Stringabstract StringvoidopenFileAsync(String fileName) abstract voidopenFileAsyncSpecial(String fileName, int flags) abstract voidopenFileAsyncSpecialType(String fileName, int flags, String fileType) abstract StringopenReader(String fullPathName, Object reader) Opens the file and creates the model set, given the reader.abstract StringopenReader(String fullPathName, String fileName, Object reader) Opens the file and creates the model set, given the reader.abstract StringopenStringInline(String strModel) abstract StringoutputToFile(Map<String, Object> params) abstract voidpopHoldRepaint(String why) abstract voidabstract voidrebond()abstract voidabstract voidabstract voidremoveSelectionListener(JmolSelectionListener listener) abstract voidrenderScreenImage(Object g, int width, int height) voidrenderScreenImage(Object g, Object currentSize, Object rectClip) Deprecated.abstract int[]resizeInnerPanel(int width, int height) abstract voidabstract Stringstarting with 14.8.2-beta-2017-02-06, uses script(xxxx) function; see runScriptCautiously for the older versionrunScriptCautiously(String script) Formerly runScript(script).abstract Stringabstract ObjectscriptCheck(String script) abstract StringscriptWait(String script) abstract ObjectscriptWaitStatus(String script, String statusList) abstract voidabstract voidsetAnimationFps(int framesPerSecond) abstract voidsetAutoBond(boolean autoBond) abstract voidsetAxesOrientationRasmol(boolean axesMessedUp) abstract voidsetBondTolerance(float bondTolerance) abstract voidsetBooleanProperty(String propertyName, boolean value) abstract voidabstract voidsetColorBackground(String colorName) voidsetConsole(JmolAppConsoleInterface console) sets a custom console -- should be called IMMEDIATELY following allocateViewer create your console with, perhaps: new org.openscience.jmol.app.jmolPanel.AppConsole(vwr, displayFrame, externalJPanel, buttonsEnabled); (see examples/basic/org/jmol/Integration.javaabstract voidsetDebugScript(boolean debugScript) abstract voidsetFloatProperty(String propertyName, float value) abstract voidsetFrankOn(boolean frankOn) abstract voidsetInMotion(boolean isInMotion) abstract voidsetIntProperty(String propertyName, int value) abstract voidsetJmolCallbackListener(JmolCallbackListener jmolCallbackListener) abstract voidabstract voidsetJmolStatusListener(JmolStatusListener jmolStatusListener) abstract voidsetMarBond(short marBond) abstract voidabstract voidsetMinBondDistance(float minBondDistance) abstract voidsetPercentVdwAtom(int percentVdwAtom) abstract voidsetPerspectiveDepth(boolean perspectiveDepth) abstract voidabstract voidsetScreenDimension(int width, int height) abstract voidsetSelectionSet(javajs.util.BS newSelection) abstract voidsetShowHydrogens(boolean showHydrogens) abstract voidsetShowMeasurements(boolean showMeasurements) abstract voidsetStringProperty(String propertyName, String value) abstract voidsetVectorScale(float vectorScaleValue) abstract voidsetVibrationPeriod(float vibrationPeriod) abstract voidsetVibrationScale(float vibrationScaleValue) abstract voidabstract voidsyncScript(String script, String applet, int port) abstract StringwriteTextFile(String string, String data)
-
Field Details
-
apiPlatform
-
Constructor Details
-
JmolViewer
public JmolViewer()
-
-
Method Details
-
getFloat
public abstract float getFloat(int tok) -
getInt
public abstract int getInt(int tok) -
getBoolean
public abstract boolean getBoolean(int tok) -
allocateViewer
protected static JmolViewer allocateViewer(Object display, JmolAdapter modelAdapter, String fullName, URL documentBase, URL codeBase, String commandOptions, JmolStatusListener statusListener, GenericPlatform implementedPlatform) This is the older main access point for creating an application or applet vwr. You can also use That is necessary when compiled into JavaScript using Java2Script In Jmol 11.6 it was manditory that one of the next commands is either vwr.evalString("ZAP"); or at least: vwr.setAppletContext("",null,null,"") One or the other of these was necessary to establish the first modelset, which might be required by one or more later evaluated commands or file loadings. Starting with Jmol 11.7, setAppletContext is rolled into allocateViewer so that the full initialization is done all at once. Starting with Jmol 12.3.13, we allow for preconstructed ApiPlatform- Parameters:
display-modelAdapter-fullName-documentBase-codeBase-commandOptions-statusListener-implementedPlatform-- Returns:
- a JmolViewer object
-
allocateViewer
a simpler option- Parameters:
container-jmolAdapter-- Returns:
- JmolViewer object
-
allocateViewer
public static JmolViewer allocateViewer(Object display, JmolAdapter modelAdapter, String fullName, URL documentBase, URL codeBase, String commandOptions, JmolStatusListener statusListener) legacy only- Parameters:
display-modelAdapter-fullName-documentBase-codeBase-commandOptions-statusListener-- Returns:
- JmolViewer object
-
setConsole
sets a custom console -- should be called IMMEDIATELY following allocateViewer create your console with, perhaps: new org.openscience.jmol.app.jmolPanel.AppConsole(vwr, displayFrame, externalJPanel, buttonsEnabled); (see examples/basic/org/jmol/Integration.java- Parameters:
console- the console to use
-
setInMotion
public abstract void setInMotion(boolean isInMotion) -
getSmartsMatch
public abstract javajs.util.BS getSmartsMatch(String smarts, javajs.util.BS bsSelected) throws Exception - Throws:
Exception
-
getJmolVersion
-
getJmolVersionNoDate
-
generateOutputForExport
for POV-Ray- Parameters:
params-- Returns:
- INI file
-
setJmolCallbackListener
-
setJmolStatusListener
-
checkHalt
-
haltScriptExecution
public abstract void haltScriptExecution() -
pushHoldRepaint
public abstract void pushHoldRepaint() -
popHoldRepaint
-
getData
-
getSmiles
- Throws:
Exception
-
getOpenSmiles
- Throws:
Exception
-
setScreenDimension
public abstract void setScreenDimension(int width, int height) -
getScreenWidth
public abstract int getScreenWidth() -
getScreenHeight
public abstract int getScreenHeight() -
getScreenImageBuffer
-
releaseScreenImage
public abstract void releaseScreenImage() -
writeTextFile
-
outputToFile
- Parameters:
params- include type, fileName, text, bytes, quality, width, height- Returns:
- null (canceled) or a message starting with OK or an error message
-
getImageAsBytes
public abstract byte[] getImageAsBytes(String type, int width, int height, int quality, String[] errMsg) - Parameters:
type-width-height-quality-errMsg- TODO- Returns:
- base64-encoded or binary version of the image
-
getMotionEventNumber
public abstract int getMotionEventNumber() -
openReader
Opens the file and creates the model set, given the reader. not used in Jmol- Parameters:
fullPathName- full path name or nullreader- a Reader, byte[], or BufferedInputStream- Returns:
- null or error message
-
openReader
Opens the file and creates the model set, given the reader. name is a text name of the file ... to be displayed in the window no need to pass a BufferedReader ... ... the FileManager will wrap a buffer around it not used in Jmol- Parameters:
fullPathName- or nullfileName- (no path) or nullreader- Reader, byte[], or BufferedInputStream- Returns:
- null or error message
-
showUrl
-
calcAtomsMinMax
-
getBoundBoxCenter
public abstract javajs.util.P3 getBoundBoxCenter() -
getBoundBoxCornerVector
public abstract javajs.util.V3 getBoundBoxCornerVector() -
getMeasurementCount
public abstract int getMeasurementCount() -
getMeasurementStringValue
-
getMeasurementCountPlusIndices
public abstract int[] getMeasurementCountPlusIndices(int i) -
getElementsPresentBitSet
public abstract javajs.util.BS getElementsPresentBitSet(int modelIndex) -
findNearestAtomIndex
public abstract int findNearestAtomIndex(int x, int y) -
script
-
scriptCheck
-
scriptWait
-
scriptWaitStatus
-
loadInline
-
loadInlineAppend
-
loadInline
-
loadInline
-
loadInline
- Parameters:
arrayModels- and array of models, each of which is a StringisAppend-- Returns:
- null or error message
-
loadInline
NOTE: THIS METHOD DOES NOT PRESERVE THE STATE- Parameters:
arrayData- a Vector of models, where each model is either a String or a String[] or a VectorisAppend- TRUE to append models (no ZAP)- Returns:
- null or error message
-
evalStringQuiet
-
isScriptExecuting
public abstract boolean isScriptExecuting() -
getModelSetFileName
-
getModelSetPathName
-
getModelSetProperties
-
getModelSetAuxiliaryInfo
-
getModelProperties
-
getModelNumber
public abstract int getModelNumber(int modelIndex) -
getModelName
-
getModelNumberDotted
-
getVisibleFramesBitSet
public abstract javajs.util.BS getVisibleFramesBitSet() -
addSelectionListener
-
removeSelectionListener
-
homePosition
public abstract void homePosition() -
getBackgroundArgb
public abstract int getBackgroundArgb() -
getMadBond
public abstract short getMadBond() -
rebond
public abstract void rebond() -
refresh
-
notifyViewerRepaintDone
public abstract void notifyViewerRepaintDone() -
getBooleanProperty
-
getParameter
-
getSetHistory
-
getStateInfo
-
syncScript
-
setColorBackground
-
setJmolDefaults
public abstract void setJmolDefaults() -
setRasmolDefaults
public abstract void setRasmolDefaults() -
setBooleanProperty
-
setIntProperty
-
setFloatProperty
-
setStringProperty
-
setShowHydrogens
public abstract void setShowHydrogens(boolean showHydrogens) -
setShowMeasurements
public abstract void setShowMeasurements(boolean showMeasurements) -
setPerspectiveDepth
public abstract void setPerspectiveDepth(boolean perspectiveDepth) -
setAutoBond
public abstract void setAutoBond(boolean autoBond) -
setMarBond
public abstract void setMarBond(short marBond) -
setBondTolerance
public abstract void setBondTolerance(float bondTolerance) -
setMinBondDistance
public abstract void setMinBondDistance(float minBondDistance) -
setAxesOrientationRasmol
public abstract void setAxesOrientationRasmol(boolean axesMessedUp) -
setPercentVdwAtom
public abstract void setPercentVdwAtom(int percentVdwAtom) -
setAnimationFps
public abstract void setAnimationFps(int framesPerSecond) -
setFrankOn
public abstract void setFrankOn(boolean frankOn) -
setDebugScript
public abstract void setDebugScript(boolean debugScript) -
deleteMeasurement
public abstract void deleteMeasurement(int i) -
clearMeasurements
public abstract void clearMeasurements() -
setVectorScale
public abstract void setVectorScale(float vectorScaleValue) -
setVibrationScale
public abstract void setVibrationScale(float vibrationScaleValue) -
setVibrationPeriod
public abstract void setVibrationPeriod(float vibrationPeriod) -
selectAll
public abstract void selectAll() -
clearSelection
public abstract void clearSelection() -
setSelectionSet
public abstract void setSelectionSet(javajs.util.BS newSelection) -
setCenterSelected
public abstract void setCenterSelected() -
rotateFront
public abstract void rotateFront() -
getModelAdapter
-
openFileAsyncSpecial
-
openFileAsyncSpecialType
-
openFileAsync
-
getErrorMessage
-
getErrorMessageUn
-
renderScreenImage
Deprecated.old -- not used in 12.2- Parameters:
g-currentSize-rectClip- // unused
-
renderScreenImage
-
evalFile
-
evalString
-
openStringInline
-
openDOM
-
openFile
-
openFiles
-
getProperty
- Parameters:
returnType- "JSON", "string", "readable", and anything else returns the Java object.infoType-paramInfo-- Returns:
- property data -- see org.jmol.viewer.PropertyManager.java
-
evaluateExpression
- Parameters:
expression-- Returns:
- a String representation of the evaluated expression
-
evaluateExpressionAsVariable
- Parameters:
expression-- Returns:
- a String representation of the evaluated expression as a script variable (org.jmol.script.SV)
-
resizeInnerPanel
public abstract int[] resizeInnerPanel(int width, int height) -
runScript
starting with 14.8.2-beta-2017-02-06, uses script(xxxx) function; see runScriptCautiously for the older version- Parameters:
script-- Returns:
- string from ScriptEvaluator#outputBuffer
-
runScriptCautiously
Formerly runScript(script). run a script immediately and return output buffer string Jmol 13.1.15- Parameters:
script-- Returns:
- string from ScriptEvaluator#outputBuffer
-
extractMolData
-
getClipboardText
-
clipImageOrPasteText
-
notifyStatusReady
public abstract void notifyStatusReady(boolean isReady) -
getModelIndexFromId
- Parameters:
id- some_id, filename#id, or ~fileNo.modelNo added ".basemodel" indicates to get the first model in a series from a JDX-MOL file.- Returns:
- model index if found; -2 if file found but model not found -2 if no file indicated and no model found -1 if no such file
-
setMenu
-
dispose
public void dispose()
-