@finos/legend-extension-dsl-diagram
Version:
Legend extension for Diagram DSL
60 lines • 2.9 kB
TypeScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type Hashable } from '@finos/legend-shared';
import { RelationshipViewEnd } from './DSL_Diagram_RelationshipViewEnd.js';
import { Point } from './geometry/DSL_Diagram_Point.js';
import type { ClassView } from './DSL_Diagram_ClassView.js';
import type { Diagram } from './DSL_Diagram_Diagram.js';
export declare class RelationshipView implements Hashable {
readonly _OWNER: Diagram;
from: RelationshipViewEnd;
to: RelationshipViewEnd;
/**
* NOTE: Unlike in the protocol model, we don't store the end points in the path but only store the
* offsets of that point from the center of the end/start classviews. The main purpose here is to
* make less error. We don't need to bother maintaining these points in the path. They are
* auto-managed. Even if an erroneous path is set (e.g. an empty list of points), this logic
* that we have will rectify that and create a sensible path.
*
* In exchange, this logic is a little complicated, we have tried to document as much about it as we could
* but the logic is not straight forward. Perhaps, we could simplify this in the future.
*/
path: Point[];
constructor(owner: Diagram, from: ClassView, to: ClassView);
/**
* Calculate the end points of the edge using offset, otherwise, use the center
*/
private computeEdgeEndpoint;
/**
* Compute the full path for the relationship view (including the ends even if these
* ends lie inside of the classviews)
*
* Notice here that the end points are recomputed every time, as such
* `path` only stores point that matters to the edge but are not end points
*/
buildFullPath(allowChange?: boolean): Point[];
/**
* For a path, only keep **at most** 1 point at each end that lies inside the class view.
* If there is no inside points, none of kept, so the path only contains outside points.
*/
static pruneUnnecessaryInsidePoints: (path: Point[], from: ClassView, to: ClassView) => Point[];
/**
* This method will compute the full path from the offset within class view for serialization and persistence purpose
*/
get pathForSerialization(): Point[];
get hashCode(): string;
}
//# sourceMappingURL=DSL_Diagram_RelationshipView.d.ts.map