Class ZoomShape

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

public abstract class ZoomShape extends 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
  • Constructor Details

    • ZoomShape

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

    • getBounds

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

      public abstract Rectangle drawShape(Graphics g, 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(Component component, Point pt)
      Shape contains the point pt.

      Note that these are in screen pixel coordinates.

      Parameters:
      pt - point
      Component - component
      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()
    • setZoomShapeOutline

      public void setZoomShapeOutline(Color outlineColor)
    • setZoomShapeFill

      public void setZoomShapeFill(Color fillColor)
    • zoomShapeToOverlayMark

      public abstract OverlayMark zoomShapeToOverlayMark(OverlayMarker overlayMarker)
      Convert the obsolete zoom shapes into newer overlay marks.
      Parameters:
      overlayMarker -
      Returns: