/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { h } from "@stencil/core";
import { Angle, Point } from "@vertexvis/geometry";
export class ViewerMeasurementLine {
    constructor() {
        /**
         * A point that specifies the starting point of the line.
         */
        this.start = Point.create();
        /**
         * A point that specifies the ending point of the line.
         */
        this.end = Point.create();
        /**
         * A length of the line cap. The line cap is a line at each end of a line.
         */
        this.capLength = 0;
        /**
         * The type of [SVG pointer
         * events](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/pointer-events)
         * that the line should respond to.
         */
        this.pointerEvents = 'none';
    }
    /**
     * @ignore
     */
    render() {
        const angle = Angle.fromPoints(this.start, this.end);
        const lineFillEndCaps = getEndCapPoints(this.start, this.end, angle, this.capLength);
        const lineStrokeEndCaps = getEndCapPoints(this.start, this.end, angle, this.capLength + 1);
        return (h("svg", { key: '96c8e5b4ddb2e0bfb86e622ba7414c5061000ea9' }, h("g", { key: '6b1673f801e3776db396e5912541d51ca54d23bf', class: "line-stroke", "pointer-events": this.pointerEvents }, h("line", { key: '1ae3892507d0a63701950c12abfa67cd2f02e46f', class: "line", x1: this.start.x, y1: this.start.y, x2: this.end.x, y2: this.end.y }), h("line", { key: 'ab3111d1d00653f1d68d12e0e89ad2e0fe609049', class: "start-cap", x1: lineStrokeEndCaps.startEndCap.start.x, y1: lineStrokeEndCaps.startEndCap.start.y, x2: lineStrokeEndCaps.startEndCap.end.x, y2: lineStrokeEndCaps.startEndCap.end.y }), h("line", { key: '5c3e899afe9a95af73fcd80aa670c3849dbe1f70', class: "end-cap", x1: lineStrokeEndCaps.endEndCap.start.x, y1: lineStrokeEndCaps.endEndCap.start.y, x2: lineStrokeEndCaps.endEndCap.end.x, y2: lineStrokeEndCaps.endEndCap.end.y })), h("g", { key: 'cfef2398d0c8445e3f9223c52b446c2cb187c5e9', class: "line-fill", "pointer-events": this.pointerEvents }, h("line", { key: '90653a7c0fadd495949f85a246d3b640086fbbef', class: "line", x1: this.start.x, y1: this.start.y, x2: this.end.x, y2: this.end.y }), h("line", { key: 'c92da23e39cf9248e12875136b68aa5de42b2e09', class: "start-cap", x1: lineFillEndCaps.startEndCap.start.x, y1: lineFillEndCaps.startEndCap.start.y, x2: lineFillEndCaps.startEndCap.end.x, y2: lineFillEndCaps.startEndCap.end.y }), h("line", { key: '5dbfeff2784da10f6e1a442fcf706edf91e9e4ef', class: "end-cap", x1: lineFillEndCaps.endEndCap.start.x, y1: lineFillEndCaps.endEndCap.start.y, x2: lineFillEndCaps.endEndCap.end.x, y2: lineFillEndCaps.endEndCap.end.y }))));
    }
    static get is() { return "vertex-viewer-measurement-line"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["viewer-measurement-line.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["viewer-measurement-line.css"]
        };
    }
    static get properties() {
        return {
            "start": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "Point.Point",
                    "resolved": "Point",
                    "references": {
                        "Point": {
                            "location": "import",
                            "path": "@vertexvis/geometry",
                            "id": "../geometry/dist/index.d.ts::\"/home/runner/work/vertex-web-sdk/vertex-web-sdk/packages/geometry/dist/point\"",
                            "referenceLocation": "Point"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "A point that specifies the starting point of the line."
                },
                "getter": false,
                "setter": false,
                "defaultValue": "Point.create()"
            },
            "end": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "Point.Point",
                    "resolved": "Point",
                    "references": {
                        "Point": {
                            "location": "import",
                            "path": "@vertexvis/geometry",
                            "id": "../geometry/dist/index.d.ts::\"/home/runner/work/vertex-web-sdk/vertex-web-sdk/packages/geometry/dist/point\"",
                            "referenceLocation": "Point"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "A point that specifies the ending point of the line."
                },
                "getter": false,
                "setter": false,
                "defaultValue": "Point.create()"
            },
            "capLength": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "A length of the line cap. The line cap is a line at each end of a line."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "cap-length",
                "defaultValue": "0"
            },
            "pointerEvents": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The type of [SVG pointer\nevents](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/pointer-events)\nthat the line should respond to."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "pointer-events",
                "defaultValue": "'none'"
            }
        };
    }
}
function getEndCapPoints(start, end, angle, length) {
    return {
        startEndCap: getPerpendicularLine(start, angle, length),
        endEndCap: getPerpendicularLine(end, angle, length),
    };
}
function getPerpendicularLine(pt, angle, length) {
    const perpAngle = angle + Math.PI / 2;
    const start = Point.add(pt, Point.polar(length / 2, perpAngle));
    const end = Point.add(pt, Point.polar(length / 2, perpAngle + Math.PI));
    return { start, end };
}
//# sourceMappingURL=viewer-measurement-line.js.map
