PamView.zoomer
Class ZoomShape

java.lang.Object
  extended by PamView.zoomer.ZoomShape
Direct Known Subclasses:
ZoomPolygon, ZoomRectangle

public abstract class ZoomShape
extends java.lang.Object

Interface to support a variety of zoomable shapes.

I currently can't think of anything but a rectangle and an arbitrary polygon, but you never know !

Author:
Doug Gillespie

Field Summary
private  boolean closed
           
private  int coordinateType
           
private  Zoomer zoomer
           
 
Constructor Summary
ZoomShape(Zoomer zoomer, int coordinateType)
           
 
Method Summary
 void closeShape()
          Shape is complete for whatever reason.
abstract  boolean containsPoint(java.awt.Component component, java.awt.Point pt)
          Shape contains the point pt.
abstract  java.awt.Rectangle drawShape(java.awt.Graphics g, java.awt.Component component, boolean beforeOther)
          Draw the shape using the given graphics handle on the given component.
abstract  java.awt.Rectangle getBounds(java.awt.Component component)
           
 int getCoordinateType()
          Get the type of coordinate (only needs to be specific within a particular display, not more generally.
abstract  double getXLength()
           
abstract  double getXStart()
           
abstract  double getYLength()
           
abstract  double getYStart()
           
 Zoomer getZoomer()
           
 boolean isClosed()
           
abstract  void newPoint(double x, double y)
          New point to add to the shape - or update old point if it's a rectangle.
abstract  boolean removeOnZoom()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coordinateType

private int coordinateType

zoomer

private Zoomer zoomer

closed

private boolean closed
Constructor Detail

ZoomShape

public ZoomShape(Zoomer zoomer,
                 int coordinateType)
Parameters:
zoomer -
coordinateType -
Method Detail

getBounds

public abstract java.awt.Rectangle getBounds(java.awt.Component component)
Returns:
the outer bounds of the zoom shape in pixels.

drawShape

public abstract java.awt.Rectangle drawShape(java.awt.Graphics g,
                                             java.awt.Component component,
                                             boolean beforeOther)
Draw the shape using the given graphics handle on the given component.

Parameters:
g - graphics
component - component to draw on
beforeOther -
Returns:
outer bounds of drawn region (should be same as getBounds());

newPoint

public abstract void newPoint(double x,
                              double y)
New point to add to the shape - or update old point if it's a rectangle.

Parameters:
x - x coordinate in display units such as time or bearing, NOT PIXELS
y - y coordinate in display units such as time or bearing, NOT PIXELS

closeShape

public void closeShape()
Shape is complete for whatever reason.


isClosed

public boolean isClosed()
Returns:
the closed

removeOnZoom

public abstract boolean removeOnZoom()
Returns:
true if the object should no longer be displayed after zooming

Basically true for rectangles, false for polygons.


containsPoint

public abstract boolean containsPoint(java.awt.Component component,
                                      java.awt.Point pt)
Shape contains the point pt.

Note that these are in screen pixel coordinates.

Parameters:
Component - component
pt - point
Returns:
true if the point is within the shape.

getXStart

public abstract double getXStart()
Returns:
the lowest x value

getXLength

public abstract double getXLength()
Returns:
the difference between the minimum and maximum x values.

getYStart

public abstract double getYStart()
Returns:
the lowest y value

getYLength

public abstract double getYLength()
Returns:
the difference between the minimum and maximum y values.

getCoordinateType

public int getCoordinateType()
Get the type of coordinate (only needs to be specific within a particular display, not more generally.

Returns:
coordinate type.

getZoomer

public Zoomer getZoomer()