This class provides a way to easily pass custom item-specific data from an IGraph to a LayoutGraph.
Remarks
This is a generic implementation of the LayoutData class that can be used to conveniently configure a custom layout configuration and to attach arbitrary data to the LayoutGraph that is used during layout.
Instances of this type can be passed to LayoutExecutor and applyLayout. Instead of using one of the provided use-case specific LayoutData subclasses, this class can be used to provide various types of data to layout algorithms. The layout algorithms can then retrieve the data via the getDataProvider mechanism under the key used to register the data with instances of this class.
Use combineWith to create an instance that contains both the data for an existing instance and this instance. Alternatively add multiple layout data instances to instances of this type.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
/**
* @param {!LayoutGraph} graph
*/
applyLayout(graph) {
// get the data provider that was registered under the provided key
const fixedNodes = graph.getDataProvider(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
)
if (fixedNodes != null) {
for (const node of graph.nodes) {
// check whether the node was marked as fixed or not
const isFree = !fixedNodes.getBoolean(node)
if (isFree) {
// and use it
graph.setLocation(node, new YPoint(1337, 42))
}
}
}
// get the data provider that was registered under the provided key for the constraints
const affectedNodes = graph.getDataProvider(
LayoutKeys.AFFECTED_NODES_DP_KEY
)
if (affectedNodes != null) {
for (const node of graph.nodes) {
// obtain the data for each edge
if (affectedNodes.getBoolean(node)) {
// and use it
graph.setSize(node, 42, 42)
}
}
}
}
applyLayout(graph: LayoutGraph): void {
// get the data provider that was registered under the provided key
const fixedNodes = graph.getDataProvider(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
)
if (fixedNodes != null) {
for (const node of graph.nodes) {
// check whether the node was marked as fixed or not
const isFree = !fixedNodes.getBoolean(node)
if (isFree) {
// and use it
graph.setLocation(node, new YPoint(1337, 42))
}
}
}
// get the data provider that was registered under the provided key for the constraints
const affectedNodes = graph.getDataProvider(
LayoutKeys.AFFECTED_NODES_DP_KEY
)
if (affectedNodes != null) {
for (const node of graph.nodes) {
// obtain the data for each edge
if (affectedNodes.getBoolean(node)) {
// and use it
graph.setSize(node, 42, 42)
}
}
}
}
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
/**
* @param {!LayoutGraph} graph
*/
applyLayout(graph) {
// get the data provider that was registered under the provided key
const nodeHalos = graph.getDataProvider(NodeHalo.NODE_HALO_DP_KEY)
if (nodeHalos != null) {
for (const node of graph.nodes) {
// obtain the data for each node from the provider
const halo = nodeHalos.get(node)
if (halo instanceof NodeHalo) {
// and use it
graph.setLocation(node, new YPoint(halo.left, halo.top))
}
}
}
// get the data provider that was registered under the provided key for the constraints
const sourcePortConstraints = graph.getDataProvider(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY
)
if (sourcePortConstraints != null) {
for (const edge of graph.edges) {
// obtain the data for each edge
const spc = sourcePortConstraints.get(edge)
if (spc instanceof PortConstraint && !spc.strong) {
// and use it
graph.setSourcePointRel(edge, YPoint.ORIGIN)
}
}
}
}
applyLayout(graph: LayoutGraph) {
// get the data provider that was registered under the provided key
const nodeHalos = graph.getDataProvider(NodeHalo.NODE_HALO_DP_KEY)
if (nodeHalos != null) {
for (const node of graph.nodes) {
// obtain the data for each node from the provider
const halo = nodeHalos.get(node)
if (halo instanceof NodeHalo) {
// and use it
graph.setLocation(node, new YPoint(halo.left, halo.top))
}
}
}
// get the data provider that was registered under the provided key for the constraints
const sourcePortConstraints = graph.getDataProvider(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY
)
if (sourcePortConstraints != null) {
for (const edge of graph.edges) {
// obtain the data for each edge
const spc = sourcePortConstraints.get(edge)
if (spc instanceof PortConstraint && !spc.strong) {
// and use it
graph.setSourcePointRel(edge, YPoint.ORIGIN)
}
}
}
}
Type Details
- yfiles module
- view-layout-bridge
- yfiles-umd modules
- view-layout-bridge
- Legacy UMD name
- yfiles.layout.GenericLayoutData
See Also
Constructors
Creates a new instance of GenericLayoutData.
Remarks
Parameters
A map of options to pass to the method.
- nodeItemCollections - Object[]
- An array whose elements define ItemCollection<TItem>s of nodes to add.
- edgeItemCollections - Object[]
- An array whose elements define ItemCollection<TItem>s of edges to add.
- labelItemCollections - Object[]
- An array whose elements define ItemCollection<TItem>s of labels to add.
- nodeEdgeItemCollections - Object[]
- An array whose elements define ItemCollection<TItem>s of nodes and edges to add.
- nodeItemMappings - Object[]
- An array whose elements define ItemMapping<TItem,TValue>s of nodes to add.
- edgeItemMappings - Object[]
- An array whose elements define ItemMapping<TItem,TValue>s of edges to add.
- labelItemMappings - Object[]
- An array whose elements define ItemMapping<TItem,TValue>s of labels to add.
- nodeEdgeItemMappings - Object[]
- An array whose elements define ItemMapping<TItem,TValue>s of nodes and edges to add.
Examples
const layoutData = new GenericLayoutData({
// each entry will become the arguments of a call to addNodeItemCollection(dpKey, itemCollection)
nodeItemCollections: [
[
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY,
(node) => node.labels.some((label) => label.text == 'Fix')
],
[LayoutKeys.AFFECTED_NODES_DP_KEY, isAffected]
],
// each entry will become the arguments of a call to addNodeItemMapping(dpKey, itemMapping)
nodeItemMappings: [
[
NodeHalo.NODE_HALO_DP_KEY,
(node) =>
node.labels.size > 0 ? NodeHalo.create(10) : NodeHalo.ZERO_HALO
]
]
})
const layoutData = new GenericLayoutData({
// each entry will become the arguments of a call to addNodeItemCollection(dpKey, itemCollection)
nodeItemCollections: [
[
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY,
(node: INode) => node.labels.some((label) => label.text == 'Fix')
],
[LayoutKeys.AFFECTED_NODES_DP_KEY, isAffected]
],
// each entry will become the arguments of a call to addNodeItemMapping(dpKey, itemMapping)
nodeItemMappings: [
[
NodeHalo.NODE_HALO_DP_KEY,
(node: INode) =>
node.labels.size > 0 ? NodeHalo.create(10) : NodeHalo.ZERO_HALO
]
]
})
Methods
Adds the data from one ore more other LayoutData instances to this instance.
Remarks
Parameters
A map of options to pass to the method.
- data - LayoutData
- The data to add to this instance.
addEdgeItemCollection
(dpKey: string, itemCollection?: ItemCollection<IEdge>) : ItemCollection<IEdge>Adds a set of IEdges in the graph that will be passed to the LayoutGraph
Remarks
In contrast to the other overloads, this overload allows using strings as a key to use for the IDataProvider in the map of providers.
You may either specify an existing ItemCollection<TItem> or omit the parameter and use the return value to initialize the data.
Parameters
A map of options to pass to the method.
- dpKey - string
- The
string
key under which the boolean information will be stored in the LayoutGraph's map of data providers. Each corresponding element in the ItemCollection<TItem> will be associated with atrue
value. - itemCollection - ItemCollection<IEdge>
- The set of elements to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemCollection<IEdge>
- An ItemCollection<TItem>, if the
itemCollection
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
addEdgeItemCollection
(dpKey: EdgeDpKey<boolean>, itemCollection?: ItemCollection<IEdge>) : ItemCollection<IEdge>Adds a set of edges in the graph that will be passed to the LayoutGraph
Remarks
Parameters
A map of options to pass to the method.
- dpKey - EdgeDpKey<boolean>
- The key under which the boolean information will be stored in the LayoutGraph's map of data providers. Each corresponding element in the ItemCollection<TItem> will be associated with a
true
value. - itemCollection - ItemCollection<IEdge>
- The set of elements to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemCollection<IEdge>
- An ItemCollection<TItem>, if the
itemCollection
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
See Also
addEdgeItemMapping
<TValue>(dpKey: EdgeDpKey<TValue>, itemMapping?: ItemMapping<IEdge,TValue>) : ItemMapping<IEdge,TValue>Adds data per IEdge in the graph that will be added to the LayoutGraph
Remarks
Type Parameters
- TValue
Parameters
A map of options to pass to the method.
- dpKey - EdgeDpKey<TValue>
- The key under which the data will be registered in the LayoutGraph's map of data providers
- itemMapping - ItemMapping<IEdge,TValue>
- The mapping to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemMapping<IEdge,TValue>
- An ItemMapping<TItem,TValue> for IEdges, if the
itemMapping
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
See Also
addEdgeItemMapping
<TValue>(dpKey: string, itemMapping?: ItemMapping<IEdge,TValue>) : ItemMapping<IEdge,TValue>Adds data per edge in the graph that will be added to the LayoutGraph
Remarks
In contrast to the other overloads, this overload allows using strings as a key to use for the IDataProvider in the map of providers.
You may either specify an existing ItemMapping<TItem,TValue> or omit the parameter and use the return value to initialize the mapping.
Type Parameters
- TValue
Parameters
A map of options to pass to the method.
- dpKey - string
- The key under which the data will be registered in the LayoutGraph's map of data providers
- itemMapping - ItemMapping<IEdge,TValue>
- The mapping to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemMapping<IEdge,TValue>
- An ItemMapping<TItem,TValue> for IModelItems, if the
itemMapping
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
addLabelItemCollection
(dpKey: string, itemCollection?: ItemCollection<ILabel>) : ItemCollection<ILabel>Adds a set of ILabels in the graph that will be passed to the LayoutGraph
Remarks
In contrast to the other overloads, this overload allows using strings as a key to use for the IDataProvider in the map of providers.
You may either specify an existing ItemCollection<TItem> or omit the parameter and use the return value to initialize the data.
Parameters
A map of options to pass to the method.
- dpKey - string
- The
string
key under which the boolean information will be stored in the LayoutGraph's map of data providers. Each corresponding element in the ItemCollection<TItem> will be associated with atrue
value. - itemCollection - ItemCollection<ILabel>
- The set of elements to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemCollection<ILabel>
- An ItemCollection<TItem>, if the
itemCollection
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
addLabelItemCollection
(dpKey: ILabelLayoutDpKey<boolean>, itemCollection?: ItemCollection<ILabel>) : ItemCollection<ILabel>Adds a set of ILabels in the graph that will be passed to the LayoutGraph
Remarks
Parameters
A map of options to pass to the method.
- dpKey - ILabelLayoutDpKey<boolean>
- The key under which the boolean information will be stored in the LayoutGraph's map of data providers. Each corresponding element in the ItemCollection<TItem> will be associated with a
true
value. - itemCollection - ItemCollection<ILabel>
- The set of elements to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemCollection<ILabel>
- An ItemCollection<TItem>, if the
itemCollection
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
See Also
addLabelItemMapping
<TValue>(dpKey: ILabelLayoutDpKey<TValue>, itemMapping?: ItemMapping<ILabel,TValue>) : ItemMapping<ILabel,TValue>Adds data per ILabel in the graph that will be added to the LayoutGraph
Remarks
Type Parameters
- TValue
Parameters
A map of options to pass to the method.
- dpKey - ILabelLayoutDpKey<TValue>
- The key under which the data will be registered in the LayoutGraph's map of data providers
- itemMapping - ItemMapping<ILabel,TValue>
- The mapping to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemMapping<ILabel,TValue>
- An ItemMapping<TItem,TValue> for ILabels, if the
itemMapping
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
See Also
addLabelItemMapping
<TValue>(dpKey: string, itemMapping?: ItemMapping<ILabel,TValue>) : ItemMapping<ILabel,TValue>Adds data per label in the graph that will be added to the LayoutGraph
Remarks
In contrast to the other overloads, this overload allows using strings as a key to use for the IDataProvider in the map of providers.
You may either specify an existing ItemMapping<TItem,TValue> or omit the parameter and use the return value to initialize the mapping.
Type Parameters
- TValue
Parameters
A map of options to pass to the method.
- dpKey - string
- The key under which the data will be registered in the LayoutGraph's map of data providers
- itemMapping - ItemMapping<ILabel,TValue>
- The mapping to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemMapping<ILabel,TValue>
- An ItemMapping<TItem,TValue> for IModelItems, if the
itemMapping
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
addNodeEdgeItemCollection
(dpKey: string, itemCollection?: ItemCollection<IModelItem>) : ItemCollection<IModelItem>Adds a set of IModelItems in the graph that will be passed to the LayoutGraph
Remarks
In contrast to the other overloads, this overload allows using strings as a key to use for the IDataProvider in the map of providers.
You may either specify an existing ItemCollection<TItem> or omit the parameter and use the return value to initialize the data.
Parameters
A map of options to pass to the method.
- dpKey - string
- The
string
key under which the boolean information will be stored in the LayoutGraph's map of data providers. Each corresponding element in the ItemCollection<TItem> will be associated with atrue
value. - itemCollection - ItemCollection<IModelItem>
- The set of elements to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemCollection<IModelItem>
- An ItemCollection<TItem>, if the
itemCollection
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
addNodeEdgeItemCollection
(dpKey: GraphObjectDpKey<boolean>, itemCollection?: ItemCollection<IModelItem>) : ItemCollection<IModelItem>Adds a set of graph items in the graph that will be passed to the LayoutGraph
Remarks
Parameters
A map of options to pass to the method.
- dpKey - GraphObjectDpKey<boolean>
- The key under which the boolean information will be stored in the LayoutGraph's map of data providers. Each corresponding element in the ItemCollection<TItem> will be associated with a
true
value. - itemCollection - ItemCollection<IModelItem>
- The set of elements to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemCollection<IModelItem>
- An ItemCollection<TItem>, if the
itemCollection
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
addNodeEdgeItemMapping
<TValue>(dpKey: GraphObjectDpKey<TValue>, itemMapping?: ItemMapping<IModelItem,TValue>) : ItemMapping<IModelItem,TValue>Adds data per element in the graph that will be added to the LayoutGraph
Remarks
Type Parameters
- TValue
Parameters
A map of options to pass to the method.
- dpKey - GraphObjectDpKey<TValue>
- The key under which the data will be registered in the LayoutGraph's map of data providers
- itemMapping - ItemMapping<IModelItem,TValue>
- The mapping to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemMapping<IModelItem,TValue>
- An ItemMapping<TItem,TValue> for nodes and edges, if the
itemMapping
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
addNodeEdgeItemMapping
<TValue>(dpKey: string, itemMapping?: ItemMapping<IModelItem,TValue>) : ItemMapping<IModelItem,TValue>Adds data per node or edge in the graph that will be added to the LayoutGraph
Remarks
In contrast to the other overloads, this overload allows using strings as a key to use for the IDataProvider in the map of providers.
You may either specify an existing ItemMapping<TItem,TValue> or omit the parameter and use the return value to initialize the mapping.
Type Parameters
- TValue
Parameters
A map of options to pass to the method.
- dpKey - string
- The key under which the data will be registered in the LayoutGraph's map of data providers
- itemMapping - ItemMapping<IModelItem,TValue>
- The mapping to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemMapping<IModelItem,TValue>
- An ItemMapping<TItem,TValue> for IModelItems, if the
itemMapping
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
addNodeItemCollection
(dpKey: string, itemCollection?: ItemCollection<INode>) : ItemCollection<INode>Adds a set of INodes in the graph that will be passed to the LayoutGraph
Remarks
In contrast to the other overloads, this overload allows using strings as a key to use for the IDataProvider in the map of providers.
You may either specify an existing ItemCollection<TItem> or omit the parameter and use the return value to initialize the data.
Parameters
A map of options to pass to the method.
- dpKey - string
- The
string
key under which the boolean information will be stored in the LayoutGraph's map of data providers. Each corresponding element in the ItemCollection<TItem> will be associated with atrue
value. - itemCollection - ItemCollection<INode>
- The set of elements to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemCollection<INode>
- An ItemCollection<TItem>, if the
itemCollection
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
addNodeItemCollection
(dpKey: NodeDpKey<boolean>, itemCollection?: ItemCollection<INode>) : ItemCollection<INode>Adds a set of INodes in the graph that will be passed to the LayoutGraph
Remarks
Parameters
A map of options to pass to the method.
- dpKey - NodeDpKey<boolean>
- The key under which the boolean information will be stored in the LayoutGraph's map of data providers. Each corresponding element in the ItemCollection<TItem> will be associated with a
true
value. - itemCollection - ItemCollection<INode>
- The set of elements to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemCollection<INode>
- An ItemCollection<TItem>, if the
itemCollection
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify which nodes to fix
const fixedNodes = layoutData.addNodeItemCollection(
OrganicRemoveOverlapsStage.FIXED_NODE_DP_KEY
).items
for (const node of graph.nodes) {
if (node.labels.some((label) => label.text == 'Fix')) {
fixedNodes.add(node)
}
}
// specify port constraints for the edges
const affectedNodes = new ItemCollection<INode>((node) => isAffected(node))
// and register the information in the data
layoutData.addNodeItemCollection(
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedNodes
)
// run the custom layout, passing in the data
graph.applyLayout(new CustomLayout(), layoutData)
See Also
addNodeItemMapping
<TValue>(dpKey: NodeDpKey<TValue>, itemMapping?: ItemMapping<INode,TValue>) : ItemMapping<INode,TValue>Adds data per INode in the graph that will be added to the LayoutGraph
Remarks
Type Parameters
- TValue
Parameters
A map of options to pass to the method.
- dpKey - NodeDpKey<TValue>
- The key under which the data will be registered in the LayoutGraph's map of data providers
- itemMapping - ItemMapping<INode,TValue>
- The mapping to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemMapping<INode,TValue>
- An ItemMapping<TItem,TValue> for INodes, if the
itemMapping
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
See Also
addNodeItemMapping
<TValue>(dpKey: string, itemMapping?: ItemMapping<INode,TValue>) : ItemMapping<INode,TValue>Adds data per node in the graph that will be added to the LayoutGraph
Remarks
In contrast to the other overloads, this overload allows using strings as a key to use for the IDataProvider in the map of providers.
You may either specify an existing ItemMapping<TItem,TValue> or omit the parameter and use the return value to initialize the mapping.
Type Parameters
- TValue
Parameters
A map of options to pass to the method.
- dpKey - string
- The key under which the data will be registered in the LayoutGraph's map of data providers
- itemMapping - ItemMapping<INode,TValue>
- The mapping to add. If omitted, an instance will automatically be created and returned.
Returns
- ↪ItemMapping<INode,TValue>
- An ItemMapping<TItem,TValue> for IModelItems, if the
itemMapping
was specified as a parameter, it will be this instance.
Examples
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping((edge) =>
isFixedEdge(edge) ? fixedPortConstraint : null
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
// create the container for the data
const layoutData = new GenericLayoutData()
// specify halos for each node, letting the data create the mapping for us
const halos = layoutData.addNodeItemMapping(NodeHalo.NODE_HALO_DP_KEY).mapper
const labelHalo = NodeHalo.create(10, 10, 10, 10)
for (const node of graph.nodes) {
halos.set(node, node.labels.size > 0 ? labelHalo : NodeHalo.ZERO_HALO)
}
// specify port constraints for the edges
const fixedPortConstraint = PortConstraint.create(PortSide.NORTH, true)
const portConstraintMapping = new ItemMapping<IEdge, PortConstraint | null>(
(edge) => (isFixedEdge(edge) ? fixedPortConstraint : null)
)
// and register the information in the data
layoutData.addEdgeItemMapping(
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DP_KEY,
portConstraintMapping
)
// run the custom layout, passing in the data
graph.applyLayout(new MyLayout(), layoutData)
Combines this instance with the given layout data.
Remarks
Parameters
A map of options to pass to the method.
- data - LayoutData
- The LayoutData to combine this instance with.
Returns
- ↪LayoutData
- The combined layout data.