net.refractions.udig.project.render
Interface IRenderContext

All Superinterfaces:
IAbstractContext
All Known Subinterfaces:
ICompositeRenderContext

public interface IRenderContext
extends IAbstractContext

Simplifies access of resource data and output image for renderers. A RenderContext has three main Jobs:

Since:
1.0.0
Author:
Jesse

Method Summary
 void clearImage()
          Clears the entire image so it is all transparent.
 void clearImage(java.awt.Rectangle paintArea)
          Clears the area of the image indicated by the rectangle.
 IRenderContext copy()
          Makes a deep copy of this object, if necessary.
 java.awt.image.BufferedImage copyImage(java.awt.Rectangle rectangle)
          Grab a specific rectangle from the raster to provide instant feedback for geoInfo and selection tools.
 Query getFeatureQuery()
           
 IGeoResource getGeoResource()
          Returns service associated with the first layer in the map.
 java.awt.image.BufferedImage getImage()
          Returns a bufferedImage that a renderer can renders to.
 java.awt.image.BufferedImage getImage(int width, int height)
          Returns a bufferedImage that a renderer can render to.
 ILabelPainter getLabelPainter()
          Returns the labeller for the next rendering.
 ILayer getLayer()
          Returns the layer in the renderer is responsible for.
 int getStatus()
          Gets the status of the layer contained by the context.
 java.lang.String getStatusMessage()
          A message to provide the user with additional feed back about the current rendering status.
 int getZorder()
          Determines the zorder of the renderer.
 boolean hasContent(java.awt.Point screenLocation)
          Test if content is rendered at the provided point.
 boolean isVisible()
          Returns true if the renderer has visible data.
 void setStatus(int status)
          Sets the status of the layer contained by the context.
 void setStatusMessage(java.lang.String message)
          Sets the current rendering status message
 
Methods inherited from interface net.refractions.udig.project.IAbstractContext
getBoundingBox, getCRS, getEditManager, getFeaturesInBbox, getMap, getMapDisplay, getMapLayers, getPixelBoundingBox, getPixelSize, getProject, getRenderManager, getSelectedLayer, getViewportModel, pixelToWorld, toShape, toShape, tranformCoordinate, worldBounds, worldToPixel, worldToScreenMathTransform, worldToScreenTransform
 

Method Detail

hasContent

boolean hasContent(java.awt.Point screenLocation)
Test if content is rendered at the provided point.

Used to optimize getInfo and selection tools.

Parameters:
screenLocation -
Returns:
true if non transparent pixel is rendered at screenLocation

copyImage

java.awt.image.BufferedImage copyImage(java.awt.Rectangle rectangle)
Grab a specific rectangle from the raster to provide instant feedback for geoInfo and selection tools.

Often this feedback takes place on the display under direction of the tool.

Parameters:
rectangle - Rectangle indicating area of interest
Returns:
Buffered image copied from the raster, or null if unavailable
See Also:
BufferedImage

getImage

java.awt.image.BufferedImage getImage(int width,
                                      int height)
Returns a bufferedImage that a renderer can render to.

The method does not guarantee an image that is the same size as the request, only that the returned image will be at least the size requested

The user of the image is required to clear the image. The image maybe cached and as a result may be dirty.

Returns:
The bufferedImage that the renderer renders to.
See Also:
BufferedImage

getImage

java.awt.image.BufferedImage getImage()
Returns a bufferedImage that a renderer can renders to.

The returned image will be the same size as the display or bigger

Returns:
The bufferedImage that the renderer renders to.
See Also:
BufferedImage

getLayer

ILayer getLayer()
Returns the layer in the renderer is responsible for.

Should normally be used when only one layer is being rendered.

Returns:
ILayer
See Also:
ILayer

getGeoResource

IGeoResource getGeoResource()
Returns service associated with the first layer in the map.

Should normally be used when only one layer is being rendered.

Returns:
IGeoResource the georesource that will be used to render the layer.

getZorder

int getZorder()
Determines the zorder of the renderer. Convenience method for getLayer.getZorder()

Returns:
the zorder of the layer contained in the context.
See Also:
ILayer.getZorder()

isVisible

boolean isVisible()
Returns true if the renderer has visible data.

If not layer is not a CompositeRenderer then this is just a call to ILayer.isVisible(). Otherwise if one of the layers is visible then it should return true

Returns:
true if the renderer has visible data.
See Also:
ILayer.isVisible()

clearImage

void clearImage()
Clears the entire image so it is all transparent.

Convenience for clearImage(getImage().getWidth(), getImage.getHeight());

See Also:
clearImage(Rectangle)

getFeatureQuery

Query getFeatureQuery()
Returns:
The filter that will return all the features that need to be rendered

clearImage

void clearImage(java.awt.Rectangle paintArea)
Clears the area of the image indicated by the rectangle.

Parameters:
paintArea -
See Also:
clearImage()

setStatus

void setStatus(int status)
Sets the status of the layer contained by the context.

Parameters:
status - the new status to set on the layer.
See Also:
ILayer.DONE, ILayer.ERROR, ILayer.MISSING, ILayer.WAIT, ILayer.WARNING, ILayer.WORKING, ILayer.UNCONFIGURED

getStatus

int getStatus()
Gets the status of the layer contained by the context.

See Also:
ILayer.DONE, ILayer.ERROR, ILayer.MISSING, ILayer.WAIT, ILayer.WARNING, ILayer.WORKING, ILayer.UNCONFIGURED

getStatusMessage

java.lang.String getStatusMessage()
A message to provide the user with additional feed back about the current rendering status.

This is used to provide feedback for a Layer's rendering status.

Returns:
message to provide the user with additional feed back about the current rendering status.
See Also:
ILayer.getStatusMessage(), setStatus(int), getStatus(), getStatusMessage()

setStatusMessage

void setStatusMessage(java.lang.String message)
Sets the current rendering status message

Parameters:
message - the status message
See Also:
ILayer.getStatusMessage(), ILayer.getStatus(), getStatusMessage(), getStatus()

copy

IRenderContext copy()
Description copied from interface: IAbstractContext
Makes a deep copy of this object, if necessary. This is an alternative to clone since I hate clone, it is too hard to implement.

Specified by:
copy in interface IAbstractContext
Returns:
a new copy of this object.

getLabelPainter

ILabelPainter getLabelPainter()
Returns the labeller for the next rendering.

Returns:
the labeller that draws the labels on the top of the map.