Package voltage.core

# Class VoltageCurve

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltageCurve

public class VoltageCurve extends VoltageComponent
Curve class

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `VoltageCurve.ControlPt1EditType`
  `class`
  `VoltageCurve.CurveChangeNotification`
  A class containing information about which parts of a curve have changed; sent with the Curve_Changed notification
  `static enum`
  `VoltageCurve.CurveType`
  `static enum`
  `VoltageCurve.MouseState`

- ## Field Summary

  ### Fields inherited from class voltage.core.VoltageComponent

  `componentName, displayName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoltageCurve(String name, String displayName, VoltageModule module)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Color`
  `GetBackgroundColor(VoltageCurve.MouseState state)`
  Returns the background color for the requested state
  `Color`
  `GetBorderColor(VoltageCurve.MouseState state)`
  Returns the border color for the requested state
  `float`
  `GetBorderSize()`
  Gets the border size.
  `Point2D.Float`
  `GetControlPoint1()`
  Returns the x invalid input: '&' y components of the curve's first control point (applicable to both cubic and quadratic curves).
  `VoltageCurve.ControlPt1EditType`
  `GetControlPoint1EditType()`
  Gets the curve-editing type (both x invalid input: '&' y components of control points editable; only x editable; only y editable).
  `Point2D.Float`
  `GetControlPoint2()`
  Returns the x invalid input: '&' y components of the curve's second control point (only applicable to cubic curves).
  `Color`
  `GetCurveColor(VoltageCurve.MouseState state)`
  Returns the curve color for the requested state
  `Point2D.Float`
  `GetCurvePosition(float pctDone)`
  Gets the curve's location, in pixels, at a location 'pctDone' percent along the curve's length.
  `Point2D.Float`
  `GetCurvePositionNormalized(float pctDone)`
  Gets the curve's position, in a range from 0 - 1, at a location 'pctDone' percent along the curve's length.
  `float`
  `GetCurveThickness()`
  Gets the curve thickness.
  `Color`
  `GetDottedLineColor(VoltageCurve.MouseState state)`
  Returns the dotted-line color for the requested state
  `float`
  `GetEndValue()`
  Get the y component (x for non-horizontal curves) of the curve's ending position)
  `float`
  `GetRangeMax()`
  Get the maximum value of the curve's range
  `float`
  `GetRangeMin()`
  Get the minimum value of the curve's range
  `float`
  `GetStartValue()`
  Get the y component (x for non-horizontal curves) of the curve's starting position)
  `boolean`
  `HasRoundedCorners()`
  Returns true if the curve object has rounded corners
  `float`
  `InvertValue(float val)`
  Inverts a value to place it at the opposite end of the curve's range (e.g., if the curve has a range from 0 - 1, calling InvertValue(0.8) will return 0.2).
  `void`
  `SetBackgroundColor(Color zeColor, VoltageCurve.MouseState state)`
  Sets the curve's background color.
  `void`
  `SetBorderColor(Color zeColor, VoltageCurve.MouseState state)`
  Sets the curve's border color.
  `void`
  `SetBorderSize(float bsize)`
  Sets the curve's border size, in pixels Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
  `void`
  `SetControlPoint1(float x, float y)`
  Sets the value of the first control point (applicable to both cubic and quadratic curves).
  `void`
  `SetControlPoint1EditType(VoltageCurve.ControlPt1EditType editMethod)`
  Set the curve's editing method: BothXAndYEditable (users can edit both x and y components of control points), XMirrorsY (users can only edit the y component, and the x component will match it - only applicable to quadratic curves), YMirrorsX (users can only edit the x component, and the y component will match it - only applicable to quadratic curves).
  `void`
  `SetControlPoint2(float x, float y)`
  Sets the value of the second control point (only applicable to cubic curves).
  `void`
  `SetCurveColor(Color zeColor, VoltageCurve.MouseState state)`
  Sets the curve color.
  `void`
  `SetCurveThickness(float csize)`
  Sets the curve's border size, in pixels Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
  `void`
  `SetCurveType(VoltageCurve.CurveType newCurveType)`
  Set the curve type: quadratic (which has 1 control point) or cubic (which has 2 control points) Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
  `void`
  `SetDottedLineColor(Color zeColor, VoltageCurve.MouseState state)`
  Sets the dotted line's color.
  `void`
  `SetEditable(boolean isEditable)`
  Set to true to allow users to edit one or more of the curve's control point values Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
  `void`
  `SetEndValue(float val)`
  Sets the y value (x value for non-horizontal curves) of the curve's ending position Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
  `void`
  `SetHasRoundedCorners(boolean roundedCorners)`
  If set to true, the edges of the curve object's bounding rectangle will have rounded corners Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
  `void`
  `SetHorizontal(boolean bHorz)`
  Set to true for a horizontal curve (the default) that proceeds left to right; set false to rotate the curve 90 degrees clockwise so that it proceeds top to bottom Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
  `void`
  `SetRange(float min, float max)`
  Sets the curve's range.
  `void`
  `SetStartValue(float val)`
  Sets the y value (x value for non-horizontal curves) of the curve's starting position Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().

  ### Methods inherited from class voltage.core.VoltageComponent

  `AddChildComponent, GetComponentID, GetDisplayName, GetHeight, GetMaxValue, GetMinValue, GetRect, GetSkin, GetTooltipText, GetTransparency, GetUserProperty, GetValue, GetWidth, GetX, GetY, IsEnabled, IsVisible, RemoveChildComponent, SetCanBeAutomated, SetEnabled, SetPosition, SetRect, SetRect, SetSize, SetSkin, SetTransparency, SetUnits, SetUserProperty, SetValue, SetValue, SetValueNoNotification, SetVisible, SetWantsMouseNotifications, SetZOrder, SkewNormalizedValue, UpdateGUIValue, WantsMouseNotifications`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VoltageCurve

    public VoltageCurve(String name, String displayName, VoltageModule module)

- ## Method Details

  - ### SetBackgroundColor

    public void SetBackgroundColor(Color zeColor, VoltageCurve.MouseState state)
    Sets the curve's background color. Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `zeColor` - the color to use. Set the color's alpha value to 0 if you don't want the background to be visible.

  - ### GetBackgroundColor

    public Color GetBackgroundColor(VoltageCurve.MouseState state)
    Returns the background color for the requested state
    Returns:
      the color.

  - ### SetBorderColor

    public void SetBorderColor(Color zeColor, VoltageCurve.MouseState state)
    Sets the curve's border color. Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `zeColor` - the color to use.

  - ### GetBorderColor

    public Color GetBorderColor(VoltageCurve.MouseState state)
    Returns the border color for the requested state
    Returns:
      the color.

  - ### SetCurveColor

    public void SetCurveColor(Color zeColor, VoltageCurve.MouseState state)
    Sets the curve color. Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `zeColor` - the color to use.

  - ### GetCurveColor

    public Color GetCurveColor(VoltageCurve.MouseState state)
    Returns the curve color for the requested state
    Returns:
      the color.

  - ### SetDottedLineColor

    public void SetDottedLineColor(Color zeColor, VoltageCurve.MouseState state)
    Sets the dotted line's color. Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `zeColor` - the color to use. Set the color's alpha value to 0 if you don't want the dotted line to be visible

  - ### GetDottedLineColor

    public Color GetDottedLineColor(VoltageCurve.MouseState state)
    Returns the dotted-line color for the requested state
    Returns:
      the color.

  - ### SetBorderSize

    public void SetBorderSize(float bsize)
    Sets the curve's border size, in pixels Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `bsize` - the number of pixels for the border.

  - ### SetCurveThickness

    public void SetCurveThickness(float csize)
    Sets the curve's border size, in pixels Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `bsize` - the number of pixels for the border.

  - ### SetHasRoundedCorners

    public void SetHasRoundedCorners(boolean roundedCorners)
    If set to true, the edges of the curve object's bounding rectangle will have rounded corners Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `roundedCorners` - true for rounded corners, false for square corners

  - ### SetRange

    public void SetRange(float min, float max)
    Sets the curve's range. You can set the curve's start, end, and control point values to any value within the range. Defaults to min = 0 and max = 1. max must be > min. Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `min` - the minimum range value
      `max` - the maximum range value

  - ### SetStartValue

    public void SetStartValue(float val)
    Sets the y value (x value for non-horizontal curves) of the curve's starting position Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `val` - the starting value. Must be within the curve's range.

  - ### SetEndValue

    public void SetEndValue(float val)
    Sets the y value (x value for non-horizontal curves) of the curve's ending position Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `val` - the ending value. Must be within the curve's range.

  - ### GetBorderSize

    public float GetBorderSize()
    Gets the border size.
    Returns:
      the size of the border.

  - ### GetCurveThickness

    public float GetCurveThickness()
    Gets the curve thickness.
    Returns:
      the curve line's thickness

  - ### HasRoundedCorners

    public boolean HasRoundedCorners()
    Returns true if the curve object has rounded corners
    Returns:
      true if the object has rounded corners

  - ### SetEditable

    public void SetEditable(boolean isEditable)
    Set to true to allow users to edit one or more of the curve's control point values Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `isEditable` - set true to allow editing

  - ### SetHorizontal

    public void SetHorizontal(boolean bHorz)
    Set to true for a horizontal curve (the default) that proceeds left to right; set false to rotate the curve 90 degrees clockwise so that it proceeds top to bottom Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `bHorz` - set true for a horizontal curve, false for a vertical one

  - ### GetStartValue

    public float GetStartValue()
    Get the y component (x for non-horizontal curves) of the curve's starting position)
    Returns:
      the start value, in terms of the curve's range

  - ### GetEndValue

    public float GetEndValue()
    Get the y component (x for non-horizontal curves) of the curve's ending position)
    Returns:
      the end value, in terms of the curve's range

  - ### GetRangeMin

    public float GetRangeMin()
    Get the minimum value of the curve's range
    Returns:
      the minimum range value

  - ### GetRangeMax

    public float GetRangeMax()
    Get the maximum value of the curve's range
    Returns:
      the maximum range value

  - ### SetCurveType

    public void SetCurveType(VoltageCurve.CurveType newCurveType)
    Set the curve type: quadratic (which has 1 control point) or cubic (which has 2 control points) Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `newCurveType` - the curve type

  - ### SetControlPoint1EditType

    public void SetControlPoint1EditType(VoltageCurve.ControlPt1EditType editMethod)
    Set the curve's editing method: BothXAndYEditable (users can edit both x and y components of control points), XMirrorsY (users can only edit the y component, and the x component will match it - only applicable to quadratic curves), YMirrorsX (users can only edit the x component, and the y component will match it - only applicable to quadratic curves). Ignored if the curve itself isn't set as editable. Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `editMethod` - the new editing method

  - ### GetControlPoint1EditType

    public VoltageCurve.ControlPt1EditType GetControlPoint1EditType()
    Gets the curve-editing type (both x invalid input: '&' y components of control points editable; only x editable; only y editable). Not applicable for cubic curves or curves that aren't set as editable.
    Returns:
      the curve-editing method

  - ### SetControlPoint1

    public void SetControlPoint1(float x, float y)
    Sets the value of the first control point (applicable to both cubic and quadratic curves). Values will be truncated to the curve's range min/max. Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `x` - the x component of the control point
      `y` - the y component of the control point

  - ### GetControlPoint1

    public Point2D.Float GetControlPoint1()
    Returns the x invalid input: '&' y components of the curve's first control point (applicable to both cubic and quadratic curves). Import java.awt.geom.Point2D.
    Returns:
      a Point2D.Float object containing the control point's coordinates

  - ### SetControlPoint2

    public void SetControlPoint2(float x, float y)
    Sets the value of the second control point (only applicable to cubic curves). Values will be truncated to the curve's range min/max. Includes a call to a native function, so to conserve CPU, avoid regularly calling this function from ProcessSample().
    Parameters:
      `x` - the x component of the control point
      `y` - the y component of the control point

  - ### GetControlPoint2

    public Point2D.Float GetControlPoint2()
    Returns the x invalid input: '&' y components of the curve's second control point (only applicable to cubic curves). Import java.awt.geom.Point2D.
    Returns:
      a Point2D.Float object containing the control point's coordinates

  - ### GetCurvePosition

    public Point2D.Float GetCurvePosition(float pctDone)
    Gets the curve's location, in pixels, at a location 'pctDone' percent along the curve's length. Assumes a horizontal curve, so if your curve is vertical, you may need to convert the x value to InvertValue(y) and the y value to x. Import java.awt.geom.Point2D.
    Parameters:
      `pctDone` - how far along the curve's length to retrieve a position, from 0 - 1.
    Returns:
      a Point2D.Float object containing the curve's coordinates

  - ### GetCurvePositionNormalized

    public Point2D.Float GetCurvePositionNormalized(float pctDone)
    Gets the curve's position, in a range from 0 - 1, at a location 'pctDone' percent along the curve's length. Import java.awt.geom.Point2D.
    Parameters:
      `pctDone` - how far along the curve's length to retrieve a position, from 0 - 1.
    Returns:
      a Point2D.Float object containing the curve's position

  - ### InvertValue

    public float InvertValue(float val)
    Inverts a value to place it at the opposite end of the curve's range (e.g., if the curve has a range from 0 - 1, calling InvertValue(0.8) will return 0.2). Doesn't do any error checking to ensure that the input value is within the curve's valid range.
    Parameters:
      `val` - the value to invert
    Returns:
      the inverted value