
/*
* 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.
 */

/*
* 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.
*/
import { __extends } from "tslib";
/**
 * Line path for bezier and straight line draw
 */
import * as graphic from '../../util/graphic.js';
import { each } from 'tvrender/lib/core/util.js';
// import { ColorString } from '../../util/types.js';
// const straightLineProto = graphic.Line.prototype;
// const bezierCurveProto = graphic.BezierCurve.prototype;
var LargeFillPolyShape = /** @class */function () {
  function LargeFillPolyShape() {
    this.pointsByColor = {};
    // points: number[][][] = [];
  }

  return LargeFillPolyShape;
}();
// function isPointNull(point: number[] | number){
//     if (point instanceof Array) {
//         return isNaN(point[0]) || isNaN(point[1])
//     }
//     return false
// }
var LargeFillPolyPath = /** @class */function (_super) {
  __extends(LargeFillPolyPath, _super);
  function LargeFillPolyPath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'largeFillPoly';
    return _this;
  }
  LargeFillPolyPath.prototype.getDefaultStyle = function () {
    return {
      stroke: 'transparent'
    };
  };
  LargeFillPolyPath.prototype.getDefaultShape = function () {
    return new LargeFillPolyShape();
  };
  LargeFillPolyPath.prototype.buildPath = function (ctx, shape) {
    var pointsByColor = shape.pointsByColor;
    each(pointsByColor, function (points, color) {
      ctx.beginPathFill();
      for (var index = 0; index < points.length; index++) {
        var polyPoints = points[index];
        for (var i = 0; i < polyPoints.length; i++) {
          if (i === 0) {
            ctx.moveTo(polyPoints[i][0], polyPoints[i][1]);
            continue;
          }
          ctx.lineTo(polyPoints[i][0], polyPoints[i][1]);
          if (i + 1 === polyPoints.length) {
            ctx.closePath();
            // const [fx, fy] = polyPoints[0];
            // ctx.lineTo(polyPoints[0][0], polyPoints[0][1]);
          }
        }
      }

      ctx.fillStyle(color);
    });
  };
  return LargeFillPolyPath;
}(graphic.Path);
export default LargeFillPolyPath;