@dra2020/baseclient 1.0.163 → 1.0.164
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/baseclient.js +93 -0
- package/dist/baseclient.js.map +1 -1
- package/dist/poly/all.d.ts +1 -0
- package/dist/poly/polyhash.d.ts +1 -0
- package/lib/poly/all.ts +1 -0
- package/lib/poly/polyhash.ts +52 -0
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -6639,6 +6639,7 @@ __exportStar(__webpack_require__(/*! ./shamos */ "./lib/poly/shamos.ts"), export
|
|
|
6639
6639
|
__exportStar(__webpack_require__(/*! ./pointinpoly */ "./lib/poly/pointinpoly.ts"), exports);
|
|
6640
6640
|
__exportStar(__webpack_require__(/*! ./mapto */ "./lib/poly/mapto.ts"), exports);
|
|
6641
6641
|
__exportStar(__webpack_require__(/*! ./featurecleanholes */ "./lib/poly/featurecleanholes.ts"), exports);
|
|
6642
|
+
__exportStar(__webpack_require__(/*! ./polyhash */ "./lib/poly/polyhash.ts"), exports);
|
|
6642
6643
|
|
|
6643
6644
|
|
|
6644
6645
|
/***/ }),
|
|
@@ -9067,6 +9068,98 @@ function topoFromBuffer(coder, ab) {
|
|
|
9067
9068
|
}
|
|
9068
9069
|
|
|
9069
9070
|
|
|
9071
|
+
/***/ }),
|
|
9072
|
+
|
|
9073
|
+
/***/ "./lib/poly/polyhash.ts":
|
|
9074
|
+
/*!******************************!*\
|
|
9075
|
+
!*** ./lib/poly/polyhash.ts ***!
|
|
9076
|
+
\******************************/
|
|
9077
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
9078
|
+
|
|
9079
|
+
|
|
9080
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9081
|
+
if (k2 === undefined) k2 = k;
|
|
9082
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9083
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9084
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9085
|
+
}
|
|
9086
|
+
Object.defineProperty(o, k2, desc);
|
|
9087
|
+
}) : (function(o, m, k, k2) {
|
|
9088
|
+
if (k2 === undefined) k2 = k;
|
|
9089
|
+
o[k2] = m[k];
|
|
9090
|
+
}));
|
|
9091
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
9092
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
9093
|
+
}) : function(o, v) {
|
|
9094
|
+
o["default"] = v;
|
|
9095
|
+
});
|
|
9096
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
9097
|
+
var ownKeys = function(o) {
|
|
9098
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
9099
|
+
var ar = [];
|
|
9100
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
9101
|
+
return ar;
|
|
9102
|
+
};
|
|
9103
|
+
return ownKeys(o);
|
|
9104
|
+
};
|
|
9105
|
+
return function (mod) {
|
|
9106
|
+
if (mod && mod.__esModule) return mod;
|
|
9107
|
+
var result = {};
|
|
9108
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
9109
|
+
__setModuleDefault(result, mod);
|
|
9110
|
+
return result;
|
|
9111
|
+
};
|
|
9112
|
+
})();
|
|
9113
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9114
|
+
exports.polyHash32 = polyHash32;
|
|
9115
|
+
const P = __importStar(__webpack_require__(/*! ./poly */ "./lib/poly/poly.ts"));
|
|
9116
|
+
const PP = __importStar(__webpack_require__(/*! ./polypack */ "./lib/poly/polypack.ts"));
|
|
9117
|
+
// Hash coordinates to 32 bit number in order to produce a fast (and a little sloppy) equivalence test.
|
|
9118
|
+
// Note that this depends on ordering, so an equivalent polygon with different coordinate ordering would
|
|
9119
|
+
// not test as equivalent. As a 32 bit number, you can expect collisions when used for large numbers of
|
|
9120
|
+
// polygons (e.g. a 700k block set might expect ~57 collisions - TX at 660K gets 62 collisions, e.g.).
|
|
9121
|
+
//
|
|
9122
|
+
function polyHash32(poly, seed = 0) {
|
|
9123
|
+
let pp = P.polyNormalize(poly);
|
|
9124
|
+
if (!pp)
|
|
9125
|
+
return 0;
|
|
9126
|
+
let h = (seed | 0) ^ 0x9e3779b9;
|
|
9127
|
+
const buf = new ArrayBuffer(8);
|
|
9128
|
+
const dv = new DataView(buf);
|
|
9129
|
+
function mix32(x) {
|
|
9130
|
+
x ^= x >>> 16;
|
|
9131
|
+
x = Math.imul(x, 0x7feb352d);
|
|
9132
|
+
x ^= x >>> 15;
|
|
9133
|
+
x = Math.imul(x, 0x846ca68b);
|
|
9134
|
+
x ^= x >>> 16;
|
|
9135
|
+
return x | 0;
|
|
9136
|
+
}
|
|
9137
|
+
let l = 0;
|
|
9138
|
+
PP.polyPackEachRing(pp, (b, iPoly, iRing, iOffset, nPoints) => {
|
|
9139
|
+
let iEnd = iOffset + (nPoints * 2);
|
|
9140
|
+
for (; iOffset < iEnd; iOffset++) {
|
|
9141
|
+
const x = b[iOffset];
|
|
9142
|
+
if (Number.isNaN(x)) {
|
|
9143
|
+
dv.setUint32(0, 0x7ff80001, true);
|
|
9144
|
+
dv.setUint32(4, 0, true);
|
|
9145
|
+
}
|
|
9146
|
+
else
|
|
9147
|
+
dv.setFloat64(0, x, true);
|
|
9148
|
+
const lo = dv.getUint32(0, true) | 0;
|
|
9149
|
+
const hi = dv.getUint32(4, true) | 0;
|
|
9150
|
+
let z = mix32(lo ^ Math.imul(hi, 0x9e3779b9) ^ Math.imul(l + 1, 0x85ebca6b));
|
|
9151
|
+
h ^= z;
|
|
9152
|
+
h = mix32(h);
|
|
9153
|
+
l++;
|
|
9154
|
+
}
|
|
9155
|
+
});
|
|
9156
|
+
h ^= l | 0;
|
|
9157
|
+
h = mix32(h);
|
|
9158
|
+
// return as unsigned 32-bit in a JS number
|
|
9159
|
+
return h >>> 0;
|
|
9160
|
+
}
|
|
9161
|
+
|
|
9162
|
+
|
|
9070
9163
|
/***/ }),
|
|
9071
9164
|
|
|
9072
9165
|
/***/ "./lib/poly/polylabel.ts":
|