"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module DisplayStyles
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.GroundPlane = void 0;
const ColorByName_1 = require("./ColorByName");
const ColorDef_1 = require("./ColorDef");
const defaultAboveColor = ColorDef_1.ColorDef.fromTbgr(ColorByName_1.ColorByName.darkGreen);
const defaultBelowColor = ColorDef_1.ColorDef.fromTbgr(ColorByName_1.ColorByName.darkBrown);
/** A circle drawn at a Z elevation, whose diameter is the the XY diagonal of the project extents, used to represent the ground as a reference point within a spatial view.
 * @see [[Environment.ground]].
 * @public
 */
class GroundPlane {
    constructor(props) {
        this.elevation = props.elevation ?? -0.01;
        this.aboveColor = props.aboveColor ?? defaultAboveColor;
        this.belowColor = props.belowColor ?? defaultBelowColor;
    }
    /** Create a new GroundPlane. Any properties not specified by `props` will be initialized to their default values. */
    static create(props) {
        return props ? new this(props) : this.defaults;
    }
    /** Create a copy of this ground plane, identical except for any properties explicitly specified by `changedProps`.
     * Any properties of `changedProps` explicitly set to `undefined` will be initialized to their default values.
     */
    clone(changedProps) {
        if (!changedProps)
            return this;
        return GroundPlane.create({ ...this, ...changedProps });
    }
    /** Create from JSON representation. */
    static fromJSON(props) {
        if (!props)
            return this.defaults;
        return new this({
            elevation: props.elevation,
            aboveColor: undefined !== props.aboveColor ? ColorDef_1.ColorDef.fromJSON(props.aboveColor) : undefined,
            belowColor: undefined !== props.belowColor ? ColorDef_1.ColorDef.fromJSON(props.belowColor) : undefined,
        });
    }
    /** Convert to JSON representation.
     * @param display If defined, the value to use for [[GroundPlaneProps.display]]; otherwise, that property will be left undefined.
     */
    toJSON(display) {
        const props = {
            elevation: this.elevation,
            aboveColor: this.aboveColor.toJSON(),
            belowColor: this.belowColor.toJSON(),
        };
        if (undefined !== display)
            props.display = display;
        return props;
    }
}
exports.GroundPlane = GroundPlane;
/** Default settings with a dark green "above" color, dark brown "below" color, and elevation of -0.01 meters. */
GroundPlane.defaults = new GroundPlane({});
//# sourceMappingURL=GroundPlane.js.map