dgeoutils 2.2.5 → 2.2.9

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.
@@ -6,92 +6,30 @@ export declare class DPolygonLoop {
6
6
  private pool;
7
7
  constructor(parent: DPolygon);
8
8
  private getLoopFunction;
9
- /**
10
- * Run loop
11
- */
12
9
  run(): DPolygon;
13
- /**
14
- * @param zoom default value would be `z` of point
15
- */
16
10
  getTileFromCoords(zoom?: number): DPolygonLoop;
17
- /**
18
- * @param zoom default value would be `z` of point
19
- */
20
11
  getCoordsFromTile(zoom?: number): DPolygonLoop;
21
12
  height(z: number): DPolygonLoop;
22
- /**
23
- * Set `x` value
24
- * @param x
25
- */
26
13
  setX(x: number): DPolygonLoop;
27
- /**
28
- * Transform `x` value by function
29
- * @param f
30
- */
31
14
  setX(f: SetterFunction): DPolygonLoop;
32
- /**
33
- * Set `y` value
34
- * @param y
35
- */
36
15
  setY(y: number): DPolygonLoop;
37
- /**
38
- * Transform `y` value by function
39
- * @param f
40
- */
41
16
  setY(f: SetterFunction): DPolygonLoop;
17
+ setZ(z: number): DPolygonLoop;
18
+ setZ(f: SetterFunction): DPolygonLoop;
42
19
  rotate(a: number): DPolygonLoop;
43
- /**
44
- * Add `v` to `x` and `y`
45
- * @param v
46
- */
47
20
  move(v: number): DPolygonLoop;
48
- /**
49
- * Add `p.x` to `x` field and `p.y` to `y` field.
50
- * @param p
51
- */
52
21
  move(p: DPoint): DPolygonLoop;
53
- /**
54
- * Add `x` to `x` field and `y` to `y` field.
55
- * @param x
56
- * @param y
57
- */
58
22
  move(x: number, y: number): DPolygonLoop;
59
23
  round(): DPolygonLoop;
60
24
  ceil(): DPolygonLoop;
61
25
  floor(): DPolygonLoop;
62
26
  toFixed(n?: number): DPolygonLoop;
63
27
  abs(): DPolygonLoop;
64
- /**
65
- * Multiply `v` to `x` and `y`
66
- * @param v
67
- */
68
28
  scale(v: number): DPolygonLoop;
69
- /**
70
- * Multiply `p.x` to `x` field and `p.y` to `y` field.
71
- * @param p
72
- */
73
29
  scale(p: DPoint): DPolygonLoop;
74
- /**
75
- * Multiply `x` to `x` field and `y` to `y` field.
76
- * @param x
77
- * @param y
78
- */
79
30
  scale(x: number, y: number): DPolygonLoop;
80
- /**
81
- * Divide `x` and `y` to `v`
82
- * @param v
83
- */
84
31
  divide(v: number): DPolygonLoop;
85
- /**
86
- * Divide `x` field to `p.x` and `y` field to `p.y`.
87
- * @param p
88
- */
89
32
  divide(p: DPoint): DPolygonLoop;
90
- /**
91
- * Divide `x` field to `x` and `y` field to `y`.
92
- * @param x
93
- * @param y
94
- */
95
33
  divide(x: number, y: number): DPolygonLoop;
96
34
  degreeToRadians(): DPolygonLoop;
97
35
  radiansToDegrees(): DPolygonLoop;
@@ -106,14 +44,6 @@ export declare class DPolygonLoop {
106
44
  minus(): DPolygonLoop;
107
45
  degreeToMeters(): DPolygonLoop;
108
46
  metersToDegree(): DPolygonLoop;
109
- /**
110
- * Flip vertically
111
- * @param size canvas size
112
- */
113
47
  flipVertically(size: DPoint): DPolygonLoop;
114
- /**
115
- * Flip vertically
116
- * @param height canvas height
117
- */
118
48
  flipVertically(height: number): DPolygonLoop;
119
49
  }
@@ -8,34 +8,33 @@ var LoopFunctions;
8
8
  LoopFunctions[LoopFunctions["height"] = 2] = "height";
9
9
  LoopFunctions[LoopFunctions["setX"] = 3] = "setX";
10
10
  LoopFunctions[LoopFunctions["setY"] = 4] = "setY";
11
- LoopFunctions[LoopFunctions["rotate"] = 5] = "rotate";
12
- LoopFunctions[LoopFunctions["move"] = 6] = "move";
13
- LoopFunctions[LoopFunctions["round"] = 7] = "round";
14
- LoopFunctions[LoopFunctions["ceil"] = 8] = "ceil";
15
- LoopFunctions[LoopFunctions["floor"] = 9] = "floor";
16
- LoopFunctions[LoopFunctions["toFixed"] = 10] = "toFixed";
17
- LoopFunctions[LoopFunctions["abs"] = 11] = "abs";
18
- LoopFunctions[LoopFunctions["scale"] = 12] = "scale";
19
- LoopFunctions[LoopFunctions["divide"] = 13] = "divide";
20
- LoopFunctions[LoopFunctions["degreeToRadians"] = 14] = "degreeToRadians";
21
- LoopFunctions[LoopFunctions["radiansToDegrees"] = 15] = "radiansToDegrees";
22
- LoopFunctions[LoopFunctions["radiansToMeters"] = 16] = "radiansToMeters";
23
- LoopFunctions[LoopFunctions["metersToRadians"] = 17] = "metersToRadians";
24
- LoopFunctions[LoopFunctions["hipPoint"] = 18] = "hipPoint";
25
- LoopFunctions[LoopFunctions["xPoint"] = 19] = "xPoint";
26
- LoopFunctions[LoopFunctions["yPoint"] = 20] = "yPoint";
27
- LoopFunctions[LoopFunctions["wPoint"] = 21] = "wPoint";
28
- LoopFunctions[LoopFunctions["hPoint"] = 22] = "hPoint";
29
- LoopFunctions[LoopFunctions["setIfLessThan"] = 23] = "setIfLessThan";
30
- LoopFunctions[LoopFunctions["minus"] = 24] = "minus";
31
- LoopFunctions[LoopFunctions["degreeToMeters"] = 25] = "degreeToMeters";
32
- LoopFunctions[LoopFunctions["metersToDegree"] = 26] = "metersToDegree";
33
- LoopFunctions[LoopFunctions["flipVertically"] = 27] = "flipVertically";
11
+ LoopFunctions[LoopFunctions["setZ"] = 5] = "setZ";
12
+ LoopFunctions[LoopFunctions["rotate"] = 6] = "rotate";
13
+ LoopFunctions[LoopFunctions["move"] = 7] = "move";
14
+ LoopFunctions[LoopFunctions["round"] = 8] = "round";
15
+ LoopFunctions[LoopFunctions["ceil"] = 9] = "ceil";
16
+ LoopFunctions[LoopFunctions["floor"] = 10] = "floor";
17
+ LoopFunctions[LoopFunctions["toFixed"] = 11] = "toFixed";
18
+ LoopFunctions[LoopFunctions["abs"] = 12] = "abs";
19
+ LoopFunctions[LoopFunctions["scale"] = 13] = "scale";
20
+ LoopFunctions[LoopFunctions["divide"] = 14] = "divide";
21
+ LoopFunctions[LoopFunctions["degreeToRadians"] = 15] = "degreeToRadians";
22
+ LoopFunctions[LoopFunctions["radiansToDegrees"] = 16] = "radiansToDegrees";
23
+ LoopFunctions[LoopFunctions["radiansToMeters"] = 17] = "radiansToMeters";
24
+ LoopFunctions[LoopFunctions["metersToRadians"] = 18] = "metersToRadians";
25
+ LoopFunctions[LoopFunctions["hipPoint"] = 19] = "hipPoint";
26
+ LoopFunctions[LoopFunctions["xPoint"] = 20] = "xPoint";
27
+ LoopFunctions[LoopFunctions["yPoint"] = 21] = "yPoint";
28
+ LoopFunctions[LoopFunctions["wPoint"] = 22] = "wPoint";
29
+ LoopFunctions[LoopFunctions["hPoint"] = 23] = "hPoint";
30
+ LoopFunctions[LoopFunctions["setIfLessThan"] = 24] = "setIfLessThan";
31
+ LoopFunctions[LoopFunctions["minus"] = 25] = "minus";
32
+ LoopFunctions[LoopFunctions["degreeToMeters"] = 26] = "degreeToMeters";
33
+ LoopFunctions[LoopFunctions["metersToDegree"] = 27] = "metersToDegree";
34
+ LoopFunctions[LoopFunctions["flipVertically"] = 28] = "flipVertically";
34
35
  })(LoopFunctions || (LoopFunctions = {}));
35
- // eslint-disable-next-line complexity
36
36
  const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg, setterArg }) => {
37
37
  let res = a;
38
- // eslint-disable-next-line default-case
39
38
  switch (functionName) {
40
39
  case LoopFunctions.getTileFromCoords:
41
40
  res = (k) => a(k)
@@ -57,6 +56,10 @@ const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg
57
56
  res = (k) => a(k)
58
57
  .setY(setterArg);
59
58
  break;
59
+ case LoopFunctions.setZ:
60
+ res = (k) => a(k)
61
+ .setZ(setterArg);
62
+ break;
60
63
  case LoopFunctions.rotate:
61
64
  res = (k) => a(k)
62
65
  .rotate(numberArg);
@@ -153,7 +156,6 @@ const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg
153
156
  return res;
154
157
  };
155
158
  class DPolygonLoop {
156
- // eslint-disable-next-line no-empty-function,no-useless-constructor
157
159
  constructor(parent) {
158
160
  this.parent = parent;
159
161
  this.pool = [];
@@ -161,15 +163,9 @@ class DPolygonLoop {
161
163
  getLoopFunction() {
162
164
  return this.pool.reduce(decodePoolRecord, (k) => k);
163
165
  }
164
- /**
165
- * Run loop
166
- */
167
166
  run() {
168
167
  return this.parent.map(this.getLoopFunction());
169
168
  }
170
- /**
171
- * @param zoom default value would be `z` of point
172
- */
173
169
  getTileFromCoords(zoom) {
174
170
  this.pool.push({
175
171
  functionName: LoopFunctions.getTileFromCoords,
@@ -177,9 +173,6 @@ class DPolygonLoop {
177
173
  });
178
174
  return this;
179
175
  }
180
- /**
181
- * @param zoom default value would be `z` of point
182
- */
183
176
  getCoordsFromTile(zoom) {
184
177
  this.pool.push({
185
178
  functionName: LoopFunctions.getCoordsFromTile,
@@ -208,6 +201,13 @@ class DPolygonLoop {
208
201
  });
209
202
  return this;
210
203
  }
204
+ setZ(z) {
205
+ this.pool.push({
206
+ functionName: LoopFunctions.setZ,
207
+ setterArg: z
208
+ });
209
+ return this;
210
+ }
211
211
  rotate(a) {
212
212
  this.pool.push({
213
213
  functionName: LoopFunctions.rotate,
@@ -96,7 +96,6 @@ class TraceMatrix {
96
96
  let prevDirection = Infinity;
97
97
  let p = group.at(0);
98
98
  while (!p.equal(group.at(0)) || points.length < 2) {
99
- // eslint-disable-next-line no-constant-condition
100
99
  while (true) {
101
100
  const nextValue = getByPosition(m, p.clone().move(traceDirections[direction]));
102
101
  const nextNeighbourValue = getByPosition(m, p.clone().move(traceDirections[left(direction)]));
package/dist/utils.js CHANGED
@@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createArray = exports.checkFunction = exports.warn = void 0;
4
4
  const index_1 = require("./index");
5
5
  const DPoint_1 = require("./DPoint");
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
6
  const warn = (...args) => {
8
7
  if (index_1.DGeo.DEBUG) {
9
- // eslint-disable-next-line no-console
10
8
  console.warn(...args);
11
9
  }
12
10
  };
@@ -45,7 +43,6 @@ const shouldBeMeters = (scope, funcName, argName) => (p) => {
45
43
  return scope;
46
44
  };
47
45
  const checkFunction = (funcName) => ({
48
- // eslint-disable-next-line func-names, object-shorthand
49
46
  checkArgument: function (argName) {
50
47
  if (!index_1.DGeo.DEBUG) {
51
48
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dgeoutils",
3
- "version": "2.2.5",
3
+ "version": "2.2.9",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "node_modules/.bin/tsc",