Package org.jmol.viewer
Class OutputManager
java.lang.Object
org.jmol.viewer.OutputManager
- Direct Known Subclasses:
OutputManagerAwt,OutputManagerJS
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringaddPngFileBytes(String name, byte[] ret, int iFile, Hashtable<Object, String> crcMap, boolean isSparDir, String newName, int ptSlash, javajs.util.Lst<Object> v) (package private) abstract StringclipImageOrPasteText(String text) protected abstract StringcreateSceneSet(String sceneFile, String type, int width, int height) private booleancreateTheImage(Object objImage, String type, javajs.util.OC out, Map<String, Object> params, String[] errRet) private StringcreateZipSet(String script, String[] scripts, boolean includeRemoteFiles, javajs.util.OC out, String pngjName) private int[]encodeImage(int width, int height, Object objImage) general image encoder, allows for BufferedImage, int[], or HTML5 2D canvas(package private) abstract String(package private) byte[]getImageAsBytes(String type, int width, int height, int quality, String[] errMsg) Called when a simple image is required -- from x=getProperty("image") or for a simple preview PNG image for inclusion in a ZIP file from write xxx.zip or xxx.jmol, or for a PNGJ or PNG image that is being posted because of a URL that contains "?POST?_PNG_" or ?POST?_PNGJ_" or ?POST?_PNGJBIN_".private voidgetImagePixels(Object objImage, Map<String, Object> params) private static intprotected abstract StringgetLogPath(String fileName) private ObjectgetOrSaveImage(Map<String, Object> params) Creates an image of params.type form -- PNG, PNGJ, PNGT, JPG, JPG64, PDF, PPM, GIF, GIFT.(package private) javajs.util.OCgetOutputChannel(String fileName, String[] fullPath) private StringgetOutputFileNameFromDialog(String fileName, int quality, Map<String, Object> params) (package private) StringgetOutputFromExport(Map<String, Object> params) private static ObjectgetRootExt(String fileName, String[] rootExt, int n) (package private) ObjectgetWrappedState(String pngjName, String[] scripts, Object objImage, javajs.util.OC pgjOut) protected StringhandleOutputToFile(Map<String, Object> params, boolean doCheck) general routine for creating an image or writing data to a file passes request to statusManager to pass along to app or applet jmolStatusListener interface(package private) void(package private) abstract javajs.util.OCopenOutputChannel(double privateKey, String fileName, boolean asWriter, boolean asAppend) (package private) StringoutputToFile(Map<String, Object> params) private StringprocessMultiFrameOutput(String fileName, javajs.util.BS bsFrames, int nVibes, Map<String, Object> params) (package private) StringprocessWriteOrCapture(Map<String, Object> params) private StringsetFullPath(Map<String, Object> params, String fileName) (package private) StringsetLogFile(String value) (package private) OutputManagerprotected StringwrapPathForAllFiles(String cmd, String strCatch) (package private) StringwriteFileData(String fileName, String type, int modelIndex, Object[] plotParameters) Generates file data and passes it on either to a FileOuputStream (Java) or via POSTing to a url using a ByteOutputStream (JavaScript)private booleanwriteFrame(int n, String[] rootExt, Map<String, Object> params, javajs.util.SB sb) private StringwriteToOutputChannel(Map<String, Object> params) From handleOutputToFile, write text, byte[], or image data to a file;private StringwriteZipFile(javajs.util.OC out, javajs.util.Lst<Object> fileNamesAndByteArrays, String msg, String pngjName) generic method to create a zip file based on http://www.exampledepot.com/egs/java.util.zip/CreateZip.html
-
Field Details
-
vwr
-
privateKey
protected double privateKey -
SCENE_TAG
- See Also:
-
-
Constructor Details
-
OutputManager
OutputManager()
-
-
Method Details
-
getLogPath
-
clipImageOrPasteText
-
getClipboardText
-
openOutputChannel
abstract javajs.util.OC openOutputChannel(double privateKey, String fileName, boolean asWriter, boolean asAppend) throws IOException - Throws:
IOException
-
createSceneSet
-
setViewer
-
writeToOutputChannel
From handleOutputToFile, write text, byte[], or image data to a file;- Parameters:
params-- Returns:
- null (canceled) or byte[] or String message starting with OK or an error message; in the case of params.image != null, return the fileName
-
getOrSaveImage
Creates an image of params.type form -- PNG, PNGJ, PNGT, JPG, JPG64, PDF, PPM, GIF, GIFT. From createImage and getImageAsBytes- Parameters:
params- include fileName, type, text, bytes, image, scripts, appendix, quality, outputStream, and type-specific parameters. If params.outputChannel != null, then we are passing back the data, and the channel will not be closed.- Returns:
- bytes[] if params.fileName==null and params.outputChannel==null otherwise, return a message string or null
- Throws:
Exception
-
getWrappedState
- Parameters:
pngjName-scripts-objImage-pgjOut-- Returns:
- either byte[] (a full ZIP file) or String (just an embedded state script)
-
createTheImage
private boolean createTheImage(Object objImage, String type, javajs.util.OC out, Map<String, Object> params, String[] errRet) throws Exception- Parameters:
objImage-type-out-params-errRet-- Returns:
- byte array if needed
- Throws:
Exception
-
getImagePixels
- Throws:
Exception
-
encodeImage
general image encoder, allows for BufferedImage, int[], or HTML5 2D canvas- Parameters:
width-height-objImage-- Returns:
- linear int[] array of ARGB values
- Throws:
Exception
-
outputToFile
-
getOutputChannel
-
processWriteOrCapture
- Parameters:
params- include fileName, type, text, bytes, scripts, quality, width, height, bsFrames, nVibes, fullPath- Returns:
- message
-
getInt
-
processMultiFrameOutput
-
getRootExt
-
setFullPath
-
getOutputFromExport
-
getImageAsBytes
Called when a simple image is required -- from x=getProperty("image") or for a simple preview PNG image for inclusion in a ZIP file from write xxx.zip or xxx.jmol, or for a PNGJ or PNG image that is being posted because of a URL that contains "?POST?_PNG_" or ?POST?_PNGJ_" or ?POST?_PNGJBIN_".- Parameters:
type-width-height-quality-errMsg-- Returns:
- image bytes or, if an error, null and an error message
-
writeFileData
Generates file data and passes it on either to a FileOuputStream (Java) or via POSTing to a url using a ByteOutputStream (JavaScript)- Parameters:
fileName-type- one of: PDB PQR FILE PLOTmodelIndex- for PLOT or PDB or PQR onlyplotParameters-- Returns:
- "OK..." or "" or null
-
writeFrame
-
getOutputFileNameFromDialog
-
handleOutputToFile
general routine for creating an image or writing data to a file passes request to statusManager to pass along to app or applet jmolStatusListener interface- Parameters:
params- include: fileName: starts with ? --> use file dialog; type: PNG, JPG, etc.; text: String to output; bytes: byte[] or null if an image; scripts for scenes; quality: for JPG and PNG; width: image width; height: image height; fullPath: String[] returndoCheck-- Returns:
- null (canceled) or a message starting with OK or an error message
-
setLogFile
-
logToFile
-
createZipSet
-
addPngFileBytes
-
writeZipFile
private String writeZipFile(javajs.util.OC out, javajs.util.Lst<Object> fileNamesAndByteArrays, String msg, String pngjName) generic method to create a zip file based on http://www.exampledepot.com/egs/java.util.zip/CreateZip.html- Parameters:
out-fileNamesAndByteArrays- Vector of [filename1, bytes|null, filename2, bytes|null, ...]msg-pngjName- TODO- Returns:
- msg bytes filename or errorMessage or byte[]
-
wrapPathForAllFiles
-