com.dlsc.flexgantt.swing.util

## Class PathCalculator

- java.lang.Object
- - com.dlsc.flexgantt.swing.util.PathCalculator

-     public class PathCalculator
      extends Object

  Since:
    2.0
  Author:
    Dirk Lemmermann

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PathCalculator.ArrowDirection` An enum listing the various directions the arrow can be painted.
    `static class` | `PathCalculator.TargetLocation` An enumerator of possible locations that the target object can have relative to the source object.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PathCalculator()` Constructs a new path calculator.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `GeneralPath` | `calculatePathEndToEnd(Rectangle sourceRect, Rectangle targetRect)` Calculates a path from the end of the source rectangle to the end of the target rectangle.
    `GeneralPath` | `calculatePathEndToStart(Rectangle sourceRect, Rectangle targetRect)` Calculates a path from the end of the source rectangle to the start of the target rectangle.
    `GeneralPath` | `calculatePathStartToEnd(Rectangle sourceRect, Rectangle targetRect)` Calculates a path from the start of the source rectangle to the end of the target rectangle.
    `GeneralPath` | `calculatePathStartToStart(Rectangle sourceRect, Rectangle targetRect)` Calculates a path from the start of the source rectangle to the start of the target rectangle.
    `PathCalculator.ArrowDirection` | `getArrowDirection()` Returns the arrow direction.
    `int` | `getCurve()` Returns the radius of the curve.
    `int` | `getGap()` The gap determines how far the line is drawn away from the bounds of the source or target timeline object.
    `int` | `getOffset()` The offset determines the end location of the first segment of the calculated path.
    `PathCalculator.TargetLocation` | `getTargetLocation()` Returns the target location.
    `void` | `setCurve(int curve)` Sets the radius for the curve.
    `void` | `setGap(int gap)` The gap determines how far the line is drawn away from the bounds of the source or target timeline object.
    `void` | `setOffset(int offset)` The offset determines the end location of the first segment of the calculated path.

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

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

- - ### Constructor Detail

    - #### PathCalculator

          public PathCalculator()

      Constructs a new path calculator.
      Since:
        2.0

  - ### Method Detail

    - #### getTargetLocation

          public PathCalculator.TargetLocation getTargetLocation()

      Returns the target location.
      Returns:
        the target location
      Since:
        2.0

    - #### getArrowDirection

          public PathCalculator.ArrowDirection getArrowDirection()

      Returns the arrow direction.
      Returns:
        the arrow direction
      Since:
        2.0

    - #### calculatePathStartToStart

          public GeneralPath calculatePathStartToStart(Rectangle sourceRect,
                                                       Rectangle targetRect)

      Calculates a path from the start of the source rectangle to the start of the target rectangle.
      Parameters:
        `sourceRect` - the source rectangle
        `targetRect` - the target rectangle
      Returns:
        a general path that will be used for painting the relationship between source and target
      Since:
        2.0

    - #### calculatePathEndToEnd

          public GeneralPath calculatePathEndToEnd(Rectangle sourceRect,
                                                   Rectangle targetRect)

      Calculates a path from the end of the source rectangle to the end of the target rectangle.
      Parameters:
        `sourceRect` - the source rectangle
        `targetRect` - the target rectangle
      Returns:
        a general path that will be used for painting the relationship between source and target
      Since:
        2.0

    - #### calculatePathStartToEnd

          public GeneralPath calculatePathStartToEnd(Rectangle sourceRect,
                                                     Rectangle targetRect)

      Calculates a path from the start of the source rectangle to the end of the target rectangle.
      Parameters:
        `sourceRect` - the source rectangle
        `targetRect` - the target rectangle
      Returns:
        a general path that will be used for painting the relationship between source and target
      Since:
        2.0

    - #### calculatePathEndToStart

          public GeneralPath calculatePathEndToStart(Rectangle sourceRect,
                                                     Rectangle targetRect)

      Calculates a path from the end of the source rectangle to the start of the target rectangle.
      Parameters:
        `sourceRect` - the source rectangle
        `targetRect` - the target rectangle
      Returns:
        a general path that will be used for painting the relationship between source and target
      Since:
        2.0

    - #### getOffset

          public int getOffset()

      The offset determines the end location of the first segment of the calculated path. The first segment is used to move away from the start or end bounds before continuing to draw up or down.
      Returns:
        the offset
      Since:
        2.0

    - #### setOffset

          public void setOffset(int offset)

      The offset determines the end location of the first segment of the calculated path. The first segment is used to move away from the start or end bounds before continuing to draw up or down.
      Parameters:
        `offset` - the offset in pixels
      Since:
        2.0

    - #### setCurve

          public void setCurve(int curve)

      Sets the radius for the curve. The radius can not be larger than the offset (see `setOffset(int)`). Setting this value to 0 results in corners instead of curves.
      Parameters:
        `curve` - the radius of the curve
      Since:
        2.0

    - #### getCurve

          public int getCurve()

      Returns the radius of the curve.
      Returns:
        the curve radius
      Since:
        2.0

    - #### getGap

          public int getGap()

      The gap determines how far the line is drawn away from the bounds of the source or target timeline object.
      Returns:
        the gap between line and timeline objects
      Since:
        2.0

    - #### setGap

          public void setGap(int gap)

      The gap determines how far the line is drawn away from the bounds of the source or target timeline object.
      Parameters:
        `gap` - the distance between line and timeline objects
      Since:
        2.0

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.