Class Vector2DFrame

All Implemented Interfaces:
ClipboardOwner, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, AppFrame, Hidable

public class Vector2DFrame extends DrawingFrame
A DrawingFrame that displays 2D plots of vector fields.
Version:
1.0
Author:
W. Christian
See Also:
  • Constructor Details

    • Vector2DFrame

      public Vector2DFrame(String xlabel, String ylabel, String frameTitle)
      Constructs a Vector2DFrame with the given axes labels and frame title.
      Parameters:
      xlabel - String
      ylabel - String
      frameTitle - String
    • Vector2DFrame

      public Vector2DFrame(String frameTitle)
      Constructs a Vector2DFrame with the given frame title but without axes.
      Parameters:
      frameTitle - String
  • Method Details

    • addMenuItems

      protected void addMenuItems()
      Adds Views menu items on the menu bar.
      Overrides:
      addMenuItems in class DrawingFrame
    • clearDrawables

      public void clearDrawables()
      Clears drawable objects added by the user from this frame.
      Overrides:
      clearDrawables in class DrawingFrame
    • getDrawables

      public ArrayList<Drawable> getDrawables()
      Gets Drawable objects added by the user to this frame.
      Overrides:
      getDrawables in class DrawingFrame
      Returns:
      the list
    • indexToX

      public double indexToX(int i)
      Gets the x coordinate for the given index.
      Parameters:
      i - int
      Returns:
      double the x coordiante
    • indexToY

      public double indexToY(int i)
    • xToIndex

      public int xToIndex(double x)
      Gets the index that is closest to the given x value
      Returns:
      double the x coordiante
    • yToIndex

      public int yToIndex(double y)
      Gets the index that is closest to the given y value
      Returns:
      double the y coordiante
    • getNx

      public int getNx()
      Gets the number of x entries.
      Returns:
      nx
    • getNy

      public int getNy()
      Gets the number of y entries.
      Returns:
      nx
    • getDrawables

      public <T extends Drawable> ArrayList<T> getDrawables(Class<T> c)
      Gets Drawable objects added by the user of an assignable type. The list contains objects that are assignable from the class or interface.
      Overrides:
      getDrawables in class DrawingFrame
      Parameters:
      c - the type of Drawable object
      Returns:
      the cloned list
      See Also:
    • clearData

      public void clearData()
      Sets the scalar field to zero.
      Overrides:
      clearData in class OSPFrame
    • resizeGrid

      public void resizeGrid(int nx, int ny)
      Resizes the number of columns and rows in the vector plot.
      Parameters:
      nx - int
      ny - int
    • setRow

      public void setRow(int row, double[][] vals) throws IllegalArgumentException
      Sets the data in the given row to new values.
      Parameters:
      row - int
      vals - double[] new values
      Throws:
      IllegalArgumentException - if array length does not match grid size.
    • setAll

      public void setAll(double[][][] vals, double xmin, double xmax, double ymin, double ymax)
      Sets the vector field's values and scale..
      Parameters:
      vals - int[][][] the new values
      xmin - double
      xmax - double
      ymin - double
      ymax - double
    • setAll

      public void setAll(double[][][] vals)
      Sets the vector field's values. Values are stored in an array with dimension val[2][n][n].
      Parameters:
      vals - double[][][] new values
    • setZRange

      public void setZRange(boolean isAutoscale, double floor, double ceil)
      Sets the autoscale flag and the floor and ceiling values for the colors. If autoscaling is true, then the min and max values of z are span the colors. If autoscaling is false, then floor and ceiling values limit the colors. Values below min map to the first color; values above max map to the last color.
      Parameters:
      isAutoscale -
      floor -
      ceil -
    • showDataTable

      public void showDataTable(boolean show)
      Shows or hides the data table.
      Parameters:
      show - boolean