org.eclipse.gef.fx.anchors

## Class ProjectionStrategy

- java.lang.Object
- - org.eclipse.gef.fx.anchors.ProjectionStrategy

All Implemented Interfaces:
  IComputationStrategy

Direct Known Subclasses:
  ChopBoxStrategy, OrthogonalProjectionStrategy

    public class ProjectionStrategy
    extends Object
    implements IComputationStrategy

An `IComputationStrategy` that computes anchor position by projecting the respective anchored reference point to the outline of the anchorage reference geometry so that the respective point has minimal distance to the anchored reference point. In detail, the computation is done as follows:

1. Compute the anchorage outlines (in scene) based on the anchorage reference geometry,using `getOutlineSegments(IGeometry)`.
2. Transform the given anchored reference point to scene coordinates.
3. Project the anchored reference point (in scene) onto the anchorage outlines.
4. Return the nearest projection to the anchored reference point.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.eclipse.gef.fx.anchors.IComputationStrategy

`IComputationStrategy.Parameter<T>`

### Constructor Summary

Constructors
Constructor and Description
`ProjectionStrategy()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Point` `computePositionInScene(Node anchorage, Node anchored, Set<IComputationStrategy.Parameter<?>> parameters)` Computes an anchor position based on the given anchorage visual, anchored visual, and anchored reference point.
`protected Point` `computeProjectionInScene(List<ICurve> anchorageOutlinesInScene, Point anchoredReferencePointInScene, Set<IComputationStrategy.Parameter<?>> parameters)` Computes the anchorage reference position in scene coordinates, based on the given anchorage outlines and the given anchored reference point.
`protected List<ICurve>` `getOutlineSegments(IGeometry geometry)` Determines the outline of the given `IGeometry`, represented as a list of `ICurve`s.
`Set<Class<? extends IComputationStrategy.Parameter<?>>>` `getRequiredParameters()` Returns the types of parameters required by this strategy.

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

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

### Constructor Detail

#### ProjectionStrategy

    public ProjectionStrategy()

### Method Detail

#### computePositionInScene

    public Point computePositionInScene(Node anchorage,
                                        Node anchored,
                                        Set<IComputationStrategy.Parameter<?>> parameters)

Description copied from interface: `IComputationStrategy`
Computes an anchor position based on the given anchorage visual, anchored visual, and anchored reference point.

Specified by:
  `computePositionInScene` in interface `IComputationStrategy`
Parameters:
  `anchorage` - The anchorage visual.
  `anchored` - The anchored visual.
  `parameters` - The available computation parameters. strategy.
Returns:
  The anchor position.

#### computeProjectionInScene

    protected Point computeProjectionInScene(List<ICurve> anchorageOutlinesInScene,
                                             Point anchoredReferencePointInScene,
                                             Set<IComputationStrategy.Parameter<?>> parameters)

Computes the anchorage reference position in scene coordinates, based on the given anchorage outlines and the given anchored reference point.

Parameters:
  `anchorageOutlinesInScene` - A list of `ICurve`s that describe the outline of the anchorage.
  `anchoredReferencePointInScene` - The reference `Point` of the anchored for which the anchorage reference `Point` is to be determined.
  `parameters` - The parameters available for the computation.
Returns:
  The anchorage reference position.

#### getOutlineSegments

    protected List<ICurve> getOutlineSegments(IGeometry geometry)

Determines the outline of the given `IGeometry`, represented as a list of `ICurve`s.

Parameters:
  `geometry` - The anchorage geometry.
Returns:
  A list of `ICurve`s representing the outline of the given `IGeometry`.

#### getRequiredParameters

    public Set<Class<? extends IComputationStrategy.Parameter<?>>> getRequiredParameters()

Description copied from interface: `IComputationStrategy`
Returns the types of parameters required by this strategy.

Specified by:
  `getRequiredParameters` in interface `IComputationStrategy`
Returns:
  The parameters required by this strategy.