Class Figure

java.lang.Object
com.motivewave.platform.sdk.draw.Figure
Direct Known Subclasses:
Box, ColorRange, Line, Polygon, ResizePoint, SinglePointFigure

public class Figure extends Object
Base Class for all figures that can be added to a study.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains​(double x, double y, DrawContext ctx)
    This method is called by the study framework to determine if the figure contains the x and y coordinates.
    void
    This method draws the figure on the graph (using the given Graphics2D).
    Gets the bounds of this figure.
    getPopupMessage​(double x, double y, DrawContext ctx)
    Gets the popup message for the given (x,y) coordinate.
    boolean
    This method is called by the study framework and is used to improve the performance of the study by only working figures that are currently visible.
    void
    This method is called to translate any real values in the figure to the graph (represented by the DrawContext).
    protected void
    Sets the bounds for this figure.
    void
    Sets the message to display when the mouse cursor is over this figure.

    Methods inherited from class java.lang.Object

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

    • Figure

      public Figure()
  • Method Details

    • isVisible

      public boolean isVisible(DrawContext ctx)
      This method is called by the study framework and is used to improve the performance of the study by only working figures that are currently visible.
      Returns:
      true if this figure is visible within the given DrawContext.
    • contains

      public boolean contains(double x, double y, DrawContext ctx)
      This method is called by the study framework to determine if the figure contains the x and y coordinates.
      Returns:
      true if this figure contains the (x,y) coordinates.
    • getPopupMessage

      public String getPopupMessage(double x, double y, DrawContext ctx)
      Gets the popup message for the given (x,y) coordinate. By default, this will return the message that is set by calling the setPopupMessage(msg) method. Override to return different messages using the x,y coordinate.
      Parameters:
      x - x coordinate
      y - y coordinate
      ctx - Draw Context
      Returns:
      popup message to display for the given (x,y) coordinate
    • setPopupMessage

      public void setPopupMessage(String msg)
      Sets the message to display when the mouse cursor is over this figure.
      Parameters:
      msg - message to display when the mouse cursor is over this figure
    • layout

      public void layout(DrawContext ctx)
      This method is called to translate any real values in the figure to the graph (represented by the DrawContext).
      Parameters:
      ctx - draw context
    • draw

      public void draw(Graphics2D gc, DrawContext ctx)
      This method draws the figure on the graph (using the given Graphics2D). This method is called by the study framework to display the figure on the graph.
      Parameters:
      gc - graphics context
      ctx - draw context
    • getBounds

      public Rectangle2D getBounds()
      Gets the bounds of this figure.
      Returns:
      the bounds of this figure
    • setBounds

      protected void setBounds(Rectangle2D bounds)
      Sets the bounds for this figure.
      Parameters:
      bounds - bounds of this figure