Class Projection

java.lang.Object
smile.plot.swing.Projection

public abstract class Projection extends Object
Projection provides methods to map logical coordinates to Java2D coordinates. Both 2D and 3D logical coordinates are supported.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Canvas
    The canvas associated with this projection.
    protected int
    The height of canvas in Java2D coordinate space.
    protected int
    The width of canvas in Java2D coordinate space.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Reset the base coordinates on Java2D screen.
    int[]
    screenProjection(double... coord)
    Project logical coordinates to Java2D coordinates.
    int[]
    screenProjectionBaseRatio(double... coord)
    Project logical coordinates in base ratio to Java2D coordinates.
    void
    setSize(int width, int height)
    Sets the size of physical plot area.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • canvas

      protected final Canvas canvas
      The canvas associated with this projection. The base object of canvas provides logical coordinate space and the Java2D coordinate space of canvas is the projection target.
    • width

      protected int width
      The width of canvas in Java2D coordinate space.
    • height

      protected int height
      The height of canvas in Java2D coordinate space.
  • Constructor Details

    • Projection

      public Projection(Canvas canvas)
      Constructor.
  • Method Details

    • reset

      public void reset()
      Reset the base coordinates on Java2D screen.
    • setSize

      public void setSize(int width, int height)
      Sets the size of physical plot area.
    • screenProjection

      public int[] screenProjection(double... coord)
      Project logical coordinates to Java2D coordinates.
    • screenProjectionBaseRatio

      public int[] screenProjectionBaseRatio(double... coord)
      Project logical coordinates in base ratio to Java2D coordinates.