Package HAL.Gui
Class UIPlot
- java.lang.Object
-
- HAL.Gui.UIPlot
-
- All Implemented Interfaces:
GuiComp
,java.io.Serializable
- Direct Known Subclasses:
PlotWindow
public class UIPlot extends java.lang.Object implements GuiComp, java.io.Serializable
the UIPlot gui component is similar to the UIGrid but is specifically for generating plots. It starts centered around 0,0. Ranging from -1 to 1 in x and y, but will automatically rescale to fit the values drawn on it- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UIPlot(int xPix, int yPix, int scaleFactor)
UIPlot(int xPix, int yPix, int scaleFactor, boolean active)
UIPlot(int xPix, int yPix, int scaleFactor, double xMin, double yMin, double xMax, double yMax)
UIPlot(int xPix, int yPix, int scaleFactor, double xMin, double yMin, double xMax, double yMax, boolean active)
UIPlot(int xPix, int yPix, int scaleFactor, double xMin, double yMin, double xMax, double yMax, int compX, int compY)
UIPlot(int xPix, int yPix, int scaleFactor, double xMin, double yMin, double xMax, double yMax, int compX, int compY, boolean active)
UIPlot(int xPix, int yPix, int scaleFactor, int compX, int compY)
UIPlot(int xPix, int yPix, int scaleFactor, int compX, int compY, boolean active)
-
Method Summary
Modifier and Type Method Description void
_GetComps(java.util.ArrayList<java.awt.Component> putHere, java.util.ArrayList<java.lang.Integer> coordsHere, java.util.ArrayList<java.lang.Integer> compSizesHere)
void
ActivateClickCoords(int drawColor)
PlotLine
AddLine(int color, double... xys)
adds a line by iterating over the double arguments to generate x,y pairs.PlotLine
AddLine(int color, double[] xs, double[] ys)
PlotLine
AddLine(int color, int[] drawHood, double... xys)
adds a line by iterating over the double arguments to generate x,y pairs.void
AddPoint(double x, double y, int color)
adds a point to the plot.void
AddPoint(double x, double y, int color, int[] drawHood)
adds a point to the plot.void
AddUpdateFn(DrawFunction AdditionalDraws)
void
Clear()
void
Clear(double xMin, double xMax, double yMin, double yMax)
int
compX()
int
compY()
void
DrawAxesLabels()
void
EnsureFit(double padX, double padY)
void
FitPoints(double padX, double padY)
void
FitPointsX(double padX)
void
FitPointsY(double padY)
boolean
IsActive()
void
SetActive(boolean isActive)
void
SetDims(double xMin, double xMax, double yMin, double yMax)
void
TickPause(int millis)
call this once per step of your model, and the function will ensure that your model runs at the rate provided in milliseconds.void
ToGIF(java.lang.String path)
void
ToJPG(java.lang.String path)
void
ToPNG(java.lang.String path)
-
-
-
Field Detail
-
grid
public UIGrid grid
-
-
Constructor Detail
-
UIPlot
public UIPlot(int xPix, int yPix, int scaleFactor, double xMin, double yMin, double xMax, double yMax, int compX, int compY, boolean active)
- Parameters:
xPix
- width of the UIPlot in pixelsyPix
- heigh of the UIPlot in pixelsscaleFactor
- the width and height in screen pixels of each UIGrid pixelcompX
- width on the gui GridBagLayoutcompY
- height on the gui GridBagLayoutactive
-
-
UIPlot
public UIPlot(int xPix, int yPix, int scaleFactor, double xMin, double yMin, double xMax, double yMax, int compX, int compY)
-
UIPlot
public UIPlot(int xPix, int yPix, int scaleFactor, double xMin, double yMin, double xMax, double yMax, boolean active)
-
UIPlot
public UIPlot(int xPix, int yPix, int scaleFactor, double xMin, double yMin, double xMax, double yMax)
-
UIPlot
public UIPlot(int xPix, int yPix, int scaleFactor, int compX, int compY, boolean active)
-
UIPlot
public UIPlot(int xPix, int yPix, int scaleFactor, int compX, int compY)
-
UIPlot
public UIPlot(int xPix, int yPix, int scaleFactor, boolean active)
-
UIPlot
public UIPlot(int xPix, int yPix, int scaleFactor)
-
-
Method Detail
-
AddUpdateFn
public void AddUpdateFn(DrawFunction AdditionalDraws)
-
ActivateClickCoords
public void ActivateClickCoords(int drawColor)
-
TickPause
public void TickPause(int millis)
call this once per step of your model, and the function will ensure that your model runs at the rate provided in milliseconds. the function will take the amount time between calls into account to ensure a consistent tick rate.
-
AddLine
public PlotLine AddLine(int color, double... xys)
adds a line by iterating over the double arguments to generate x,y pairs. the line will be drawn with the color argument. The PlotLine object returned can be subsequently added to
-
Clear
public void Clear(double xMin, double xMax, double yMin, double yMax)
-
Clear
public void Clear()
-
AddLine
public PlotLine AddLine(int color, int[] drawHood, double... xys)
adds a line by iterating over the double arguments to generate x,y pairs. the line will be drawn with the color argument. The PlotLine object returned can be subsequently added to The DrawHood argument will be used to draw multi-pixel points
-
AddLine
public PlotLine AddLine(int color, double[] xs, double[] ys)
-
AddPoint
public void AddPoint(double x, double y, int color)
adds a point to the plot. the point will be 1 pixel in size and the color specified
-
AddPoint
public void AddPoint(double x, double y, int color, int[] drawHood)
adds a point to the plot. the point will be drawn using the drawHood to set pixels around the draw point, and will be set to the color specified
-
DrawAxesLabels
public void DrawAxesLabels()
-
_GetComps
public void _GetComps(java.util.ArrayList<java.awt.Component> putHere, java.util.ArrayList<java.lang.Integer> coordsHere, java.util.ArrayList<java.lang.Integer> compSizesHere)
-
FitPointsY
public void FitPointsY(double padY)
-
FitPointsX
public void FitPointsX(double padX)
-
SetDims
public void SetDims(double xMin, double xMax, double yMin, double yMax)
-
EnsureFit
public void EnsureFit(double padX, double padY)
-
FitPoints
public void FitPoints(double padX, double padY)
-
ToPNG
public void ToPNG(java.lang.String path)
-
ToJPG
public void ToJPG(java.lang.String path)
-
ToGIF
public void ToGIF(java.lang.String path)
-
-