Remarks
Typically, this class is not used directly but through the LayoutExecutor or applyLayout and applyLayoutAnimated.
In addition, this class supports IGraphs with edge to edge connections, i.e., edges that are adjacent to other edges. Since such edges are not allowed in a layoutGraph, the property hideEdgesAtEdges specifies whether these edges shouldn't be converted into the layout graph at all or converted into a corresponding structure with helper nodes.
See Also
- The chapter Applying an Automatic Layout describes how to apply automatic layout algorithms.
Members
Constructors
Properties
Among other factors, the results produced by layout algorithms usually depend on the order of the nodes and edges within a graph. Unfortunately, useful operations such as hiding or unhiding elements from a graph or simply invoking layout algorithms on a graph will have the potential side effect of changing that order.
With this comparison it is possible to establish a predefined order of edges within a graph to avoid non-deterministic layout behavior.
See Also
3x3.See Also
See Also
Gets or sets a mapping that specifies how ILabels should be placed by the layout algorithm.
This setting only affects layout algorithms which support label placement. Also, if EdgeLabelPreferredPlacements are already defined for a label, all values other than KEEP_PARAMETER are ignored for that label.
Default is PREFER_MODEL.
See Also
Gets the layoutGraph instance.
Among other factors, the results produced by layout algorithms usually depend on the order of the nodes and edges within a graph. Unfortunately, useful operations such as hiding or unhiding elements from a graph or simply invoking layout algorithms on a graph will have the potential side effect of changing that order.
With this comparison it is possible to establish a predefined order of nodes within a graph to avoid non-deterministic layout behavior.
See Also
Gets or sets the mapping from ports to a policy that specifies how port locations should be adjusted after a layout has been calculated.
This can be useful if the port assignment calculated by the layout algorithm is insufficient.
Layout algorithms only consider rectangular nodes even though the actual shape of a node is, for example, circular. Hence, the ports are usually placed at the border of the nodes' bounds (except for some layout algorithms that produce straight-line edge routes and place the ports at the nodes' center).
Based on this setting the edges will be shortened or lengthened in a way that their sourcePorts and targetPorts will be placed on the node's outline.
The default is a constant ItemMapping<TItem, TValue> returning LENGTHEN for all ports.
See Also
See Also
Gets or sets a mapping that specifies how IPorts should be placed by the layout algorithm.
This setting only affects layout algorithms which support PortCandidates. Also, if PortCandidates are already defined for an edge, they override the current port positions.
Default is PREFER_MODEL.
See Also
Methods
Registers a single value data for the adapted layout graph with the specified ValueDataKey<TValue>.
dataKey, it will be replaced. To only temporarily replace an existing value, you should add a context layer before and remove it afterward.Parameters
- dataKey: ValueDataKey<T>
- The ValueDataKey<TValue> the data should be registered for.
- value: T
- The data to register.
Registers data for individual nodes at the graph with the specified NodeDataKey<TValue>.
dataKey, it will be replaced. To only temporarily replace an existing value, you should add a layer before and remove it afterward.Parameters
- dataKey: NodeDataKey<T>
- The NodeDataKey<TValue> the data should be registered for.
- provider: IMapper<INode, T>
- The data to be registered at the graph.
Registers data for individual edges at the graph with the specified EdgeDataKey<TValue>.
dataKey, it will be replaced. To only temporarily replace an existing value, you should add a layer before and remove it afterward.Parameters
- dataKey: EdgeDataKey<T>
- The EdgeDataKey<TValue> the data should be registered for.
- provider: IMapper<IEdge, T>
- The data to be registered at the graph.
Registers data for individual node labels at the graph with the specified NodeLabelDataKey<TValue>.
dataKey, it will be replaced. To only temporarily replace an existing value, you should add a layer before and remove it afterward.Parameters
- dataKey: NodeLabelDataKey<T>
- The NodeLabelDataKey<TValue> the data should be registered for.
- provider: IMapper<ILabel, T>
- The data to be registered at the graph.
Registers data for individual edge labels at the graph with the specified EdgeLabelDataKey<TValue>.
dataKey, it will be replaced. To only temporarily replace an existing value, you should add a layer before and remove it afterward.Parameters
- dataKey: EdgeLabelDataKey<T>
- The EdgeLabelDataKey<TValue> the data should be registered for.
- provider: IMapper<ILabel, T>
- The data to be registered at the graph.
Registers data for individual nodes at the graph with the specified NodeDataKey<TValue>.
The IMapper<K, V> is created from the given getter and optional setter callbacks.
If an IMapper<K, V> is already registered with the same dataKey, it will be replaced. To only temporarily replace an existing value, you should add a layer before and remove it afterward.
Parameters
- dataKey: NodeDataKey<T>
- The NodeDataKey<TValue> the data should be registered for.
- getter: function(INode): T
- A callback to get the data for an edge in the created mapper.
- setter?: function(INode, T): void
- A callback to set the data for an edge in the created mapper.
Registers data for individual edges at the graph with the specified EdgeDataKey<TValue>.
The IMapper<K, V> is created from the given getter and optional setter callbacks.
If an IMapper<K, V> is already registered with the same dataKey, it will be replaced. To only temporarily replace an existing value, you should add a layer before and remove it afterward.
Parameters
- dataKey: EdgeDataKey<T>
- The EdgeDataKey<TValue> the data should be registered for.
- getter: function(IEdge): T
- A callback to get the data for an edge in the created mapper.
- setter?: function(IEdge, T): void
- A callback to set the data for an edge in the created mapper.
Registers data for individual node labels at the graph with the specified NodeLabelDataKey<TValue>.
The IMapper<K, V> is created from the given getter and optional setter callbacks.
If an IMapper<K, V> is already registered with the same dataKey, it will be replaced. To only temporarily replace an existing value, you should add a layer before and remove it afterward.
Parameters
- dataKey: NodeLabelDataKey<T>
- The NodeLabelDataKey<TValue> the data should be registered for.
- getter: function(ILabel): T
- A callback to get the data for an edge in the created mapper.
- setter?: function(ILabel, T): void
- A callback to set the data for an edge in the created mapper.
Registers data for individual edge labels at the graph with the specified EdgeLabelDataKey<TValue>.
The IMapper<K, V> is created from the given getter and optional setter callbacks.
If an IMapper<K, V> is already registered with the same dataKey, it will be replaced. To only temporarily replace an existing value, you should add a layer before and remove it afterward.
Parameters
- dataKey: EdgeLabelDataKey<T>
- The EdgeLabelDataKey<TValue> the data should be registered for.
- getter: function(ILabel): T
- A callback to get the data for an edge in the created mapper.
- setter?: function(ILabel, T): void
- A callback to set the data for an edge in the created mapper.
Applies an ILayoutAlgorithm to an IGraph, optionally applying some LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>.
Parameters
- layout: ILayoutAlgorithm
- The layout algorithm to apply.
- layoutData?: LayoutData<INode, IEdge, ILabel, ILabel>
- The layout data.
Helper method that applies a given LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> for IGraph elements onto the layoutGraph using the mapping between the elements established by this instance.
Parameters
- layoutData: LayoutData<INode, IEdge, ILabel, ILabel>
- The data to apply to the layoutGraph
Sets the layout information of all graph items of the originalGraph to the current values of the corresponding items in the layoutGraph.
Creates a copy of an IEdgeStyle instance that is used during the layout for path calculations and the like.
style for the following IEdgeStyle implementations: PolylineEdgeStyle, ArcEdgeStyle, BezierEdgeStyle, and VOID_EDGE_STYLE. All other style implementations are replaced by instances of PolylineEdgeStyle. If you use a custom style where the edge path calculation depends on the style, you should overwrite this method and create a copy of your style instance.Parameters
- style: IEdgeStyle
- The style to copy.
Return Value
- IEdgeStyle
- A replacement of
stylethat is used during layout calculation.
Creates a copy of an INodeStyle instance that is used during the layout.
style for the following INodeStyle implementations: ShapeNodeStyle, GeneralPathNodeStyle, RectangleNodeStyle, ArrowNodeStyle, and GroupNodeStyle. All other style implementations are replaced by instances of ShapeNodeStyle. If you use a custom style where the layout calculation depends on the style, you should overwrite this method and create a copy of your style instance.Parameters
- style: INodeStyle
- The style to copy.
Return Value
- INodeStyle
- A replacement of
stylethat is used during layout calculation.
Creates the LabelCandidate for a given label and ILabelModelParameter combination.
Parameters
- originalLabel: ILabel
- The original label.
- helperLabel: ILabel
- The helper label that describes the current laid out label.
- layoutParameter: ILabelModelParameter
- The parameter to create a candidate for.
- edgeLabel: LayoutEdgeLabel
- The LayoutEdgeLabel of the label to pass to the candidate.
Return Value
- LabelCandidate
- A candidate to yield for the labeling algorithms or
null.
Creates a LabelCandidate for a given label and ILabelModelParameter combination.
Parameters
- originalLabel: ILabel
- The original label.
- helperLabel: ILabel
- The helper label that describes the current laid out label.
- layoutParameter: ILabelModelParameter
- The parameter to create a candidate for.
- ownerLayout: LayoutNodeLabel
- The LayoutNodeLabel of the label to pass to the candidate.
Return Value
- LabelCandidate
- A candidate to yield for the labeling algorithms or
null.
Initializes the layoutGraph instance by taking the current state of the originalGraph and the settings of this adapter.
newLocation is the position of the helper node center after the layout.Parameters
newLocation is the position of the source/target location after the layout.Parameters
Constants
A data provider key that can be used to look up the original IEdge of an LayoutEdge.
A data provider key that can be used to look up the original ILabel of an LayoutEdgeLabel.
A data provider key that can be used to look up the original INode of a LayoutNode.
A data provider key that can be used to look up the original ILabel of an LayoutNodeLabel.
A data provider key that can be used to look up the source port of the original IEdge of an LayoutEdge.
A data provider key that can be used to look up the target port of the original IEdge of an LayoutEdge.
This key is used to provide information about helper nodes that have been inserted into the graph to model edges at edges.
A data provider key that can be used to look up the original unconnected ports of the original IPortOwner of an LayoutEdge in the case of edge-to-edge connections.
You can access all (connected and unconnected) ports through the ports property of the original IGraph elements, which can be retrieved through the ORIGINAL_NODE_DATA_KEY and ORIGINAL_EDGE_DATA_KEY data providers. The information about whether a port is connected or not is not readily accessible from there, though. You can use this data provider to specifically find these ports, e.g. to create additional LayoutPortCandidates or just reserve space for them.
This data provider is created automatically for the layoutGraph of this LayoutGraphAdapter. Especially, it is available if the layout is run with a LayoutExecutor or methods applyLayoutAnimated and applyLayout.
A data provider key that can be used to look up the original unconnected ports of the original IPortOwner of an LayoutNode.
You can access all (connected and unconnected) ports through the ports property of the original IGraph elements, which can be retrieved through the ORIGINAL_NODE_DATA_KEY and ORIGINAL_EDGE_DATA_KEY data providers. The information about whether a port is connected or not is not readily accessible from there, though. You can use this data provider to specifically find these ports, e.g. to create additional LayoutPortCandidates or just reserve space for them.
This data provider is created automatically for the layoutGraph of this LayoutGraphAdapter. Especially, it is available if the layout is run with a LayoutExecutor or methods applyLayoutAnimated and applyLayout.