sprotty
Version:
A next-gen framework for graphical views
65 lines • 3.56 kB
TypeScript
/********************************************************************************
* Copyright (c) 2024 TypeFox and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { SParentElementImpl } from "../../base/model/smodel";
import { SEdgeImpl } from "../../graph/sgraph";
import { EdgeRouting, IEdgeRoutePostprocessor, RoutedPoint } from "../routing/routing";
/**
* Finds junction points in the edge routes. A junction point is a point where two or more edges split.
* This excludes the source and target points of the edges.
*
* Only works with straight line segments.
*/
export declare class JunctionFinder implements IEdgeRoutePostprocessor {
/** Map of edges as SEdgeImpl for faster lookup by id */
protected edgesMap: Map<string, SEdgeImpl>;
/** Map of unique edges ids with the same source */
protected sourcesMap: Map<string, Set<string>>;
/** Map of unique edges ids with the same target */
protected targetsMap: Map<string, Set<string>>;
apply(routing: EdgeRouting, parent: SParentElementImpl): void;
protected findJunctions(routing: EdgeRouting, parent: SParentElementImpl): void;
/**
* Finds the junction points of routes with the same source
*/
protected findJunctionPointsWithSameSource(edge: SEdgeImpl, route: RoutedPoint[], routing: EdgeRouting): void;
/**
* Finds the junction points of routes with the same target
*/
protected findJunctionPointsWithSameTarget(edge: SEdgeImpl, route: RoutedPoint[], routing: EdgeRouting): void;
/**
* Set the junction points of two routes according to the segments direction.
* If the segments have different directions, the junction point is the previous common point.
* If the segments have the same direction, the junction point is the point with the greatest or lowest value axis value depending on the direction.
*/
protected setJunctionPoints(route: RoutedPoint[], otherRoute: RoutedPoint[], junctionIndex: number): void;
/**
* Set the previous point as a junction point.
* This is used when two segments have the same direction but the other axis is different.
* For example if the routes are going in opposite directions, or if the route don't split orthogonally.
*/
protected setPreviousPointAsJunction(route: RoutedPoint[], sameSourceRoute: RoutedPoint[], junctionIndex: number): void;
/**
* Get the main direction of a segment.
* The main direction is the axis with the greatest difference between the two points.
*/
protected getSegmentDirection(firstPoint: RoutedPoint, secondPoint: RoutedPoint): "left" | "right" | "down" | "up";
/**
* Finds the index where two routes diverge.
* Returns -1 if no divergence can be found.
*/
protected getJunctionIndex(firstRoute: RoutedPoint[], secondRoute: RoutedPoint[]): number;
}
//# sourceMappingURL=junction-finder.d.ts.map