Package voltage.core

# Class VoltageLine

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltageLine

public class VoltageLine extends VoltageComponent
Line class with optional arrow head.

- ## Field Summary

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

  `componentName, displayName`

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `float`
  `GetArrowLength()`
  returns the length of the arrow (parallel to the line's direction) in pixels; only applicable if the line has an arrow
  `float`
  `GetArrowWidth()`
  returns the width of the arrow (perpendicular to the line's direction) in pixels; only applicable if the line has an arrow
  `int`
  `GetEndX()`
  Returns the x position of the line's end point.
  `int`
  `GetEndY()`
  Returns the y position of the line's end point.
  `Color`
  `GetLineColor()`
  Returns the color in which the line will be drawn
  `float`
  `GetLineWidth()`
  Returns the line's thickness in pixels
  `int`
  `GetStartX()`
  Returns the x position of the line's starting point.
  `int`
  `GetStartY()`
  Returns the y position of the line's starting point.
  `boolean`
  `HasArrow()`
  returns true if this line has an arrow drawn at its endpoint
  `void`
  `SetArrowLength(float length)`
  sets the length of the arrow (parallel to the line's direction) in pixels; only applicable if the line has an arrow
  `void`
  `SetArrowWidth(float width)`
  sets the width of the arrow (perpendicular to the line's direction) in pixels; only applicable if the line has an arrow
  `void`
  `SetEndPosition(int xpos, int ypos)`
  Sets the position of the line's end point.
  `void`
  `SetHasArrow(boolean ha)`
  if true, the line will have an arrow drawn at its endpoint; call SetArrowWidth() and SetArrowLength() to set the size of the arrow
  `void`
  `SetLineColor(Color zeColor)`
  Sets the color with which the line will be drawn
  `void`
  `SetLineWidth(float lwidth)`
  Sets the line's thickness in pixels
  `void`
  `SetPosition(int x, int y)`
  Not applicable to VoltageLines, has no effect; call SetStartPosition, SetEndPosition, or SetPosition(xStart, yStart, xEnd, yEnd) instead
  `void`
  `SetPosition(int nStartX, int nStartY, int nEndX, int nEndY)`
  Sets the positions of the line's start and end points.
  `void`
  `SetRect(int x, int y, int width, int height)`
  Not applicable to VoltageLines, has no effect; call SetStartPosition, SetEndPosition, or SetPosition(xStart, yStart, xEnd, yEnd) instead
  `void`
  `SetSize(int width, int height)`
  Not applicable to VoltageLines, has no effect; call SetStartPosition, SetEndPosition, or SetPosition(xStart, yStart, xEnd, yEnd) instead
  `void`
  `SetStartPosition(int xpos, int ypos)`
  Sets the position of the line's starting point.

  ### 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, SetRect, 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

  - ### VoltageLine

    public VoltageLine(String name, String displayName, VoltageModule module)
    Constructor
    Parameters:
      `name` - the internal name.
      `displayName` - the display name.
      `module` - the module this belongs to.

- ## Method Details

  - ### SetLineColor

    public void SetLineColor(Color zeColor)
    Sets the color with which the line will be drawn
    Parameters:
      `zeColor` - the color to set the line.

  - ### SetLineWidth

    public void SetLineWidth(float lwidth)
    Sets the line's thickness in pixels
    Parameters:
      `lwidth` - the width of the line in pixels.

  - ### SetStartPosition

    public void SetStartPosition(int xpos, int ypos)
    Sets the position of the line's starting point.
    Parameters:
      `xpos` - x pixel coordinate.
      `ypos` - y pixel coordinate.

  - ### SetEndPosition

    public void SetEndPosition(int xpos, int ypos)
    Sets the position of the line's end point.
    Parameters:
      `xpos` - x pixel coordinate.
      `ypos` - y pixel coordinate.

  - ### SetPosition

    public void SetPosition(int nStartX, int nStartY, int nEndX, int nEndY)
    Sets the positions of the line's start and end points.
    Parameters:
      `nStartX` - x pixel coordinate.
      `nStartY` - y pixel coordinate.
      `nEndX` - x pixel coordinate.
      `nEndY` - y pixel coordinate.

  - ### SetHasArrow

    public void SetHasArrow(boolean ha)
    if true, the line will have an arrow drawn at its endpoint; call SetArrowWidth() and SetArrowLength() to set the size of the arrow
    Parameters:
      `ha` - true/false

  - ### SetArrowWidth

    public void SetArrowWidth(float width)
    sets the width of the arrow (perpendicular to the line's direction) in pixels; only applicable if the line has an arrow
    Parameters:
      `width` - arrow width in pixels.

  - ### SetArrowLength

    public void SetArrowLength(float length)
    sets the length of the arrow (parallel to the line's direction) in pixels; only applicable if the line has an arrow
    Parameters:
      `length` - arrow length in pixels.

  - ### SetPosition

    public void SetPosition(int x, int y)
    Not applicable to VoltageLines, has no effect; call SetStartPosition, SetEndPosition, or SetPosition(xStart, yStart, xEnd, yEnd) instead
    Overrides:
      `SetPosition` in class `VoltageComponent`
    Parameters:
      `x` - int
      `y` - int

  - ### SetSize

    public void SetSize(int width, int height)
    Not applicable to VoltageLines, has no effect; call SetStartPosition, SetEndPosition, or SetPosition(xStart, yStart, xEnd, yEnd) instead
    Overrides:
      `SetSize` in class `VoltageComponent`
    Parameters:
      `width` - int
      `height` - int

  - ### SetRect

    public void SetRect(int x, int y, int width, int height)
    Not applicable to VoltageLines, has no effect; call SetStartPosition, SetEndPosition, or SetPosition(xStart, yStart, xEnd, yEnd) instead
    Overrides:
      `SetRect` in class `VoltageComponent`
    Parameters:
      `x` - int
      `y` - int
      `width` - int
      `height` - int

  - ### GetLineColor

    public Color GetLineColor()
    Returns the color in which the line will be drawn
    Returns:
      the color in which the line will be drawn

  - ### GetLineWidth

    public float GetLineWidth()
    Returns the line's thickness in pixels
    Returns:
      the line's thickness in pixels

  - ### GetStartX

    public int GetStartX()
    Returns the x position of the line's starting point. Note that the line object's bounding rectangle will usually be larger than the bounding rectangle of the line's start and end points because it needs to account for line thickness and arrow size, so GetStartX() and GetEndX() (which refer to line endpoints) often won't return the same values as GetX() or GetRect() (which refer to the line object's bounding rectangle).
    Returns:
      the line's start x.

  - ### GetStartY

    public int GetStartY()
    Returns the y position of the line's starting point. Note that the line object's bounding rectangle will usually be larger than the bounding rectangle of the line's start and end points because it needs to account for line thickness and arrow size, so GetStartY() and GetEndY() (which refer to line endpoints) often won't return the same values as GetY() or GetRect() (which refer to the line object's bounding rectangle).
    Returns:
      the line's start y.

  - ### GetEndX

    public int GetEndX()
    Returns the x position of the line's end point. Note that the line object's bounding rectangle will usually be larger than the bounding rectangle of the line's start and end points because it needs to account for line thickness and arrow size, so GetStartX() and GetEndX() (which refer to line endpoints) often won't return the same values as GetX() or GetRect() (which refer to the line object's bounding rectangle).
    Returns:
      the line's end x.

  - ### GetEndY

    public int GetEndY()
    Returns the y position of the line's end point. Note that the line object's bounding rectangle will usually be larger than the bounding rectangle of the line's start and end points because it needs to account for line thickness and arrow size, so GetStartY() and GetEndY() (which refer to line endpoints) often won't return the same values as GetY() or GetRect() (which refer to the line object's bounding rectangle).
    Returns:
      the line's end y.

  - ### HasArrow

    public boolean HasArrow()
    returns true if this line has an arrow drawn at its endpoint
    Returns:
      true/false.

  - ### GetArrowWidth

    public float GetArrowWidth()
    returns the width of the arrow (perpendicular to the line's direction) in pixels; only applicable if the line has an arrow
    Returns:
      the arrow width.

  - ### GetArrowLength

    public float GetArrowLength()
    returns the length of the arrow (parallel to the line's direction) in pixels; only applicable if the line has an arrow
    Returns:
      the arrow length.