Used by CreateEdgeInputMode to determine the direction in which edges get created.
Type Details
- yfiles module
- view-editor
- yfiles-umd modules
- view-editor, view-table, view
- Legacy UMD name
- yfiles.input.EdgeDirectionPolicy
Constants
A policy where edges will be created in the direction depending on whether the creation started at a source or target IPortCandidate.
Examples
With this policy CreateEdgeInputMode queries both getAllSourcePortCandidates and getAllTargetPortCandidates for a port candidate to start edge creation from. If the chosen candidate has been returned by the latter method the edge will be created in reversed order.
This requires a custom IPortCandidateProvider which implements both getAllSourcePortCandidates and getAllTargetPortCandidates to return candidates to start edge creation at the source port and at the target port, respectively.
public class TagSensitivePortCandidateProvider : IPortCandidateProvider
{
private readonly IPortOwner owner;
public TagSensitivePortCandidateProvider(IPortOwner owner) {
this.owner = owner;
}
public IEnumerable<IPortCandidate> GetSourcePortCandidates(IInputModeContext context) {
return from port in owner.Ports where "Source".Equals(port.Tag) select new DefaultPortCandidate(port);
}
public IEnumerable<IPortCandidate> GetTargetPortCandidates(IInputModeContext context) {
return from port in owner.Ports where "Target".Equals(port.Tag) select new DefaultPortCandidate(port);
}
...
}
A policy where edges can only be created from target to source port in reverse direction.
Static Methods
Converts the argument to EdgeDirectionPolicy.
Parameters
A map of options to pass to the method.
- value - EdgeDirectionPolicy
- The value to convert to EdgeDirectionPolicy.
Returns
- ↪EdgeDirectionPolicy
- Either
value
if it is already a EdgeDirectionPolicy or an appropriate converted value.