
/*
* 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 { Path } from '../graphic.js';
var CirculateLineShape = /** @class */function () {
  function CirculateLineShape() {
    this.points = [];
    this.count = 0;
    this.gap = 0;
    this.lineWidth = 1;
  }
  return CirculateLineShape;
}();
function formatPoint(px, lineWidth) {
  if (lineWidth === void 0) {
    lineWidth = 1;
  }
  return lineWidth % 2 === 0 ? Math.floor(px) : Math.floor(px) + 0.5;
}
var CirculateLine = /** @class */function (_super) {
  __extends(CirculateLine, _super);
  function CirculateLine(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'circulateLine';
    return _this;
  }
  CirculateLine.prototype.getDefaultShape = function () {
    return new CirculateLineShape();
  };
  CirculateLine.prototype.buildPath = function (ctx, shape) {
    var points = shape.points,
      count = shape.count,
      gap = shape.gap,
      lineWidth = shape.lineWidth;
    var start = points[0],
      end = points[1];
    var _a = start || [],
      startX = _a[0],
      startY = _a[1];
    var _b = end || [],
      endX = _b[0],
      endY = _b[1];
    for (var index = 0; index < count; index++) {
      var xGap = index * gap;
      ctx.moveTo(formatPoint(startX + xGap, lineWidth), startY);
      ctx.lineTo(formatPoint(endX + xGap, lineWidth), endY);
    }
  };
  return CirculateLine;
}(Path);
export default CirculateLine;