Ergo provides a two primary rendering options, a 2D renderer that is available for all systems and a 3D renderer, which is currently only available for 32 bit windows systems. This page will briefly discuss the 2D renderer and how a new renderer can be added to the system.
RendererBuilder
The RendererBuilder is an abstract Java class that provides the API for building the renderers available in Ergo. It is contributed by the edu.illinois.ncsa.ergo.gis.ui plugin. In order to create a new renderer, a plugin must depend on edu.illinois.ncsa.ergo.gis.ui and must add the extension point edu.illinois.ncsa.ergo.gis.ui.gisRenderers. The extension point has 4 requirements:
- id - the id of the contribution
- name - a descriptive name
- tag - the tag associated with the extension
- class - the class that extends RendererBuilder and handles constructing the renderer.
2D Renderer
The MapPageBuilder is responsible for building the 2D renderer for Ergo. You can find the class in the edu.illinois.ncsa.ergo.gis.geotools.ui plugin. The RendererBuilder provides a Scenario object that contains all of the data associated with a scenario and it is the responsibility of the subclass of RendererBuilder to implement the methods for rendering the scene.
Custom Renderer
To create a custom renderer, your plug-in will need to depend on edu.illinois.ncsa.ergo.gis.geotools.ui, add the extension point edu.illinois.ncsa.ergo.gis.ui.gisRenderers, and create an extension that provides an implementation of RendererBuilder.
public abstract RendererBuilder implements ControlBuilder, Renderer {
// Extension point for a new renderer builder
public final static String EXT_PT = "edu.illinois.ncsa.ergo.gis.ui.gisRenderers";
public abstract void defaultView();
public abstract void zoomIn();
public abstract void zoomOut();
public abstract void panLeft();
public abstract void panRight();
public abstract void panUp();
public abstract void panDown();
public abstract void tiltUp();
public abstract void tiltDown();
public abstract boolean canZoomIn();
public abstract boolean canZoomOut();
public abstract boolean canPanLeft();
public abstract boolean canPanRight();
public abstract boolean canPanUp();
public abstract boolean canPanDown();
public abstract boolean canTiltUp();
public abstract boolean canTiltDown();
public abstract RendererState getRendererState();
public abstract void setRendererState(RendererState state);
public abstract void restoreScenarioRendererState();
public abstract void exportRenderWindowToImage(String filename, String format);
public abstract String[] getSupportedFormatNames();
protected abstract void handleSelectionLayerChanged();
protected abstract void handleSelectedFeaturesChanged();
public abstract void refresh();
public abstract void setAutoRefresh(boolean autoRefresh);
public abstract void buildControlsForm(IManagedForm mform);
}
public interface ControlBuilder
{
Composite build(Composite parent, Layout layout);
Composite build(Composite parent);
void dispose();
}
/**
* Draws a <code>Scenario</code>.
*/
public interface Renderer
{
/**
*
* @param p
*/
public void setScenario(Scenario p);
/**
*
* @return
*/
public Scenario getScenario();
/**
*
* @throws RenderingException
*/
public void draw() throws RenderingException;
}