nodes2ts 1.1.9 → 3.0.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.
Files changed (105) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.cjs +11 -0
  3. package/.github/workflows/lint.js.yml +22 -0
  4. package/.github/workflows/node.js.yml +22 -0
  5. package/.mocharc.js +7 -0
  6. package/README.md +22 -5
  7. package/dist/Interval.d.ts +7 -8
  8. package/dist/Interval.js +12 -12
  9. package/dist/Interval.js.map +1 -1
  10. package/dist/MutableInteger.js +5 -4
  11. package/dist/MutableInteger.js.map +1 -1
  12. package/dist/Platform.d.ts +15 -0
  13. package/dist/Platform.js +53 -0
  14. package/dist/Platform.js.map +1 -0
  15. package/dist/R1Interval.d.ts +8 -9
  16. package/dist/R1Interval.js +59 -78
  17. package/dist/R1Interval.js.map +1 -1
  18. package/dist/R2Vector.d.ts +12 -13
  19. package/dist/R2Vector.js +65 -85
  20. package/dist/R2Vector.js.map +1 -1
  21. package/dist/S1Angle.d.ts +38 -5
  22. package/dist/S1Angle.js +89 -37
  23. package/dist/S1Angle.js.map +1 -1
  24. package/dist/S1ChordAngle.d.ts +166 -0
  25. package/dist/S1ChordAngle.js +318 -0
  26. package/dist/S1ChordAngle.js.map +1 -0
  27. package/dist/S1Interval.d.ts +11 -12
  28. package/dist/S1Interval.js +134 -140
  29. package/dist/S1Interval.js.map +1 -1
  30. package/dist/S2.d.ts +8 -5
  31. package/dist/S2.js +91 -108
  32. package/dist/S2.js.map +1 -1
  33. package/dist/S2Cap.d.ts +33 -25
  34. package/dist/S2Cap.js +199 -203
  35. package/dist/S2Cap.js.map +1 -1
  36. package/dist/S2Cell.d.ts +15 -13
  37. package/dist/S2Cell.js +196 -206
  38. package/dist/S2Cell.js.map +1 -1
  39. package/dist/S2CellId.d.ts +37 -14
  40. package/dist/S2CellId.js +407 -359
  41. package/dist/S2CellId.js.map +1 -1
  42. package/dist/S2CellUnion.d.ts +1 -2
  43. package/dist/S2CellUnion.js +137 -133
  44. package/dist/S2CellUnion.js.map +1 -1
  45. package/dist/S2EdgeUtil.js +14 -17
  46. package/dist/S2EdgeUtil.js.map +1 -1
  47. package/dist/S2LatLng.d.ts +15 -11
  48. package/dist/S2LatLng.js +100 -114
  49. package/dist/S2LatLng.js.map +1 -1
  50. package/dist/S2LatLngRect.d.ts +8 -4
  51. package/dist/S2LatLngRect.js +215 -197
  52. package/dist/S2LatLngRect.js.map +1 -1
  53. package/dist/S2Metric.d.ts +4 -5
  54. package/dist/S2Metric.js +30 -27
  55. package/dist/S2Metric.js.map +1 -1
  56. package/dist/S2Point.d.ts +48 -14
  57. package/dist/S2Point.js +156 -109
  58. package/dist/S2Point.js.map +1 -1
  59. package/dist/S2Projections.d.ts +43 -9
  60. package/dist/S2Projections.js +226 -47
  61. package/dist/S2Projections.js.map +1 -1
  62. package/dist/S2Region.js +2 -1
  63. package/dist/S2Region.js.map +1 -1
  64. package/dist/S2RegionCoverer.d.ts +21 -6
  65. package/dist/S2RegionCoverer.js +144 -109
  66. package/dist/S2RegionCoverer.js.map +1 -1
  67. package/dist/export.d.ts +0 -1
  68. package/dist/export.js +42 -32
  69. package/dist/export.js.map +1 -1
  70. package/dist/utils/preconditions.d.ts +2 -0
  71. package/dist/utils/preconditions.js +16 -0
  72. package/dist/utils/preconditions.js.map +1 -0
  73. package/package.json +28 -34
  74. package/.npmignore +0 -8
  75. package/.nyc_output/1eb1f420a13c15f529aac41a40bcaa21.json +0 -1
  76. package/.nyc_output/5ff62256eb1c111254ba0b469fb547da.json +0 -1
  77. package/.nyc_output/949d6e8c2061067f3bdfd27dfff5ba83.json +0 -1
  78. package/coverage/Interval.ts.html +0 -203
  79. package/coverage/MutableInteger.ts.html +0 -77
  80. package/coverage/R1Interval.ts.html +0 -647
  81. package/coverage/R2Vector.ts.html +0 -587
  82. package/coverage/S1Angle.ts.html +0 -344
  83. package/coverage/S1Interval.ts.html +0 -1349
  84. package/coverage/S2.ts.html +0 -1178
  85. package/coverage/S2Cap.ts.html +0 -1433
  86. package/coverage/S2Cell.ts.html +0 -1415
  87. package/coverage/S2CellId.ts.html +0 -3329
  88. package/coverage/S2EdgeUtil.ts.html +0 -2534
  89. package/coverage/S2LatLng.ts.html +0 -848
  90. package/coverage/S2LatLngRect.ts.html +0 -2222
  91. package/coverage/S2Point.ts.html +0 -758
  92. package/coverage/S2Projections.ts.html +0 -518
  93. package/coverage/base.css +0 -212
  94. package/coverage/decimal.ts.html +0 -68
  95. package/coverage/index.html +0 -288
  96. package/coverage/prettify.css +0 -1
  97. package/coverage/prettify.js +0 -1
  98. package/coverage/sort-arrow-sprite.png +0 -0
  99. package/coverage/sorter.js +0 -158
  100. package/dist/decimal.d.ts +0 -3
  101. package/dist/decimal.js +0 -4
  102. package/dist/decimal.js.map +0 -1
  103. package/dist/decimal_augmentation.d.ts +0 -24
  104. package/dist/decimal_augmentation.js +0 -2
  105. package/dist/decimal_augmentation.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /*
2
3
  * Copyright 2005 Google Inc.
3
4
  *
@@ -13,12 +14,12 @@
13
14
  * See the License for the specific language governing permissions and
14
15
  * limitations under the License.
15
16
  */
16
- "use strict";
17
- var S2Cell_1 = require("./S2Cell");
18
- var S2CellId_1 = require("./S2CellId");
19
- var S2CellUnion_1 = require("./S2CellUnion");
20
- var S2Projections_1 = require("./S2Projections");
21
- var decimal_1 = require('./decimal');
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.S2RegionCoverer = void 0;
19
+ const S2Cell_1 = require("./S2Cell");
20
+ const S2CellId_1 = require("./S2CellId");
21
+ const S2CellUnion_1 = require("./S2CellUnion");
22
+ const S2Projections_1 = require("./S2Projections");
22
23
  /**
23
24
  * An S2RegionCoverer is a class that allows arbitrary regions to be
24
25
  * approximated as unions of cells (S2CellUnion). This is useful for
@@ -50,11 +51,11 @@ var decimal_1 = require('./decimal');
50
51
  * methods will conflict and produce unpredictable results.
51
52
  *
52
53
  */
53
- var S2RegionCoverer = (function () {
54
+ class S2RegionCoverer {
54
55
  /**
55
56
  * Default constructor, sets all fields to default values.
56
57
  */
57
- function S2RegionCoverer() {
58
+ constructor() {
58
59
  this.minLevel = 0;
59
60
  this.maxLevel = S2CellId_1.S2CellId.MAX_LEVEL;
60
61
  this.levelMod = 1;
@@ -79,19 +80,19 @@ var S2RegionCoverer = (function () {
79
80
  /**
80
81
  * Sets the minimum level to be used.
81
82
  */
82
- S2RegionCoverer.prototype.setMinLevel = function (minLevel) {
83
+ setMinLevel(minLevel) {
83
84
  // assert (minLevel >= 0 && minLevel <= S2CellId.MAX_LEVEL);
84
85
  this.minLevel = Math.max(0, Math.min(S2CellId_1.S2CellId.MAX_LEVEL, minLevel));
85
86
  return this;
86
- };
87
+ }
87
88
  /**
88
89
  * Sets the maximum level to be used.
89
90
  */
90
- S2RegionCoverer.prototype.setMaxLevel = function (maxLevel) {
91
+ setMaxLevel(maxLevel) {
91
92
  // assert (maxLevel >= 0 && maxLevel <= S2CellId.MAX_LEVEL);
92
93
  this.maxLevel = Math.max(0, Math.min(S2CellId_1.S2CellId.MAX_LEVEL, maxLevel));
93
94
  return this;
94
- };
95
+ }
95
96
  /**
96
97
  * If specified, then only cells where (level - min_level) is a multiple of
97
98
  * "level_mod" will be used (default 1). This effectively allows the branching
@@ -99,11 +100,11 @@ var S2RegionCoverer = (function () {
99
100
  * parameter values allowed are 1, 2, or 3, corresponding to branching factors
100
101
  * of 4, 16, and 64 respectively.
101
102
  */
102
- S2RegionCoverer.prototype.setLevelMod = function (levelMod) {
103
+ setLevelMod(levelMod) {
103
104
  // assert (levelMod >= 1 && levelMod <= 3);
104
105
  this.levelMod = Math.max(1, Math.min(3, levelMod));
105
106
  return this;
106
- };
107
+ }
107
108
  /**
108
109
  * Sets the maximum desired number of cells in the approximation (defaults to
109
110
  * kDefaultMaxCells). Note the following:
@@ -134,10 +135,22 @@ var S2RegionCoverer = (function () {
134
135
  * worst case: 215518 14.41 9.72 5.26 3.91 2.75 1.92 1.20 1.02
135
136
  * </pre>
136
137
  */
137
- S2RegionCoverer.prototype.setMaxCells = function (maxCells) {
138
+ setMaxCells(maxCells) {
138
139
  this.maxCells = maxCells;
139
140
  return this;
140
- };
141
+ }
142
+ getMinLevel() {
143
+ return this.minLevel;
144
+ }
145
+ getMaxLevel() {
146
+ return this.maxLevel;
147
+ }
148
+ getMaxCells() {
149
+ return this.maxCells;
150
+ }
151
+ getLevelMod() {
152
+ return this.levelMod;
153
+ }
141
154
  /**
142
155
  * Computes a list of cell ids that covers the given region and satisfies the
143
156
  * various restrictions specified above.
@@ -145,7 +158,7 @@ var S2RegionCoverer = (function () {
145
158
  * @param region The region to cover
146
159
  * @param covering The list filled in by this method
147
160
  */
148
- S2RegionCoverer.prototype.getCoveringCells = function (region) {
161
+ getCoveringCells(region) {
149
162
  // Rather than just returning the raw list of cell ids generated by
150
163
  // GetCoveringInternal(), we construct a cell union and then denormalize it.
151
164
  // This has the effect of replacing four child cells with their parent
@@ -153,9 +166,9 @@ var S2RegionCoverer = (function () {
153
166
  // (min_level, level_mod, etc). This strategy significantly reduces the
154
167
  // number of cells returned in many cases, and it is cheap compared to
155
168
  // computing the covering in the first place.
156
- var tmp = this.getCoveringUnion(region);
169
+ const tmp = this.getCoveringUnion(region);
157
170
  return tmp.denormalize(this.minLevel, this.levelMod);
158
- };
171
+ }
159
172
  /**
160
173
  * Computes a list of cell ids that is contained within the given region and
161
174
  * satisfies the various restrictions specified above.
@@ -163,10 +176,10 @@ var S2RegionCoverer = (function () {
163
176
  * @param region The region to fill
164
177
  * @param interior The list filled in by this method
165
178
  */
166
- S2RegionCoverer.prototype.getInteriorCoveringCells = function (region) {
167
- var tmp = this.getInteriorCoveringUnion(region);
179
+ getInteriorCoveringCells(region) {
180
+ const tmp = this.getInteriorCoveringUnion(region);
168
181
  return tmp.denormalize(this.minLevel, this.levelMod);
169
- };
182
+ }
170
183
  /**
171
184
  * Return a normalized cell union that covers the given region and satisfies
172
185
  * the restrictions *EXCEPT* for min_level() and level_mod(). These criteria
@@ -175,43 +188,41 @@ var S2RegionCoverer = (function () {
175
188
  * whenever possible. (Note that the list of cell ids passed to the cell union
176
189
  * constructor does in fact satisfy all the given restrictions.)
177
190
  */
178
- S2RegionCoverer.prototype.getCoveringUnion = function (region, covering) {
179
- if (covering === void 0) { covering = new S2CellUnion_1.S2CellUnion(); }
191
+ getCoveringUnion(region, covering = new S2CellUnion_1.S2CellUnion()) {
180
192
  this.interiorCovering = false;
181
193
  this.getCoveringInternal(region);
182
194
  covering.initSwap(this.result);
195
+ this.result = [];
183
196
  return covering;
184
- };
197
+ }
185
198
  /**
186
199
  * Return a normalized cell union that is contained within the given region
187
200
  * and satisfies the restrictions *EXCEPT* for min_level() and level_mod().
188
201
  */
189
- S2RegionCoverer.prototype.getInteriorCoveringUnion = function (region, covering) {
190
- if (covering === void 0) { covering = new S2CellUnion_1.S2CellUnion(); }
202
+ getInteriorCoveringUnion(region, covering = new S2CellUnion_1.S2CellUnion()) {
191
203
  this.interiorCovering = true;
192
204
  this.getCoveringInternal(region);
193
205
  covering.initSwap(this.result);
206
+ this.result = [];
194
207
  return covering;
195
- };
196
- // /**
197
- // * Given a connected region and a starting point, return a set of cells at the
198
- // * given level that cover the region.
199
- // */
200
- // public static getSimpleCovering(
201
- // region:S2Region , start:S2Point , level:number):S2CellId[] {
202
- // S2RegionCoverer.floodFill(region, S2CellId.fromPoint(start).parentL(level));
203
- // }
208
+ }
209
+ /**
210
+ * Given a connected region and a starting point, return a set of cells at the given level that
211
+ * cover the region.
212
+ */
213
+ static getSimpleCovering(region, start, level) {
214
+ return this.floodFill(region, S2CellId_1.S2CellId.fromPoint(start).parentL(level));
215
+ }
204
216
  /**
205
217
  * If the cell intersects the given region, return a new candidate with no
206
218
  * children, otherwise return null. Also marks the candidate as "terminal" if
207
219
  * it should not be expanded further.
208
220
  */
209
- S2RegionCoverer.prototype.newCandidate = function (cell) {
221
+ newCandidate(cell) {
210
222
  if (!this.region.mayIntersectC(cell)) {
211
- // console.log("NOT INTERSECTING",this.region);
212
223
  return null;
213
224
  }
214
- var isTerminal = false;
225
+ let isTerminal = false;
215
226
  if (cell.level >= this.minLevel) {
216
227
  if (this.interiorCovering) {
217
228
  if (this.region.containsC(cell)) {
@@ -227,26 +238,30 @@ var S2RegionCoverer = (function () {
227
238
  }
228
239
  }
229
240
  }
230
- var candidate = new Candidate();
241
+ const candidate = new Candidate();
231
242
  candidate.cell = cell;
232
243
  candidate.isTerminal = isTerminal;
233
244
  candidate.numChildren = 0;
234
245
  if (!isTerminal) {
235
- candidate.children = Array.apply(null, new Array(1 << this.maxChildrenShift()));
246
+ candidate.children = [];
247
+ const numOfChildren = 1 << this.maxChildrenShift();
248
+ for (let i = 0; i < numOfChildren; i++) {
249
+ candidate.children.push(new Candidate());
250
+ }
236
251
  }
237
252
  this.candidatesCreatedCounter++;
238
253
  return candidate;
239
- };
254
+ }
240
255
  /** Return the log base 2 of the maximum number of children of a candidate. */
241
- S2RegionCoverer.prototype.maxChildrenShift = function () {
256
+ maxChildrenShift() {
242
257
  return 2 * this.levelMod;
243
- };
258
+ }
244
259
  /**
245
260
  * Process a candidate by either adding it to the result list or expanding its
246
261
  * children and inserting it into the priority queue. Passing an argument of
247
262
  * NULL does nothing.
248
263
  */
249
- S2RegionCoverer.prototype.addCandidate = function (candidate) {
264
+ addCandidate(candidate) {
250
265
  if (candidate == null) {
251
266
  return;
252
267
  }
@@ -257,9 +272,10 @@ var S2RegionCoverer = (function () {
257
272
  // assert (candidate.numChildren == 0);
258
273
  // Expand one level at a time until we hit min_level_ to ensure that
259
274
  // we don't skip over it.
260
- var numLevels = (candidate.cell.level < this.minLevel) ? 1 : this.levelMod;
261
- var numTerminals = this.expandChildren(candidate, candidate.cell, numLevels);
275
+ const numLevels = (candidate.cell.level < this.minLevel) ? 1 : this.levelMod;
276
+ const numTerminals = this.expandChildren(candidate, candidate.cell, numLevels);
262
277
  if (candidate.numChildren == 0) {
278
+ // Do nothing
263
279
  }
264
280
  else if (!this.interiorCovering && numTerminals == 1 << this.maxChildrenShift()
265
281
  && candidate.cell.level >= this.minLevel) {
@@ -277,28 +293,29 @@ var S2RegionCoverer = (function () {
277
293
  // at the same level, we prefer the cells with the smallest number of
278
294
  // intersecting children. Finally, we prefer cells that have the smallest
279
295
  // number of children that cannot be refined any further.
280
- var priority = -((((candidate.cell.level << this.maxChildrenShift()) + candidate.numChildren)
296
+ const priority = -((((candidate.cell.level << this.maxChildrenShift()) + candidate.numChildren)
281
297
  << this.maxChildrenShift()) + numTerminals);
282
298
  this.candidateQueue.add(new QueueEntry(priority, candidate));
299
+ // logger.info("Push: " + candidate.cell.id() + " (" + priority + ") ");
283
300
  }
284
- };
301
+ }
285
302
  /**
286
303
  * Populate the children of "candidate" by expanding the given number of
287
304
  * levels from the given cell. Returns the number of children that were marked
288
305
  * "terminal".
289
306
  */
290
- S2RegionCoverer.prototype.expandChildren = function (candidate, cell, numLevels) {
307
+ expandChildren(candidate, cell, numLevels) {
291
308
  numLevels--;
292
- var childCells = cell.subdivide();
293
- var numTerminals = 0;
294
- for (var i = 0; i < 4; ++i) {
309
+ const childCells = cell.subdivide();
310
+ let numTerminals = 0;
311
+ for (let i = 0; i < 4; ++i) {
295
312
  if (numLevels > 0) {
296
313
  if (this.region.mayIntersectC(childCells[i])) {
297
314
  numTerminals += this.expandChildren(candidate, childCells[i], numLevels);
298
315
  }
299
316
  continue;
300
317
  }
301
- var child = this.newCandidate(childCells[i]);
318
+ const child = this.newCandidate(childCells[i]);
302
319
  if (child != null) {
303
320
  candidate.children[candidate.numChildren++] = child;
304
321
  if (child.isTerminal) {
@@ -307,9 +324,9 @@ var S2RegionCoverer = (function () {
307
324
  }
308
325
  }
309
326
  return numTerminals;
310
- };
327
+ }
311
328
  /** Computes a set of initial candidates that cover the given region. */
312
- S2RegionCoverer.prototype.getInitialCandidates = function () {
329
+ getInitialCandidates() {
313
330
  // Optimization: if at least 4 cells are desired (the normal case),
314
331
  // start with a 4-cell covering of the region's bounding cap. This
315
332
  // lets us skip quite a few levels of refinement when the region to
@@ -317,8 +334,8 @@ var S2RegionCoverer = (function () {
317
334
  if (this.maxCells >= 4) {
318
335
  // Find the maximum level such that the bounding cap contains at most one
319
336
  // cell vertex at that level.
320
- var cap = this.region.getCapBound();
321
- var level = decimal_1.Decimal.min(S2Projections_1.S2Projections.MIN_WIDTH.getMaxLevel(cap.angle().radians.times(2)), decimal_1.Decimal.min(this.maxLevel, S2CellId_1.S2CellId.MAX_LEVEL - 1)).toNumber();
337
+ const cap = this.region.getCapBound();
338
+ let level = Math.min(S2Projections_1.S2Projections.MIN_WIDTH.getMaxLevel(2 * cap.angle().radians), Math.min(this.maxLevel, S2CellId_1.S2CellId.MAX_LEVEL - 1));
322
339
  if (this.levelMod > 1 && level > this.minLevel) {
323
340
  level -= (level - this.minLevel) % this.levelMod;
324
341
  }
@@ -327,22 +344,21 @@ var S2RegionCoverer = (function () {
327
344
  if (level > 0) {
328
345
  // Find the leaf cell containing the cap axis, and determine which
329
346
  // subcell of the parent cell contains it.
330
- // ArrayList<S2CellId> base = new ArrayList<>(4);
331
- var id = S2CellId_1.S2CellId.fromPoint(cap.axis);
332
- var base = id.getVertexNeighbors(level);
333
- for (var i = 0; i < base.length; ++i) {
347
+ const id = S2CellId_1.S2CellId.fromPoint(cap.axis);
348
+ const base = id.getVertexNeighbors(level);
349
+ for (let i = 0; i < base.length; ++i) {
334
350
  this.addCandidate(this.newCandidate(new S2Cell_1.S2Cell(base[i])));
335
351
  }
336
352
  return;
337
353
  }
338
354
  }
339
355
  // Default: start with all six cube faces.
340
- for (var face = 0; face < 6; ++face) {
356
+ for (let face = 0; face < 6; ++face) {
341
357
  this.addCandidate(this.newCandidate(S2RegionCoverer.FACE_CELLS[face]));
342
358
  }
343
- };
359
+ }
344
360
  /** Generates a covering and stores it in result. */
345
- S2RegionCoverer.prototype.getCoveringInternal = function (region) {
361
+ getCoveringInternal(region) {
346
362
  // Strategy: Start with the 6 faces of the cube. Discard any
347
363
  // that do not intersect the shape. Then repeatedly choose the
348
364
  // largest cell that intersects the shape and subdivide it.
@@ -365,18 +381,16 @@ var S2RegionCoverer = (function () {
365
381
  this.candidatesCreatedCounter = 0;
366
382
  this.getInitialCandidates();
367
383
  while (this.candidateQueue.size() !== 0 && (!this.interiorCovering || this.result.length < this.maxCells)) {
368
- var candidate = this.candidateQueue.poll().candidate;
369
- // logger.info("Pop: " + candidate.cell.id());
370
- if (candidate.cell.level < this.minLevel || candidate.numChildren == 1
371
- || this.result.length + (this.interiorCovering ? 0 : this.candidateQueue.size()) + candidate.numChildren
372
- <= this.maxCells) {
384
+ const candidate = this.candidateQueue.poll().candidate;
385
+ if (this.interiorCovering || candidate.cell.level < this.minLevel || candidate.numChildren == 1
386
+ || this.result.length + this.candidateQueue.size() + candidate.numChildren <= this.maxCells) {
373
387
  // Expand this candidate into its children.
374
- for (var i = 0; i < candidate.numChildren; ++i) {
375
- this.addCandidate(candidate.children[i]);
388
+ for (let i = 0; i < candidate.numChildren; ++i) {
389
+ if (!this.interiorCovering || this.result.length < this.maxCells) {
390
+ this.addCandidate(candidate.children[i]);
391
+ }
376
392
  }
377
393
  }
378
- else if (this.interiorCovering) {
379
- }
380
394
  else {
381
395
  candidate.isTerminal = true;
382
396
  this.addCandidate(candidate);
@@ -384,53 +398,74 @@ var S2RegionCoverer = (function () {
384
398
  }
385
399
  this.candidateQueue.clear();
386
400
  this.region = null;
387
- };
401
+ }
388
402
  /**
389
- * By default, the covering uses at most 8 cells at any level. This gives a
390
- * reasonable tradeoff between the number of cells used and the accuracy of
391
- * the approximation (see table below).
403
+ * Given a region and a starting cell, return the set of all the edge-connected cells at the same
404
+ * level that intersect "region". The output cells are returned in arbitrary order.
392
405
  */
393
- S2RegionCoverer.DEFAULT_MAX_CELLS = 8;
394
- S2RegionCoverer.FACE_CELLS = new Array(6).map(function (face) { return S2Cell_1.S2Cell.fromFacePosLevel(face, 0, 0); });
395
- return S2RegionCoverer;
396
- }());
397
- exports.S2RegionCoverer = S2RegionCoverer;
398
- var Candidate = (function () {
399
- function Candidate() {
406
+ static floodFill(region, start) {
407
+ const all = new Set();
408
+ const frontier = [];
409
+ const output = [];
410
+ all.add(start.toToken());
411
+ frontier.push(start);
412
+ while (frontier.length !== 0) {
413
+ const id = frontier.pop();
414
+ if (!region.mayIntersectC(new S2Cell_1.S2Cell(id))) {
415
+ continue;
416
+ }
417
+ output.push(id);
418
+ const neighbors = id.getEdgeNeighbors();
419
+ for (let edge = 0; edge < 4; ++edge) {
420
+ const nbr = neighbors[edge];
421
+ if (!all.has(nbr.toToken())) {
422
+ frontier.push(nbr);
423
+ all.add(nbr.toToken());
424
+ }
425
+ }
426
+ }
427
+ return output;
400
428
  }
429
+ }
430
+ exports.S2RegionCoverer = S2RegionCoverer;
431
+ /**
432
+ * By default, the covering uses at most 8 cells at any level. This gives a
433
+ * reasonable tradeoff between the number of cells used and the accuracy of
434
+ * the approximation (see table below).
435
+ */
436
+ S2RegionCoverer.DEFAULT_MAX_CELLS = 8;
437
+ S2RegionCoverer.FACE_CELLS = [0, 1, 2, 3, 4, 5].map(face => S2Cell_1.S2Cell.fromFace(face));
438
+ class Candidate {
401
439
  // elements.
402
- Candidate.prototype.toString = function () {
403
- return "isTermina: " + this.isTerminal + " - Cell: " + this.cell.toString();
404
- };
405
- return Candidate;
406
- }());
407
- var PriorityQueue = (function () {
408
- function PriorityQueue() {
440
+ toString() {
441
+ return `isTerminal: ${this.isTerminal} - Cell: ${this.cell.toString()}`;
442
+ }
443
+ }
444
+ class PriorityQueue {
445
+ constructor() {
409
446
  this.clear();
410
447
  }
411
- PriorityQueue.prototype.add = function (item) {
448
+ add(item) {
412
449
  this.items.push(item);
413
- this.items.sort(function (a, b) { return a.compare(b); });
414
- };
415
- PriorityQueue.prototype.clear = function () {
450
+ this.items.sort((a, b) => a.compare(b));
451
+ }
452
+ clear() {
416
453
  this.items = [];
417
- };
418
- PriorityQueue.prototype.size = function () {
454
+ }
455
+ size() {
419
456
  return this.items.length;
420
- };
421
- PriorityQueue.prototype.poll = function () {
457
+ }
458
+ poll() {
422
459
  return this.items.splice(0, 1)[0];
423
- };
424
- return PriorityQueue;
425
- }());
426
- var QueueEntry = (function () {
427
- function QueueEntry(id, candidate) {
460
+ }
461
+ }
462
+ class QueueEntry {
463
+ constructor(id, candidate) {
428
464
  this.id = id;
429
465
  this.candidate = candidate;
430
466
  }
431
- QueueEntry.prototype.compare = function (other) {
467
+ compare(other) {
432
468
  return this.id < other.id ? 1 : (this.id > other.id ? -1 : 0);
433
- };
434
- return QueueEntry;
435
- }());
469
+ }
470
+ }
436
471
  //# sourceMappingURL=S2RegionCoverer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"S2RegionCoverer.js","sourceRoot":"","sources":["../src/S2RegionCoverer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAEH,uBAAqB,UAAU,CAAC,CAAA;AAEhC,yBAAuB,YAAY,CAAC,CAAA;AACpC,4BAA0B,eAAe,CAAC,CAAA;AAC1C,8BAA4B,iBAAiB,CAAC,CAAA;AAC9C,wBAAsB,WAAW,CAAC,CAAA;AAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;IA4CE;;OAEG;IACH;QACE,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,mBAAQ,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,eAAe,CAAC,iBAAiB,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,cAAc,GAAG,IAAI,aAAa,EAAc,CAAC;IACxD,CAAC;IAEH,2EAA2E;IAC3E,yDAAyD;IACzD,EAAE;IACF,yEAAyE;IACzE,oEAAoE;IACpE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,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAsc7F,MAAM,SAAS;IAKb,YAAY;IAEL,QAAQ;QACb,OAAO,eAAe,IAAI,CAAC,UAAU,YAAY,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC1E,CAAC;CACF;AAKD,MAAM,aAAa;IAGjB;QACE,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,GAAG,CAAC,IAAM;QACR,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK;QACH,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;CACF;AAED,MAAM,UAAU;IAKd,YAA0B,EAAS,EAAS,SAAmB;QAArC,OAAE,GAAF,EAAE,CAAO;QAAS,cAAS,GAAT,SAAS,CAAU;IAE/D,CAAC;IAND,OAAO,CAAC,KAAgB;QACtB,OAAO,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;CAKF"}
package/dist/export.d.ts CHANGED
@@ -17,7 +17,6 @@ export * from './S2Point';
17
17
  export * from './S2Projections';
18
18
  export * from './S2Region';
19
19
  export * from './S2RegionCoverer';
20
- export * from './decimal_augmentation';
21
20
  export declare class Utils {
22
21
  /**
23
22
  * Calculates a region covering a circle
package/dist/export.js CHANGED
@@ -1,30 +1,42 @@
1
1
  "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- var S2Cap_1 = require("./S2Cap");
6
- __export(require('./Interval'));
7
- __export(require('./MutableInteger'));
8
- __export(require('./R1Interval'));
9
- __export(require('./R2Vector'));
10
- __export(require('./S1Angle'));
11
- __export(require('./S1Interval'));
12
- __export(require('./S2'));
13
- __export(require('./S2Cap'));
14
- __export(require('./S2Cell'));
15
- __export(require('./S2CellId'));
16
- __export(require('./S2CellUnion'));
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Utils = void 0;
18
+ const S2Cap_1 = require("./S2Cap");
19
+ __exportStar(require("./Interval"), exports);
20
+ __exportStar(require("./MutableInteger"), exports);
21
+ __exportStar(require("./R1Interval"), exports);
22
+ __exportStar(require("./R2Vector"), exports);
23
+ __exportStar(require("./S1Angle"), exports);
24
+ __exportStar(require("./S1Interval"), exports);
25
+ __exportStar(require("./S2"), exports);
26
+ __exportStar(require("./S2Cap"), exports);
27
+ __exportStar(require("./S2Cell"), exports);
28
+ __exportStar(require("./S2CellId"), exports);
29
+ __exportStar(require("./S2CellUnion"), exports);
17
30
  // export * from './S2EdgeIndex';
18
31
  // export * from './S2EdgeUtil';
19
- __export(require('./S2LatLng'));
20
- __export(require('./S2LatLngRect'));
32
+ __exportStar(require("./S2LatLng"), exports);
33
+ __exportStar(require("./S2LatLngRect"), exports);
21
34
  // export * from './S2Loop';
22
- __export(require('./S2Point'));
23
- __export(require('./S2Projections'));
24
- __export(require('./S2RegionCoverer'));
25
- var Utils = (function () {
26
- function Utils() {
27
- }
35
+ __exportStar(require("./S2Point"), exports);
36
+ __exportStar(require("./S2Projections"), exports);
37
+ __exportStar(require("./S2Region"), exports);
38
+ __exportStar(require("./S2RegionCoverer"), exports);
39
+ class Utils {
28
40
  /**
29
41
  * Calculates a region covering a circle
30
42
  * NOTE: The current implementation uses S2Cap while S2Loop would be better (S2Loop is not implemented yet)
@@ -33,21 +45,19 @@ var Utils = (function () {
33
45
  * @param points the number of points to calculate. The higher the better precision
34
46
  * @returns {S2Region}
35
47
  */
36
- Utils.calcRegionFromCenterRadius = function (center, radiusInKM, points) {
37
- if (points === void 0) { points = 16; }
38
- var pointsAtDistance = center.pointsAtDistance(radiusInKM, points);
39
- var s2Cap = S2Cap_1.S2Cap.empty().addPoint(center.toPoint());
48
+ static calcRegionFromCenterRadius(center, radiusInKM, points = 16) {
49
+ const pointsAtDistance = center.pointsAtDistance(radiusInKM, points);
50
+ let s2Cap = S2Cap_1.S2Cap.empty().addPoint(center.toPoint());
40
51
  // It would be probably enough to add one of the points/2 pair of opposite points in the circle such
41
52
  // as (0, points/2). but since this is just a temporary solution lets stick with this as it
42
53
  // will come handy when implementing S2Loop.
43
54
  pointsAtDistance
44
- .map(function (p) { return p.toPoint(); })
45
- .forEach(function (p) {
55
+ .map(p => p.toPoint())
56
+ .forEach(p => {
46
57
  s2Cap = s2Cap.addPoint(p);
47
58
  });
48
59
  return s2Cap;
49
- };
50
- return Utils;
51
- }());
60
+ }
61
+ }
52
62
  exports.Utils = Utils;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QAAQ,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QACP,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IACH,YAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBY,aAAK,QAuBjB,CAAA"}
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../src/export.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,mCAA8B;AAC9B,6CAA2B;AAC3B,mDAAiC;AACjC,+CAA6B;AAC7B,6CAA2B;AAC3B,4CAA0B;AAC1B,+CAA6B;AAC7B,uCAAqB;AACrB,0CAAwB;AACxB,2CAAyB;AACzB,6CAA2B;AAC3B,gDAA8B;AAC9B,iCAAiC;AACjC,gCAAgC;AAChC,6CAA2B;AAC3B,iDAA+B;AAC/B,4BAA4B;AAC5B,4CAA0B;AAC1B,kDAAgC;AAChC,6CAA2B;AAC3B,oDAAkC;AAElC,MAAa,KAAK;IAEhB;;;;;;;OAOG;IACH,MAAM,CAAC,0BAA0B,CAAC,MAAe,EAAE,UAAiB,EAAE,MAAM,GAAC,EAAE;QAC7E,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACrE,IAAI,KAAK,GAAG,aAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,oGAAoG;QACpG,2FAA2F;QAC3F,4CAA4C;QAC5C,gBAAgB;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;aACrB,OAAO,CAAC,CAAC,CAAC,EAAE;YACX,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAvBD,sBAuBC"}
@@ -0,0 +1,2 @@
1
+ export declare function checkArgument(condition: boolean, message?: string): void;
2
+ export declare function checkState(condition: boolean, message?: string): void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkState = exports.checkArgument = void 0;
4
+ function checkArgument(condition, message) {
5
+ if (!condition) {
6
+ throw Error('IllegalArgumentException: ' + (message || ''));
7
+ }
8
+ }
9
+ exports.checkArgument = checkArgument;
10
+ function checkState(condition, message) {
11
+ if (!condition) {
12
+ throw Error('IllegalStateException: ' + (message || ''));
13
+ }
14
+ }
15
+ exports.checkState = checkState;
16
+ //# sourceMappingURL=preconditions.js.map