C

CompositePortLocationModel

An implementation of IPortLocationModel that can be used to create custom port location models out of existing IPortLocationModelParameter instances.
ImplementsInheritance Hierarchy

Remarks

This class holds a number of parameters and serves as a container for these parameters.

Examples

Custom models can easily be created in the following way:

Creating a custom CompositePortLocationModel
const compositeModel = new CompositePortLocationModel()

compositeModel.addParameter(FreeNodePortLocationModel.CENTER)
compositeModel.addParameter(FreeNodePortLocationModel.BOTTOM)
compositeModel.addParameter(FreeNodePortLocationModel.TOP)
compositeModel.addParameter(FreeNodePortLocationModel.RIGHT)
compositeModel.addParameter(FreeNodePortLocationModel.LEFT)
graph.nodeDefaults.ports.locationParameter =
  compositeModel.locationParameters.first()!

Note that in order to work, this model needs to have at least one parameter added.

See Also

Developer's Guide

API

addParameter

Members

No filters for this type

Constructors

Initializes a new instance of the CompositePortLocationModel class.

Properties

Gets all parameters that are associated with this instance.
This enumerates the instances that wrap the parameters that have been added to this instance via addParameter.
readonlyfinal

Property Value

The parameters that are managed by this instance.

Methods

Adds the given parameter to the locationParameters of this instance.

Note that this will create a new parameter instance that is then actually bound to this instance and returned. The instance is stored by reference, so if this is a mutable instance, this instance will be implicitly modified, too.

The side, cost, and capacity are only used by the layout executor to automatically create port candidates for layout algorithms.

final

Parameters

locationParameter: IPortLocationModelParameter
The parameter to add to this instance.
side?: CompositePortLocationModelPortSide
The side an attached edge should enter or leave the port after an automatic layout.
cost?: number
The cost to take this location by an automatic layout.
capacity?: number
The capacity how many edges may be assigned to the described location by an automatic layout.

Return Value

CompositePortLocationModelParameter
The parameter to use with this model that wraps the given parameter.
Factory method that creates a parameter for the given owner that tries to match the provided location in absolute world coordinates.
This implementation iterates over all locationParameters to return the one that matches the given location the best.
final

Parameters

owner: IPortOwner
The port owner that will own the port for which the parameter shall be created.
location: Point
The location in the world coordinate system that should be matched as best as possible.

Return Value

IPortLocationModelParameter
A new instance that can be used to describe the location of an IPort at the given owner.

Throws

Exception ({ name: 'ArgumentError' })
owner is not supported by one of the added parameters.
Exception ({ name: 'ArgumentError' })
location contains one or more NaN values.
Provides a lookup context for the given port.
final

Parameters

port: IPort
The port to use in the context.

Return Value

ILookup
An implementation of the ILookup interface that can be used to query additional aspects of the port.
Determines the location of the port for the given parameter.
final

Parameters

port: IPort
The port to determine the location for.
locationParameter: IPortLocationModelParameter
The parameter to use. The parameter can be expected to be created by this instance having the model property set to this instance.

Return Value

Point
The calculated location of the port.