controller
Interface IDisplayAdapter


public interface IDisplayAdapter

Adapter to connect the display and the model.

Author:
Mathias Ricken

Method Summary
 void draw(java.awt.Graphics2D g, java.awt.Component comp, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)
          Draw model in this region.
 java.awt.Dimension getDisplaySize()
          Get size of the display.
 java.awt.geom.Point2D.Double getPanDelta(java.awt.geom.Point2D.Double delta)
          Ask the model how much to pan, given where the user scrolled.
 java.awt.geom.Point2D.Double getViewPosition(java.awt.geom.Point2D.Double pos)
          Ask the model where to scroll, given where the user has scrolled.
 void returnHome(IScrollAdapter sa)
          The action to be executed if the display should return home.
 

Method Detail

draw

void draw(java.awt.Graphics2D g,
          java.awt.Component comp,
          java.awt.geom.Point2D.Double p1,
          java.awt.geom.Point2D.Double p2)
Draw model in this region. The graphics object has been set up so that (0,0) represents the top left and (100,100) the bottom right corner.

Parameters:
g - graphics object
comp - the component to drawFish on
p1 - top left edge of the region
p2 - bottom right edge of the region

getDisplaySize

java.awt.Dimension getDisplaySize()
Get size of the display.

Returns:
size of the display in model coordinate units.

returnHome

void returnHome(IScrollAdapter sa)
The action to be executed if the display should return home.

Parameters:
sa - scroll adapter

getViewPosition

java.awt.geom.Point2D.Double getViewPosition(java.awt.geom.Point2D.Double pos)
Ask the model where to scroll, given where the user has scrolled. If the environment just acts like a normal panal, it should return pos without modification. If the environment recenters, it should return a position in the middle of the pan area. All coordinates are in model coordinate units.

Parameters:
pos - position where the user scrolled to
Returns:
position where the environment wants the view to be
See Also:
getPanDelta(java.awt.geom.Point2D.Double)

getPanDelta

java.awt.geom.Point2D.Double getPanDelta(java.awt.geom.Point2D.Double delta)
Ask the model how much to pan, given where the user scrolled. If the environment just acts like a normal panal, it should return (0,0). If the environment recenters, it should return delta without modification. All coordinates are in model coordinate units.

Parameters:
delta - how far the user scrolled
Returns:
how far the panel should scroll
See Also:
getViewPosition(java.awt.geom.Point2D.Double)