sprotty
Version:
A next-gen framework for graphical views
104 lines • 4.75 kB
TypeScript
/********************************************************************************
* Copyright (c) 2017-2018 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 { Point } from 'sprotty-protocol/lib/utils/geometry';
import { Alignable, EdgePlacement, Fadeable, Hoverable, Selectable } from 'sprotty-protocol/lib/model';
import { ModelIndexImpl, SChildElementImpl, SModelElementImpl } from '../base/model/smodel';
import { InternalBoundsAware, ModelLayoutOptions, SShapeElementImpl } from '../features/bounds/model';
import { SConnectableElementImpl, SRoutableElementImpl } from '../features/routing/model';
import { ViewportRootElementImpl } from '../features/viewport/viewport-root';
import { FluentIterable } from '../utils/iterable';
/**
* Root element for graph-like models.
*/
export declare class SGraphImpl extends ViewportRootElementImpl {
layoutOptions?: ModelLayoutOptions;
constructor(index?: SGraphIndex);
}
/**
* Model element class for nodes, which are the main entities in a graph. A node can be connected to
* another node via an SEdge. Such a connection can be direct, i.e. the node is the source or target of
* the edge, or indirect through a port, i.e. it contains an SPort which is the source or target of the edge.
*/
export declare class SNodeImpl extends SConnectableElementImpl implements Selectable, Fadeable, Hoverable {
static readonly DEFAULT_FEATURES: symbol[];
children: SChildElementImpl[];
layout?: string;
selected: boolean;
hoverFeedback: boolean;
opacity: number;
canConnect(routable: SRoutableElementImpl, role: string): boolean;
get incomingEdges(): FluentIterable<SEdgeImpl>;
get outgoingEdges(): FluentIterable<SEdgeImpl>;
}
/**
* A port is a connection point for edges. It should always be contained in an SNode.
*/
export declare class SPortImpl extends SConnectableElementImpl implements Selectable, Fadeable, Hoverable {
static readonly DEFAULT_FEATURES: symbol[];
selected: boolean;
hoverFeedback: boolean;
opacity: number;
get incomingEdges(): FluentIterable<SEdgeImpl>;
get outgoingEdges(): FluentIterable<SEdgeImpl>;
}
/**
* Model element class for edges, which are the connectors in a graph. An edge has a source and a target,
* each of which can be either a node or a port. The source and target elements are referenced via their
* ids and can be resolved with the index stored in the root element.
*/
export declare class SEdgeImpl extends SRoutableElementImpl implements Fadeable, Selectable, Hoverable, InternalBoundsAware {
static readonly DEFAULT_FEATURES: symbol[];
selected: boolean;
hoverFeedback: boolean;
opacity: number;
}
/**
* A label can be attached to a node, edge, or port, and contains some text to be rendered in its view.
*/
export declare class SLabelImpl extends SShapeElementImpl implements Selectable, Alignable, Fadeable {
static readonly DEFAULT_FEATURES: symbol[];
text: string;
selected: boolean;
alignment: Point;
opacity: number;
edgePlacement?: EdgePlacement;
}
/**
* A compartment is used to group multiple child elements such as labels of a node. Usually a `vbox`
* or `hbox` layout is used to arrange these children.
*/
export declare class SCompartmentImpl extends SShapeElementImpl implements Fadeable {
static readonly DEFAULT_FEATURES: symbol[];
children: SChildElementImpl[];
layout?: string;
layoutOptions?: {
[key: string]: string | number | boolean;
};
opacity: number;
}
/**
* A specialized model index that tracks outgoing and incoming edges.
*/
export declare class SGraphIndex extends ModelIndexImpl {
private outgoing;
private incoming;
add(element: SModelElementImpl): void;
remove(element: SModelElementImpl): void;
getAttachedElements(element: SModelElementImpl): FluentIterable<SModelElementImpl>;
getIncomingEdges(element: SConnectableElementImpl): FluentIterable<SEdgeImpl>;
getOutgoingEdges(element: SConnectableElementImpl): FluentIterable<SEdgeImpl>;
}
//# sourceMappingURL=sgraph.d.ts.map