Class Plane
java.lang.Object | +----java.awt.Component | +----java.awt.Canvas | +----Plane
- public class Plane
- extends Canvas
- corner
- The abstract coordinates of the upper-left corner of the visible window.
- draw_axes
- Should we draw the axes on this plane.
- LOGOFTEN
- Log of ten, used in making tickmarks.
- prefsize
- The width and height, in pixels, of the visible window.
- reset
- The original corner coordinates, width and height, in abstract units, of the visible window, to be used when we wish to reset.
- show_xticks
- Should we draw tickmarks on the x-border of the visible window.
- size
- The width and height, in abstract coordinates, of the visible window.
- Plane(double, double, double, double, int, int)
- Constructor for Planes.
- abstractToPixels(double, double)
- Convert abstract coordinates to pixels in this Plane's window.
- drawTickmarks(Graphics)
- Draws tickmarks on the lower and left edges of this's visible window; lower edge tickmarks only drawn if show_xticks is true.
- paint(Graphics)
- Paint this Plane.
- pixelsToAbstract(int, int)
- Convert pixel coordinates to abstract in this Plane's window.
- preferredSize()
- Gives the preferred size, at which this Plane was created.
- reset()
- Resets the UL corner of this plane and its width and height to be as when first created (in abstract units), then repaints.
- toString()
- Makes a string containing the ranges of coordinates, in abstract units, that are currently visible in this Plane; only shows the y range if show_xticks is false.
corner
public double corner[]
- The abstract coordinates of the upper-left corner of the visible window.
public double size[]
- The width and height, in abstract coordinates, of the visible window.
public int prefsize[]
- The width and height, in pixels, of the visible window.
protected double reset[]
- The original corner coordinates, width and height, in abstract units,
of the visible window, to be used when we wish to reset.
public boolean draw_axes
- Should we draw the axes on this plane.
public boolean show_xticks
- Should we draw tickmarks on the x-border of the visible window.
public static final double LOGOFTEN
- Log of ten, used in making tickmarks.
Plane
public Plane(double cx, double cy, double sx, double sy, int x, int y)
- Constructor for Planes.
- Parameters:
- cx - the abstract coordinates of the left side of the visble window
- cy - the abstract coordinates of the top edge of the visble window
- sx - the width of the visible window, in abstract units
- sy - the height of the visible window, in abstract units
- x - the width of the window in pixels
- y - the height of the window in pixels
- cy - the abstract coordinates of the top edge of the visble window
drawTickmarks
public void drawTickmarks(Graphics g)
- Draws tickmarks on the lower and left edges of this's visible window;
lower edge tickmarks only drawn if show_xticks is true.
- Parameters:
- g - the graphics object upon which to draw
public void paint(Graphics g)
- Paint this Plane.
- Parameters:
- g - the graphics object upon which to paint
- Overrides:
- paint in class Canvas
public Dimension preferredSize()
- Gives the preferred size, at which this Plane was created.
- Returns:
- a Dimension of the Plane's original size, in pixels.
- Overrides:
- preferredSize in class Component
public void reset()
- Resets the UL corner of this plane and its width and height to be as
when first created (in abstract units), then repaints.
public String toString()
- Makes a string containing the ranges of coordinates, in abstract units,
that are currently visible in this Plane; only shows the y range if
show_xticks is false.
- Returns:
- the String showing this Plane's abstract dimensions
- Overrides:
- toString in class Component
public double[] pixelsToAbstract(int x, int y)
- Convert pixel coordinates to abstract in this Plane's window.
- Parameters:
- x - an input x coordinate, in pixels
- y - an input y coordinate, in pixels
- Returns:
- an array of two doubles telling the corresponding x and y abstract coordinates
public int[] abstractToPixels(double x, double y)
- Convert abstract coordinates to pixels in this Plane's window.
- Parameters:
- x - an input x coordinate, in abstract units
- y - an input y coordinate, in abstract units
- Returns:
- an array of two ints telling the corresponding x and y pixel coordinates