@wcardinal/wcardinal-ui 0.310.1 → 0.312.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.310.1
2
+ Winter Cardinal UI v0.312.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1369,6 +1369,17 @@ var DASHED = 128;
1369
1369
  var DASHED_DENSELY = 256;
1370
1370
  var DASHED_LOOSELY = 512;
1371
1371
  var CURVE = 1024;
1372
+ var FORMATTER_SHIFT = 10;
1373
+ var FORMATTER_MASK = 0xffc00;
1374
+ var FORMATTER_EXTENSION_LOWEST = 512;
1375
+ var FORMATTER_EXTENSION_HIGHEST = 1023;
1376
+ var FORMATTER_CURVE = 1;
1377
+ /**
1378
+ * EShape point style.
1379
+ *
1380
+ * * Bits 0 to 9: Bit field of styles.
1381
+ * * Bits 10 to 19: Formatter ID.
1382
+ */
1372
1383
  var EShapePointsStyle = {
1373
1384
  NONE: 0,
1374
1385
  CLOSED: CLOSED,
@@ -1397,7 +1408,11 @@ var EShapePointsStyle = {
1397
1408
  /** @deprecated in favor of EShapeStrokeStyle. */
1398
1409
  DASHED_MASK: DASHED | DASHED_DENSELY | DASHED_LOOSELY,
1399
1410
  CURVE: CURVE,
1400
- FORMATTER_MASK: CURVE
1411
+ FORMATTER_SHIFT: FORMATTER_SHIFT,
1412
+ FORMATTER_MASK: FORMATTER_MASK,
1413
+ FORMATTER_EXTENSION_LOWEST: FORMATTER_EXTENSION_LOWEST,
1414
+ FORMATTER_EXTENSION_HIGHEST: FORMATTER_EXTENSION_HIGHEST,
1415
+ FORMATTER_CURVE: FORMATTER_CURVE
1401
1416
  };
1402
1417
 
1403
1418
  var buildColor = function (color, alpha, voffset, vcount, colors) {
@@ -18241,191 +18256,551 @@ var toIndexOf = function (array, value) {
18241
18256
  * Copyright (C) 2019 Toshiba Corporation
18242
18257
  * SPDX-License-Identifier: Apache-2.0
18243
18258
  */
18244
- var PID = Math.PI * 2;
18245
- var PIH = Math.PI * 0.5;
18246
- var vdot = function (x0, y0, x1, y1) {
18247
- return x0 * x1 + y0 * y1;
18248
- };
18249
- var vlen = function (x0, y0) {
18250
- return Math.sqrt(vdot(x0, y0, x0, y0));
18251
- };
18252
- var vcross = function (x0, y0, x1, y1) {
18253
- return x0 * y1 - y0 * x1;
18254
- };
18255
- var pnew = function () {
18256
- return {
18257
- center: [0, 0],
18258
- axis1: [0, 0],
18259
- axis2: [0, 0],
18260
- angle: [0, 0, 0]
18261
- };
18262
- };
18263
- var pset = function (cx, cy, a1x, a1y, a2x, a2y, angle1, angle2, angle3, result) {
18264
- var c = result.center;
18265
- c[0] = cx;
18266
- c[1] = cy;
18267
- var a1 = result.axis1;
18268
- a1[0] = a1x;
18269
- a1[1] = a1y;
18270
- var a2 = result.axis2;
18271
- a2[0] = a2x;
18272
- a2[1] = a2y;
18273
- var a = result.angle;
18274
- a[0] = angle1;
18275
- a[1] = angle2;
18276
- a[2] = angle3;
18277
- return result;
18278
- };
18279
- var pcopy = function (source, result) {
18280
- var c = source.center;
18281
- var a1 = source.axis1;
18282
- var a2 = source.axis2;
18283
- var a = source.angle;
18284
- return pset(c[0], c[1], a1[0], a1[1], a2[0], a2[1], a[0], a[1], a[2], result);
18285
- };
18286
- var acopy = function (source, result) {
18287
- var sourceLength = source.length;
18288
- for (var i = 0; i < sourceLength; ++i) {
18289
- result[i] = source[i];
18259
+ var toPointsBoundary = function (values, result) {
18260
+ var valuesLength = values.length;
18261
+ if (2 <= valuesLength) {
18262
+ var xmin = values[0];
18263
+ var ymin = values[1];
18264
+ var xmax = xmin;
18265
+ var ymax = ymin;
18266
+ for (var i = 2, imax = values.length; i < imax; i += 2) {
18267
+ var x = values[i];
18268
+ var y = values[i + 1];
18269
+ xmin = Math.min(xmin, x);
18270
+ ymin = Math.min(ymin, y);
18271
+ xmax = Math.max(xmax, x);
18272
+ ymax = Math.max(ymax, y);
18273
+ }
18274
+ result[0] = xmin;
18275
+ result[1] = ymin;
18276
+ result[2] = xmax;
18277
+ result[3] = ymax;
18290
18278
  }
18291
- if (result.length !== sourceLength) {
18292
- result.length = sourceLength;
18279
+ else {
18280
+ result[0] = 0;
18281
+ result[1] = 0;
18282
+ result[2] = 0;
18283
+ result[3] = 0;
18293
18284
  }
18294
18285
  return result;
18295
18286
  };
18296
- /**
18297
- * An utility class for spline curves based on the work of Cem Yuksel.
18298
- * Pleaase refer to the paper `A class of C2 interpolating splines`.
18299
- * http://www.cemyuksel.com/research/interpolating_splines/
18287
+
18288
+ /*
18289
+ * Copyright (C) 2019 Toshiba Corporation
18290
+ * SPDX-License-Identifier: Apache-2.0
18300
18291
  */
18301
- var UtilCurve = /** @class */ (function () {
18302
- function UtilCurve() {
18292
+ var EShapePointsMarkerBase = /** @class */ (function () {
18293
+ function EShapePointsMarkerBase(parent) {
18294
+ var _this = this;
18295
+ this._parent = parent;
18296
+ this._lockCount = 0;
18297
+ this._isTypeChanged = false;
18298
+ this._isSizeChanged = false;
18299
+ this._isFillChanged = false;
18300
+ this._type = EShapePointsMarkerType.NONE;
18301
+ this._size = new pixi_js.ObservablePoint(function () {
18302
+ _this.onSizeChange();
18303
+ }, undefined, EShapeDefaults.SIZE_X * 0.15, EShapeDefaults.SIZE_Y * 0.15);
18304
+ this._fill = this.newFill();
18305
+ this._transformId = 0;
18303
18306
  }
18304
- UtilCurve.set = function (center1, angle10, angle11, axis11, axis12, center2, angle20, angle21, axis21, axis22, nsegment, isAdaptive, isEdge, result, resultIndex) {
18305
- var a = Math.max(Math.abs(angle10 - angle11), Math.abs(angle20 - angle21));
18306
- var n = isAdaptive ? Math.max(1, Math.round(nsegment * (a / PIH))) : nsegment;
18307
- var imax = isEdge ? n + 1 : n;
18308
- for (var i = 0; i < imax; ++i) {
18309
- var t = i / n;
18310
- var w0 = 1 - t;
18311
- var w1 = t;
18312
- var t1 = w0 * angle10 + w1 * angle11;
18313
- var c1 = Math.cos(t1);
18314
- var s1 = Math.sin(t1);
18315
- var x1 = center1[0] + c1 * axis11[0] + s1 * axis12[0];
18316
- var y1 = center1[1] + c1 * axis11[1] + s1 * axis12[1];
18317
- var t2 = w0 * angle20 + w1 * angle21;
18318
- var c2 = Math.cos(t2);
18319
- var s2 = Math.sin(t2);
18320
- var x2 = center2[0] + c2 * axis21[0] + s2 * axis22[0];
18321
- var y2 = center2[1] + c2 * axis21[1] + s2 * axis22[1];
18322
- var t3 = PIH * t;
18323
- var c3 = Math.cos(t3);
18324
- var s3 = Math.sin(t3);
18325
- var cc3 = c3 * c3;
18326
- var ss3 = s3 * s3;
18327
- var x3 = cc3 * x1 + ss3 * x2;
18328
- var y3 = cc3 * y1 + ss3 * y2;
18329
- result[++resultIndex] = x3;
18330
- result[++resultIndex] = y3;
18331
- }
18332
- return resultIndex;
18307
+ EShapePointsMarkerBase.prototype.newFill = function () {
18308
+ return new EShapeFillImpl(this, true, EShapeDefaults.FILL_COLOR, 1);
18333
18309
  };
18334
- /**
18335
- * Calculate an interpolated points of the given control points.
18336
- *
18337
- * @param length A number of control points.
18338
- * @param values An array of control points.
18339
- * @param toParameter An interpolation method.
18340
- * @param isClosed True if the line is closed.
18341
- * @param nsegment The number of segments per 90 degree if isAdaptive is true.
18342
- * If isAdaptive is false, the number of segments is fixed to the given number
18343
- * regardless of arc angles.
18344
- * @param isAdaptive True to adjust the number of segments adaptively.
18345
- * @returns An interpolated points of the given control points.
18346
- */
18347
- UtilCurve.interpolate = function (length, values, segments, toParameter, isClosed, nsegment, isAdaptive, result) {
18348
- var rvalues = result.values;
18349
- var rsegments = result.segments;
18350
- if (length <= 2) {
18351
- acopy(values, rvalues);
18352
- acopy(segments, rsegments);
18353
- return result;
18310
+ EShapePointsMarkerBase.prototype.lock = function () {
18311
+ this._lockCount += 1;
18312
+ if (this._lockCount === 1) {
18313
+ this._isTypeChanged = false;
18314
+ this._isSizeChanged = false;
18315
+ this._isFillChanged = false;
18354
18316
  }
18355
- var c0 = this.WORK_P0 || pnew();
18356
- var c1 = this.WORK_P1 || pnew();
18357
- var c2 = this.WORK_P2 || pnew();
18358
- this.WORK_P0 = c0;
18359
- this.WORK_P1 = c1;
18360
- this.WORK_P2 = c2;
18361
- var rvaluesCount = -1;
18362
- var rsegmentCount = -1;
18363
- if (isClosed) {
18364
- toParameter(0, length, values, c0);
18365
- pcopy(c0, c1);
18366
- for (var i = 1; i < length; ++i) {
18367
- toParameter(i, length, values, c2);
18368
- if (0 <= toIndexOf(segments, i)) {
18369
- var index = (i - 1) << 1;
18370
- rvalues[++rvaluesCount] = values[index + 0];
18371
- rvalues[++rvaluesCount] = values[index + 1];
18372
- rsegments[++rsegmentCount] = (rvaluesCount + 1) >> 1;
18373
- }
18374
- else {
18375
- rvaluesCount = this.set(c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, c2.center, c2.angle[0], c2.angle[1], c2.axis1, c2.axis2, nsegment, isAdaptive, false, rvalues, rvaluesCount);
18376
- }
18377
- var c3 = c1;
18378
- c1 = c2;
18379
- c2 = c3;
18317
+ return this;
18318
+ };
18319
+ EShapePointsMarkerBase.prototype.unlock = function () {
18320
+ this._lockCount -= 1;
18321
+ if (this._lockCount === 0) {
18322
+ if (this._isTypeChanged) {
18323
+ this.onTypeChange();
18380
18324
  }
18381
- if (0 <= toIndexOf(segments, 0)) {
18382
- var index = (length - 1) << 1;
18383
- rvalues[++rvaluesCount] = values[index + 0];
18384
- rvalues[++rvaluesCount] = values[index + 1];
18385
- rsegments.unshift(0);
18386
- rsegmentCount += 1;
18325
+ else if (this._isSizeChanged) {
18326
+ this.onSizeChange();
18387
18327
  }
18388
- else {
18389
- rvaluesCount = this.set(c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, c0.center, c0.angle[0], c0.angle[1], c0.axis1, c0.axis2, nsegment, isAdaptive, false, rvalues, rvaluesCount);
18328
+ else if (this._isFillChanged) {
18329
+ this.onFillChange();
18390
18330
  }
18331
+ this._isTypeChanged = false;
18332
+ this._isSizeChanged = false;
18333
+ this._isFillChanged = false;
18391
18334
  }
18392
- else {
18393
- toParameter(1, length, values, c0);
18394
- if (0 <= toIndexOf(segments, 1)) {
18395
- rvalues[++rvaluesCount] = values[0];
18396
- rvalues[++rvaluesCount] = values[1];
18397
- rsegments[++rsegmentCount] = 1;
18398
- }
18399
- else {
18400
- rvaluesCount = this.set(c0.center, c0.angle[0], c0.angle[1], c0.axis1, c0.axis2, c0.center, c0.angle[0], c0.angle[1], c0.axis1, c0.axis2, nsegment, isAdaptive, false, rvalues, rvaluesCount);
18401
- }
18402
- pcopy(c0, c1);
18403
- for (var i = 2, imax = length - 1; i < imax; ++i) {
18404
- toParameter(i, length, values, c2);
18405
- if (0 <= toIndexOf(segments, i)) {
18406
- var index = (i - 1) << 1;
18407
- rvalues[++rvaluesCount] = values[index + 0];
18408
- rvalues[++rvaluesCount] = values[index + 1];
18409
- rsegments[++rsegmentCount] = (rvaluesCount + 1) >> 1;
18410
- }
18411
- else {
18412
- rvaluesCount = this.set(c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, c2.center, c2.angle[0], c2.angle[1], c2.axis1, c2.axis2, nsegment, isAdaptive, false, rvalues, rvaluesCount);
18413
- }
18414
- var c3 = c1;
18415
- c1 = c2;
18416
- c2 = c3;
18417
- }
18418
- if (0 <= toIndexOf(segments, length - 1)) {
18419
- var index = (length - 2) << 1;
18420
- rvalues[++rvaluesCount] = values[index + 0];
18421
- rvalues[++rvaluesCount] = values[index + 1];
18422
- rsegments[++rsegmentCount] = (rvaluesCount + 1) >> 1;
18423
- }
18424
- else {
18425
- rvaluesCount = this.set(c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, nsegment, isAdaptive, true, rvalues, rvaluesCount);
18335
+ return this;
18336
+ };
18337
+ Object.defineProperty(EShapePointsMarkerBase.prototype, "type", {
18338
+ get: function () {
18339
+ return this._type;
18340
+ },
18341
+ set: function (type) {
18342
+ if (this._type !== type) {
18343
+ this._type = type;
18344
+ this.onTypeChange();
18426
18345
  }
18346
+ },
18347
+ enumerable: false,
18348
+ configurable: true
18349
+ });
18350
+ EShapePointsMarkerBase.prototype.onTypeChange = function () {
18351
+ if (0 < this._lockCount) {
18352
+ this._isTypeChanged = true;
18353
+ return;
18427
18354
  }
18428
- rvaluesCount += 1;
18355
+ this._parent.onTypeChange();
18356
+ };
18357
+ Object.defineProperty(EShapePointsMarkerBase.prototype, "size", {
18358
+ get: function () {
18359
+ return this._size;
18360
+ },
18361
+ enumerable: false,
18362
+ configurable: true
18363
+ });
18364
+ EShapePointsMarkerBase.prototype.onSizeChange = function () {
18365
+ if (0 < this._lockCount) {
18366
+ this._isSizeChanged = true;
18367
+ return;
18368
+ }
18369
+ this._parent.onSizeChange();
18370
+ };
18371
+ Object.defineProperty(EShapePointsMarkerBase.prototype, "transform", {
18372
+ get: function () {
18373
+ return this.updateTransform();
18374
+ },
18375
+ enumerable: false,
18376
+ configurable: true
18377
+ });
18378
+ EShapePointsMarkerBase.prototype.updateTransform = function () {
18379
+ var result = this._transform;
18380
+ if (result == null) {
18381
+ result = new pixi_js.Matrix();
18382
+ this._transform = result;
18383
+ }
18384
+ var parentParent = this._parent.parent;
18385
+ var id = parentParent.id;
18386
+ if (this._transformId !== id) {
18387
+ this._transformId = id;
18388
+ var formatted = parentParent.formatted;
18389
+ if (2 <= formatted.length) {
18390
+ this.toTransform(formatted.values, result);
18391
+ }
18392
+ else {
18393
+ result.identity();
18394
+ }
18395
+ }
18396
+ return result;
18397
+ };
18398
+ EShapePointsMarkerBase.prototype.toTransformMatrix = function (x0, y0, x1, y1, result) {
18399
+ var dx = x0 - x1;
18400
+ var dy = y0 - y1;
18401
+ var n = dx * dx + dy * dy;
18402
+ if (0.00001 < n) {
18403
+ var f = 1 / Math.sqrt(n);
18404
+ var nx = dx * f;
18405
+ var ny = dy * f;
18406
+ result.set(ny, -nx, -nx, -ny, x0, y0);
18407
+ }
18408
+ else {
18409
+ result.set(1, 0, 0, 1, x0, y0);
18410
+ }
18411
+ return result;
18412
+ };
18413
+ Object.defineProperty(EShapePointsMarkerBase.prototype, "fill", {
18414
+ get: function () {
18415
+ return this._fill;
18416
+ },
18417
+ enumerable: false,
18418
+ configurable: true
18419
+ });
18420
+ EShapePointsMarkerBase.prototype.onFillChange = function () {
18421
+ if (0 < this._lockCount) {
18422
+ this._isFillChanged = true;
18423
+ return;
18424
+ }
18425
+ this._parent.onFillChange();
18426
+ };
18427
+ EShapePointsMarkerBase.prototype.updateUploaded = function () {
18428
+ this.onFillChange();
18429
+ };
18430
+ EShapePointsMarkerBase.prototype.copy = function (source) {
18431
+ var size = source.size;
18432
+ this.set(source.type, size.x, size.y);
18433
+ return this;
18434
+ };
18435
+ EShapePointsMarkerBase.prototype.set = function (type, sizeX, sizeY) {
18436
+ this.lock();
18437
+ if (type != null) {
18438
+ this.type = type;
18439
+ }
18440
+ this.size.set(sizeX, sizeY);
18441
+ this.unlock();
18442
+ return this;
18443
+ };
18444
+ EShapePointsMarkerBase.prototype.serialize = function (manager) {
18445
+ var size = this._size;
18446
+ var fillId = this._fill.serialize(manager);
18447
+ return manager.addResource("[".concat(this._type, ",").concat(size.x, ",").concat(size.y, ",").concat(fillId, "]"));
18448
+ };
18449
+ EShapePointsMarkerBase.prototype.deserialize = function (resourceId, manager) {
18450
+ var resources = manager.resources;
18451
+ if (0 <= resourceId && resourceId < resources.length) {
18452
+ var parsed = manager.getExtension(resourceId);
18453
+ if (parsed == null) {
18454
+ parsed = JSON.parse(resources[resourceId]);
18455
+ manager.setExtension(resourceId, parsed);
18456
+ }
18457
+ this.lock();
18458
+ this.type = parsed[0];
18459
+ this._size.set(parsed[1], parsed[2]);
18460
+ this._fill.deserialize(parsed[3], manager);
18461
+ this.unlock();
18462
+ }
18463
+ };
18464
+ return EShapePointsMarkerBase;
18465
+ }());
18466
+
18467
+ var EShapePointsMarkerHead = /** @class */ (function (_super) {
18468
+ __extends(EShapePointsMarkerHead, _super);
18469
+ function EShapePointsMarkerHead() {
18470
+ return _super !== null && _super.apply(this, arguments) || this;
18471
+ }
18472
+ EShapePointsMarkerHead.prototype.toTransform = function (values, result) {
18473
+ var valuesLength = values.length;
18474
+ if (4 <= valuesLength) {
18475
+ return this.toTransformMatrix(values[valuesLength - 2], values[valuesLength - 1], values[valuesLength - 4], values[valuesLength - 3], result);
18476
+ }
18477
+ else {
18478
+ result.identity();
18479
+ }
18480
+ return result;
18481
+ };
18482
+ return EShapePointsMarkerHead;
18483
+ }(EShapePointsMarkerBase));
18484
+
18485
+ var EShapePointsMarkerTail = /** @class */ (function (_super) {
18486
+ __extends(EShapePointsMarkerTail, _super);
18487
+ function EShapePointsMarkerTail() {
18488
+ return _super !== null && _super.apply(this, arguments) || this;
18489
+ }
18490
+ EShapePointsMarkerTail.prototype.toTransform = function (values, result) {
18491
+ var valuesLength = values.length;
18492
+ if (4 <= valuesLength) {
18493
+ return this.toTransformMatrix(values[0], values[1], values[2], values[3], result);
18494
+ }
18495
+ else {
18496
+ result.identity();
18497
+ }
18498
+ return result;
18499
+ };
18500
+ return EShapePointsMarkerTail;
18501
+ }(EShapePointsMarkerBase));
18502
+
18503
+ /*
18504
+ * Copyright (C) 2019 Toshiba Corporation
18505
+ * SPDX-License-Identifier: Apache-2.0
18506
+ */
18507
+ var EShapePointsMarkerContainerImpl = /** @class */ (function () {
18508
+ function EShapePointsMarkerContainerImpl(parent) {
18509
+ this._parent = parent;
18510
+ this._lockCount = 0;
18511
+ this._isTypeChanged = false;
18512
+ this._isSizeChanged = false;
18513
+ this._isFillChanged = false;
18514
+ this._head = new EShapePointsMarkerHead(this);
18515
+ this._tail = new EShapePointsMarkerTail(this);
18516
+ }
18517
+ EShapePointsMarkerContainerImpl.prototype.lock = function () {
18518
+ this._lockCount += 1;
18519
+ if (this._lockCount === 1) {
18520
+ this._isTypeChanged = false;
18521
+ this._isSizeChanged = false;
18522
+ this._isFillChanged = false;
18523
+ }
18524
+ return this;
18525
+ };
18526
+ EShapePointsMarkerContainerImpl.prototype.unlock = function () {
18527
+ this._lockCount -= 1;
18528
+ if (this._lockCount === 0) {
18529
+ if (this._isTypeChanged) {
18530
+ this.onTypeChange();
18531
+ }
18532
+ else if (this._isSizeChanged) {
18533
+ this.onSizeChange();
18534
+ }
18535
+ else if (this._isFillChanged) {
18536
+ this.onFillChange();
18537
+ }
18538
+ this._isTypeChanged = false;
18539
+ this._isSizeChanged = false;
18540
+ this._isFillChanged = false;
18541
+ }
18542
+ return this;
18543
+ };
18544
+ Object.defineProperty(EShapePointsMarkerContainerImpl.prototype, "parent", {
18545
+ get: function () {
18546
+ return this._parent;
18547
+ },
18548
+ enumerable: false,
18549
+ configurable: true
18550
+ });
18551
+ Object.defineProperty(EShapePointsMarkerContainerImpl.prototype, "head", {
18552
+ get: function () {
18553
+ return this._head;
18554
+ },
18555
+ enumerable: false,
18556
+ configurable: true
18557
+ });
18558
+ Object.defineProperty(EShapePointsMarkerContainerImpl.prototype, "tail", {
18559
+ get: function () {
18560
+ return this._tail;
18561
+ },
18562
+ enumerable: false,
18563
+ configurable: true
18564
+ });
18565
+ EShapePointsMarkerContainerImpl.prototype.onTypeChange = function () {
18566
+ if (0 < this._lockCount) {
18567
+ this._isTypeChanged = true;
18568
+ return;
18569
+ }
18570
+ this._parent.onMarkerTypeChange();
18571
+ };
18572
+ EShapePointsMarkerContainerImpl.prototype.onSizeChange = function () {
18573
+ if (0 < this._lockCount) {
18574
+ this._isSizeChanged = true;
18575
+ return;
18576
+ }
18577
+ this._parent.onMarkerSizeChange();
18578
+ };
18579
+ EShapePointsMarkerContainerImpl.prototype.onFillChange = function () {
18580
+ if (0 < this._lockCount) {
18581
+ this._isFillChanged = true;
18582
+ return;
18583
+ }
18584
+ this._parent.onMarkerFillChange();
18585
+ };
18586
+ EShapePointsMarkerContainerImpl.prototype.copy = function (source) {
18587
+ this.lock();
18588
+ this._head.copy(source.head);
18589
+ this._tail.copy(source.tail);
18590
+ this.unlock();
18591
+ return this;
18592
+ };
18593
+ EShapePointsMarkerContainerImpl.prototype.serialize = function (manager) {
18594
+ var headId = this._head.serialize(manager);
18595
+ var tailId = this._tail.serialize(manager);
18596
+ return manager.addResource("[".concat(headId, ",").concat(tailId, "]"));
18597
+ };
18598
+ EShapePointsMarkerContainerImpl.prototype.deserialize = function (resourceId, manager) {
18599
+ var resources = manager.resources;
18600
+ if (0 <= resourceId && resourceId < resources.length) {
18601
+ var parsed = manager.getExtension(resourceId);
18602
+ if (parsed == null) {
18603
+ parsed = JSON.parse(resources[resourceId]);
18604
+ manager.setExtension(resourceId, parsed);
18605
+ }
18606
+ this.lock();
18607
+ this._head.deserialize(parsed[0], manager);
18608
+ this._tail.deserialize(parsed[1], manager);
18609
+ this.unlock();
18610
+ }
18611
+ };
18612
+ return EShapePointsMarkerContainerImpl;
18613
+ }());
18614
+
18615
+ /*
18616
+ * Copyright (C) 2019 Toshiba Corporation
18617
+ * SPDX-License-Identifier: Apache-2.0
18618
+ */
18619
+ var PID = Math.PI * 2;
18620
+ var PIH = Math.PI * 0.5;
18621
+ var vdot = function (x0, y0, x1, y1) {
18622
+ return x0 * x1 + y0 * y1;
18623
+ };
18624
+ var vlen = function (x0, y0) {
18625
+ return Math.sqrt(vdot(x0, y0, x0, y0));
18626
+ };
18627
+ var vcross = function (x0, y0, x1, y1) {
18628
+ return x0 * y1 - y0 * x1;
18629
+ };
18630
+ var pnew = function () {
18631
+ return {
18632
+ center: [0, 0],
18633
+ axis1: [0, 0],
18634
+ axis2: [0, 0],
18635
+ angle: [0, 0, 0]
18636
+ };
18637
+ };
18638
+ var pset = function (cx, cy, a1x, a1y, a2x, a2y, angle1, angle2, angle3, result) {
18639
+ var c = result.center;
18640
+ c[0] = cx;
18641
+ c[1] = cy;
18642
+ var a1 = result.axis1;
18643
+ a1[0] = a1x;
18644
+ a1[1] = a1y;
18645
+ var a2 = result.axis2;
18646
+ a2[0] = a2x;
18647
+ a2[1] = a2y;
18648
+ var a = result.angle;
18649
+ a[0] = angle1;
18650
+ a[1] = angle2;
18651
+ a[2] = angle3;
18652
+ return result;
18653
+ };
18654
+ var pcopy = function (source, result) {
18655
+ var c = source.center;
18656
+ var a1 = source.axis1;
18657
+ var a2 = source.axis2;
18658
+ var a = source.angle;
18659
+ return pset(c[0], c[1], a1[0], a1[1], a2[0], a2[1], a[0], a[1], a[2], result);
18660
+ };
18661
+ var acopy = function (source, result) {
18662
+ var sourceLength = source.length;
18663
+ for (var i = 0; i < sourceLength; ++i) {
18664
+ result[i] = source[i];
18665
+ }
18666
+ if (result.length !== sourceLength) {
18667
+ result.length = sourceLength;
18668
+ }
18669
+ return result;
18670
+ };
18671
+ /**
18672
+ * An utility class for spline curves based on the work of Cem Yuksel.
18673
+ * Pleaase refer to the paper `A class of C2 interpolating splines`.
18674
+ * http://www.cemyuksel.com/research/interpolating_splines/
18675
+ */
18676
+ var UtilCurve = /** @class */ (function () {
18677
+ function UtilCurve() {
18678
+ }
18679
+ UtilCurve.set = function (center1, angle10, angle11, axis11, axis12, center2, angle20, angle21, axis21, axis22, nsegment, isAdaptive, isEdge, result, resultIndex) {
18680
+ var a = Math.max(Math.abs(angle10 - angle11), Math.abs(angle20 - angle21));
18681
+ var n = isAdaptive ? Math.max(1, Math.round(nsegment * (a / PIH))) : nsegment;
18682
+ var imax = isEdge ? n + 1 : n;
18683
+ for (var i = 0; i < imax; ++i) {
18684
+ var t = i / n;
18685
+ var w0 = 1 - t;
18686
+ var w1 = t;
18687
+ var t1 = w0 * angle10 + w1 * angle11;
18688
+ var c1 = Math.cos(t1);
18689
+ var s1 = Math.sin(t1);
18690
+ var x1 = center1[0] + c1 * axis11[0] + s1 * axis12[0];
18691
+ var y1 = center1[1] + c1 * axis11[1] + s1 * axis12[1];
18692
+ var t2 = w0 * angle20 + w1 * angle21;
18693
+ var c2 = Math.cos(t2);
18694
+ var s2 = Math.sin(t2);
18695
+ var x2 = center2[0] + c2 * axis21[0] + s2 * axis22[0];
18696
+ var y2 = center2[1] + c2 * axis21[1] + s2 * axis22[1];
18697
+ var t3 = PIH * t;
18698
+ var c3 = Math.cos(t3);
18699
+ var s3 = Math.sin(t3);
18700
+ var cc3 = c3 * c3;
18701
+ var ss3 = s3 * s3;
18702
+ var x3 = cc3 * x1 + ss3 * x2;
18703
+ var y3 = cc3 * y1 + ss3 * y2;
18704
+ result[++resultIndex] = x3;
18705
+ result[++resultIndex] = y3;
18706
+ }
18707
+ return resultIndex;
18708
+ };
18709
+ /**
18710
+ * Calculate an interpolated points of the given control points.
18711
+ *
18712
+ * @param length A number of control points.
18713
+ * @param values An array of control points.
18714
+ * @param toParameter An interpolation method.
18715
+ * @param isClosed True if the line is closed.
18716
+ * @param nsegment The number of segments per 90 degree if isAdaptive is true.
18717
+ * If isAdaptive is false, the number of segments is fixed to the given number
18718
+ * regardless of arc angles.
18719
+ * @param isAdaptive True to adjust the number of segments adaptively.
18720
+ * @returns An interpolated points of the given control points.
18721
+ */
18722
+ UtilCurve.interpolate = function (length, values, segments, toParameter, isClosed, nsegment, isAdaptive, result) {
18723
+ var rvalues = result.values;
18724
+ var rsegments = result.segments;
18725
+ if (length <= 2) {
18726
+ acopy(values, rvalues);
18727
+ acopy(segments, rsegments);
18728
+ return result;
18729
+ }
18730
+ var c0 = this.WORK_P0 || pnew();
18731
+ var c1 = this.WORK_P1 || pnew();
18732
+ var c2 = this.WORK_P2 || pnew();
18733
+ this.WORK_P0 = c0;
18734
+ this.WORK_P1 = c1;
18735
+ this.WORK_P2 = c2;
18736
+ var rvaluesCount = -1;
18737
+ var rsegmentCount = -1;
18738
+ if (isClosed) {
18739
+ toParameter(0, length, values, c0);
18740
+ pcopy(c0, c1);
18741
+ for (var i = 1; i < length; ++i) {
18742
+ toParameter(i, length, values, c2);
18743
+ if (0 <= toIndexOf(segments, i)) {
18744
+ var index = (i - 1) << 1;
18745
+ rvalues[++rvaluesCount] = values[index + 0];
18746
+ rvalues[++rvaluesCount] = values[index + 1];
18747
+ rsegments[++rsegmentCount] = (rvaluesCount + 1) >> 1;
18748
+ }
18749
+ else {
18750
+ rvaluesCount = this.set(c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, c2.center, c2.angle[0], c2.angle[1], c2.axis1, c2.axis2, nsegment, isAdaptive, false, rvalues, rvaluesCount);
18751
+ }
18752
+ var c3 = c1;
18753
+ c1 = c2;
18754
+ c2 = c3;
18755
+ }
18756
+ if (0 <= toIndexOf(segments, 0)) {
18757
+ var index = (length - 1) << 1;
18758
+ rvalues[++rvaluesCount] = values[index + 0];
18759
+ rvalues[++rvaluesCount] = values[index + 1];
18760
+ rsegments.unshift(0);
18761
+ rsegmentCount += 1;
18762
+ }
18763
+ else {
18764
+ rvaluesCount = this.set(c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, c0.center, c0.angle[0], c0.angle[1], c0.axis1, c0.axis2, nsegment, isAdaptive, false, rvalues, rvaluesCount);
18765
+ }
18766
+ }
18767
+ else {
18768
+ toParameter(1, length, values, c0);
18769
+ if (0 <= toIndexOf(segments, 1)) {
18770
+ rvalues[++rvaluesCount] = values[0];
18771
+ rvalues[++rvaluesCount] = values[1];
18772
+ rsegments[++rsegmentCount] = 1;
18773
+ }
18774
+ else {
18775
+ rvaluesCount = this.set(c0.center, c0.angle[0], c0.angle[1], c0.axis1, c0.axis2, c0.center, c0.angle[0], c0.angle[1], c0.axis1, c0.axis2, nsegment, isAdaptive, false, rvalues, rvaluesCount);
18776
+ }
18777
+ pcopy(c0, c1);
18778
+ for (var i = 2, imax = length - 1; i < imax; ++i) {
18779
+ toParameter(i, length, values, c2);
18780
+ if (0 <= toIndexOf(segments, i)) {
18781
+ var index = (i - 1) << 1;
18782
+ rvalues[++rvaluesCount] = values[index + 0];
18783
+ rvalues[++rvaluesCount] = values[index + 1];
18784
+ rsegments[++rsegmentCount] = (rvaluesCount + 1) >> 1;
18785
+ }
18786
+ else {
18787
+ rvaluesCount = this.set(c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, c2.center, c2.angle[0], c2.angle[1], c2.axis1, c2.axis2, nsegment, isAdaptive, false, rvalues, rvaluesCount);
18788
+ }
18789
+ var c3 = c1;
18790
+ c1 = c2;
18791
+ c2 = c3;
18792
+ }
18793
+ if (0 <= toIndexOf(segments, length - 1)) {
18794
+ var index = (length - 2) << 1;
18795
+ rvalues[++rvaluesCount] = values[index + 0];
18796
+ rvalues[++rvaluesCount] = values[index + 1];
18797
+ rsegments[++rsegmentCount] = (rvaluesCount + 1) >> 1;
18798
+ }
18799
+ else {
18800
+ rvaluesCount = this.set(c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, c1.center, c1.angle[1], c1.angle[2], c1.axis1, c1.axis2, nsegment, isAdaptive, true, rvalues, rvaluesCount);
18801
+ }
18802
+ }
18803
+ rvaluesCount += 1;
18429
18804
  if (rvalues.length !== rvaluesCount) {
18430
18805
  rvalues.length = rvaluesCount;
18431
18806
  }
@@ -18567,425 +18942,98 @@ var UtilCurve = /** @class */ (function () {
18567
18942
  n3y = -e3x;
18568
18943
  }
18569
18944
  else {
18570
- n3x = -e3y;
18571
- n3y = +e3x;
18572
- }
18573
- var we = -(b * b) / l2;
18574
- var wn = -(b * a) / l2;
18575
- var a1x = we * e3x + wn * n3x;
18576
- var a1y = we * e3y + wn * n3y;
18577
- var cx = x1 - a1x;
18578
- var cy = y1 - a1y;
18579
- var a2x = x2 - cx;
18580
- var a2y = y2 - cy;
18581
- return pset(cx, cy, a1x, a1y, a2x, a2y, -beta, 0, PIH, result);
18582
- }
18583
- else {
18584
- var e0x = d10x / l0;
18585
- var e0y = d10y / l0;
18586
- var n3x = void 0, n3y = void 0;
18587
- if (vcross(d10x, d10y, d12x, d12y) < 0) {
18588
- n3x = +e0y;
18589
- n3y = -e0x;
18590
- }
18591
- else {
18592
- n3x = -e0y;
18593
- n3y = +e0x;
18594
- }
18595
- var we = -(b * b) / l0;
18596
- var wn = -(b * a) / l0;
18597
- var a1x = we * e0x + wn * n3x;
18598
- var a1y = we * e0y + wn * n3y;
18599
- var cx = x1 - a1x;
18600
- var cy = y1 - a1y;
18601
- var a2x = x0 - cx;
18602
- var a2y = y0 - cy;
18603
- return pset(cx, cy, a1x, a1y, -a2x, -a2y, -PIH, 0, beta, result);
18604
- }
18605
- };
18606
- UtilCurve.toHybrid = function (index, length, values, result) {
18607
- var circle = UtilCurve.toCircle(index, length, values, result);
18608
- var a0 = circle.angle[0];
18609
- var a2 = circle.angle[2];
18610
- var amin = Math.min(a0, a2);
18611
- var amax = Math.max(a0, a2);
18612
- if (amin < -PIH || PIH < amax) {
18613
- return UtilCurve.toEllipse(index, length, values, result);
18614
- }
18615
- return circle;
18616
- };
18617
- return UtilCurve;
18618
- }());
18619
-
18620
- /*
18621
- * Copyright (C) 2019 Toshiba Corporation
18622
- * SPDX-License-Identifier: Apache-2.0
18623
- */
18624
- var eShapePointsFormatterCurve = function (length, values, segments, style, result) {
18625
- UtilCurve.interpolate(length, values, segments, UtilCurve.toHybrid, !!(style & EShapePointsStyle.CLOSED), EShapeDefaults.CURVE_SEGMENT_COUNT, true, result);
18626
- result.length = result.values.length >> 1;
18627
- result.style = style;
18628
- return result;
18629
- };
18630
-
18631
- /*
18632
- * Copyright (C) 2019 Toshiba Corporation
18633
- * SPDX-License-Identifier: Apache-2.0
18634
- */
18635
- var toPointsBoundary = function (values, result) {
18636
- var valuesLength = values.length;
18637
- if (2 <= valuesLength) {
18638
- var xmin = values[0];
18639
- var ymin = values[1];
18640
- var xmax = xmin;
18641
- var ymax = ymin;
18642
- for (var i = 2, imax = values.length; i < imax; i += 2) {
18643
- var x = values[i];
18644
- var y = values[i + 1];
18645
- xmin = Math.min(xmin, x);
18646
- ymin = Math.min(ymin, y);
18647
- xmax = Math.max(xmax, x);
18648
- ymax = Math.max(ymax, y);
18649
- }
18650
- result[0] = xmin;
18651
- result[1] = ymin;
18652
- result[2] = xmax;
18653
- result[3] = ymax;
18654
- }
18655
- else {
18656
- result[0] = 0;
18657
- result[1] = 0;
18658
- result[2] = 0;
18659
- result[3] = 0;
18660
- }
18661
- return result;
18662
- };
18663
-
18664
- /*
18665
- * Copyright (C) 2019 Toshiba Corporation
18666
- * SPDX-License-Identifier: Apache-2.0
18667
- */
18668
- var EShapePointsMarkerBase = /** @class */ (function () {
18669
- function EShapePointsMarkerBase(parent) {
18670
- var _this = this;
18671
- this._parent = parent;
18672
- this._lockCount = 0;
18673
- this._isTypeChanged = false;
18674
- this._isSizeChanged = false;
18675
- this._isFillChanged = false;
18676
- this._type = EShapePointsMarkerType.NONE;
18677
- this._size = new pixi_js.ObservablePoint(function () {
18678
- _this.onSizeChange();
18679
- }, undefined, EShapeDefaults.SIZE_X * 0.15, EShapeDefaults.SIZE_Y * 0.15);
18680
- this._fill = this.newFill();
18681
- this._transformId = 0;
18682
- }
18683
- EShapePointsMarkerBase.prototype.newFill = function () {
18684
- return new EShapeFillImpl(this, true, EShapeDefaults.FILL_COLOR, 1);
18685
- };
18686
- EShapePointsMarkerBase.prototype.lock = function () {
18687
- this._lockCount += 1;
18688
- if (this._lockCount === 1) {
18689
- this._isTypeChanged = false;
18690
- this._isSizeChanged = false;
18691
- this._isFillChanged = false;
18692
- }
18693
- return this;
18694
- };
18695
- EShapePointsMarkerBase.prototype.unlock = function () {
18696
- this._lockCount -= 1;
18697
- if (this._lockCount === 0) {
18698
- if (this._isTypeChanged) {
18699
- this.onTypeChange();
18700
- }
18701
- else if (this._isSizeChanged) {
18702
- this.onSizeChange();
18703
- }
18704
- else if (this._isFillChanged) {
18705
- this.onFillChange();
18706
- }
18707
- this._isTypeChanged = false;
18708
- this._isSizeChanged = false;
18709
- this._isFillChanged = false;
18710
- }
18711
- return this;
18712
- };
18713
- Object.defineProperty(EShapePointsMarkerBase.prototype, "type", {
18714
- get: function () {
18715
- return this._type;
18716
- },
18717
- set: function (type) {
18718
- if (this._type !== type) {
18719
- this._type = type;
18720
- this.onTypeChange();
18721
- }
18722
- },
18723
- enumerable: false,
18724
- configurable: true
18725
- });
18726
- EShapePointsMarkerBase.prototype.onTypeChange = function () {
18727
- if (0 < this._lockCount) {
18728
- this._isTypeChanged = true;
18729
- return;
18730
- }
18731
- this._parent.onTypeChange();
18732
- };
18733
- Object.defineProperty(EShapePointsMarkerBase.prototype, "size", {
18734
- get: function () {
18735
- return this._size;
18736
- },
18737
- enumerable: false,
18738
- configurable: true
18739
- });
18740
- EShapePointsMarkerBase.prototype.onSizeChange = function () {
18741
- if (0 < this._lockCount) {
18742
- this._isSizeChanged = true;
18743
- return;
18744
- }
18745
- this._parent.onSizeChange();
18746
- };
18747
- Object.defineProperty(EShapePointsMarkerBase.prototype, "transform", {
18748
- get: function () {
18749
- return this.updateTransform();
18750
- },
18751
- enumerable: false,
18752
- configurable: true
18753
- });
18754
- EShapePointsMarkerBase.prototype.updateTransform = function () {
18755
- var result = this._transform;
18756
- if (result == null) {
18757
- result = new pixi_js.Matrix();
18758
- this._transform = result;
18759
- }
18760
- var parentParent = this._parent.parent;
18761
- var id = parentParent.id;
18762
- if (this._transformId !== id) {
18763
- this._transformId = id;
18764
- var formatted = parentParent.formatted;
18765
- if (2 <= formatted.length) {
18766
- this.toTransform(formatted.values, result);
18767
- }
18768
- else {
18769
- result.identity();
18945
+ n3x = -e3y;
18946
+ n3y = +e3x;
18770
18947
  }
18771
- }
18772
- return result;
18773
- };
18774
- EShapePointsMarkerBase.prototype.toTransformMatrix = function (x0, y0, x1, y1, result) {
18775
- var dx = x0 - x1;
18776
- var dy = y0 - y1;
18777
- var n = dx * dx + dy * dy;
18778
- if (0.00001 < n) {
18779
- var f = 1 / Math.sqrt(n);
18780
- var nx = dx * f;
18781
- var ny = dy * f;
18782
- result.set(ny, -nx, -nx, -ny, x0, y0);
18948
+ var we = -(b * b) / l2;
18949
+ var wn = -(b * a) / l2;
18950
+ var a1x = we * e3x + wn * n3x;
18951
+ var a1y = we * e3y + wn * n3y;
18952
+ var cx = x1 - a1x;
18953
+ var cy = y1 - a1y;
18954
+ var a2x = x2 - cx;
18955
+ var a2y = y2 - cy;
18956
+ return pset(cx, cy, a1x, a1y, a2x, a2y, -beta, 0, PIH, result);
18783
18957
  }
18784
18958
  else {
18785
- result.set(1, 0, 0, 1, x0, y0);
18786
- }
18787
- return result;
18788
- };
18789
- Object.defineProperty(EShapePointsMarkerBase.prototype, "fill", {
18790
- get: function () {
18791
- return this._fill;
18792
- },
18793
- enumerable: false,
18794
- configurable: true
18795
- });
18796
- EShapePointsMarkerBase.prototype.onFillChange = function () {
18797
- if (0 < this._lockCount) {
18798
- this._isFillChanged = true;
18799
- return;
18800
- }
18801
- this._parent.onFillChange();
18802
- };
18803
- EShapePointsMarkerBase.prototype.updateUploaded = function () {
18804
- this.onFillChange();
18805
- };
18806
- EShapePointsMarkerBase.prototype.copy = function (source) {
18807
- var size = source.size;
18808
- this.set(source.type, size.x, size.y);
18809
- return this;
18810
- };
18811
- EShapePointsMarkerBase.prototype.set = function (type, sizeX, sizeY) {
18812
- this.lock();
18813
- if (type != null) {
18814
- this.type = type;
18815
- }
18816
- this.size.set(sizeX, sizeY);
18817
- this.unlock();
18818
- return this;
18819
- };
18820
- EShapePointsMarkerBase.prototype.serialize = function (manager) {
18821
- var size = this._size;
18822
- var fillId = this._fill.serialize(manager);
18823
- return manager.addResource("[".concat(this._type, ",").concat(size.x, ",").concat(size.y, ",").concat(fillId, "]"));
18824
- };
18825
- EShapePointsMarkerBase.prototype.deserialize = function (resourceId, manager) {
18826
- var resources = manager.resources;
18827
- if (0 <= resourceId && resourceId < resources.length) {
18828
- var parsed = manager.getExtension(resourceId);
18829
- if (parsed == null) {
18830
- parsed = JSON.parse(resources[resourceId]);
18831
- manager.setExtension(resourceId, parsed);
18959
+ var e0x = d10x / l0;
18960
+ var e0y = d10y / l0;
18961
+ var n3x = void 0, n3y = void 0;
18962
+ if (vcross(d10x, d10y, d12x, d12y) < 0) {
18963
+ n3x = +e0y;
18964
+ n3y = -e0x;
18832
18965
  }
18833
- this.lock();
18834
- this.type = parsed[0];
18835
- this._size.set(parsed[1], parsed[2]);
18836
- this._fill.deserialize(parsed[3], manager);
18837
- this.unlock();
18966
+ else {
18967
+ n3x = -e0y;
18968
+ n3y = +e0x;
18969
+ }
18970
+ var we = -(b * b) / l0;
18971
+ var wn = -(b * a) / l0;
18972
+ var a1x = we * e0x + wn * n3x;
18973
+ var a1y = we * e0y + wn * n3y;
18974
+ var cx = x1 - a1x;
18975
+ var cy = y1 - a1y;
18976
+ var a2x = x0 - cx;
18977
+ var a2y = y0 - cy;
18978
+ return pset(cx, cy, a1x, a1y, -a2x, -a2y, -PIH, 0, beta, result);
18838
18979
  }
18839
18980
  };
18840
- return EShapePointsMarkerBase;
18841
- }());
18842
-
18843
- var EShapePointsMarkerHead = /** @class */ (function (_super) {
18844
- __extends(EShapePointsMarkerHead, _super);
18845
- function EShapePointsMarkerHead() {
18846
- return _super !== null && _super.apply(this, arguments) || this;
18847
- }
18848
- EShapePointsMarkerHead.prototype.toTransform = function (values, result) {
18849
- var valuesLength = values.length;
18850
- if (4 <= valuesLength) {
18851
- return this.toTransformMatrix(values[valuesLength - 2], values[valuesLength - 1], values[valuesLength - 4], values[valuesLength - 3], result);
18852
- }
18853
- else {
18854
- result.identity();
18981
+ UtilCurve.toHybrid = function (index, length, values, result) {
18982
+ var circle = UtilCurve.toCircle(index, length, values, result);
18983
+ var a0 = circle.angle[0];
18984
+ var a2 = circle.angle[2];
18985
+ var amin = Math.min(a0, a2);
18986
+ var amax = Math.max(a0, a2);
18987
+ if (amin < -PIH || PIH < amax) {
18988
+ return UtilCurve.toEllipse(index, length, values, result);
18855
18989
  }
18856
- return result;
18990
+ return circle;
18857
18991
  };
18858
- return EShapePointsMarkerHead;
18859
- }(EShapePointsMarkerBase));
18992
+ return UtilCurve;
18993
+ }());
18860
18994
 
18861
- var EShapePointsMarkerTail = /** @class */ (function (_super) {
18862
- __extends(EShapePointsMarkerTail, _super);
18863
- function EShapePointsMarkerTail() {
18864
- return _super !== null && _super.apply(this, arguments) || this;
18865
- }
18866
- EShapePointsMarkerTail.prototype.toTransform = function (values, result) {
18867
- var valuesLength = values.length;
18868
- if (4 <= valuesLength) {
18869
- return this.toTransformMatrix(values[0], values[1], values[2], values[3], result);
18870
- }
18871
- else {
18872
- result.identity();
18873
- }
18874
- return result;
18875
- };
18876
- return EShapePointsMarkerTail;
18877
- }(EShapePointsMarkerBase));
18995
+ /*
18996
+ * Copyright (C) 2019 Toshiba Corporation
18997
+ * SPDX-License-Identifier: Apache-2.0
18998
+ */
18999
+ var eShapePointsFormatterCurve = function (length, values, segments, style, result) {
19000
+ UtilCurve.interpolate(length, values, segments, UtilCurve.toHybrid, !!(style & EShapePointsStyle.CLOSED), EShapeDefaults.CURVE_SEGMENT_COUNT, true, result);
19001
+ result.length = result.values.length >> 1;
19002
+ result.style = style;
19003
+ return result;
19004
+ };
18878
19005
 
18879
19006
  /*
18880
19007
  * Copyright (C) 2019 Toshiba Corporation
18881
19008
  * SPDX-License-Identifier: Apache-2.0
18882
19009
  */
18883
- var EShapePointsMarkerContainerImpl = /** @class */ (function () {
18884
- function EShapePointsMarkerContainerImpl(parent) {
18885
- this._parent = parent;
18886
- this._lockCount = 0;
18887
- this._isTypeChanged = false;
18888
- this._isSizeChanged = false;
18889
- this._isFillChanged = false;
18890
- this._head = new EShapePointsMarkerHead(this);
18891
- this._tail = new EShapePointsMarkerTail(this);
19010
+ var EShapePointsFormatters = /** @class */ (function () {
19011
+ function EShapePointsFormatters() {
18892
19012
  }
18893
- EShapePointsMarkerContainerImpl.prototype.lock = function () {
18894
- this._lockCount += 1;
18895
- if (this._lockCount === 1) {
18896
- this._isTypeChanged = false;
18897
- this._isSizeChanged = false;
18898
- this._isFillChanged = false;
18899
- }
18900
- return this;
18901
- };
18902
- EShapePointsMarkerContainerImpl.prototype.unlock = function () {
18903
- this._lockCount -= 1;
18904
- if (this._lockCount === 0) {
18905
- if (this._isTypeChanged) {
18906
- this.onTypeChange();
18907
- }
18908
- else if (this._isSizeChanged) {
18909
- this.onSizeChange();
18910
- }
18911
- else if (this._isFillChanged) {
18912
- this.onFillChange();
18913
- }
18914
- this._isTypeChanged = false;
18915
- this._isSizeChanged = false;
18916
- this._isFillChanged = false;
18917
- }
18918
- return this;
18919
- };
18920
- Object.defineProperty(EShapePointsMarkerContainerImpl.prototype, "parent", {
18921
- get: function () {
18922
- return this._parent;
18923
- },
18924
- enumerable: false,
18925
- configurable: true
18926
- });
18927
- Object.defineProperty(EShapePointsMarkerContainerImpl.prototype, "head", {
18928
- get: function () {
18929
- return this._head;
18930
- },
18931
- enumerable: false,
18932
- configurable: true
18933
- });
18934
- Object.defineProperty(EShapePointsMarkerContainerImpl.prototype, "tail", {
18935
- get: function () {
18936
- return this._tail;
18937
- },
18938
- enumerable: false,
18939
- configurable: true
18940
- });
18941
- EShapePointsMarkerContainerImpl.prototype.onTypeChange = function () {
18942
- if (0 < this._lockCount) {
18943
- this._isTypeChanged = true;
18944
- return;
18945
- }
18946
- this._parent.onMarkerTypeChange();
18947
- };
18948
- EShapePointsMarkerContainerImpl.prototype.onSizeChange = function () {
18949
- if (0 < this._lockCount) {
18950
- this._isSizeChanged = true;
18951
- return;
19013
+ EShapePointsFormatters.set = function (id, datum) {
19014
+ if (this.data == null) {
19015
+ this.data = this.newData();
18952
19016
  }
18953
- this._parent.onMarkerSizeChange();
19017
+ this.data.set(id, datum);
18954
19018
  };
18955
- EShapePointsMarkerContainerImpl.prototype.onFillChange = function () {
18956
- if (0 < this._lockCount) {
18957
- this._isFillChanged = true;
18958
- return;
19019
+ EShapePointsFormatters.get = function (index) {
19020
+ if (this.data == null) {
19021
+ this.data = this.newData();
18959
19022
  }
18960
- this._parent.onMarkerFillChange();
18961
- };
18962
- EShapePointsMarkerContainerImpl.prototype.copy = function (source) {
18963
- this.lock();
18964
- this._head.copy(source.head);
18965
- this._tail.copy(source.tail);
18966
- this.unlock();
18967
- return this;
19023
+ return this.data.get(index);
18968
19024
  };
18969
- EShapePointsMarkerContainerImpl.prototype.serialize = function (manager) {
18970
- var headId = this._head.serialize(manager);
18971
- var tailId = this._tail.serialize(manager);
18972
- return manager.addResource("[".concat(headId, ",").concat(tailId, "]"));
19025
+ EShapePointsFormatters.find = function (style) {
19026
+ return this.get((style & EShapePointsStyle.FORMATTER_MASK) >> EShapePointsStyle.FORMATTER_SHIFT);
18973
19027
  };
18974
- EShapePointsMarkerContainerImpl.prototype.deserialize = function (resourceId, manager) {
18975
- var resources = manager.resources;
18976
- if (0 <= resourceId && resourceId < resources.length) {
18977
- var parsed = manager.getExtension(resourceId);
18978
- if (parsed == null) {
18979
- parsed = JSON.parse(resources[resourceId]);
18980
- manager.setExtension(resourceId, parsed);
18981
- }
18982
- this.lock();
18983
- this._head.deserialize(parsed[0], manager);
18984
- this._tail.deserialize(parsed[1], manager);
18985
- this.unlock();
18986
- }
19028
+ EShapePointsFormatters.newData = function () {
19029
+ var result = new Map();
19030
+ result.set(EShapePointsStyle.FORMATTER_CURVE, {
19031
+ label: "Curve",
19032
+ formatter: eShapePointsFormatterCurve
19033
+ });
19034
+ return result;
18987
19035
  };
18988
- return EShapePointsMarkerContainerImpl;
19036
+ return EShapePointsFormatters;
18989
19037
  }());
18990
19038
 
18991
19039
  /*
@@ -19194,18 +19242,14 @@ var EShapeLinePoints = /** @class */ (function () {
19194
19242
  });
19195
19243
  Object.defineProperty(EShapeLinePoints.prototype, "formatted", {
19196
19244
  get: function () {
19245
+ var _a, _b;
19197
19246
  this.fit();
19198
19247
  var id = this._id;
19199
19248
  var result = this._formatted;
19200
19249
  if (this._formattedId !== id) {
19201
19250
  this._formattedId = id;
19202
19251
  var style = this._style;
19203
- var formatter = this._formatter;
19204
- if (formatter == null) {
19205
- if (style & EShapePointsStyle.CURVE) {
19206
- formatter = eShapePointsFormatterCurve;
19207
- }
19208
- }
19252
+ var formatter = (_a = this._formatter) !== null && _a !== void 0 ? _a : (_b = EShapePointsFormatters.find(style)) === null || _b === void 0 ? void 0 : _b.formatter;
19209
19253
  if (formatter != null) {
19210
19254
  if (result == null) {
19211
19255
  result = {