Organic Edge Router
This chapter describes the major API changes to the OrganicEdgeRouter introduced with yFiles for HTML 3.0 and how to migrate from the older version.
Renamed, Moved, and Removed Classes and Members
yFiles for HTML 2.6 | yFiles for HTML 3.0 | Remarks |
---|---|---|
Changed Default Values and Behavior Changes
Port placement now considers the specified port candidates. The ports are placed in a post-processing step by the PortPlacementStage. Port candidates can be specified using the properties on the sub-data OrganicEdgeRouterData.ports. See also the section Ports.
Scope
yFiles for HTML 3.0 introduces more powerful options to configure the scope (the set of edges to route) of the organic router. The new scope property offers functionality to specify the affected edges directly or based on their incident nodes.
For more information on changes to the Scope API, see Scope and Affected Items.
const organicEdgeRouter = new OrganicEdgeRouter()
const organicRouterData = organicEdgeRouter.createLayoutData(graph)
organicRouterData.scope.edges.predicate = (edge) => {
if (edge === edge1 || edge === edge2) {
// edge1 and edge2 are routed
return true
}
// all others are not routed
return false
}
// additionally, all edges incident to node1 are routed as well
organicRouterData.scope.incidentNodes.items.add(node)
const organicEdgeRouter = new OrganicEdgeRouter()
const organicRouterData = organicEdgeRouter.createLayoutData(graph)
organicRouterData.scope.edges.predicate = (edge: any) => {
if (edge === edge1 || edge === edge2) {
// edge1 and edge2 are routed
return true
}
// all others are not routed
return false
}
// additionally, all edges incident to node1 are routed as well
organicRouterData.scope.incidentNodes.items.add(node)