nodes2ts 3.0.0 → 4.0.1
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/LICENSE +21 -0
- package/README.md +102 -15
- package/dist/export.cjs +5350 -0
- package/dist/export.cjs.map +1 -0
- package/dist/export.d.cts +1847 -0
- package/dist/export.d.ts +1837 -20
- package/dist/export.js +5299 -62
- package/dist/export.js.map +1 -1
- package/package.json +34 -55
- package/.eslintignore +0 -3
- package/.eslintrc.cjs +0 -11
- package/.github/workflows/lint.js.yml +0 -22
- package/.github/workflows/node.js.yml +0 -22
- package/.mocharc.js +0 -7
- package/dist/Interval.d.ts +0 -24
- package/dist/Interval.js +0 -23
- package/dist/Interval.js.map +0 -1
- package/dist/MutableInteger.d.ts +0 -4
- package/dist/MutableInteger.js +0 -10
- package/dist/MutableInteger.js.map +0 -1
- package/dist/Platform.d.ts +0 -15
- package/dist/Platform.js +0 -53
- package/dist/Platform.js.map +0 -1
- package/dist/R1Interval.d.ts +0 -76
- package/dist/R1Interval.js +0 -158
- package/dist/R1Interval.js.map +0 -1
- package/dist/R2Vector.d.ts +0 -34
- package/dist/R2Vector.js +0 -131
- package/dist/R2Vector.js.map +0 -1
- package/dist/S1Angle.d.ts +0 -60
- package/dist/S1Angle.js +0 -133
- package/dist/S1Angle.js.map +0 -1
- package/dist/S1ChordAngle.d.ts +0 -166
- package/dist/S1ChordAngle.js +0 -318
- package/dist/S1ChordAngle.js.map +0 -1
- package/dist/S1Interval.d.ts +0 -109
- package/dist/S1Interval.js +0 -398
- package/dist/S1Interval.js.map +0 -1
- package/dist/S2.d.ts +0 -96
- package/dist/S2.js +0 -231
- package/dist/S2.js.map +0 -1
- package/dist/S2Cap.d.ts +0 -122
- package/dist/S2Cap.js +0 -399
- package/dist/S2Cap.js.map +0 -1
- package/dist/S2Cell.d.ts +0 -106
- package/dist/S2Cell.js +0 -358
- package/dist/S2Cell.js.map +0 -1
- package/dist/S2CellId.d.ts +0 -290
- package/dist/S2CellId.js +0 -983
- package/dist/S2CellId.js.map +0 -1
- package/dist/S2CellUnion.d.ts +0 -179
- package/dist/S2CellUnion.js +0 -523
- package/dist/S2CellUnion.js.map +0 -1
- package/dist/S2EdgeUtil.d.ts +0 -17
- package/dist/S2EdgeUtil.js +0 -785
- package/dist/S2EdgeUtil.js.map +0 -1
- package/dist/S2LatLng.d.ts +0 -77
- package/dist/S2LatLng.js +0 -186
- package/dist/S2LatLng.js.map +0 -1
- package/dist/S2LatLngRect.d.ts +0 -190
- package/dist/S2LatLngRect.js +0 -624
- package/dist/S2LatLngRect.js.map +0 -1
- package/dist/S2Metric.d.ts +0 -38
- package/dist/S2Metric.js +0 -79
- package/dist/S2Metric.js.map +0 -1
- package/dist/S2Point.d.ts +0 -78
- package/dist/S2Point.js +0 -250
- package/dist/S2Point.js.map +0 -1
- package/dist/S2Projections.d.ts +0 -102
- package/dist/S2Projections.js +0 -331
- package/dist/S2Projections.js.map +0 -1
- package/dist/S2Region.d.ts +0 -31
- package/dist/S2Region.js +0 -18
- package/dist/S2Region.js.map +0 -1
- package/dist/S2RegionCoverer.d.ts +0 -186
- package/dist/S2RegionCoverer.js +0 -471
- package/dist/S2RegionCoverer.js.map +0 -1
- package/dist/utils/preconditions.d.ts +0 -2
- package/dist/utils/preconditions.js +0 -16
- package/dist/utils/preconditions.js.map +0 -1
package/dist/S2RegionCoverer.js
DELETED
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2005 Google Inc.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
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");
|
|
23
|
-
/**
|
|
24
|
-
* An S2RegionCoverer is a class that allows arbitrary regions to be
|
|
25
|
-
* approximated as unions of cells (S2CellUnion). This is useful for
|
|
26
|
-
* implementing various sorts of search and precomputation operations.
|
|
27
|
-
*
|
|
28
|
-
* Typical usage: {@code S2RegionCoverer coverer; coverer.setMaxCells(5); S2Cap
|
|
29
|
-
* cap = S2Cap.fromAxisAngle(...); S2CellUnion covering;
|
|
30
|
-
* coverer.getCovering(cap, covering); * }
|
|
31
|
-
*
|
|
32
|
-
* This yields a cell union of at most 5 cells that is guaranteed to cover the
|
|
33
|
-
* given cap (a disc-shaped region on the sphere).
|
|
34
|
-
*
|
|
35
|
-
* The approximation algorithm is not optimal but does a pretty good job in
|
|
36
|
-
* practice. The output does not always use the maximum number of cells allowed,
|
|
37
|
-
* both because this would not always yield a better approximation, and because
|
|
38
|
-
* max_cells() is a limit on how much work is done exploring the possible
|
|
39
|
-
* covering as well as a limit on the final output size.
|
|
40
|
-
*
|
|
41
|
-
* One can also generate interior coverings, which are sets of cells which are
|
|
42
|
-
* entirely contained within a region. Interior coverings can be empty, even for
|
|
43
|
-
* non-empty regions, if there are no cells that satisfy the provided
|
|
44
|
-
* constraints and are contained by the region. Note that for performance
|
|
45
|
-
* reasons, it is wise to specify a max_level when computing interior coverings
|
|
46
|
-
* - otherwise for regions with small or zero area, the algorithm may spend a
|
|
47
|
-
* lot of time subdividing cells all the way to leaf level to try to find
|
|
48
|
-
* contained cells.
|
|
49
|
-
*
|
|
50
|
-
* This class is thread-unsafe. Simultaneous calls to any of the getCovering
|
|
51
|
-
* methods will conflict and produce unpredictable results.
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
class S2RegionCoverer {
|
|
55
|
-
/**
|
|
56
|
-
* Default constructor, sets all fields to default values.
|
|
57
|
-
*/
|
|
58
|
-
constructor() {
|
|
59
|
-
this.minLevel = 0;
|
|
60
|
-
this.maxLevel = S2CellId_1.S2CellId.MAX_LEVEL;
|
|
61
|
-
this.levelMod = 1;
|
|
62
|
-
this.maxCells = S2RegionCoverer.DEFAULT_MAX_CELLS;
|
|
63
|
-
this.region = null;
|
|
64
|
-
this.result = [];
|
|
65
|
-
this.candidateQueue = new PriorityQueue();
|
|
66
|
-
}
|
|
67
|
-
// Set the minimum and maximum cell level to be used. The default is to use
|
|
68
|
-
// all cell levels. Requires: max_level() >= min_level().
|
|
69
|
-
//
|
|
70
|
-
// To find the cell level corresponding to a given physical distance, use
|
|
71
|
-
// the S2Cell metrics defined in s2.h. For example, to find the cell
|
|
72
|
-
// level that corresponds to an average edge length of 10km, use:
|
|
73
|
-
//
|
|
74
|
-
// int level = S2::kAvgEdge.GetClosestLevel(
|
|
75
|
-
// geostore::S2Earth::KmToRadians(length_km));
|
|
76
|
-
//
|
|
77
|
-
// Note: min_level() takes priority over max_cells(), i.e. cells below the
|
|
78
|
-
// given level will never be used even if this causes a large number of
|
|
79
|
-
// cells to be returned.
|
|
80
|
-
/**
|
|
81
|
-
* Sets the minimum level to be used.
|
|
82
|
-
*/
|
|
83
|
-
setMinLevel(minLevel) {
|
|
84
|
-
// assert (minLevel >= 0 && minLevel <= S2CellId.MAX_LEVEL);
|
|
85
|
-
this.minLevel = Math.max(0, Math.min(S2CellId_1.S2CellId.MAX_LEVEL, minLevel));
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Sets the maximum level to be used.
|
|
90
|
-
*/
|
|
91
|
-
setMaxLevel(maxLevel) {
|
|
92
|
-
// assert (maxLevel >= 0 && maxLevel <= S2CellId.MAX_LEVEL);
|
|
93
|
-
this.maxLevel = Math.max(0, Math.min(S2CellId_1.S2CellId.MAX_LEVEL, maxLevel));
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* If specified, then only cells where (level - min_level) is a multiple of
|
|
98
|
-
* "level_mod" will be used (default 1). This effectively allows the branching
|
|
99
|
-
* factor of the S2CellId hierarchy to be increased. Currently the only
|
|
100
|
-
* parameter values allowed are 1, 2, or 3, corresponding to branching factors
|
|
101
|
-
* of 4, 16, and 64 respectively.
|
|
102
|
-
*/
|
|
103
|
-
setLevelMod(levelMod) {
|
|
104
|
-
// assert (levelMod >= 1 && levelMod <= 3);
|
|
105
|
-
this.levelMod = Math.max(1, Math.min(3, levelMod));
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Sets the maximum desired number of cells in the approximation (defaults to
|
|
110
|
-
* kDefaultMaxCells). Note the following:
|
|
111
|
-
*
|
|
112
|
-
* <ul>
|
|
113
|
-
* <li>For any setting of max_cells(), up to 6 cells may be returned if that
|
|
114
|
-
* is the minimum number of cells required (e.g. if the region intersects all
|
|
115
|
-
* six face cells). Up to 3 cells may be returned even for very tiny convex
|
|
116
|
-
* regions if they happen to be located at the intersection of three cube
|
|
117
|
-
* faces.
|
|
118
|
-
*
|
|
119
|
-
* <li>For any setting of max_cells(), an arbitrary number of cells may be
|
|
120
|
-
* returned if min_level() is too high for the region being approximated.
|
|
121
|
-
*
|
|
122
|
-
* <li>If max_cells() is less than 4, the area of the covering may be
|
|
123
|
-
* arbitrarily large compared to the area of the original region even if the
|
|
124
|
-
* region is convex (e.g. an S2Cap or S2LatLngRect).
|
|
125
|
-
* </ul>
|
|
126
|
-
*
|
|
127
|
-
* Accuracy is measured by dividing the area of the covering by the area of
|
|
128
|
-
* the original region. The following table shows the median and worst case
|
|
129
|
-
* values for this area ratio on a test case consisting of 100,000 spherical
|
|
130
|
-
* caps of random size (generated using s2regioncoverer_unittest):
|
|
131
|
-
*
|
|
132
|
-
* <pre>
|
|
133
|
-
* max_cells: 3 4 5 6 8 12 20 100 1000
|
|
134
|
-
* median ratio: 5.33 3.32 2.73 2.34 1.98 1.66 1.42 1.11 1.01
|
|
135
|
-
* worst case: 215518 14.41 9.72 5.26 3.91 2.75 1.92 1.20 1.02
|
|
136
|
-
* </pre>
|
|
137
|
-
*/
|
|
138
|
-
setMaxCells(maxCells) {
|
|
139
|
-
this.maxCells = maxCells;
|
|
140
|
-
return this;
|
|
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
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Computes a list of cell ids that covers the given region and satisfies the
|
|
156
|
-
* various restrictions specified above.
|
|
157
|
-
*
|
|
158
|
-
* @param region The region to cover
|
|
159
|
-
* @param covering The list filled in by this method
|
|
160
|
-
*/
|
|
161
|
-
getCoveringCells(region) {
|
|
162
|
-
// Rather than just returning the raw list of cell ids generated by
|
|
163
|
-
// GetCoveringInternal(), we construct a cell union and then denormalize it.
|
|
164
|
-
// This has the effect of replacing four child cells with their parent
|
|
165
|
-
// whenever this does not violate the covering parameters specified
|
|
166
|
-
// (min_level, level_mod, etc). This strategy significantly reduces the
|
|
167
|
-
// number of cells returned in many cases, and it is cheap compared to
|
|
168
|
-
// computing the covering in the first place.
|
|
169
|
-
const tmp = this.getCoveringUnion(region);
|
|
170
|
-
return tmp.denormalize(this.minLevel, this.levelMod);
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Computes a list of cell ids that is contained within the given region and
|
|
174
|
-
* satisfies the various restrictions specified above.
|
|
175
|
-
*
|
|
176
|
-
* @param region The region to fill
|
|
177
|
-
* @param interior The list filled in by this method
|
|
178
|
-
*/
|
|
179
|
-
getInteriorCoveringCells(region) {
|
|
180
|
-
const tmp = this.getInteriorCoveringUnion(region);
|
|
181
|
-
return tmp.denormalize(this.minLevel, this.levelMod);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Return a normalized cell union that covers the given region and satisfies
|
|
185
|
-
* the restrictions *EXCEPT* for min_level() and level_mod(). These criteria
|
|
186
|
-
* cannot be satisfied using a cell union because cell unions are
|
|
187
|
-
* automatically normalized by replacing four child cells with their parent
|
|
188
|
-
* whenever possible. (Note that the list of cell ids passed to the cell union
|
|
189
|
-
* constructor does in fact satisfy all the given restrictions.)
|
|
190
|
-
*/
|
|
191
|
-
getCoveringUnion(region, covering = new S2CellUnion_1.S2CellUnion()) {
|
|
192
|
-
this.interiorCovering = false;
|
|
193
|
-
this.getCoveringInternal(region);
|
|
194
|
-
covering.initSwap(this.result);
|
|
195
|
-
this.result = [];
|
|
196
|
-
return covering;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Return a normalized cell union that is contained within the given region
|
|
200
|
-
* and satisfies the restrictions *EXCEPT* for min_level() and level_mod().
|
|
201
|
-
*/
|
|
202
|
-
getInteriorCoveringUnion(region, covering = new S2CellUnion_1.S2CellUnion()) {
|
|
203
|
-
this.interiorCovering = true;
|
|
204
|
-
this.getCoveringInternal(region);
|
|
205
|
-
covering.initSwap(this.result);
|
|
206
|
-
this.result = [];
|
|
207
|
-
return covering;
|
|
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
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* If the cell intersects the given region, return a new candidate with no
|
|
218
|
-
* children, otherwise return null. Also marks the candidate as "terminal" if
|
|
219
|
-
* it should not be expanded further.
|
|
220
|
-
*/
|
|
221
|
-
newCandidate(cell) {
|
|
222
|
-
if (!this.region.mayIntersectC(cell)) {
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
let isTerminal = false;
|
|
226
|
-
if (cell.level >= this.minLevel) {
|
|
227
|
-
if (this.interiorCovering) {
|
|
228
|
-
if (this.region.containsC(cell)) {
|
|
229
|
-
isTerminal = true;
|
|
230
|
-
}
|
|
231
|
-
else if (cell.level + this.levelMod > this.maxLevel) {
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
if (cell.level + this.levelMod > this.maxLevel || this.region.containsC(cell)) {
|
|
237
|
-
isTerminal = true;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const candidate = new Candidate();
|
|
242
|
-
candidate.cell = cell;
|
|
243
|
-
candidate.isTerminal = isTerminal;
|
|
244
|
-
candidate.numChildren = 0;
|
|
245
|
-
if (!isTerminal) {
|
|
246
|
-
candidate.children = [];
|
|
247
|
-
const numOfChildren = 1 << this.maxChildrenShift();
|
|
248
|
-
for (let i = 0; i < numOfChildren; i++) {
|
|
249
|
-
candidate.children.push(new Candidate());
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
this.candidatesCreatedCounter++;
|
|
253
|
-
return candidate;
|
|
254
|
-
}
|
|
255
|
-
/** Return the log base 2 of the maximum number of children of a candidate. */
|
|
256
|
-
maxChildrenShift() {
|
|
257
|
-
return 2 * this.levelMod;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Process a candidate by either adding it to the result list or expanding its
|
|
261
|
-
* children and inserting it into the priority queue. Passing an argument of
|
|
262
|
-
* NULL does nothing.
|
|
263
|
-
*/
|
|
264
|
-
addCandidate(candidate) {
|
|
265
|
-
if (candidate == null) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
if (candidate.isTerminal) {
|
|
269
|
-
this.result.push(candidate.cell.id);
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
// assert (candidate.numChildren == 0);
|
|
273
|
-
// Expand one level at a time until we hit min_level_ to ensure that
|
|
274
|
-
// we don't skip over it.
|
|
275
|
-
const numLevels = (candidate.cell.level < this.minLevel) ? 1 : this.levelMod;
|
|
276
|
-
const numTerminals = this.expandChildren(candidate, candidate.cell, numLevels);
|
|
277
|
-
if (candidate.numChildren == 0) {
|
|
278
|
-
// Do nothing
|
|
279
|
-
}
|
|
280
|
-
else if (!this.interiorCovering && numTerminals == 1 << this.maxChildrenShift()
|
|
281
|
-
&& candidate.cell.level >= this.minLevel) {
|
|
282
|
-
// Optimization: add the parent cell rather than all of its children.
|
|
283
|
-
// We can't do this for interior coverings, since the children just
|
|
284
|
-
// intersect the region, but may not be contained by it - we need to
|
|
285
|
-
// subdivide them further.
|
|
286
|
-
candidate.isTerminal = true;
|
|
287
|
-
this.addCandidate(candidate);
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
// We negate the priority so that smaller absolute priorities are returned
|
|
291
|
-
// first. The heuristic is designed to refine the largest cells first,
|
|
292
|
-
// since those are where we have the largest potential gain. Among cells
|
|
293
|
-
// at the same level, we prefer the cells with the smallest number of
|
|
294
|
-
// intersecting children. Finally, we prefer cells that have the smallest
|
|
295
|
-
// number of children that cannot be refined any further.
|
|
296
|
-
const priority = -((((candidate.cell.level << this.maxChildrenShift()) + candidate.numChildren)
|
|
297
|
-
<< this.maxChildrenShift()) + numTerminals);
|
|
298
|
-
this.candidateQueue.add(new QueueEntry(priority, candidate));
|
|
299
|
-
// logger.info("Push: " + candidate.cell.id() + " (" + priority + ") ");
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Populate the children of "candidate" by expanding the given number of
|
|
304
|
-
* levels from the given cell. Returns the number of children that were marked
|
|
305
|
-
* "terminal".
|
|
306
|
-
*/
|
|
307
|
-
expandChildren(candidate, cell, numLevels) {
|
|
308
|
-
numLevels--;
|
|
309
|
-
const childCells = cell.subdivide();
|
|
310
|
-
let numTerminals = 0;
|
|
311
|
-
for (let i = 0; i < 4; ++i) {
|
|
312
|
-
if (numLevels > 0) {
|
|
313
|
-
if (this.region.mayIntersectC(childCells[i])) {
|
|
314
|
-
numTerminals += this.expandChildren(candidate, childCells[i], numLevels);
|
|
315
|
-
}
|
|
316
|
-
continue;
|
|
317
|
-
}
|
|
318
|
-
const child = this.newCandidate(childCells[i]);
|
|
319
|
-
if (child != null) {
|
|
320
|
-
candidate.children[candidate.numChildren++] = child;
|
|
321
|
-
if (child.isTerminal) {
|
|
322
|
-
++numTerminals;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return numTerminals;
|
|
327
|
-
}
|
|
328
|
-
/** Computes a set of initial candidates that cover the given region. */
|
|
329
|
-
getInitialCandidates() {
|
|
330
|
-
// Optimization: if at least 4 cells are desired (the normal case),
|
|
331
|
-
// start with a 4-cell covering of the region's bounding cap. This
|
|
332
|
-
// lets us skip quite a few levels of refinement when the region to
|
|
333
|
-
// be covered is relatively small.
|
|
334
|
-
if (this.maxCells >= 4) {
|
|
335
|
-
// Find the maximum level such that the bounding cap contains at most one
|
|
336
|
-
// cell vertex at that level.
|
|
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));
|
|
339
|
-
if (this.levelMod > 1 && level > this.minLevel) {
|
|
340
|
-
level -= (level - this.minLevel) % this.levelMod;
|
|
341
|
-
}
|
|
342
|
-
// We don't bother trying to optimize the level == 0 case, since more than
|
|
343
|
-
// four face cells may be required.
|
|
344
|
-
if (level > 0) {
|
|
345
|
-
// Find the leaf cell containing the cap axis, and determine which
|
|
346
|
-
// subcell of the parent cell contains it.
|
|
347
|
-
const id = S2CellId_1.S2CellId.fromPoint(cap.axis);
|
|
348
|
-
const base = id.getVertexNeighbors(level);
|
|
349
|
-
for (let i = 0; i < base.length; ++i) {
|
|
350
|
-
this.addCandidate(this.newCandidate(new S2Cell_1.S2Cell(base[i])));
|
|
351
|
-
}
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
// Default: start with all six cube faces.
|
|
356
|
-
for (let face = 0; face < 6; ++face) {
|
|
357
|
-
this.addCandidate(this.newCandidate(S2RegionCoverer.FACE_CELLS[face]));
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
/** Generates a covering and stores it in result. */
|
|
361
|
-
getCoveringInternal(region) {
|
|
362
|
-
// Strategy: Start with the 6 faces of the cube. Discard any
|
|
363
|
-
// that do not intersect the shape. Then repeatedly choose the
|
|
364
|
-
// largest cell that intersects the shape and subdivide it.
|
|
365
|
-
//
|
|
366
|
-
// result contains the cells that will be part of the output, while the
|
|
367
|
-
// priority queue contains cells that we may still subdivide further. Cells
|
|
368
|
-
// that are entirely contained within the region are immediately added to
|
|
369
|
-
// the output, while cells that do not intersect the region are immediately
|
|
370
|
-
// discarded.
|
|
371
|
-
// Therefore pq_ only contains cells that partially intersect the region.
|
|
372
|
-
// Candidates are prioritized first according to cell size (larger cells
|
|
373
|
-
// first), then by the number of intersecting children they have (fewest
|
|
374
|
-
// children first), and then by the number of fully contained children
|
|
375
|
-
// (fewest children first).
|
|
376
|
-
if (!(this.candidateQueue.size() == 0 && this.result.length == 0)) {
|
|
377
|
-
throw new Error('preconditions are not satisfied');
|
|
378
|
-
}
|
|
379
|
-
// Preconditions.checkState(this.candidateQueue.isEmpty() && this.result.isEmpty());
|
|
380
|
-
this.region = region;
|
|
381
|
-
this.candidatesCreatedCounter = 0;
|
|
382
|
-
this.getInitialCandidates();
|
|
383
|
-
while (this.candidateQueue.size() !== 0 && (!this.interiorCovering || this.result.length < 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) {
|
|
387
|
-
// Expand this candidate into its children.
|
|
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
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
candidate.isTerminal = true;
|
|
396
|
-
this.addCandidate(candidate);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
this.candidateQueue.clear();
|
|
400
|
-
this.region = null;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
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.
|
|
405
|
-
*/
|
|
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;
|
|
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 {
|
|
439
|
-
// elements.
|
|
440
|
-
toString() {
|
|
441
|
-
return `isTerminal: ${this.isTerminal} - Cell: ${this.cell.toString()}`;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
class PriorityQueue {
|
|
445
|
-
constructor() {
|
|
446
|
-
this.clear();
|
|
447
|
-
}
|
|
448
|
-
add(item) {
|
|
449
|
-
this.items.push(item);
|
|
450
|
-
this.items.sort((a, b) => a.compare(b));
|
|
451
|
-
}
|
|
452
|
-
clear() {
|
|
453
|
-
this.items = [];
|
|
454
|
-
}
|
|
455
|
-
size() {
|
|
456
|
-
return this.items.length;
|
|
457
|
-
}
|
|
458
|
-
poll() {
|
|
459
|
-
return this.items.splice(0, 1)[0];
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
class QueueEntry {
|
|
463
|
-
constructor(id, candidate) {
|
|
464
|
-
this.id = id;
|
|
465
|
-
this.candidate = candidate;
|
|
466
|
-
}
|
|
467
|
-
compare(other) {
|
|
468
|
-
return this.id < other.id ? 1 : (this.id > other.id ? -1 : 0);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
//# sourceMappingURL=S2RegionCoverer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"S2RegionCoverer.js","sourceRoot":"","sources":["../src/S2RegionCoverer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;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AE,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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preconditions.js","sourceRoot":"","sources":["../../src/utils/preconditions.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAC,SAAkB,EAAE,OAAgB;IAChE,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,KAAK,CAAC,4BAA4B,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;KAC7D;AACH,CAAC;AAJD,sCAIC;AAED,SAAgB,UAAU,CAAC,SAAkB,EAAE,OAAgB;IAC7D,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,KAAK,CAAC,yBAAyB,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;KAC1D;AACH,CAAC;AAJD,gCAIC"}
|