java.lang.Object
com.motivewave.platform.sdk.draw.Figure
com.motivewave.platform.sdk.draw.Box

public class Box extends Figure
Draws a rectangular box with the given start and end coordinates. A fill color may be used to fill the interior of the box.
  • Constructor Details

    • Box

      public Box(Coordinate start, Coordinate end)
      Constructor
      Parameters:
      start - starting location of the box
      end - ending location of the box
    • Box

      public Box(Coordinate start, Coordinate end, PathInfo info)
      Constructor
      Parameters:
      start - starting location of the box
      end - ending location of the box
      info - describes how to display the outline of the box.
    • Box

      public Box(long startTime, double startValue, long endTime, double endValue)
      Constructor.
      Parameters:
      startTime -
      startValue -
      endTime -
      endValue -
    • Box

      public Box(long startTime, double startValue, long endTime, double endValue, PathInfo info)
      Constructor.
      Parameters:
      startTime -
      startValue -
      endTime -
      endValue -
      info -
  • Method Details

    • setStart

      public void setStart(long time, double value)
      Sets the location of the start of the box.
      Parameters:
      time - time (as milliseconds since 1970)
      value - (y coordinate)
    • getStartTime

      public long getStartTime()
      Gets the time of the starting location of the box.
      Returns:
      start time for the box (milliseconds since 1970)
    • getStartValue

      public double getStartValue()
      Gets the value of the starting location of the box.
      Returns:
      start value for the box
    • setEnd

      public void setEnd(long time, double value)
      Sets the location of the end of the box.
      Parameters:
      time - time (as milliseconds since 1970)
      value - (y coordinate)
    • getEndTime

      public long getEndTime()
      Gets the time of the ending location of the box.
      Returns:
      end time for the box (milliseconds since 1970)
    • getEndValue

      public double getEndValue()
      Gets the value of the ending location of the box.
      Returns:
      end value for the box
    • getLineColor

      public Color getLineColor()
      Gets the color for drawing the box outline.
      Returns:
      the color of the line used to draw the box outline.
    • setLineColor

      public void setLineColor(Color color)
      Sets the color of the line used to draw the box outline.
      Parameters:
      color - box outline color
    • getFillColor

      public Color getFillColor()
      Gets the color for drawing the box fill (null for no fill).
      Returns:
      the color used to draw the box fill (null for no fill).
    • setFillColor

      public void setFillColor(Color color)
      Sets the color for drawing the box fill (null for no fill).
      Parameters:
      color - box fill color
    • setStroke

      public void setStroke(Stroke stroke)
      Sets the stroke for displaying the box outline. If this value is null, the outline will not be drawn.
      Parameters:
      stroke -
    • getStroke

      public Stroke getStroke()
      Gets the stroke for displaying the box outline.
      Returns:
      stroke for displaying the box outline
    • isVisible

      public boolean isVisible(DrawContext ctx)
      Returns true if the box is currently visible within the given draw context.
      Overrides:
      isVisible in class Figure
      Parameters:
      ctx - draw context
      Returns:
      true if the box is visible within the current draw context.
    • contains

      public boolean contains(double x, double y, DrawContext ctx)
      Returns true if the box contains the given x and y coordinates within the given draw context.
      Overrides:
      contains in class Figure
      Parameters:
      x - x coordinate
      y - y coordinate
      ctx - draw context
      Returns:
      true if the box contains the given x and y coordinates
    • layout

      public void layout(DrawContext ctx)
      Lays out the box by converting the start and end coordinates to x,y coordinates on the graph. This is called by the study framework.
      Overrides:
      layout in class Figure
      Parameters:
      ctx - draw context
    • draw

      public void draw(Graphics2D gc, DrawContext ctx)
      Draws the box (this is called by the study framework).
      Overrides:
      draw in class Figure
      Parameters:
      gc - Graphics Context
      ctx - Draw Context