Table of Contents
Comparison Viewer Rendering Plugin
This document describes the comparison viewer rendering plugin architecture and how to create and add a new viewer rendering plugin to the MBAT Comparison Viewer Workspace.
Architecture
Events
Requirements Specification
This section describes the expected behavior for the rendering plugins.
- Error Handling
- To ensure graceful handling of errors that occur when loading data, the rendering plugin will throw the following exceptions:
- java.io.FileNotFoundException (bad file name)
- java.net.MalformedURLException (bad URL)
- java.net.UnknownHostException (wrong URL)
- java.util.zip.DataFormatException (unrecognized or bad data format)
- net.nbirn.mbat.core.datatypes.mbObjectException (unsupported mbObject)
- javax.media.opengl.GLException (OpenGL? error)
- java.io.IOException (URL connection error, HTTP page not found, general exception)
- Note: if your error does not fit into any of the above categories, you can use IOException as a general exception. We just require a meaningful description of the error in the exception's detail message
(ie: ex.getMessage()).
- Linking
For testing purposes, please document the following on the
MouseBIRN Partner Plugins wiki page:
- User Manual
- Introduction (brief description of intent and use of plugin)
- Getting Started (describe how to load data into your plugin)
- File Formats Supported (describe what types of file can be loaded by your plugin)
- Cart Objects Supported (describe what types of cart objects can be loaded by your plugin)
- User Interface (describe how to interact and manipulate your plugin)
- Functional Specification
- Data Input Methods (describe which methods of loading your plugin are supported)
- Serializing/Deserializing (descibe what states (ie: translation, scale, rotation, opacity, brightness, contrast, etc) are saved during serialization and what states are restored during deserialization)
- Linking (descibe the behavior when layers are linked together (ie: adjusting brightness on master layer adjusts brightness to same level on slave layers).
- Workspace Interoperability (describe how you expect the returned data to used in other workspaces)
- Error Handling (describe how you handle the error cases above)
Creating a new plugin
Plugin class
- Inherit from existing layer (
JLayerImage2D, JLayerImage3D?)
-
display()
-
createLayerGUIFactory()
- Inherit from base layer (
dlLayer)
Customize status bar
For classes that inherit from
JLayerImage2D, you can customize the size, position, color, and text of the status bar. The
JLayerImage2D saves the status bar size, position, and color properties and can be accessed using the getters/setters for
!StatusBarDimension(), StatusBarPosition(), ColorStatusBarBG(), ColorStatusBarBGDark(). The default status bar is drawn as an fully opaque rectangle with a color gradient, with the
ColorStatusBarBG color at the top to the
ColorStatusBarBGDark color at the bottom.
The default drawStatusBar method calls 3 methods shown below. Derived classes can override any of these methods to customize the status bar.
public void drawStatusBar ( GL gl, int w, int h )
{
// set status bar dimension and position
setStatusBarDimensionPosition( w,h );
// draw status bar background
drawStatusBarBackground( gl, w, h );
// draw status bar text
drawStatusBarText( gl, w, h );
}
Configuring Plugin Properties
To configure how your Viewer plugin gets instantiated and loaded by the Viewer Workspace GUI, you must add the following required parameters to the
plugin.xml:
Parameters:
| Parameter Name | Values | Description |
| supportsLoadFromFile | true/false | Enable/disable adding this plugin to the "Load from File" button |
| supportsLoadFromCart | true/false | Enable/disable adding this plugin to the "Load from Cart" button |
| supportsAddLayer | true/false | Enable/disable adding this plugin to the "Add Layer" button |
DarenLee? - 29 Jun 2009