PamView.zoomer
Class ZoomPolygon

java.lang.Object
  extended by PamView.zoomer.ZoomShape
      extended by PamView.zoomer.ZoomPolygon

public class ZoomPolygon
extends ZoomShape

A zoom polygon created by the zoomer.

Author:
Doug Gillespie

Field Summary
private  java.awt.Point currentMousePoint
           
private  java.awt.Point startPoint
           
private  double[] xPoints
           
private  double[] yPoints
           
 
Constructor Summary
ZoomPolygon(Zoomer zoomer, java.awt.Point startPoint, int coordinateType, double xStart, double yStart)
           
 
Method Summary
 void closeShape()
          Shape is complete for whatever reason.
 boolean containsPoint(java.awt.Component component, java.awt.Point pt)
          Shape contains the point pt.
 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.
 java.awt.Rectangle drawShapeOutline(java.awt.Graphics g, java.awt.Component component)
           
 java.awt.Rectangle drawShapeSolid(java.awt.Graphics g, java.awt.Component component)
           
private  double getArrayMax(double[] array)
           
private  double getArrayMin(double[] array)
           
 java.awt.Rectangle getBounds(java.awt.Component component)
           
 int getNumPoints()
           
private  java.awt.Polygon getPolygon(java.awt.Component component)
           
 java.awt.Point getStartPoint()
           
 double getXLength()
           
 double getXStart()
           
 double getYLength()
           
 double getYStart()
           
 void newPoint(double x, double y)
          New point to add to the shape - or update old point if it's a rectangle.
 boolean removeOnZoom()
           
 void setCurrentMousePoint(java.awt.Point currentMousePoint)
           
 
Methods inherited from class PamView.zoomer.ZoomShape
getCoordinateType, getZoomer, isClosed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xPoints

private double[] xPoints

yPoints

private double[] yPoints

currentMousePoint

private java.awt.Point currentMousePoint

startPoint

private java.awt.Point startPoint
Constructor Detail

ZoomPolygon

public ZoomPolygon(Zoomer zoomer,
                   java.awt.Point startPoint,
                   int coordinateType,
                   double xStart,
                   double yStart)
Method Detail

drawShape

public java.awt.Rectangle drawShape(java.awt.Graphics g,
                                    java.awt.Component component,
                                    boolean beforeOther)
Description copied from class: ZoomShape
Draw the shape using the given graphics handle on the given component.

Specified by:
drawShape in class ZoomShape
Parameters:
g - graphics
component - component to draw on
Returns:
outer bounds of drawn region (should be same as getBounds());

drawShapeOutline

public java.awt.Rectangle drawShapeOutline(java.awt.Graphics g,
                                           java.awt.Component component)

drawShapeSolid

public java.awt.Rectangle drawShapeSolid(java.awt.Graphics g,
                                         java.awt.Component component)

getPolygon

private java.awt.Polygon getPolygon(java.awt.Component component)

getBounds

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

containsPoint

public boolean containsPoint(java.awt.Component component,
                             java.awt.Point pt)
Description copied from class: ZoomShape
Shape contains the point pt.

Note that these are in screen pixel coordinates.

Specified by:
containsPoint in class ZoomShape
pt - point
Returns:
true if the point is within the shape.

newPoint

public void newPoint(double x,
                     double y)
Description copied from class: ZoomShape
New point to add to the shape - or update old point if it's a rectangle.

Specified by:
newPoint in class ZoomShape
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()
Description copied from class: ZoomShape
Shape is complete for whatever reason.

Overrides:
closeShape in class ZoomShape

removeOnZoom

public boolean removeOnZoom()
Specified by:
removeOnZoom in class ZoomShape
Returns:
true if the object should no longer be displayed after zooming

Basically true for rectangles, false for polygons.


setCurrentMousePoint

public void setCurrentMousePoint(java.awt.Point currentMousePoint)
Parameters:
currentMousePoint - the currentMousePoint to set

getStartPoint

public java.awt.Point getStartPoint()
Returns:
the startPoint

getNumPoints

public int getNumPoints()

getArrayMin

private double getArrayMin(double[] array)

getArrayMax

private double getArrayMax(double[] array)

getXLength

public double getXLength()
Specified by:
getXLength in class ZoomShape
Returns:
the difference between the minimum and maximum x values.

getXStart

public double getXStart()
Specified by:
getXStart in class ZoomShape
Returns:
the lowest x value

getYLength

public double getYLength()
Specified by:
getYLength in class ZoomShape
Returns:
the difference between the minimum and maximum y values.

getYStart

public double getYStart()
Specified by:
getYStart in class ZoomShape
Returns:
the lowest y value