Provides different ways to define a mapping from model items to incremental hints for use with HierarchicLayoutData.
Remarks
Only one of the provided ways to define a mapping can be used at the same time, therefore only one of the properties of this class should be set on an instance.
Functions, IMapper<K,V>s and constant values are automatically converted to IncrementalHintItemMappings. For example:
// Constant
new HierarchicLayoutData({
incrementalHints: hintsFactory.createSequenceIncrementallyHint(node)
})
// Context Delegate
new HierarchicLayoutData({
incrementalHints: (item, factory) =>
incremental ? factory.createLayerIncrementallyHint(item) : null
})
// or
const factory = hierarchicLayout.createIncrementalHintsFactory()
new HierarchicLayoutData({
incrementalHints: (item) =>
incremental ? factory.createLayerIncrementallyHint(item) : null
})
// Mapper
new HierarchicLayoutData({ incrementalHints: new Mapper() })
// or a JavaScript Map
new HierarchicLayoutData({ incrementalHints: new Map() })
// Constant
new HierarchicLayoutData({
incrementalHints: hintsFactory.createSequenceIncrementallyHint(node)
})
// Context Delegate
new HierarchicLayoutData({
incrementalHints: (item: IModelItem, factory: IIncrementalHintsFactory) =>
incremental ? factory.createLayerIncrementallyHint(item) : null
})
// or
const factory = hierarchicLayout.createIncrementalHintsFactory()
new HierarchicLayoutData({
incrementalHints: (item: IModelItem) =>
incremental ? factory.createLayerIncrementallyHint(item) : null
})
// Mapper
new HierarchicLayoutData({ incrementalHints: new Mapper() })
// or a JavaScript Map
new HierarchicLayoutData({ incrementalHints: new Map() })
Note that the properties incrementalLayeringNodes and incrementalSequencingItems cannot be defined directly using this converter.
Furthermore, the conversion supports a parameter object to initialize the properties. For example:
// Create a new IncrementalHintItemMapping from a JavaScript Map and initialize its 'mapper' with the new Map.
// This also works for the different properties as well.
const mappingFromMap = IncrementalHintItemMapping.from({
mapper: new Map()
})
// Or, instead of providing the specific property, the 'includes' key can be used
const mappingWithIncludes = IncrementalHintItemMapping.from({
includes: new Map()
})
Examples
Elements which should be placed incrementally can be provided as collections:
More specific hints can be created using an IIncrementalHintsFactory:
Type Details
- yfiles module
- view-layout-bridge
- yfiles-umd modules
- view-layout-bridge
- Legacy UMD name
- yfiles.hierarchic.IncrementalHintItemMapping
See Also
Constructors
Creates a new instance of IncrementalHintItemMapping.
Parameters
A map of options to pass to the method.
- incrementalLayeringNodes - ItemCollection<INode>
An item collection of nodes that are mapped to incremental layering hints. This option sets the incrementalLayeringNodes property on the created object.
- incrementalSequencingItems - ItemCollection<IModelItem>
An item collection of nodes or edges that are mapped to incremental sequencing hints. This option sets the incrementalSequencingItems property on the created object.
- contextDelegate - function(IModelItem, IIncrementalHintsFactory):Object
A delegate from the items and a context object to the values. This option sets the contextDelegate property on the created object.
Signature Details
function(arg1: IModelItem, arg2: IIncrementalHintsFactory) : Object
Encapsulates a method that has two parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg1 - IModelItem
- The first parameter of the method that this delegate encapsulates.
- arg2 - IIncrementalHintsFactory
- The second parameter of the method that this delegate encapsulates.
Returns
- Object
- The return value of the method that this delegate encapsulates.
- delegate - function(IModelItem):Object
A delegate that implements the mapping. This option sets the delegate property on the created object.
Signature Details
function(key: IModelItem) : Object
A delegate that mimics the get access.Parameters
- key - IModelItem
- The key of the mapping.
Returns
- Object
- The value or a suitable default that is associated with
key
.
- mapper - IMapper<IModelItem,Object>
An IMapper<K,V> that realizes the mapping. This option sets the mapper property on the created object.
- constant - Object
A constant value all items are mapped to. This option sets the constant property on the created object.
Properties
Gets or sets a constant value all items are mapped to.
Remarks
See Also
Defined in
Gets or sets a delegate from the items and a context object to the values.
Signature Details
function(arg1: IModelItem, arg2: IIncrementalHintsFactory) : any
TResult
parameter.Parameters
- arg1 - IModelItem
- The first parameter of the method that this delegate encapsulates.
- arg2 - IIncrementalHintsFactory
- The second parameter of the method that this delegate encapsulates.
Returns
- any
- The return value of the method that this delegate encapsulates.
Defined in
Gets or sets a delegate that implements the mapping.
Remarks
Signature Details
function(key: IModelItem) : any
Parameters
- key - IModelItem
- The key of the mapping.
Returns
- any
- The value or a suitable default that is associated with
key
.
See Also
Defined in
Gets or sets an item collection of nodes that are mapped to incremental layering hints.
Examples
// create a HierarchicLayout which rearranges
// only the incremental graph elements
const hl = new HierarchicLayout({ layoutMode: LayoutMode.INCREMENTAL })
// provide additional data to configure the HierarchicLayout
const hlData = new HierarchicLayoutData()
// specify the nodes to rearrange
hlData.incrementalHints.incrementalLayeringNodes = incrementalNodes
// specify the edges to rearrange
hlData.incrementalHints.incrementalSequencingItems =
ItemCollection.from(incrementalEdges)
graph.applyLayout(hl, hlData)
// create a HierarchicLayout which rearranges
// only the incremental graph elements
const hl = new HierarchicLayout({ layoutMode: LayoutMode.INCREMENTAL })
// provide additional data to configure the HierarchicLayout
const hlData = new HierarchicLayoutData()
// specify the nodes to rearrange
hlData.incrementalHints.incrementalLayeringNodes = incrementalNodes
// specify the edges to rearrange
hlData.incrementalHints.incrementalSequencingItems =
ItemCollection.from<IModelItem>(incrementalEdges)
graph.applyLayout(hl, hlData)
// create a HierarchicLayout which rearranges
// only the incremental graph elements
const hl = new HierarchicLayout({ layoutMode: LayoutMode.INCREMENTAL })
// provide additional data to configure the HierarchicLayout
const hlData = new HierarchicLayoutData()
// specify the nodes to rearrange
hlData.incrementalHints.incrementalLayeringNodes = (node) =>
isIncremental(node)
// specify the nodes and edges to rearrange
hlData.incrementalHints.incrementalSequencingItems = (item) =>
isIncremental(item)
graph.applyLayout(hl, hlData)
// create a HierarchicLayout which rearranges
// only the incremental graph elements
const hl = new HierarchicLayout({ layoutMode: LayoutMode.INCREMENTAL })
// provide additional data to configure the HierarchicLayout
const hlData = new HierarchicLayoutData()
// specify the nodes to rearrange
hlData.incrementalHints.incrementalLayeringNodes = (node: INode): boolean =>
isIncremental(node)
// specify the nodes and edges to rearrange
hlData.incrementalHints.incrementalSequencingItems = (
item: IModelItem
): boolean => isIncremental(item)
graph.applyLayout(hl, hlData)
See Also
Gets or sets an item collection of nodes or edges that are mapped to incremental sequencing hints.
Examples
// create a HierarchicLayout which rearranges
// only the incremental graph elements
const hl = new HierarchicLayout({ layoutMode: LayoutMode.INCREMENTAL })
// provide additional data to configure the HierarchicLayout
const hlData = new HierarchicLayoutData()
// specify the nodes to rearrange
hlData.incrementalHints.incrementalLayeringNodes = incrementalNodes
// specify the edges to rearrange
hlData.incrementalHints.incrementalSequencingItems =
ItemCollection.from(incrementalEdges)
graph.applyLayout(hl, hlData)
// create a HierarchicLayout which rearranges
// only the incremental graph elements
const hl = new HierarchicLayout({ layoutMode: LayoutMode.INCREMENTAL })
// provide additional data to configure the HierarchicLayout
const hlData = new HierarchicLayoutData()
// specify the nodes to rearrange
hlData.incrementalHints.incrementalLayeringNodes = incrementalNodes
// specify the edges to rearrange
hlData.incrementalHints.incrementalSequencingItems =
ItemCollection.from<IModelItem>(incrementalEdges)
graph.applyLayout(hl, hlData)
// create a HierarchicLayout which rearranges
// only the incremental graph elements
const hl = new HierarchicLayout({ layoutMode: LayoutMode.INCREMENTAL })
// provide additional data to configure the HierarchicLayout
const hlData = new HierarchicLayoutData()
// specify the nodes to rearrange
hlData.incrementalHints.incrementalLayeringNodes = (node) =>
isIncremental(node)
// specify the nodes and edges to rearrange
hlData.incrementalHints.incrementalSequencingItems = (item) =>
isIncremental(item)
graph.applyLayout(hl, hlData)
// create a HierarchicLayout which rearranges
// only the incremental graph elements
const hl = new HierarchicLayout({ layoutMode: LayoutMode.INCREMENTAL })
// provide additional data to configure the HierarchicLayout
const hlData = new HierarchicLayoutData()
// specify the nodes to rearrange
hlData.incrementalHints.incrementalLayeringNodes = (node: INode): boolean =>
isIncremental(node)
// specify the nodes and edges to rearrange
hlData.incrementalHints.incrementalSequencingItems = (
item: IModelItem
): boolean => isIncremental(item)
graph.applyLayout(hl, hlData)
See Also
Gets or sets an IMapper<K,V> that realizes the mapping.
Remarks
See Also
Defined in
Static Methods
Creates a IncrementalHintItemMapping instance from the given object by performing automatic type conversion.
Parameters
A map of options to pass to the method.
- itemMappingLike - IncrementalHintItemMapping
- The object to convert to a IncrementalHintItemMapping.
Returns
- ↪IncrementalHintItemMapping
- Either
itemMappingLike
if it is already a IncrementalHintItemMapping or a new instance, initialized to /// the values found initemMappingLike
.