/**
 * DevExtreme (esm/viz/gauges/linear_range_container.js)
 * Version: 21.1.7 (build 22012-0313)
 * Build date: Wed Jan 12 2022
 *
 * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import BaseRangeContainer from "./base_range_container";
var _Number = Number;
var _max = Math.max;
import {
    normalizeEnum as _normalizeEnum
} from "../core/utils";
var LinearRangeContainer = BaseRangeContainer.inherit({
    _processOptions: function() {
        this.vertical = this._options.vertical;
        this._inner = this._outer = 0;
        if (this.vertical) {
            switch (_normalizeEnum(this._options.horizontalOrientation)) {
                case "left":
                    this._inner = 1;
                    break;
                case "center":
                    this._inner = this._outer = .5;
                    break;
                default:
                    this._outer = 1
            }
        } else {
            switch (_normalizeEnum(this._options.verticalOrientation)) {
                case "top":
                    this._inner = 1;
                    break;
                case "center":
                    this._inner = this._outer = .5;
                    break;
                default:
                    this._outer = 1
            }
        }
    },
    _isVisible: function() {
        return true
    },
    _createRange: function(range, layout) {
        var inner = this._inner;
        var outer = this._outer;
        var startPosition = this._translator.translate(range.start);
        var endPosition = this._translator.translate(range.end);
        var points;
        var x = layout.x;
        var y = layout.y;
        var startWidth = range.startWidth;
        var endWidth = range.endWidth;
        if (this.vertical) {
            points = [x - startWidth * inner, startPosition, x - endWidth * inner, endPosition, x + endWidth * outer, endPosition, x + startWidth * outer, startPosition]
        } else {
            points = [startPosition, y + startWidth * outer, startPosition, y - startWidth * inner, endPosition, y - endWidth * inner, endPosition, y + endWidth * outer]
        }
        return this._renderer.path(points, "area")
    },
    measure: function(layout) {
        var result = {};
        var width;
        result.min = result.max = layout[this.vertical ? "x" : "y"];
        width = this._options.width;
        width = _Number(width) || _max(_Number(width.start), _Number(width.end));
        result.min -= this._inner * width;
        result.max += this._outer * width;
        return result
    }
});
export default LinearRangeContainer;
