sprotty
Version:
A next-gen framework for graphical views
53 lines • 2.77 kB
TypeScript
/********************************************************************************
* Copyright (c) 2017-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 { interfaces } from "inversify";
import { Bounds, Point } from "sprotty-protocol/lib/utils/geometry";
import { SChildElementImpl, SModelElementImpl, SModelRootImpl, SParentElementImpl } from "./smodel";
import { CustomFeatures } from "./smodel-factory";
/**
* Register a model element constructor for an element type.
*/
export declare function registerModelElement(context: {
bind: interfaces.Bind;
isBound: interfaces.IsBound;
}, type: string, constr: new () => SModelElementImpl, features?: CustomFeatures, isOverride?: boolean): void;
/**
* Find a parent element that satisfies the given predicate.
*/
export declare function findParent(element: SModelElementImpl, predicate: (e: SModelElementImpl) => boolean): SModelElementImpl | undefined;
/**
* Find a parent element that implements the feature identified with the given predicate.
*/
export declare function findParentByFeature<T>(element: SModelElementImpl, predicate: (t: SModelElementImpl) => t is SModelElementImpl & T): SModelElementImpl & T | undefined;
/**
* Translate a point from the coordinate system of the source element to the coordinate system
* of the target element.
*/
export declare function translatePoint(point: Point, source: SModelElementImpl, target: SModelElementImpl): Point;
/**
* Translate some bounds from the coordinate system of the source element to the coordinate system
* of the target element.
*/
export declare function translateBounds(bounds: Bounds, source: SModelElementImpl, target: SModelElementImpl): Bounds;
/**
* Tests if the given model contains an id of then given element or one of its descendants.
*/
export declare function containsSome(root: SModelRootImpl, element: SChildElementImpl): boolean;
/**
* Transforms the local bounds all the way up to the root.
*/
export declare function transformToRootBounds(parent: SParentElementImpl, bounds: Bounds): Bounds;
//# sourceMappingURL=smodel-utils.d.ts.map