sprotty
Version:
A next-gen framework for graphical views
61 lines • 3.23 kB
TypeScript
/********************************************************************************
* Copyright (c) 2021-2022 EclipseSource 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 { Point } from "sprotty-protocol/lib/utils/geometry";
import { EdgeRouting, IEdgeRoutePostprocessor, RoutedPoint } from "../routing/routing";
export interface Intersection {
readonly routable1: string;
readonly segmentIndex1: number;
readonly routable2: string;
readonly segmentIndex2: number;
readonly intersectionPoint: Point;
}
export interface IntersectingRoutedPoint extends RoutedPoint {
intersections: Intersection[];
}
export declare function isIntersectingRoutedPoint(routedPoint: Point): routedPoint is IntersectingRoutedPoint;
export declare const BY_X_THEN_Y: (a: Intersection, b: Intersection) => number;
export declare const BY_DESCENDING_X_THEN_Y: (a: Intersection, b: Intersection) => number;
export declare const BY_X_THEN_DESCENDING_Y: (a: Intersection, b: Intersection) => number;
export declare const BY_DESCENDING_X_THEN_DESCENDING_Y: (a: Intersection, b: Intersection) => number;
/**
* Finds intersections among edges and updates routed points to reflect those intersections.
*
* This only yields correct intersections among straight line segments and doesn't work with bezier curves.
*/
export declare class IntersectionFinder implements IEdgeRoutePostprocessor {
/**
* Finds all intersections in the specified `routing` and replaces the `RoutedPoints` that are
* intersecting by adding intersection information to routing points (@see `IntersectingRoutedPoints`).
* @param routing the edge routing to find intersections for and update.
*/
apply(routing: EdgeRouting): void;
/**
* Finds the intersections in the specified `routing` and returns them.
* @param routing the edge routing to find intersections for and update.
* @returns the identified intersections.
*/
find(routing: EdgeRouting): Intersection[];
/**
* Specifies whether or not a specific route should be included in this intersection search or not.
*
* As this intersection finder only supports linear line segments, this method only returns `true`
* for routes that only contain routed points, which are either 'source', 'target' or 'linear'.
*/
protected isSupportedRoute(route: RoutedPoint[]): boolean;
protected addToRouting(intersections: Intersection[], routing: EdgeRouting): void;
private addIntersectionToRoutedPoint;
}
//# sourceMappingURL=intersection-finder.d.ts.map