Difference between revisions of "Jmol JavaScript Object/JSV"

From Jmol
Jump to navigation Jump to search
(getting specialized subsections out of the main Jmol-JSO page)
(Info variable for JSV)
Line 12: Line 12:
  
 
== Creating and inserting the JSpecView applet ==  
 
== Creating and inserting the JSpecView applet ==  
To create a JSpecView applet, use <code>Jmol.getJSVApplet()</code>.
+
To create a JSpecView applet, use for example:
 +
var myJSV = Jmol.getJSVApplet("myJSV", Info)
 +
 
 +
Parameters making the <code>Info</code> variable (with default values shown between angular brackets):
 +
* '''Info.height''' <<code>500</code>>
 +
* '''Info.width''' <<code>300</code>>
 +
* '''Info.debug''' <<code>false</code>>
 +
* '''Info.jarPath''' <<code>.</code>>
 +
* '''Info.jarFile''' <<code>JSpecViewApplet.jar</code>>
 +
* '''Info.isSigned''' <<code>false</code>>
 +
* '''Info.initParams''' <empty>
 +
* '''Info.readyFunction''' <empty>
 +
* '''Info.script''' <empty>
  
Syntax:
 
Jmol.getJSVApplet = function(id, Info)
 
  
 
== JSpecView-specific methods ==
 
== JSpecView-specific methods ==
Line 22: Line 32:
  
 
Syntax:
 
Syntax:
  Jmol.jsvAddHightlight = function(jsvApplet, x1, x2, r, g, b, a)  
+
  Jmol.jsvAddHightlight(myJSV, x1, x2, r, g, b, a)  
  Jmol.jsvExport = function(jsvApplet, exportType, n)  
+
  Jmol.jsvExport(myJSV, exportType, n)  
  Jmol.jsvGetCoordinate = function(jsvApplet)  
+
  Jmol.jsvGetCoordinate(myJSV)  
  Jmol.jsvGetPropertyAsJavaObject = function(jsvApplet, key)  
+
  Jmol.jsvGetPropertyAsJavaObject(myJSV, key)  
  Jmol.jsvGetPropertyAsJSON = function(jsvApplet, key)  
+
  Jmol.jsvGetPropertyAsJSON(myJSV, key)  
  Jmol.jsvGetSolnColour = function(jsvApplet)  
+
  Jmol.jsvGetSolnColour(myJSV)  
  Jmol.jsvIsPro = function(jsvApplet)  
+
  Jmol.jsvIsPro(myJSV)  
  Jmol.jsvIsSigned = function(jsvApplet)  
+
  Jmol.jsvIsSigned(myJSV)  
  Jmol.jsvLoadInline = function(jsvApplet, data, params)
+
  Jmol.jsvLoadInline(myJSV, data, params)
  Jmol.jsvRemoveAllHighlights = function(jsvApplet)  
+
  Jmol.jsvRemoveAllHighlights(myJSV)  
  Jmol.jsvRemoveHighlight = function(jsvApplet, x1, x2)
+
  Jmol.jsvRemoveHighlight(myJSV, x1, x2)
  Jmol.jsvReversePlot = function(jsvApplet)  
+
  Jmol.jsvReversePlot(myJSV)  
  Jmol.jsvRunScript = function(jsvApplet, script)
+
  Jmol.jsvRunScript(myJSV, script)
  Jmol.jsvRunScriptNow = function(jsvApplet, script)  
+
  Jmol.jsvRunScriptNow(myJSV, script)  
  Jmol.jsvSetFilePath = function(jsvApplet, tmpFilePath)  
+
  Jmol.jsvSetFilePath(myJSV, tmpFilePath)  
  Jmol.jsvSetSpectrumNumber = function(jsvApplet, n)  
+
  Jmol.jsvSetSpectrumNumber(myJSV, n)  
  Jmol.jsvSetVisible = function(jsvApplet, TF)
+
  Jmol.jsvSetVisible(myJSV, true/false)
  Jmol.jsvSyncScript = function(jsvApplet, peakScript)
+
  Jmol.jsvSyncScript(myJSV, peakScript)
  Jmol.jsvToggleCoordinate = function(jsvApplet)
+
  Jmol.jsvToggleCoordinate(myJSV)
  Jmol.jsvToggleGrid = function(jsvApplet)  
+
  Jmol.jsvToggleGrid(myJSV)  
  Jmol.jsvToggleIntegration = function(jsvApplet)
+
  Jmol.jsvToggleIntegration(myJSV)
  Jmol.jsvWriteStatus = function(jsvApplet, msg)
+
  Jmol.jsvWriteStatus(myJSV, message)

Revision as of 19:17, 26 February 2013

Integration of JSpecView into Jmol-JSO

Extensive work in 2012 integrated JSpecView into Jmol 13.

  • The Jmol application now includes a new tools menu item that opens a frame for JSpecView.
  • The Jmol applet can communicate to and from a JSpecView applet in the same page, using the Jmol sync command. Jmol-JSO brokers this transaction and allows coordinated applet start-up so that one applet does not send a command to the other before both are ready.

This makes it possible to tie 3D models to IR, NMR, UV/VIS, GC, and GC/MS spectra, using the JCAMP-DX Version 6 standard.

Associated with this integration, we have designed a specification for an extension of the JCAMP-DX format that allows one JDX file to contain both Jmol-readable 3D models and peak information, allowing the user to click on, for example, a carbon atom in Jmol and have the C-13 NMR spectrum automatically display and highlight the associated peak in JSpecView.

For a demonstration of the Jmol <-> JSpecView connection, see the JSpecView subdirectory at chemapps.stolaf.edu or the demo pages at the University of the West Indies.

Creating and inserting the JSpecView applet

To create a JSpecView applet, use for example:

var myJSV = Jmol.getJSVApplet("myJSV", Info)

Parameters making the Info variable (with default values shown between angular brackets):

  • Info.height <500>
  • Info.width <300>
  • Info.debug <false>
  • Info.jarPath <.>
  • Info.jarFile <JSpecViewApplet.jar>
  • Info.isSigned <false>
  • Info.initParams <empty>
  • Info.readyFunction <empty>
  • Info.script <empty>


JSpecView-specific methods

All these functions must be applied to the unique Jmol object (this name is literal, cannot be changed) --see syntax and examples below.

Syntax:

Jmol.jsvAddHightlight(myJSV, x1, x2, r, g, b, a) 
Jmol.jsvExport(myJSV, exportType, n) 
Jmol.jsvGetCoordinate(myJSV) 
Jmol.jsvGetPropertyAsJavaObject(myJSV, key) 
Jmol.jsvGetPropertyAsJSON(myJSV, key) 
Jmol.jsvGetSolnColour(myJSV) 
Jmol.jsvIsPro(myJSV) 
Jmol.jsvIsSigned(myJSV) 
Jmol.jsvLoadInline(myJSV, data, params)
Jmol.jsvRemoveAllHighlights(myJSV) 
Jmol.jsvRemoveHighlight(myJSV, x1, x2)
Jmol.jsvReversePlot(myJSV) 
Jmol.jsvRunScript(myJSV, script)
Jmol.jsvRunScriptNow(myJSV, script) 
Jmol.jsvSetFilePath(myJSV, tmpFilePath) 
Jmol.jsvSetSpectrumNumber(myJSV, n) 
Jmol.jsvSetVisible(myJSV, true/false)
Jmol.jsvSyncScript(myJSV, peakScript)
Jmol.jsvToggleCoordinate(myJSV)
Jmol.jsvToggleGrid(myJSV) 
Jmol.jsvToggleIntegration(myJSV)
Jmol.jsvWriteStatus(myJSV, message)

Contributors

AngelHerraez