nodes2ts 4.0.1 → 4.0.2
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.
- package/dist/export.cjs +63 -10
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +45 -5
- package/dist/export.d.ts +45 -5
- package/dist/export.js +63 -10
- package/dist/export.js.map +1 -1
- package/package.json +1 -1
package/dist/export.cjs
CHANGED
|
@@ -3350,6 +3350,13 @@ var UINT64_MAX = 0xFFFFFFFFFFFFFFFFn;
|
|
|
3350
3350
|
|
|
3351
3351
|
// src/S2Projections.ts
|
|
3352
3352
|
var _S2Projections = class _S2Projections {
|
|
3353
|
+
/**
|
|
3354
|
+
* The maximum value of an si- or ti-coordinate. The range of valid (si,ti) values is
|
|
3355
|
+
* [0..MAX_SiTi].
|
|
3356
|
+
*/
|
|
3357
|
+
static get MAX_SITI() {
|
|
3358
|
+
return 1n << BigInt(_S2Projections.MAX_LEVEL + 1);
|
|
3359
|
+
}
|
|
3353
3360
|
static getUNorm(face, u) {
|
|
3354
3361
|
switch (face) {
|
|
3355
3362
|
case 0:
|
|
@@ -3590,11 +3597,6 @@ _S2Projections.XYZ_TRANSFORMS = [
|
|
|
3590
3597
|
}
|
|
3591
3598
|
}
|
|
3592
3599
|
];
|
|
3593
|
-
/**
|
|
3594
|
-
* The maximum value of an si- or ti-coordinate. The range of valid (si,ti) values is
|
|
3595
|
-
* [0..MAX_SiTi].
|
|
3596
|
-
*/
|
|
3597
|
-
_S2Projections.MAX_SITI = 1n << BigInt(_S2Projections.MAX_LEVEL + 1);
|
|
3598
3600
|
var S2Projections = _S2Projections;
|
|
3599
3601
|
|
|
3600
3602
|
// src/S2CellId.ts
|
|
@@ -4242,10 +4244,20 @@ _S2CellId.FACE_BITS = 3;
|
|
|
4242
4244
|
_S2CellId.NUM_FACES = 6;
|
|
4243
4245
|
_S2CellId.MAX_LEVEL = 30;
|
|
4244
4246
|
// Valid levels: 0..MAX_LEVEL
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4247
|
+
/**
|
|
4248
|
+
* The number of bits used by a position along the Hilbert curve over all
|
|
4249
|
+
* faces (range 1..2*MAX_LEVEL+1). This is a fixed constant encoding the
|
|
4250
|
+
* canonical 64-bit S2 cell ID layout; it must NEVER be derived from a
|
|
4251
|
+
* mutable MAX_LEVEL.
|
|
4252
|
+
*/
|
|
4253
|
+
_S2CellId.POS_BITS = 2 * 30 + 1;
|
|
4254
|
+
// = 61
|
|
4255
|
+
/**
|
|
4256
|
+
* The maximum coordinate value for an (i,j) cell index. Equal to 2^30.
|
|
4257
|
+
* Fixed constant matching the 30-level S2 grid.
|
|
4258
|
+
*/
|
|
4259
|
+
_S2CellId.MAX_SIZE = 1 << 30;
|
|
4260
|
+
// = 1073741824
|
|
4249
4261
|
/** Maximum unsigned 64-bit value (sentinel). */
|
|
4250
4262
|
_S2CellId.MAX_UNSIGNED = UINT64_MAX;
|
|
4251
4263
|
// The following lookup tables are used to convert efficiently between an
|
|
@@ -4269,6 +4281,10 @@ _S2CellId.LOOKUP_IJ = [];
|
|
|
4269
4281
|
* This is the offset required to wrap around from the beginning of the
|
|
4270
4282
|
* Hilbert curve to the end or vice versa; see next_wrap() and prev_wrap().
|
|
4271
4283
|
*/
|
|
4284
|
+
/**
|
|
4285
|
+
* Precomputed wrap offset. Fixed constant; must not be derived from a
|
|
4286
|
+
* mutable POS_BITS.
|
|
4287
|
+
*/
|
|
4272
4288
|
_S2CellId.WRAP_OFFSET = BigInt(_S2CellId.NUM_FACES) << BigInt(_S2CellId.POS_BITS);
|
|
4273
4289
|
var S2CellId = _S2CellId;
|
|
4274
4290
|
function initLookupCell(level, i, j, origOrientation, pos, orientation) {
|
|
@@ -4333,6 +4349,9 @@ var _S2Cell = class _S2Cell {
|
|
|
4333
4349
|
this.init(cellID);
|
|
4334
4350
|
}
|
|
4335
4351
|
}
|
|
4352
|
+
static get MAX_CELL_SIZE() {
|
|
4353
|
+
return 1 << S2CellId.MAX_LEVEL;
|
|
4354
|
+
}
|
|
4336
4355
|
get id() {
|
|
4337
4356
|
return this.cellID;
|
|
4338
4357
|
}
|
|
@@ -4622,7 +4641,6 @@ var _S2Cell = class _S2Cell {
|
|
|
4622
4641
|
};
|
|
4623
4642
|
}
|
|
4624
4643
|
};
|
|
4625
|
-
_S2Cell.MAX_CELL_SIZE = 1 << S2CellId.MAX_LEVEL;
|
|
4626
4644
|
// We grow the bounds slightly to make sure that the bounding rectangle
|
|
4627
4645
|
// also contains the normalized versions of the vertices. Note that the
|
|
4628
4646
|
// maximum result magnitude is Pi, with a floating-point exponent of 1.
|
|
@@ -5302,6 +5320,41 @@ var QueueEntry = class {
|
|
|
5302
5320
|
|
|
5303
5321
|
// src/export.ts
|
|
5304
5322
|
var Utils = class {
|
|
5323
|
+
/**
|
|
5324
|
+
* Atomically updates the maximum cell level across all S2 classes.
|
|
5325
|
+
*
|
|
5326
|
+
* This sets the `MAX_LEVEL` field on `S2`, `S2CellId`, and `S2Projections`
|
|
5327
|
+
* in one call, keeping them in sync.
|
|
5328
|
+
*
|
|
5329
|
+
* **What changes:**
|
|
5330
|
+
* - `S2Cell.MAX_CELL_SIZE` (derived via getter from `S2CellId.MAX_LEVEL`)
|
|
5331
|
+
* - `S2Projections.MAX_SITI` (derived via getter)
|
|
5332
|
+
* - `S2CellId.getSizeIJ()` / `S2CellId.getSizeST()` size calculations
|
|
5333
|
+
* - Default max-level caps in `S2RegionCoverer` and `S2Metric`
|
|
5334
|
+
* - `S2CellId.isLeaf()` / `level()` detection of the leaf level
|
|
5335
|
+
*
|
|
5336
|
+
* **What does NOT change:**
|
|
5337
|
+
* - `S2CellId.POS_BITS` (always 61) — the 64-bit S2 cell ID bit layout is
|
|
5338
|
+
* a fixed canonical format; changing it breaks encoding/decoding.
|
|
5339
|
+
* - `S2CellId.MAX_SIZE` (always 2^30) — the Hilbert-curve grid resolution.
|
|
5340
|
+
* - `S2CellId.WRAP_OFFSET` — derived from the fixed `POS_BITS`.
|
|
5341
|
+
*
|
|
5342
|
+
* For shorter cell tokens, use `parentL(desiredLevel)` or set
|
|
5343
|
+
* `S2RegionCoverer.maxLevel`; `toToken()` naturally produces compact hex
|
|
5344
|
+
* strings for lower-level cells (e.g. level 10 → 6 hex chars).
|
|
5345
|
+
*
|
|
5346
|
+
* @param level — integer in [1, 30]
|
|
5347
|
+
*/
|
|
5348
|
+
static setMaxLevel(level) {
|
|
5349
|
+
if (!Number.isInteger(level) || level < 1 || level > 30) {
|
|
5350
|
+
throw new RangeError(
|
|
5351
|
+
`MAX_LEVEL must be an integer in [1, 30], got ${level}`
|
|
5352
|
+
);
|
|
5353
|
+
}
|
|
5354
|
+
S2.MAX_LEVEL = level;
|
|
5355
|
+
S2CellId.MAX_LEVEL = level;
|
|
5356
|
+
S2Projections.MAX_LEVEL = level;
|
|
5357
|
+
}
|
|
5305
5358
|
/**
|
|
5306
5359
|
* Calculates a region covering a circle
|
|
5307
5360
|
* NOTE: The current implementation uses S2Cap while S2Loop would be better (S2Loop is not implemented yet)
|