
/*
* 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";
import * as graphic from '../../util/graphic.js';
import { createClipPath } from '../helper/createClipPathFromCoordSys.js';
import ChartView from '../../view/Chart.js';
import { each } from 'tvrender/lib/core/util.js';
import LineFillsPath from './LineFillsPath.js';
var LineFillsView = /** @class */function (_super) {
  __extends(LineFillsView, _super);
  function LineFillsView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = LineFillsView.type;
    return _this;
  }
  LineFillsView.prototype.init = function () {};
  LineFillsView.prototype.render = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    this._renderLines(data, seriesModel, api);
    var clipPath = seriesModel.get('clip', true) && createClipPath(seriesModel.coordinateSystem, false, seriesModel);
    if (clipPath) {
      this.group.setClipPath(clipPath);
    } else {
      this.group.removeClipPath();
    }
    // toggleHoverEmphasis(this.group, null, null, false);
    // const groupId = seriesModel.get('groupId');
    // getECData(this.group).groupId = groupId;
  };

  LineFillsView.prototype._getClipShape = function (seriesModel) {
    if (!seriesModel.get('clip', true)) {
      return;
    }
    var coordSys = seriesModel.coordinateSystem;
    // PENDING make `0.1` configurable, for example, `clipTolerance`?
    return coordSys && coordSys.getArea && coordSys.getArea(.1);
  };
  LineFillsView.prototype._renderLines = function (data, seriesModel, api) {
    // const emphasisState = seriesModel.get('emphasis').emphasisState;
    if (!this._linesGroup) {
      this._linesGroup = new graphic.Group();
      this.group.add(this._linesGroup);
    } else {
      this._linesGroup.removeAll();
    }
    var linesGroup = this._linesGroup;
    var z2 = seriesModel.get('z2');
    var linesPoints = data.getLayout('linesPoints');
    each(linesPoints, function (item) {
      var color = item.color,
        points = item.points;
      var el = new LineFillsPath({
        shape: {
          points: points
        },
        style: {
          fill: color,
          stroke: 'none'
        },
        z2: z2
      });
      // el.states.emphasis = emphasisState as any;
      linesGroup.add(el);
    });
  };
  LineFillsView.prototype.remove = function (ecModel, api) {
    this._linesGroup && this._linesGroup.removeAll();
    this._linesGroup = null;
  };
  LineFillsView.prototype.dispose = function (ecModel, api) {
    this.remove(ecModel, api);
    // this._lineGroup.removeAll();
  };

  LineFillsView.type = 'lineFills';
  return LineFillsView;
}(ChartView);
export default LineFillsView;