org.eclipse.graphiti.ui.internal.figures

## Class FlexibleRotatableLocator

- java.lang.Object
- - org.eclipse.draw2d.AbstractLocator
  - - org.eclipse.graphiti.ui.internal.figures.FlexibleRotatableLocator

All Implemented Interfaces:
  org.eclipse.draw2d.Locator

    public class FlexibleRotatableLocator
    extends org.eclipse.draw2d.AbstractLocator

This is a very flexible Locator, which places a `RotatableDecoration` or a non-rotatable IFigure on a `Connection`. The location is determined using a relative distance on the connection (e.g. "0.5" is the middle of the connection) and/or using an absolute distance on the connection (e.g. "100" is 100 pixel from the anchor).

### Constructor Summary

Constructors
Constructor and Description
`FlexibleRotatableLocator(org.eclipse.draw2d.Connection connection, boolean distanceToStart, double relativeDistance, int absoluteDistance, double rotateDegrees)` Creates a new FlexibleRotabableLocator.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `getAbsoluteDistance()` Returns the absolute distance of the location to the start/end-point.
`boolean` `getDistanceToStart()` Returns true, if the distance values (see `getRelativeDistance()` and `getAbsoluteDistance()`) refer to the start point of the connection.
`double` `getRelativeDistance()` Returns the relative distance of the location to the start/end-point.
`double` `getRotateDegrees()` Returns the degrees, around which the figure shall be rotated, if it is a RotatableDecoration.
`void` `relocate(org.eclipse.draw2d.IFigure target)` Rotates the figure, if it is a RotatableDecoration.
`void` `setAbsoluteDistance(int absoluteDistance)` Sets the absolute distance of the location to the start/end-point.
`void` `setDistanceToStart(boolean distanceToStart)` Sets, If the distance values refer to the start-point or the end-point.
`void` `setRelativeDistance(double relativeDistance)` Sets the relative distance of the location to the start/end-point.
`void` `setRotateDegrees(double rotateDegrees)` Sets the degrees, around which the figure shall be rotated, if it is a RotatableDecoration.

### Methods inherited from class org.eclipse.draw2d.AbstractLocator

`getGap, getRelativePosition, setGap, setRelativePosition`

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

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

### Constructor Detail

#### FlexibleRotatableLocator

    public FlexibleRotatableLocator(org.eclipse.draw2d.Connection connection,
                                    boolean distanceToStart,
                                    double relativeDistance,
                                    int absoluteDistance,
                                    double rotateDegrees)

Creates a new FlexibleRotabableLocator.

Parameters:
  `connection` - The connection, as described in `getConnection()`.
  `distanceToStart` - If the distance values refer to the start-point or the end-point. See `getDistanceToStart()`.
  `relativeDistance` - The relative distance, as described in `getRelativeDistance()`.
  `absoluteDistance` - The absolute distance, as described in `getAbsoluteDistance()`.
  `rotateDegrees` - The degrees to rotate, as described in `getRotateDegrees()`.

### Method Detail

#### getDistanceToStart

    public final boolean getDistanceToStart()

Returns true, if the distance values (see `getRelativeDistance()` and `getAbsoluteDistance()`) refer to the start point of the connection. Returns false, if the distance values refer to the end point of the connection. For example if a relative and absolute distance are "0", then returning true will place the location on the start point and returning false on the end point.

Returns:
  If the distance values refer to the start-point or the end-point.

#### setDistanceToStart

    public final void setDistanceToStart(boolean distanceToStart)

Sets, If the distance values refer to the start-point or the end-point. For details see `getDistanceToStart()`.

Parameters:
  `distanceToStart` - If true, the distance values refer to the start-point.

#### getRelativeDistance

    public final double getRelativeDistance()

Returns the relative distance of the location to the start/end-point. The total distance is calculated by ([relative distance] * [length of connection] + [absolute distance]).

Returns:
  The relative distance of the location to the start/end-point.
See Also:
  `getAbsoluteDistance()`, `getDistanceToStart()`

#### setRelativeDistance

    public final void setRelativeDistance(double relativeDistance)

Sets the relative distance of the location to the start/end-point. For details see `getRelativeDistance()`.

Parameters:
  `relativeDistance` - The relative distance of the location to the start/end-point.

#### getAbsoluteDistance

    public final int getAbsoluteDistance()

Returns the absolute distance of the location to the start/end-point. The total distance is calculated by ([relative distance] * [length of connection] + [absolute distance]).

Returns:
  The absolute distance of the location to the start/end-point.
See Also:
  `getRelativeDistance()`, `getDistanceToStart()`

#### setAbsoluteDistance

    public final void setAbsoluteDistance(int absoluteDistance)

Sets the absolute distance of the location to the start/end-point. For details see `getAbsoluteDistance()`.

Parameters:
  `absoluteDistance` - The absolute distance of the location to the start/end-point.

#### getRotateDegrees

    public final double getRotateDegrees()

Returns the degrees, around which the figure shall be rotated, if it is a RotatableDecoration. This rotation around a fixed value is done additionally to the dynamic rotation depending on the connection.

Returns:
  The degrees, around which the figure shall be rotated, if it is a RotatableDecoration.

#### setRotateDegrees

    public final void setRotateDegrees(double rotateDegrees)

Sets the degrees, around which the figure shall be rotated, if it is a RotatableDecoration. For details see `getRotateDegrees()`.

Parameters:
  `rotateDegrees` - The degrees, around which the figure shall be rotated, if it is a RotatableDecoration.

#### relocate

    public void relocate(org.eclipse.draw2d.IFigure target)

Rotates the figure, if it is a RotatableDecoration.

Specified by:
  `relocate` in interface `org.eclipse.draw2d.Locator`
Overrides:
  `relocate` in class `org.eclipse.draw2d.AbstractLocator`
Parameters:
  `target` - The figure to rotate.