
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you 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.
*/


/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

import { __extends } from "tslib";
import * as graphic from '../../util/graphic.js';
var ArrowSymbolPathShape = /** @class */function () {
  function ArrowSymbolPathShape() {}
  return ArrowSymbolPathShape;
}();
var ArrowSymbolPath = /** @class */function (_super) {
  __extends(ArrowSymbolPath, _super);
  // private _ctx: CanvasRenderingContext2D;
  function ArrowSymbolPath(opts) {
    return _super.call(this, opts) || this;
  }
  ArrowSymbolPath.prototype.getDefaultShape = function () {
    return new ArrowSymbolPathShape();
  };
  ArrowSymbolPath.prototype.buildPath = function (path, shape) {
    var points = shape.points,
      barWidth = shape.barWidth,
      valueLength = shape.valueLength,
      minHeight = shape.minHeight,
      isWebviewRender = shape.isWebviewRender,
      fill = shape.fill;
    var symbolProxy = this.symbolProxy;
    var symbolProxyShape = symbolProxy.shape;
    var isUp = symbolProxyShape.symbolType === 'arrowUp';
    var w = barWidth * 0.7;
    // const rectHeight = Math.max(Math.floor((28 - w) / 3), 0);
    var triangleWidth = Math.floor(w * 0.3);
    var triangleHeight = w / 2;
    for (var i = 0; i < points.length; i++) {
      var _a = points[i],
        x = _a.x,
        y = _a.y,
        value = _a.value;
      var height = Math.max(Math.round(value * valueLength), minHeight, triangleHeight);
      symbolProxyShape.x = x;
      symbolProxyShape.y = y + (isUp ? height / 2 + 10 : -height / 2 - 10);
      symbolProxyShape.width = w;
      symbolProxyShape.height = height;
      symbolProxyShape.triangleWidth = triangleWidth;
      symbolProxyShape.triangleHeight = triangleHeight;
      symbolProxy.buildPath(path, symbolProxyShape, true);
      if (isWebviewRender && i % 5 === 0 && fill) {
        path.fillStyle(fill);
        path.beginPathFill();
      }
    }
  };
  return ArrowSymbolPath;
}(graphic.Path);
export default ArrowSymbolPath;