dgeoutils 2.4.9 → 2.4.12

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.
@@ -14,7 +14,7 @@ export declare const PI_IN_DEGREE = 180;
14
14
  export declare const DOUBLE_PI_IN_DEGREE = 360;
15
15
  export declare const PI_TO_DEGREE: number;
16
16
  export declare const DEGREE_TO_PI: number;
17
- export declare type SetterFunction = (t: DPoint) => number;
17
+ declare type SetterFunction<T> = (t: DPoint) => T;
18
18
  export declare class DPoint {
19
19
  x: number;
20
20
  y: number;
@@ -45,11 +45,12 @@ export declare class DPoint {
45
45
  distance(p: DPoint): number;
46
46
  distance3d(p: DPoint): number;
47
47
  setX(x: number): DPoint;
48
- setX(f: SetterFunction): DPoint;
48
+ setX(f: SetterFunction<number>): DPoint;
49
49
  setZ(z: number): DPoint;
50
- setZ(f: SetterFunction): DPoint;
50
+ setZ(f: SetterFunction<number>): DPoint;
51
51
  setY(y: number): DPoint;
52
- setY(f: SetterFunction): DPoint;
52
+ setY(f: SetterFunction<number>): DPoint;
53
+ setProperties(v: SetterFunction<Record<string, any>> | Record<string, any>): DPoint;
53
54
  clone(): DPoint;
54
55
  gt(p: DPoint): boolean;
55
56
  lt(p: DPoint): boolean;
@@ -103,9 +104,13 @@ export declare class DPoint {
103
104
  get wPoint(): DPoint;
104
105
  get hPoint(): DPoint;
105
106
  get lat(): number;
107
+ set lat(v: number);
106
108
  get lng(): number;
109
+ set lng(v: number);
107
110
  get lon(): number;
111
+ set lon(v: number);
108
112
  get alt(): number | undefined;
113
+ set alt(v: number | undefined);
109
114
  simple(xKey?: string, yKey?: string): {
110
115
  [key: string]: number;
111
116
  };
@@ -113,4 +118,6 @@ export declare class DPoint {
113
118
  minus(): DPoint;
114
119
  orthodromicPath(point: DPoint, pointsCount?: number): DPolygon;
115
120
  sortByDistance(p: DPolygon): DPolygon;
121
+ calculateAltitudeByDistanceBetweenPoints(p1: DPoint, p2: DPoint): DPoint;
116
122
  }
123
+ export {};
@@ -259,6 +259,10 @@ var DPoint = (function () {
259
259
  this.y = typeof y === 'number' ? y : y(this);
260
260
  return this;
261
261
  };
262
+ DPoint.prototype.setProperties = function (v) {
263
+ this.properties = typeof v === 'object' ? v : v(this);
264
+ return this;
265
+ };
262
266
  DPoint.prototype.clone = function () {
263
267
  var p = new DPoint(this.x, this.y, this.z);
264
268
  p.properties = __assign({}, this.properties);
@@ -599,6 +603,9 @@ var DPoint = (function () {
599
603
  get: function () {
600
604
  return this.y;
601
605
  },
606
+ set: function (v) {
607
+ this.y = v;
608
+ },
602
609
  enumerable: false,
603
610
  configurable: true
604
611
  });
@@ -606,6 +613,9 @@ var DPoint = (function () {
606
613
  get: function () {
607
614
  return this.x;
608
615
  },
616
+ set: function (v) {
617
+ this.x = v;
618
+ },
609
619
  enumerable: false,
610
620
  configurable: true
611
621
  });
@@ -613,6 +623,9 @@ var DPoint = (function () {
613
623
  get: function () {
614
624
  return this.x;
615
625
  },
626
+ set: function (v) {
627
+ this.x = v;
628
+ },
616
629
  enumerable: false,
617
630
  configurable: true
618
631
  });
@@ -620,6 +633,9 @@ var DPoint = (function () {
620
633
  get: function () {
621
634
  return this.z;
622
635
  },
636
+ set: function (v) {
637
+ this.z = v;
638
+ },
623
639
  enumerable: false,
624
640
  configurable: true
625
641
  });
@@ -670,6 +686,27 @@ var DPoint = (function () {
670
686
  })
671
687
  .sort(function (a, b) { return a.properties.distance - b.properties.distance; });
672
688
  };
689
+ DPoint.prototype.calculateAltitudeByDistanceBetweenPoints = function (p1, p2) {
690
+ var _a, _b, _c, _d;
691
+ if (p1.alt === p2.alt) {
692
+ this.alt = p1.alt;
693
+ }
694
+ else {
695
+ var minAlt = Math.min((_a = p1.alt) !== null && _a !== void 0 ? _a : 0, (_b = p2.alt) !== null && _b !== void 0 ? _b : 0);
696
+ var maxAlt = Math.max((_c = p1.alt) !== null && _c !== void 0 ? _c : 0, (_d = p2.alt) !== null && _d !== void 0 ? _d : 0);
697
+ var dAlt = maxAlt - minAlt;
698
+ var distance1 = this.distance(p1);
699
+ var distance2 = this.distance(p2);
700
+ var totalDistance = distance1 + distance2;
701
+ if (p1.alt === minAlt) {
702
+ this.alt = minAlt + distance1 / totalDistance * dAlt;
703
+ }
704
+ else {
705
+ this.alt = minAlt + distance2 / totalDistance * dAlt;
706
+ }
707
+ }
708
+ return this;
709
+ };
673
710
  return DPoint;
674
711
  }());
675
712
  exports.DPoint = DPoint;
@@ -1,6 +1,7 @@
1
1
  import { DPolygon } from './DPolygon';
2
- import { DPoint, SetterFunction } from './DPoint';
3
- export declare type LoopFunction = (k: DPoint) => DPoint;
2
+ import { DPoint } from './DPoint';
3
+ export declare type SetterFunction<T> = (t: DPoint, index: number) => T;
4
+ export declare type LoopFunction = (k: DPoint, index: number) => DPoint;
4
5
  export declare class DPolygonLoop {
5
6
  private readonly parent;
6
7
  private pool;
@@ -11,11 +12,12 @@ export declare class DPolygonLoop {
11
12
  getCoordsFromTile(zoom?: number): DPolygonLoop;
12
13
  height(z: number): DPolygonLoop;
13
14
  setX(x: number): DPolygonLoop;
14
- setX(f: SetterFunction): DPolygonLoop;
15
+ setX(f: SetterFunction<number>): DPolygonLoop;
16
+ setProperties(setterArgByObject: SetterFunction<Record<string, any>> | Record<string, any>): DPolygonLoop;
15
17
  setY(y: number): DPolygonLoop;
16
- setY(f: SetterFunction): DPolygonLoop;
18
+ setY(f: SetterFunction<number>): DPolygonLoop;
17
19
  setZ(z: number): DPolygonLoop;
18
- setZ(f: SetterFunction): DPolygonLoop;
20
+ setZ(f: SetterFunction<number>): DPolygonLoop;
19
21
  rotate(a: number): DPolygonLoop;
20
22
  rotate3dX(a: number): DPolygonLoop;
21
23
  rotate3dY(a: number): DPolygonLoop;
@@ -35,139 +35,144 @@ var LoopFunctions;
35
35
  LoopFunctions[LoopFunctions["degreeToMeters"] = 29] = "degreeToMeters";
36
36
  LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
37
37
  LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
38
+ LoopFunctions[LoopFunctions["setProperties"] = 32] = "setProperties";
38
39
  })(LoopFunctions || (LoopFunctions = {}));
39
40
  var decodePoolRecord = function (a, _a) {
40
- var functionName = _a.functionName, pointArg = _a.pointArg, numberPointArg = _a.numberPointArg, numberArg = _a.numberArg, setterArg = _a.setterArg;
41
+ var functionName = _a.functionName, pointArg = _a.pointArg, numberPointArg = _a.numberPointArg, numberArg = _a.numberArg, setterArg = _a.setterArg, setterArgByObject = _a.setterArgByObject;
41
42
  var res = a;
42
43
  switch (functionName) {
43
44
  case LoopFunctions.getTileFromCoords:
44
- res = function (k) { return a(k)
45
+ res = function (k, index) { return a(k, index)
45
46
  .getTileFromCoords(numberArg); };
46
47
  break;
47
48
  case LoopFunctions.getCoordsFromTile:
48
- res = function (k) { return a(k)
49
+ res = function (k, index) { return a(k, index)
49
50
  .getCoordsFromTile(numberArg); };
50
51
  break;
51
52
  case LoopFunctions.height:
52
- res = function (k) { return a(k)
53
+ res = function (k, index) { return a(k, index)
53
54
  .height(numberArg); };
54
55
  break;
55
56
  case LoopFunctions.setX:
56
- res = function (k) { return a(k)
57
- .setX(setterArg); };
57
+ res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
58
+ .setX(setterArg) : a(k, index).setX(function (p) { return setterArg(p, index); }); };
58
59
  break;
59
60
  case LoopFunctions.setY:
60
- res = function (k) { return a(k)
61
- .setY(setterArg); };
61
+ res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
62
+ .setY(setterArg) : a(k, index).setY(function (p) { return setterArg(p, index); }); };
62
63
  break;
63
64
  case LoopFunctions.setZ:
64
- res = function (k) { return a(k)
65
- .setZ(setterArg); };
65
+ res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
66
+ .setZ(setterArg) : a(k, index).setZ(function (p) { return setterArg(p, index); }); };
66
67
  break;
67
68
  case LoopFunctions.rotate:
68
- res = function (k) { return a(k)
69
+ res = function (k, index) { return a(k, index)
69
70
  .rotate(numberArg); };
70
71
  break;
71
72
  case LoopFunctions.rotate3dX:
72
- res = function (k) { return a(k)
73
+ res = function (k, index) { return a(k, index)
73
74
  .rotate3dX(numberArg); };
74
75
  break;
75
76
  case LoopFunctions.rotate3dY:
76
- res = function (k) { return a(k)
77
+ res = function (k, index) { return a(k, index)
77
78
  .rotate3dY(numberArg); };
78
79
  break;
79
80
  case LoopFunctions.rotate3dZ:
80
- res = function (k) { return a(k)
81
+ res = function (k, index) { return a(k, index)
81
82
  .rotate3dZ(numberArg); };
82
83
  break;
83
84
  case LoopFunctions.move:
84
- res = function (k) { return a(k)
85
+ res = function (k, index) { return a(k, index)
85
86
  .move(numberPointArg, numberArg); };
86
87
  break;
87
88
  case LoopFunctions.round:
88
- res = function (k) { return a(k)
89
+ res = function (k, index) { return a(k, index)
89
90
  .round(); };
90
91
  break;
91
92
  case LoopFunctions.ceil:
92
- res = function (k) { return a(k)
93
+ res = function (k, index) { return a(k, index)
93
94
  .ceil(); };
94
95
  break;
95
96
  case LoopFunctions.floor:
96
- res = function (k) { return a(k)
97
+ res = function (k, index) { return a(k, index)
97
98
  .floor(); };
98
99
  break;
99
100
  case LoopFunctions.toFixed:
100
- res = function (k) { return a(k)
101
+ res = function (k, index) { return a(k, index)
101
102
  .toFixed(numberArg); };
102
103
  break;
103
104
  case LoopFunctions.abs:
104
- res = function (k) { return a(k)
105
+ res = function (k, index) { return a(k, index)
105
106
  .abs(); };
106
107
  break;
107
108
  case LoopFunctions.scale:
108
- res = function (k) { return a(k)
109
+ res = function (k, index) { return a(k, index)
109
110
  .scale(numberPointArg, numberArg); };
110
111
  break;
111
112
  case LoopFunctions.divide:
112
- res = function (k) { return a(k)
113
+ res = function (k, index) { return a(k, index)
113
114
  .divide(numberPointArg, numberArg); };
114
115
  break;
115
116
  case LoopFunctions.degreeToRadians:
116
- res = function (k) { return a(k)
117
+ res = function (k, index) { return a(k, index)
117
118
  .degreeToRadians(); };
118
119
  break;
119
120
  case LoopFunctions.radiansToDegrees:
120
- res = function (k) { return a(k)
121
+ res = function (k, index) { return a(k, index)
121
122
  .radiansToDegrees(); };
122
123
  break;
123
124
  case LoopFunctions.radiansToMeters:
124
- res = function (k) { return a(k)
125
+ res = function (k, index) { return a(k, index)
125
126
  .radiansToMeters(); };
126
127
  break;
127
128
  case LoopFunctions.metersToRadians:
128
- res = function (k) { return a(k)
129
+ res = function (k, index) { return a(k, index)
129
130
  .metersToRadians(); };
130
131
  break;
131
132
  case LoopFunctions.hipPoint:
132
- res = function (k) { return a(k)
133
+ res = function (k, index) { return a(k, index)
133
134
  .hipPoint; };
134
135
  break;
135
136
  case LoopFunctions.xPoint:
136
- res = function (k) { return a(k)
137
+ res = function (k, index) { return a(k, index)
137
138
  .xPoint; };
138
139
  break;
139
140
  case LoopFunctions.yPoint:
140
- res = function (k) { return a(k)
141
+ res = function (k, index) { return a(k, index)
141
142
  .yPoint; };
142
143
  break;
143
144
  case LoopFunctions.wPoint:
144
- res = function (k) { return a(k)
145
+ res = function (k, index) { return a(k, index)
145
146
  .wPoint; };
146
147
  break;
147
148
  case LoopFunctions.hPoint:
148
- res = function (k) { return a(k)
149
+ res = function (k, index) { return a(k, index)
149
150
  .hPoint; };
150
151
  break;
151
152
  case LoopFunctions.setIfLessThan:
152
- res = function (k) { return a(k)
153
+ res = function (k, index) { return a(k, index)
153
154
  .setIfLessThan(pointArg); };
154
155
  break;
155
156
  case LoopFunctions.minus:
156
- res = function (k) { return a(k)
157
+ res = function (k, index) { return a(k, index)
157
158
  .minus(); };
158
159
  break;
159
160
  case LoopFunctions.degreeToMeters:
160
- res = function (k) { return a(k)
161
+ res = function (k, index) { return a(k, index)
161
162
  .degreeToMeters(); };
162
163
  break;
163
164
  case LoopFunctions.metersToDegree:
164
- res = function (k) { return a(k)
165
+ res = function (k, index) { return a(k, index)
165
166
  .metersToDegree(); };
166
167
  break;
167
168
  case LoopFunctions.flipVertically:
168
- res = function (k) { return a(k)
169
+ res = function (k, index) { return a(k, index)
169
170
  .flipVertically(numberPointArg); };
170
171
  break;
172
+ case LoopFunctions.setProperties:
173
+ res = function (k, index) { return typeof setterArgByObject === 'object' ? a(k, index)
174
+ .setProperties(setterArgByObject) : a(k, index).setProperties(function (p) { return setterArgByObject(p, index); }); };
175
+ break;
171
176
  }
172
177
  return res;
173
178
  };
@@ -210,6 +215,13 @@ var DPolygonLoop = (function () {
210
215
  });
211
216
  return this;
212
217
  };
218
+ DPolygonLoop.prototype.setProperties = function (setterArgByObject) {
219
+ this.pool.push({
220
+ functionName: LoopFunctions.setProperties,
221
+ setterArgByObject: setterArgByObject
222
+ });
223
+ return this;
224
+ };
213
225
  DPolygonLoop.prototype.setY = function (y) {
214
226
  this.pool.push({
215
227
  functionName: LoopFunctions.setY,
@@ -220,6 +220,10 @@ export class DPoint {
220
220
  this.y = typeof y === 'number' ? y : y(this);
221
221
  return this;
222
222
  }
223
+ setProperties(v) {
224
+ this.properties = typeof v === 'object' ? v : v(this);
225
+ return this;
226
+ }
223
227
  clone() {
224
228
  const p = new DPoint(this.x, this.y, this.z);
225
229
  p.properties = Object.assign({}, this.properties);
@@ -498,15 +502,27 @@ export class DPoint {
498
502
  get lat() {
499
503
  return this.y;
500
504
  }
505
+ set lat(v) {
506
+ this.y = v;
507
+ }
501
508
  get lng() {
502
509
  return this.x;
503
510
  }
511
+ set lng(v) {
512
+ this.x = v;
513
+ }
504
514
  get lon() {
505
515
  return this.x;
506
516
  }
517
+ set lon(v) {
518
+ this.x = v;
519
+ }
507
520
  get alt() {
508
521
  return this.z;
509
522
  }
523
+ set alt(v) {
524
+ this.z = v;
525
+ }
510
526
  simple(xKey = 'x', yKey = 'y') {
511
527
  return {
512
528
  [xKey]: this.x,
@@ -549,4 +565,25 @@ export class DPoint {
549
565
  })
550
566
  .sort((a, b) => a.properties.distance - b.properties.distance);
551
567
  }
568
+ calculateAltitudeByDistanceBetweenPoints(p1, p2) {
569
+ var _a, _b, _c, _d;
570
+ if (p1.alt === p2.alt) {
571
+ this.alt = p1.alt;
572
+ }
573
+ else {
574
+ const minAlt = Math.min((_a = p1.alt) !== null && _a !== void 0 ? _a : 0, (_b = p2.alt) !== null && _b !== void 0 ? _b : 0);
575
+ const maxAlt = Math.max((_c = p1.alt) !== null && _c !== void 0 ? _c : 0, (_d = p2.alt) !== null && _d !== void 0 ? _d : 0);
576
+ const dAlt = maxAlt - minAlt;
577
+ const distance1 = this.distance(p1);
578
+ const distance2 = this.distance(p2);
579
+ const totalDistance = distance1 + distance2;
580
+ if (p1.alt === minAlt) {
581
+ this.alt = minAlt + distance1 / totalDistance * dAlt;
582
+ }
583
+ else {
584
+ this.alt = minAlt + distance2 / totalDistance * dAlt;
585
+ }
586
+ }
587
+ return this;
588
+ }
552
589
  }
@@ -32,138 +32,143 @@ var LoopFunctions;
32
32
  LoopFunctions[LoopFunctions["degreeToMeters"] = 29] = "degreeToMeters";
33
33
  LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
34
34
  LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
35
+ LoopFunctions[LoopFunctions["setProperties"] = 32] = "setProperties";
35
36
  })(LoopFunctions || (LoopFunctions = {}));
36
- const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg, setterArg }) => {
37
+ const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg, setterArg, setterArgByObject }) => {
37
38
  let res = a;
38
39
  switch (functionName) {
39
40
  case LoopFunctions.getTileFromCoords:
40
- res = (k) => a(k)
41
+ res = (k, index) => a(k, index)
41
42
  .getTileFromCoords(numberArg);
42
43
  break;
43
44
  case LoopFunctions.getCoordsFromTile:
44
- res = (k) => a(k)
45
+ res = (k, index) => a(k, index)
45
46
  .getCoordsFromTile(numberArg);
46
47
  break;
47
48
  case LoopFunctions.height:
48
- res = (k) => a(k)
49
+ res = (k, index) => a(k, index)
49
50
  .height(numberArg);
50
51
  break;
51
52
  case LoopFunctions.setX:
52
- res = (k) => a(k)
53
- .setX(setterArg);
53
+ res = (k, index) => typeof setterArg === 'number' ? a(k, index)
54
+ .setX(setterArg) : a(k, index).setX((p) => setterArg(p, index));
54
55
  break;
55
56
  case LoopFunctions.setY:
56
- res = (k) => a(k)
57
- .setY(setterArg);
57
+ res = (k, index) => typeof setterArg === 'number' ? a(k, index)
58
+ .setY(setterArg) : a(k, index).setY((p) => setterArg(p, index));
58
59
  break;
59
60
  case LoopFunctions.setZ:
60
- res = (k) => a(k)
61
- .setZ(setterArg);
61
+ res = (k, index) => typeof setterArg === 'number' ? a(k, index)
62
+ .setZ(setterArg) : a(k, index).setZ((p) => setterArg(p, index));
62
63
  break;
63
64
  case LoopFunctions.rotate:
64
- res = (k) => a(k)
65
+ res = (k, index) => a(k, index)
65
66
  .rotate(numberArg);
66
67
  break;
67
68
  case LoopFunctions.rotate3dX:
68
- res = (k) => a(k)
69
+ res = (k, index) => a(k, index)
69
70
  .rotate3dX(numberArg);
70
71
  break;
71
72
  case LoopFunctions.rotate3dY:
72
- res = (k) => a(k)
73
+ res = (k, index) => a(k, index)
73
74
  .rotate3dY(numberArg);
74
75
  break;
75
76
  case LoopFunctions.rotate3dZ:
76
- res = (k) => a(k)
77
+ res = (k, index) => a(k, index)
77
78
  .rotate3dZ(numberArg);
78
79
  break;
79
80
  case LoopFunctions.move:
80
- res = (k) => a(k)
81
+ res = (k, index) => a(k, index)
81
82
  .move(numberPointArg, numberArg);
82
83
  break;
83
84
  case LoopFunctions.round:
84
- res = (k) => a(k)
85
+ res = (k, index) => a(k, index)
85
86
  .round();
86
87
  break;
87
88
  case LoopFunctions.ceil:
88
- res = (k) => a(k)
89
+ res = (k, index) => a(k, index)
89
90
  .ceil();
90
91
  break;
91
92
  case LoopFunctions.floor:
92
- res = (k) => a(k)
93
+ res = (k, index) => a(k, index)
93
94
  .floor();
94
95
  break;
95
96
  case LoopFunctions.toFixed:
96
- res = (k) => a(k)
97
+ res = (k, index) => a(k, index)
97
98
  .toFixed(numberArg);
98
99
  break;
99
100
  case LoopFunctions.abs:
100
- res = (k) => a(k)
101
+ res = (k, index) => a(k, index)
101
102
  .abs();
102
103
  break;
103
104
  case LoopFunctions.scale:
104
- res = (k) => a(k)
105
+ res = (k, index) => a(k, index)
105
106
  .scale(numberPointArg, numberArg);
106
107
  break;
107
108
  case LoopFunctions.divide:
108
- res = (k) => a(k)
109
+ res = (k, index) => a(k, index)
109
110
  .divide(numberPointArg, numberArg);
110
111
  break;
111
112
  case LoopFunctions.degreeToRadians:
112
- res = (k) => a(k)
113
+ res = (k, index) => a(k, index)
113
114
  .degreeToRadians();
114
115
  break;
115
116
  case LoopFunctions.radiansToDegrees:
116
- res = (k) => a(k)
117
+ res = (k, index) => a(k, index)
117
118
  .radiansToDegrees();
118
119
  break;
119
120
  case LoopFunctions.radiansToMeters:
120
- res = (k) => a(k)
121
+ res = (k, index) => a(k, index)
121
122
  .radiansToMeters();
122
123
  break;
123
124
  case LoopFunctions.metersToRadians:
124
- res = (k) => a(k)
125
+ res = (k, index) => a(k, index)
125
126
  .metersToRadians();
126
127
  break;
127
128
  case LoopFunctions.hipPoint:
128
- res = (k) => a(k)
129
+ res = (k, index) => a(k, index)
129
130
  .hipPoint;
130
131
  break;
131
132
  case LoopFunctions.xPoint:
132
- res = (k) => a(k)
133
+ res = (k, index) => a(k, index)
133
134
  .xPoint;
134
135
  break;
135
136
  case LoopFunctions.yPoint:
136
- res = (k) => a(k)
137
+ res = (k, index) => a(k, index)
137
138
  .yPoint;
138
139
  break;
139
140
  case LoopFunctions.wPoint:
140
- res = (k) => a(k)
141
+ res = (k, index) => a(k, index)
141
142
  .wPoint;
142
143
  break;
143
144
  case LoopFunctions.hPoint:
144
- res = (k) => a(k)
145
+ res = (k, index) => a(k, index)
145
146
  .hPoint;
146
147
  break;
147
148
  case LoopFunctions.setIfLessThan:
148
- res = (k) => a(k)
149
+ res = (k, index) => a(k, index)
149
150
  .setIfLessThan(pointArg);
150
151
  break;
151
152
  case LoopFunctions.minus:
152
- res = (k) => a(k)
153
+ res = (k, index) => a(k, index)
153
154
  .minus();
154
155
  break;
155
156
  case LoopFunctions.degreeToMeters:
156
- res = (k) => a(k)
157
+ res = (k, index) => a(k, index)
157
158
  .degreeToMeters();
158
159
  break;
159
160
  case LoopFunctions.metersToDegree:
160
- res = (k) => a(k)
161
+ res = (k, index) => a(k, index)
161
162
  .metersToDegree();
162
163
  break;
163
164
  case LoopFunctions.flipVertically:
164
- res = (k) => a(k)
165
+ res = (k, index) => a(k, index)
165
166
  .flipVertically(numberPointArg);
166
167
  break;
168
+ case LoopFunctions.setProperties:
169
+ res = (k, index) => typeof setterArgByObject === 'object' ? a(k, index)
170
+ .setProperties(setterArgByObject) : a(k, index).setProperties((p) => setterArgByObject(p, index));
171
+ break;
167
172
  }
168
173
  return res;
169
174
  };
@@ -206,6 +211,13 @@ export class DPolygonLoop {
206
211
  });
207
212
  return this;
208
213
  }
214
+ setProperties(setterArgByObject) {
215
+ this.pool.push({
216
+ functionName: LoopFunctions.setProperties,
217
+ setterArgByObject
218
+ });
219
+ return this;
220
+ }
209
221
  setY(y) {
210
222
  this.pool.push({
211
223
  functionName: LoopFunctions.setY,
@@ -256,6 +256,10 @@ var DPoint = (function () {
256
256
  this.y = typeof y === 'number' ? y : y(this);
257
257
  return this;
258
258
  };
259
+ DPoint.prototype.setProperties = function (v) {
260
+ this.properties = typeof v === 'object' ? v : v(this);
261
+ return this;
262
+ };
259
263
  DPoint.prototype.clone = function () {
260
264
  var p = new DPoint(this.x, this.y, this.z);
261
265
  p.properties = __assign({}, this.properties);
@@ -596,6 +600,9 @@ var DPoint = (function () {
596
600
  get: function () {
597
601
  return this.y;
598
602
  },
603
+ set: function (v) {
604
+ this.y = v;
605
+ },
599
606
  enumerable: false,
600
607
  configurable: true
601
608
  });
@@ -603,6 +610,9 @@ var DPoint = (function () {
603
610
  get: function () {
604
611
  return this.x;
605
612
  },
613
+ set: function (v) {
614
+ this.x = v;
615
+ },
606
616
  enumerable: false,
607
617
  configurable: true
608
618
  });
@@ -610,6 +620,9 @@ var DPoint = (function () {
610
620
  get: function () {
611
621
  return this.x;
612
622
  },
623
+ set: function (v) {
624
+ this.x = v;
625
+ },
613
626
  enumerable: false,
614
627
  configurable: true
615
628
  });
@@ -617,6 +630,9 @@ var DPoint = (function () {
617
630
  get: function () {
618
631
  return this.z;
619
632
  },
633
+ set: function (v) {
634
+ this.z = v;
635
+ },
620
636
  enumerable: false,
621
637
  configurable: true
622
638
  });
@@ -667,6 +683,27 @@ var DPoint = (function () {
667
683
  })
668
684
  .sort(function (a, b) { return a.properties.distance - b.properties.distance; });
669
685
  };
686
+ DPoint.prototype.calculateAltitudeByDistanceBetweenPoints = function (p1, p2) {
687
+ var _a, _b, _c, _d;
688
+ if (p1.alt === p2.alt) {
689
+ this.alt = p1.alt;
690
+ }
691
+ else {
692
+ var minAlt = Math.min((_a = p1.alt) !== null && _a !== void 0 ? _a : 0, (_b = p2.alt) !== null && _b !== void 0 ? _b : 0);
693
+ var maxAlt = Math.max((_c = p1.alt) !== null && _c !== void 0 ? _c : 0, (_d = p2.alt) !== null && _d !== void 0 ? _d : 0);
694
+ var dAlt = maxAlt - minAlt;
695
+ var distance1 = this.distance(p1);
696
+ var distance2 = this.distance(p2);
697
+ var totalDistance = distance1 + distance2;
698
+ if (p1.alt === minAlt) {
699
+ this.alt = minAlt + distance1 / totalDistance * dAlt;
700
+ }
701
+ else {
702
+ this.alt = minAlt + distance2 / totalDistance * dAlt;
703
+ }
704
+ }
705
+ return this;
706
+ };
670
707
  return DPoint;
671
708
  }());
672
709
  export { DPoint };