net.refractions.udig.project.ui.render.displayAdapter
Interface ViewportPane


public interface ViewportPane

The ViewportPane is the display area for a Map.

The default implementation is a java.awt.Pane. It Registers itself with a CompositeRenderer and obtains the image from the CompositeRenderer if the CompositeRenderer is "ready"

Viewport is responsible for:

Since:
0.1
Author:
jeichar

Method Summary
 void addDrawCommand(IDrawCommand command)
          Adds a Draw command to the list of draw commands.
 void addMouseListener(MapMouseListener l)
          See Component.addMouseListener(java.awt.event.MouseListener)
 void addMouseMotionListener(MapMouseMotionListener l)
          See Component.addMouseMotionListener(java.awt.event.MouseMotionListener)
 void addMouseWheelListener(MapMouseWheelListener l)
          See Component.addMouseWheelListener(java.awt.event.MouseWheelListener)
 void addPaneListener(IMapDisplayListener listener)
          Adds a listener interested in size changes to the pane
 void dispose()
          disposes of any system resources
 void enableDrawCommands(boolean enable)
          Switches ViewportPainter to run custom IDrawCommands during map repainting or disable them.
 Control getControl()
          Returns the SWT Control that listeners, including drag and drop, can be added to.
 GlassPane getGlass()
          Returns the glass pane.
 MapPart getMapEditor()
          Returns the associated MapEditor object.
 java.awt.image.BufferedImage image(int w, int h)
          Create a image that is compatable with this ViewportPane.
 boolean isDisposed()
          returns if the viewportpane has been disposed
 boolean isVisible()
          Returns true if the viewportPane component is visible.
 void removeMouseListener(MapMouseListener l)
          See Component.removeMouseListener(java.awt.event.MouseListener)
 void removeMouseMotionListener(MapMouseMotionListener l)
          See Component.removeMouseMotionListener(java.awt.event.MouseMotionListener)
 void removeMouseWheelListener(MapMouseWheelListener l)
          See Component.removeMouseWheelListener(java.awt.event.MouseWheelListener)
 void removePaneListener(IMapDisplayListener listener)
          Removes a MapDisplayListener.
 void renderDone()
          Called when a renderer has data that can be displayed.
 void renderStarting()
          Called when rendering is about to start.
 void renderUpdate()
          Called when renderer has rendered for single Job scheduled run.
 void repaint()
          Repaints the ViewportPane
 void repaint(int x, int y, int width, int height)
          Requests that the area indicated is repainted
 void setCursor(org.eclipse.swt.graphics.Cursor cursor)
          Sets the mouse cursor.
 void setGlass(GlassPane glass)
          Sets the glass Pane
 void setRenderManager(RenderManager manager)
          Called to set the owning renderManager()
 void update()
          This function is used to force paint events for a control.
 

Method Detail

image

java.awt.image.BufferedImage image(int w,
                                   int h)
Create a image that is compatable with this ViewportPane.

Parameters:
w - width
h - height
Returns:
BufferedImage (may be hardware accelarated)

repaint

void repaint()
Repaints the ViewportPane

Requests a repaint actually - may not occur right away.


repaint

void repaint(int x,
             int y,
             int width,
             int height)
Requests that the area indicated is repainted

Requests a repaint actually - may not occur right away.

Parameters:
x - x coordinate of the top left corner of the box to repaint
y - y coordinate of the top left corner of the box to repaint
width - width of the box to repaint
height - height of the box to repaint

update

void update()
This function is used to force paint events for a control. See the Canvas.update() method.

Forces all oustanding paint events for this control to be delivered before returning. The children of the control are unaffected. Only paint events are dispatched.

Using update is generally unnecessary and can cause flickering and performance problems. This is true because update() defats the merging of paint events implemented by the operating system.

This function is currently being used by the Pan tool to try to reduce the number of incorrectly positioned images drawn on the screen. (To ensure all paint events are processed before we invalidate the transform and move the image).


setCursor

void setCursor(org.eclipse.swt.graphics.Cursor cursor)
Sets the mouse cursor.

Limited to System cursors at the moment. Custom cursors will be forthcoming.

Parameters:
cursor - The cursor to use

removeMouseListener

void removeMouseListener(MapMouseListener l)
See Component.removeMouseListener(java.awt.event.MouseListener)

Parameters:
l - A mouse listener

removeMouseMotionListener

void removeMouseMotionListener(MapMouseMotionListener l)
See Component.removeMouseMotionListener(java.awt.event.MouseMotionListener)

Parameters:
l - A mouse listener

removeMouseWheelListener

void removeMouseWheelListener(MapMouseWheelListener l)
See Component.removeMouseWheelListener(java.awt.event.MouseWheelListener)

Parameters:
l - A mouse listener

addMouseListener

void addMouseListener(MapMouseListener l)
See Component.addMouseListener(java.awt.event.MouseListener)

Parameters:
l - A mouse listener

addMouseMotionListener

void addMouseMotionListener(MapMouseMotionListener l)
See Component.addMouseMotionListener(java.awt.event.MouseMotionListener)

Parameters:
l - A mouse listener

addMouseWheelListener

void addMouseWheelListener(MapMouseWheelListener l)
See Component.addMouseWheelListener(java.awt.event.MouseWheelListener)

Parameters:
l - A mouse listener

addPaneListener

void addPaneListener(IMapDisplayListener listener)
Adds a listener interested in size changes to the pane


removePaneListener

void removePaneListener(IMapDisplayListener listener)
Removes a MapDisplayListener.


dispose

void dispose()
disposes of any system resources


addDrawCommand

void addDrawCommand(IDrawCommand command)
Adds a Draw command to the list of draw commands. This will not refresh the ViewportPane.

Parameters:
command - The new draw command.

enableDrawCommands

void enableDrawCommands(boolean enable)
Switches ViewportPainter to run custom IDrawCommands during map repainting or disable them.

Parameters:
enable - true is to run custom draw commands, false otherwise

renderStarting

void renderStarting()
Called when rendering is about to start.


renderUpdate

void renderUpdate()
Called when renderer has rendered for single Job scheduled run.


renderDone

void renderDone()
Called when a renderer has data that can be displayed.

May be called when a refresh is required because the rendered data has changed


setRenderManager

void setRenderManager(RenderManager manager)
Called to set the owning renderManager()


getMapEditor

MapPart getMapEditor()
Returns the associated MapEditor object.

Returns:
the associated MapEditor object.

getControl

Control getControl()
Returns the SWT Control that listeners, including drag and drop, can be added to.

Returns:
the SWT Control that listeners, including drag and drop, can be added to.

isVisible

boolean isVisible()
Returns true if the viewportPane component is visible.

Returns:
true if the viewportPane component is visible.

isDisposed

boolean isDisposed()
returns if the viewportpane has been disposed

Returns:
true if the viewportpane has been disposed

getGlass

GlassPane getGlass()
Returns the glass pane. The GlassPane contains a draw function that can be used to draw directly on the image.

Returns:
glass pane if set; null if not set

setGlass

void setGlass(GlassPane glass)
Sets the glass Pane