@overmap-ai/core 1.0.65-mapbox.0 → 1.0.65
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/constants/offline.d.ts +1 -1
- package/dist/overmap-core.js +70 -7
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +69 -6
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/typings/models/geo.d.ts +3 -3
- package/dist/utils/coordinates.d.ts +18 -4
- package/dist/utils/utils.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OUTBOX_RETRY_DELAY =
|
|
1
|
+
export declare const OUTBOX_RETRY_DELAY = 60000;
|
package/dist/overmap-core.js
CHANGED
|
@@ -409,21 +409,70 @@ const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
|
|
|
409
409
|
const selectAccessToken = (state) => state.authReducer.accessToken;
|
|
410
410
|
const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
|
|
411
411
|
const authReducer = authSlice.reducer;
|
|
412
|
-
const
|
|
412
|
+
const coordinatesToLiteral = (coordinates) => {
|
|
413
|
+
return { lng: coordinates[0], lat: coordinates[1] };
|
|
414
|
+
};
|
|
415
|
+
const literalToCoordinates = (literal) => {
|
|
416
|
+
return [literal.lng, literal.lat];
|
|
417
|
+
};
|
|
418
|
+
const flipCoordinates = (coordinates) => {
|
|
419
|
+
return [coordinates[1], coordinates[0]];
|
|
420
|
+
};
|
|
421
|
+
const flipBounds = (bounds) => {
|
|
422
|
+
return [flipCoordinates(bounds[0]), flipCoordinates(bounds[1])];
|
|
423
|
+
};
|
|
424
|
+
function offsetPositionByMeters(originalPosition, latMeters, lngMeters) {
|
|
425
|
+
const { lat, lng } = originalPosition;
|
|
426
|
+
const earthRadius = 6378137;
|
|
427
|
+
const metersPerDegree = 2 * Math.PI * earthRadius / 360;
|
|
428
|
+
const newLng = lng + lngMeters / metersPerDegree / Math.cos(lat * Math.PI / 180);
|
|
429
|
+
const newLat = lat - latMeters / metersPerDegree;
|
|
430
|
+
return { lat: newLat, lng: newLng };
|
|
431
|
+
}
|
|
432
|
+
const createPointGeometry = (coordinates) => {
|
|
413
433
|
return {
|
|
414
434
|
type: "Point",
|
|
415
|
-
coordinates
|
|
435
|
+
coordinates
|
|
416
436
|
};
|
|
417
437
|
};
|
|
438
|
+
const coordinatesAreEqual = (a, b) => {
|
|
439
|
+
return a[0] === b[0] && a[1] === b[1];
|
|
440
|
+
};
|
|
441
|
+
const coordinatesToText = (coordinates, decimalPlaces) => {
|
|
442
|
+
if (!coordinates)
|
|
443
|
+
return "(No Location)";
|
|
444
|
+
const { lat, lng } = coordinatesToLiteral(coordinates);
|
|
445
|
+
if (decimalPlaces)
|
|
446
|
+
return `${lat.toFixed(decimalPlaces)}, ${lng.toFixed(decimalPlaces)}`;
|
|
447
|
+
return `${lat}, ${lng}`;
|
|
448
|
+
};
|
|
449
|
+
const coordinatesToUrlText = (coordinates) => {
|
|
450
|
+
const { lat, lng } = coordinatesToLiteral(coordinates);
|
|
451
|
+
return `${lat}%2C${lng}`;
|
|
452
|
+
};
|
|
453
|
+
const openCoordsInGoogleMaps = (coordinates) => {
|
|
454
|
+
const url = `https://www.google.com/maps/search/?api=1&query=${coordinatesToUrlText(coordinates)}`;
|
|
455
|
+
window.open(url);
|
|
456
|
+
};
|
|
457
|
+
const openDirectionsInGoogleMaps = (startingPoint, destination) => {
|
|
458
|
+
const startingPointUrl = coordinatesToUrlText(startingPoint);
|
|
459
|
+
const destinationUrl = coordinatesToUrlText(destination);
|
|
460
|
+
const url = `https://www.google.com/maps/dir/?api=1&origin=${startingPointUrl}&destination=${destinationUrl}`;
|
|
461
|
+
window.open(url);
|
|
462
|
+
};
|
|
463
|
+
const worldBounds = {
|
|
464
|
+
type: "MultiPoint",
|
|
465
|
+
coordinates: [
|
|
466
|
+
[90, -180],
|
|
467
|
+
[-90, 180]
|
|
468
|
+
]
|
|
469
|
+
};
|
|
418
470
|
const createMultiPointGeometry = (coordinates) => {
|
|
419
471
|
return {
|
|
420
472
|
type: "MultiPoint",
|
|
421
473
|
coordinates
|
|
422
474
|
};
|
|
423
475
|
};
|
|
424
|
-
const coordinatesAreEqual = (a, b) => {
|
|
425
|
-
return a[0] === b[0] && a[1] === b[1];
|
|
426
|
-
};
|
|
427
476
|
function classNames(...args) {
|
|
428
477
|
const classes = [];
|
|
429
478
|
for (const arg of args) {
|
|
@@ -601,11 +650,14 @@ function onlyUniqueHashes(value, index, self) {
|
|
|
601
650
|
return v.file_sha1 === value.file_sha1;
|
|
602
651
|
}) === index;
|
|
603
652
|
}
|
|
653
|
+
function boundsContainPoint(bounds, coordinates) {
|
|
654
|
+
return bounds[0][0] > coordinates[0] && bounds[1][0] < coordinates[0] && bounds[0][1] > coordinates[1] && bounds[1][1] < coordinates[1];
|
|
655
|
+
}
|
|
604
656
|
const emailRegex = /^.+@.+\..+$/;
|
|
605
657
|
const fullAssetMarkerSize = 45;
|
|
606
658
|
const DEFAULT_ISSUE_STATUS = IssueStatus.BACKLOG;
|
|
607
659
|
const DEFAULT_ISSUE_PRIORITY = IssuePriority.MEDIUM;
|
|
608
|
-
const OUTBOX_RETRY_DELAY =
|
|
660
|
+
const OUTBOX_RETRY_DELAY = 6e4;
|
|
609
661
|
const EMPTY_ARRAY = Object.freeze([]);
|
|
610
662
|
let debug = false;
|
|
611
663
|
const REACT_APP_DEBUG_MEMOIZATION = {}.REACT_APP_DEBUG_MEMOIZATION || "";
|
|
@@ -7637,6 +7689,7 @@ export {
|
|
|
7637
7689
|
authReducer,
|
|
7638
7690
|
authSlice,
|
|
7639
7691
|
blobToBase64,
|
|
7692
|
+
boundsContainPoint,
|
|
7640
7693
|
categoryReducer,
|
|
7641
7694
|
categorySlice,
|
|
7642
7695
|
classNames,
|
|
@@ -7644,6 +7697,9 @@ export {
|
|
|
7644
7697
|
clearTokens,
|
|
7645
7698
|
constructUploadedFilePayloads,
|
|
7646
7699
|
coordinatesAreEqual,
|
|
7700
|
+
coordinatesToLiteral,
|
|
7701
|
+
coordinatesToText,
|
|
7702
|
+
coordinatesToUrlText,
|
|
7647
7703
|
createMultiPointGeometry,
|
|
7648
7704
|
createOfflineAction,
|
|
7649
7705
|
createPointGeometry,
|
|
@@ -7706,6 +7762,8 @@ export {
|
|
|
7706
7762
|
fileReducer,
|
|
7707
7763
|
fileSlice,
|
|
7708
7764
|
fileToBlob,
|
|
7765
|
+
flipBounds,
|
|
7766
|
+
flipCoordinates,
|
|
7709
7767
|
formReducer,
|
|
7710
7768
|
formRevisionAttachmentReducer,
|
|
7711
7769
|
formRevisionAttachmentSlice,
|
|
@@ -7772,14 +7830,18 @@ export {
|
|
|
7772
7830
|
issueUpdateSlice,
|
|
7773
7831
|
licenseReducer,
|
|
7774
7832
|
licenseSlice,
|
|
7833
|
+
literalToCoordinates,
|
|
7775
7834
|
logOnlyOnce,
|
|
7776
7835
|
markAsDeleted,
|
|
7777
7836
|
markForDeletion,
|
|
7778
7837
|
memoize,
|
|
7779
7838
|
moveDocument,
|
|
7780
7839
|
offline,
|
|
7840
|
+
offsetPositionByMeters,
|
|
7781
7841
|
onlyUniqueHashes,
|
|
7782
7842
|
onlyUniqueOfflineIds,
|
|
7843
|
+
openCoordsInGoogleMaps,
|
|
7844
|
+
openDirectionsInGoogleMaps,
|
|
7783
7845
|
organizationAccessReducer,
|
|
7784
7846
|
organizationAccessSlice,
|
|
7785
7847
|
organizationReducer,
|
|
@@ -8094,6 +8156,7 @@ export {
|
|
|
8094
8156
|
versioningSlice,
|
|
8095
8157
|
warningColor,
|
|
8096
8158
|
workspaceReducer,
|
|
8097
|
-
workspaceSlice
|
|
8159
|
+
workspaceSlice,
|
|
8160
|
+
worldBounds
|
|
8098
8161
|
};
|
|
8099
8162
|
//# sourceMappingURL=overmap-core.js.map
|