Class MagneticFieldCanvas

All Implemented Interfaces:
IComponentZoomable, ImageObserver, MenuContainer, Serializable

public class MagneticFieldCanvas extends JComponent implements IComponentZoomable
See Also:
  • Field Details

  • Constructor Details

    • MagneticFieldCanvas

      public MagneticFieldCanvas(int sector, double xmin, double perpMin, double width, double height, MagneticFieldCanvas.CSType type)
      Create a canvas
      Parameters:
      xmin -
      perpMin - min value in direction perpendicular to z (the beam direction)
      width -
      height -
  • Method Details

    • setExtraText

      public void setExtraText(String s)
    • setShowGradient

      public void setShowGradient(boolean grad)
    • setSector

      public void setSector(int sect)
    • clearTrajectories

      public void clearTrajectories()
      Remove all trajectories
    • addTrajectory

      public void addTrajectory(double[] xx, double[] yy, double[] zz, Color lc, Stroke ls)
      Set a trajectory
      Parameters:
      xx -
      yy -
      zz -
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • drawTrajectories

      protected void drawTrajectories(Graphics g, Rectangle bounds)
      Draw a single trajectory
      Parameters:
      g - the graphics context
      bounds -
    • setAffineTransforms

      protected void setAffineTransforms()
    • drawGrid

      protected void drawGrid(Graphics g, Rectangle bounds)
    • drawMagneticField

      protected void drawMagneticField(Graphics g, Rectangle bounds)
    • localToWorld

      public void localToWorld(Point pp, Point2D.Double wp)
      This converts a screen or pixel point to a world point.
      Specified by:
      localToWorld in interface IComponentZoomable
      Parameters:
      pp - contains the local (screen-pixel) point.
      wp - will hold the resultant world point.
    • worldToLocal

      public void worldToLocal(Point pp, Point2D.Double wp)
      This converts a world point to a screen or pixel point.
      Specified by:
      worldToLocal in interface IComponentZoomable
      Parameters:
      pp - will hold the resultant local (screen-pixel) point.
      wp - contains world point.
    • getFieldValues

      public static double[] getFieldValues()
      Get the values array for the plot.
      Returns:
      the values array.
    • getFieldColors

      public static Color[] getFieldColors()
      Get the color array for the plot.
      Returns:
      the color array for the plot.
    • getPanelWithStatus

      public JPanel getPanelWithStatus(int width, int height)
    • getComponent

      public JComponent getComponent()
      Description copied from interface: IComponentZoomable
      Get the component being zoomed
      Specified by:
      getComponent in interface IComponentZoomable
      Returns:
      the component being zoomed
    • getWorldSystem

      public Rectangle2D.Double getWorldSystem()
      Description copied from interface: IComponentZoomable
      Get the current world system
      Specified by:
      getWorldSystem in interface IComponentZoomable
      Returns:
      the current world system
    • setWorldSystem

      public void setWorldSystem(Rectangle2D.Double wr)
      Description copied from interface: IComponentZoomable
      Set the world system
      Specified by:
      setWorldSystem in interface IComponentZoomable
      Parameters:
      wr - the world system