/* eslint-disable class-methods-use-this */
import { RectilinearTip } from './tips/RectilinearTip.js';
/**
 * A class that is responsible for sketching different kind of line tips.
 */
export class TipSketch {
    /**
     * Builds a tip at the **end** of the line (at the target position).
     *
     * @param type The type of the tip to construct.
     * @param line The definition of the line that the tip is attached to
     * @param directions Computed line directions
     * @returns The definition of a tip pointing at the parent (the other end)
     */
    endMarker(type, line, directions) {
        let artist;
        if (line.type === 'rectilinear') {
            artist = new RectilinearTip('end', line, directions);
        }
        else {
            throw new Error(`Unknown tip type: ${line.type}`);
        }
        let shape;
        switch (type) {
            case 'parent':
                shape = artist.parent();
                break;
            case 'direction':
                shape = artist.direction();
                break;
            case 'association':
                shape = artist.association();
                break;
            default: throw new Error(`Unsupported association shape: ${type}.`);
        }
        if (!shape) {
            throw new Error(`Unable to create a tip shape.`);
        }
        return shape;
    }
    /**
     * Builds a tip at the **start** of the line (at the source position).
     *
     * @param type The type of the tip to construct.
     * @param line The definition of the line that the tip is attached to
     * @param directions Computed line directions
     * @returns The definition of a tip pointing at the parent (the other end)
     */
    startMarker(type, line, directions) {
        let artist;
        if (line.type === 'rectilinear') {
            artist = new RectilinearTip('start', line, directions);
        }
        else {
            throw new Error(`Unknown tip type: ${line.type}`);
        }
        let shape;
        switch (type) {
            case 'parent':
                shape = artist.parent();
                break;
            case 'direction':
                shape = artist.direction();
                break;
            case 'association':
                shape = artist.association();
                break;
            default: throw new Error(`Unsupported association shape: ${type}.`);
        }
        if (!shape) {
            throw new Error(`Unable to create a tip shape.`);
        }
        return shape;
    }
}
//# sourceMappingURL=TipSketch.js.map