[VCLab-Main] [Software] [MATLAB Graphics Plugin]


MATLAB Graphics Plugin

The MATLAB Graphics Plugin performs communications with the MATLAB graphics windows. It provides mechanisms to map MATLAB graphics or graphic metafiles to the plugin window.

Embedding ---- Keys and Parameters
Methods ---- Examples

MATLAB Graphics operation

The MATLAB Graphics Plugin is a functional extension of the basic MATLAB Plugin. A page with an embedded MATLAB Graphics Plugin needs the MATLAB Plugin to issue MATLAB commands. A Java class with a set of methods for MATLAB graphics execution on the page is available.

MatlabGraphicsPlugin

Understanding the plugin graphic mechanism which makes heavy use of the clipboard facilities, the details will be explained using the functional diagram above. For getting a MATLAB graphic into the browser window the graphic is created as usual through MATLAB plot commands. This may be performed on the page in using the MATLAB Plugin methods mEvalString or mEvalMFile. The graphic generated in this way must be copied with the print -dmeta command to the clipboard. From there, it will be transferred to the Graphics Plugin window by the showClipBoard method. These steps need not to be done separately. The showClipBoard method includes additional functionalities in combining all these steps into one method.

The graphic mapped to the plugin window needs not to come only from the clipboard. The plugin supports graphic stored in the extended metafile format, which will be loaded from URL or file by the showEmf method.

Requirements

The Plugin consists of the dynamic link library NPShowClpBrd.dll and the Java class ClpBrdPlugin.class, which both reside in the browser plugin directory. This plugin is compatible with MATLAB 4 and MATLAB 5. The software is installed with the VCLab installer, as shown in the installation guide.

Plugin Embedding at Glance

The standard plugin configuration is to specify the MIME-type of the plugin. This is performed by the TYPE key

<EMBED TYPE="image/x-emf" WIDTH=400 HEIGHT=350 NAME="name">

This enables the browser to load this plugin. There is no way at least so far to specify a plugin by its name. The MATLAB graphics output will be mapped to the plugin window, for which the size by HEIGHT and WIDTH is given. The mapping itself will be perfomed by the Java methods.

The plugin can be embedded such that at start time a given metafile graphic can be displayed in the plugin window. Embedding by

<EMBED SRC="file.emf" WIDTH=400 HEIGHT=350 NAME="name">

will load the extended metafile file.emf specified by the SRC key and the graphic will be displayed in the plugin window.

The mapping of the graphic from the clipboard or metafile will be performed such that the entire graphic is visible. Thus, the aspect ratio may change. The programmer is responsible to specify the appropriate HEIGHT and WIDTH parameters for having no distorted mapping.

Optional Keys and Parameters

Parameter Type Syntax
Type
TYPE = "image/x-emf"
The plugin will be specified by its MIME-type. This loads only the plugin, but does not start any operation.
Source
SRC = "URL"
If this parameter is specified and the extension of the file specified by the URL has the extension emf, this extended metafile will be loaded from the URL as given by the source key. The graphic of this metafile will be immediately mapped to the plugin window.
Periodic Sampling
START = "mode"

mode = false (default)
= true
If true specified, the plugin will scan the clipboard every 500ms and, if changed, the clipboard graphic will be mapped to the plugin window.

Plugin Methods

The plugin provides public Java methods that can be called from Java applets or JavaScript. This allows to implement dynamical actions.

Operation Syntax
Clipboard Operation void showClipBoard()
The graphic stored in the clipboard will be mapped to the Graphics Plugin window.

void showClipBoard(VCLabPlugin vclab,String plotcmd)
This method sends the MATLAB plot command string given by plotcmd to the MATLAB Plugin for execution in the MATLAB workspace and maps the results from the MATLAB graphic to the Graphics Plugin window. Before plotcmd is executed the MATLAB graphic window is initialized. The height and width of the MATLAB graphic window is taken from the Graphics Plugin window. The MATLAB Plugin is referenced by its object name given in vclab.

void showClipBoard(VCLabPlugin vclab,String plotcmd,boolean hold)
This method sends the MATLAB plot command string given by plotcmd to the MATLAB Plugin for execution in the MATLAB workspace and maps the results from the MATLAB graphic to the Graphics Plugin window. If hold is true, the drawing is merged into the previous graphic. Otherwise the operation is perfomed in the same way as by the method without using the hold parameter. The MATLAB Plugin is referenced by its object name given in vclab.
Extended Metafile Operation void showEmf(URL EMFFileURL)
This method loads an EMF-file over the web and maps the graphic to the Graphics Plugin window.

void showEmf(String EMFFilePath)
This method loads an EMF-file given by the EMFFilePath and maps the graphic to the Graphics Plugin window.
Start Periodic Sampling void start()
This method will start periodic sampling. The plugin will scan the clipboard every 500ms and, if changed, the clipboard graphic will be mapped to the plugin window.
Stop Periodic Sampling void stop()
This method will stop periodic sampling.

Examples

Basic example with embedding and plotting
Example with embedding, and all methods

[VCLab-Main] [Software] [MATLAB Graphics Plugin]


©CS 1996, 1997, 1998, 2001