Class ResizePoint

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

public class ResizePoint extends Figure
Resize points provide a way for the user to interact with a study using the mouse. The user can move resize points around the chart by dragging them to the desired location.
  • Constructor Details

    • ResizePoint

      public ResizePoint(Enums.ResizeType type)
      Constructor. Creates a resize point of the given type.
      Parameters:
      type - resize type
    • ResizePoint

      public ResizePoint(Enums.ResizeType type, boolean absolute)
      Constructor. Creates a resize point of the given type and using absolute/relative positioning
      Parameters:
      type - resize type
      absolute - true if the location is based on an absolute position (time, price)
  • Method Details

    • layout

      public void layout(DrawContext ctx)
      Calculates x/y coordinates on the graph. If the position is absolute and the location is set (time/price), this will convert it to the graph coordinates.
      Overrides:
      layout in class Figure
      Parameters:
      ctx - draw context
    • 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. This implementation considers the use of the relative location to determine if the figure contains x and y.
      Overrides:
      contains in class Figure
      Returns:
      true if this figure contains the (x,y) coordinates.
    • getType

      public Enums.ResizeType getType()
      Gets the type of resize point. The type can be use to constrain the movement of the point.
      Returns:
      type or resize point
      See Also:
    • getFillColor

      public Color getFillColor()
      Gets the fill color (for drawing the resize point)
      Returns:
      fill color for this resize point
    • setFillColor

      public void setFillColor(Color c)
      Sets the fill color (for drawing the resize point)
      Parameters:
      c - fill color
    • getOutlineColor

      public Color getOutlineColor()
      Gets the outline color (for drawing the resize point)
      Returns:
      outline color for this resize point
    • setOutlineColor

      public void setOutlineColor(Color c)
      Sets the outline color (for drawing the resize point)
      Parameters:
      c - outline color
    • setGraphLocation

      public void setGraphLocation(Point2D location)
      Sets the location where this figure will be drawn on the graph.
      Parameters:
      location - x,y coordinate where this point will be drawn
    • getGraphLocation

      public Point2D getGraphLocation()
      Gets the location where this figure will be drawn on the graph.
      Returns:
      graph location of this figure
    • isSnapToLocation

      public boolean isSnapToLocation()
      Indicates if this resize point should snap to common location such as the bottom or top of a price bar.
      Returns:
      true if the resize point should snap to the top/bottom of price bars
    • setSnapToLocation

      public void setSnapToLocation(boolean b)
      Sets the snap to location attribute. If true, this resize point will snap to the top ane bottom of price bars.
      Parameters:
      b - snap to location attribute
    • getLocation

      public Coordinate getLocation()
      Gets the absolute location (ie time and price).
      Returns:
      the absolute location.
    • setLocation

      public void setLocation(Coordinate coord)
      Sets the absolute location (ie time and price).
      Parameters:
      coord - coordinate for the absolute location
    • setLocation

      public void setLocation(long time, double value)
      Sets the absolute location of this figure.
      Parameters:
      time - time value (in milliseconds)
      value - y axis value
    • getTime

      public long getTime()
      Gets the time location (x coordinate).
      Returns:
      time x coordinate in milliseconds since 1970
    • getValue

      public double getValue()
      Gets the real value location (y coordinate).
      Returns:
      real value (y coordinate)
    • isAbsolute

      public boolean isAbsolute()
      true if an absolute time/price coordinate is used to determine its location
      Returns:
      true if an absolute time/price coordinate is used to determine the location
    • draw

      public void draw(Graphics2D gc, DrawContext ctx)
      Draws the resize point using the outline and fill color
      Overrides:
      draw in class Figure
      Parameters:
      gc - graphics context
      ctx - draw context