@dra2020/baseclient 1.0.116 → 1.0.118
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 +1 -1
- package/dist/baseclient.js +27 -18
- package/dist/baseclient.js.map +1 -1
- package/dist/ot-js/otsession.d.ts +2 -0
- package/lib/ot-js/otsession.ts +4 -2
- package/lib/poly/pointinpoly.ts +0 -5
- package/lib/poly/polypack.ts +18 -0
- package/lib/poly/union.ts +7 -13
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2021-
|
|
3
|
+
Copyright (c) 2021-2023 Dave's Redistricting, LLC.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/baseclient.js
CHANGED
|
@@ -5795,7 +5795,7 @@ exports.OTServerEngine = OTServerEngine;
|
|
|
5795
5795
|
|
|
5796
5796
|
|
|
5797
5797
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5798
|
-
exports.SessionFilterFunction = exports.accessMapFindUser = exports.accessFindUser = exports.ServerStateMaintenance = exports.ServerStateRunning = exports.PermAll = exports.PermEdit = exports.PermAdmin = exports.PermOwner = exports.PermWrite = exports.PermRead = exports.PermNone = exports.FilterCount = exports.FilterMyGroups = exports.FilterCOI = exports.FilterOfficial = exports.FilterPublic = exports.FilterTrash = exports.FilterRecent = exports.FilterMyPublic = exports.FilterSharedWithMe = exports.FilterMyMaps = exports.EClockAnomaly = exports.EMaintenance = exports.ENoAccess = exports.ENoPerm = exports.ELoadFailed = exports.EBadRequest = exports.ENoUser = exports.EClockReset = exports.EClockFailure = exports.EClockSeen = exports.ENoSession = exports.ERetry = exports.EFull = exports.EFail = exports.ESuccess = void 0;
|
|
5798
|
+
exports.SessionFilterFunction = exports.accessMapFindUser = exports.accessFindUser = exports.ServerStateMaintenance = exports.ServerStateRunning = exports.PermAll = exports.PermEdit = exports.PermVersion = exports.PermAdmin = exports.PermOwner = exports.PermWrite = exports.PermRead = exports.PermNone = exports.FilterCount = exports.FilterMyGroups = exports.FilterCOI = exports.FilterOfficial = exports.FilterPublic = exports.FilterTrash = exports.FilterRecent = exports.FilterMyPublic = exports.FilterSharedWithMe = exports.FilterMyMaps = exports.EClockAnomaly = exports.EMaintenance = exports.ENoAccess = exports.ENoPerm = exports.ELoadFailed = exports.EBadRequest = exports.ENoUser = exports.EClockReset = exports.EClockFailure = exports.EClockSeen = exports.ENoSession = exports.ERetry = exports.EFull = exports.EFail = exports.ESuccess = void 0;
|
|
5799
5799
|
// Errors
|
|
5800
5800
|
exports.ESuccess = 0; // Generic success
|
|
5801
5801
|
exports.EFail = 1; // Generic failure
|
|
@@ -5829,6 +5829,7 @@ exports.PermRead = 1; // Can view
|
|
|
5829
5829
|
exports.PermWrite = 2; // Can modify
|
|
5830
5830
|
exports.PermOwner = 4; // Can change deleted, published, access permissions
|
|
5831
5831
|
exports.PermAdmin = 8; // Can administer site
|
|
5832
|
+
exports.PermVersion = 16; // Can view a specific version
|
|
5832
5833
|
exports.PermEdit = (exports.PermWrite | exports.PermOwner);
|
|
5833
5834
|
exports.PermAll = (exports.PermRead | exports.PermWrite | exports.PermOwner | exports.PermAdmin);
|
|
5834
5835
|
// Server State
|
|
@@ -7297,18 +7298,13 @@ function polyContainsPoint(poly, x, y) {
|
|
|
7297
7298
|
let pp = PP.polyPack(poly);
|
|
7298
7299
|
if (pp == null)
|
|
7299
7300
|
return false;
|
|
7300
|
-
let bFound = false;
|
|
7301
7301
|
let bInside = false;
|
|
7302
7302
|
let iCurPoly = -1;
|
|
7303
7303
|
let bCurInside = false;
|
|
7304
7304
|
PP.polyPackEachRing(pp, (b, iPoly, iRing, iOffset, nPoints) => {
|
|
7305
|
-
if (bFound)
|
|
7306
|
-
return;
|
|
7307
7305
|
if (iRing == 0) {
|
|
7308
|
-
if (iCurPoly >= 0 && bCurInside)
|
|
7306
|
+
if (iCurPoly >= 0 && bCurInside)
|
|
7309
7307
|
bInside = true;
|
|
7310
|
-
bFound = true;
|
|
7311
|
-
}
|
|
7312
7308
|
iCurPoly = iPoly;
|
|
7313
7309
|
bCurInside = false;
|
|
7314
7310
|
}
|
|
@@ -8903,6 +8899,23 @@ function featurePack(f, prepack) {
|
|
|
8903
8899
|
return f.geometry.packed;
|
|
8904
8900
|
}
|
|
8905
8901
|
else if (f && f.type === 'FeatureCollection' && f.features) {
|
|
8902
|
+
// Empty?
|
|
8903
|
+
if (f.features.length == 0)
|
|
8904
|
+
return f;
|
|
8905
|
+
// Already packed or packed incorrectly?
|
|
8906
|
+
let ff = f.features[0];
|
|
8907
|
+
if (ff && ff.geometry && ff.geometry.packed) {
|
|
8908
|
+
// Already packed
|
|
8909
|
+
if (ArrayBuffer.isView(ff.geometry.packed.buffer))
|
|
8910
|
+
return f;
|
|
8911
|
+
// Improperly packed (buffer converted to object - convert back to buffer
|
|
8912
|
+
let o = ff.geometry.packed.buffer;
|
|
8913
|
+
let b = new Float64Array(Util.countKeys(o));
|
|
8914
|
+
for (const i in o)
|
|
8915
|
+
b[Number(i)] = o[i];
|
|
8916
|
+
f.features.forEach((ff) => ff.geometry.packed.buffer = b);
|
|
8917
|
+
return f;
|
|
8918
|
+
}
|
|
8906
8919
|
// Allocate one large buffer
|
|
8907
8920
|
let nFloats = 0;
|
|
8908
8921
|
let i;
|
|
@@ -10359,17 +10372,13 @@ function polyIntersectArea(p1, p2) {
|
|
|
10359
10372
|
let pp2 = Poly.polyNormalize(p2);
|
|
10360
10373
|
let area = 0;
|
|
10361
10374
|
PP.polyPackEachRing(pp1, (buffer1, iPoly1, iRing1, iOffset1, nPoints1) => {
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
area += Poly.polyArea(result);
|
|
10370
|
-
}
|
|
10371
|
-
});
|
|
10372
|
-
}
|
|
10375
|
+
let c1 = unpackCoords(buffer1, iOffset1, nPoints1);
|
|
10376
|
+
PP.polyPackEachRing(pp2, (buffer2, iPoly2, iRing2, iOffset2, nPoints2) => {
|
|
10377
|
+
let c2 = unpackCoords(buffer2, iOffset2, nPoints2);
|
|
10378
|
+
let result = _intersection(c1, c2);
|
|
10379
|
+
if (result && result.length > 0)
|
|
10380
|
+
area += Poly.polyArea(result) * ((!iRing1 == !iRing2) ? 1 : -1);
|
|
10381
|
+
});
|
|
10373
10382
|
});
|
|
10374
10383
|
return area;
|
|
10375
10384
|
}
|