dgeoutils 2.2.4 → 2.2.8

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.
@@ -8,31 +8,31 @@ 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
38
  switch (functionName) {
@@ -56,6 +56,10 @@ const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg
56
56
  res = (k) => a(k)
57
57
  .setY(setterArg);
58
58
  break;
59
+ case LoopFunctions.setZ:
60
+ res = (k) => a(k)
61
+ .setZ(setterArg);
62
+ break;
59
63
  case LoopFunctions.rotate:
60
64
  res = (k) => a(k)
61
65
  .rotate(numberArg);
@@ -148,7 +152,6 @@ const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg
148
152
  res = (k) => a(k)
149
153
  .flipVertically(numberPointArg);
150
154
  break;
151
- default:
152
155
  }
153
156
  return res;
154
157
  };
@@ -160,15 +163,9 @@ class DPolygonLoop {
160
163
  getLoopFunction() {
161
164
  return this.pool.reduce(decodePoolRecord, (k) => k);
162
165
  }
163
- /**
164
- * Run loop
165
- */
166
166
  run() {
167
167
  return this.parent.map(this.getLoopFunction());
168
168
  }
169
- /**
170
- * @param zoom default value would be `z` of point
171
- */
172
169
  getTileFromCoords(zoom) {
173
170
  this.pool.push({
174
171
  functionName: LoopFunctions.getTileFromCoords,
@@ -176,9 +173,6 @@ class DPolygonLoop {
176
173
  });
177
174
  return this;
178
175
  }
179
- /**
180
- * @param zoom default value would be `z` of point
181
- */
182
176
  getCoordsFromTile(zoom) {
183
177
  this.pool.push({
184
178
  functionName: LoopFunctions.getCoordsFromTile,
@@ -207,6 +201,13 @@ class DPolygonLoop {
207
201
  });
208
202
  return this;
209
203
  }
204
+ setZ(z) {
205
+ this.pool.push({
206
+ functionName: LoopFunctions.setZ,
207
+ setterArg: z
208
+ });
209
+ return this;
210
+ }
210
211
  rotate(a) {
211
212
  this.pool.push({
212
213
  functionName: LoopFunctions.rotate,
@@ -6,8 +6,8 @@ export declare enum TraceMatrixValues {
6
6
  }
7
7
  declare type SimpleMatrix = TraceMatrixValues[][];
8
8
  export declare class TraceMatrix {
9
- private readonly m;
10
9
  private readonly size;
10
+ private readonly m;
11
11
  constructor(size: DPoint, f: (p: DPoint) => TraceMatrixValues);
12
12
  fullMatrixTrace(): DPolygon[];
13
13
  private reverseMatrix;
@@ -25,6 +25,7 @@ const setByPosition = (m, p, value) => {
25
25
  };
26
26
  class TraceMatrix {
27
27
  constructor(size, f) {
28
+ this.size = size;
28
29
  this.findGroupByIndex = (m, s) => {
29
30
  const res = new DPolygon_1.DPolygon();
30
31
  if (s && getByPosition(m, s) === TraceMatrixValues.t) {
@@ -95,7 +96,6 @@ class TraceMatrix {
95
96
  let prevDirection = Infinity;
96
97
  let p = group.at(0);
97
98
  while (!p.equal(group.at(0)) || points.length < 2) {
98
- // eslint-disable-next-line no-constant-condition
99
99
  while (true) {
100
100
  const nextValue = getByPosition(m, p.clone().move(traceDirections[direction]));
101
101
  const nextNeighbourValue = getByPosition(m, p.clone().move(traceDirections[left(direction)]));
@@ -146,7 +146,6 @@ class TraceMatrix {
146
146
  const t = this.reverseMatrix(tmpMatrix);
147
147
  return this.totalCountInMatrix(t) ? t : null;
148
148
  };
149
- this.size = size;
150
149
  this.m = TraceMatrix.createMatrix(this.size, f);
151
150
  }
152
151
  fullMatrixTrace() {
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.4",
3
+ "version": "2.2.8",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "node_modules/.bin/tsc",
@@ -56,4 +56,4 @@
56
56
  "type": "git",
57
57
  "url": "https://github.com/edejin/DGeoUtils"
58
58
  }
59
- }
59
+ }