magicrealmsshared 0.3.19 → 0.3.21
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/communication/ws.d.ts +2 -0
- package/dist/communication/ws.js +2 -1
- package/dist/geo/chunks.d.ts +11 -0
- package/dist/geo/chunks.js +33 -0
- package/package.json +5 -1
package/dist/communication/ws.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.POSUPDATE_COMMAND = exports.DATA_UPDATE_COMMAND = exports.LOGIN_RESPONSE_CODE_SERVER_ERROR = exports.LOGIN_RESPONSE_CODE_PASSWORD_INVALID = exports.LOGIN_RESPONSE_CODE_EMAIL_INVALID = exports.LOGIN_RESPONSE_CODE_SUCCESS = exports.LOGIN_RESPONSE_COMMAND = exports.LOGIN_COMMAND = exports.AUTH_ACK = exports.AUTH = void 0;
|
|
3
|
+
exports.ADMIN_WELL_CREATE_COMMAND = exports.POSUPDATE_COMMAND = exports.DATA_UPDATE_COMMAND = exports.LOGIN_RESPONSE_CODE_SERVER_ERROR = exports.LOGIN_RESPONSE_CODE_PASSWORD_INVALID = exports.LOGIN_RESPONSE_CODE_EMAIL_INVALID = exports.LOGIN_RESPONSE_CODE_SUCCESS = exports.LOGIN_RESPONSE_COMMAND = exports.LOGIN_COMMAND = exports.AUTH_ACK = exports.AUTH = void 0;
|
|
4
4
|
exports.AUTH = "AUTH";
|
|
5
5
|
exports.AUTH_ACK = "AUTH_ACK";
|
|
6
6
|
exports.LOGIN_COMMAND = "LOGIN";
|
|
@@ -11,3 +11,4 @@ exports.LOGIN_RESPONSE_CODE_PASSWORD_INVALID = 20;
|
|
|
11
11
|
exports.LOGIN_RESPONSE_CODE_SERVER_ERROR = 1000;
|
|
12
12
|
exports.DATA_UPDATE_COMMAND = "DATA_UPDATE";
|
|
13
13
|
exports.POSUPDATE_COMMAND = "POSUPDATE";
|
|
14
|
+
exports.ADMIN_WELL_CREATE_COMMAND = "ADMIN_WELL_CREATE";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @export
|
|
3
|
+
* @typedef {ChunkCoordinates}
|
|
4
|
+
* @description [Longitude, Latidude]
|
|
5
|
+
*/
|
|
6
|
+
export type ChunkCoordinates = [number, number];
|
|
7
|
+
export declare const ChunkSizeLong = 0.025;
|
|
8
|
+
export declare const ChunkSizeLat = 0.025;
|
|
9
|
+
export declare function ChunkCoordinatesAreEqual(...chunkCoordinates: ChunkCoordinates[]): boolean;
|
|
10
|
+
export declare function ChunkCoordinatesOfGEOJSONPoint(point: GeoJSON.Point): ChunkCoordinates;
|
|
11
|
+
export declare function GEOJSONPointIsInChunks(point: GeoJSON.Point, ...chunkCoordinates: ChunkCoordinates[]): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChunkSizeLat = exports.ChunkSizeLong = void 0;
|
|
4
|
+
exports.ChunkCoordinatesAreEqual = ChunkCoordinatesAreEqual;
|
|
5
|
+
exports.ChunkCoordinatesOfGEOJSONPoint = ChunkCoordinatesOfGEOJSONPoint;
|
|
6
|
+
exports.GEOJSONPointIsInChunks = GEOJSONPointIsInChunks;
|
|
7
|
+
exports.ChunkSizeLong = 0.025;
|
|
8
|
+
exports.ChunkSizeLat = 0.025;
|
|
9
|
+
function ChunkCoordinatesAreEqual(...chunkCoordinates) {
|
|
10
|
+
if (chunkCoordinates.length < 1)
|
|
11
|
+
return false;
|
|
12
|
+
for (const cc of chunkCoordinates) {
|
|
13
|
+
if (cc.length != 2)
|
|
14
|
+
return false;
|
|
15
|
+
if (cc[0] != chunkCoordinates[0][0] || cc[1] != chunkCoordinates[0][1])
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
function ChunkCoordinatesOfGEOJSONPoint(point) {
|
|
21
|
+
return [
|
|
22
|
+
Math.floor(point.coordinates[0] / exports.ChunkSizeLong),
|
|
23
|
+
Math.floor(point.coordinates[1] / exports.ChunkSizeLat),
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
function GEOJSONPointIsInChunks(point, ...chunkCoordinates) {
|
|
27
|
+
const chunkCoordinatesOfPoint = ChunkCoordinatesOfGEOJSONPoint(point);
|
|
28
|
+
for (const cc of chunkCoordinates) {
|
|
29
|
+
if (ChunkCoordinatesAreEqual(cc, chunkCoordinatesOfPoint))
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magicrealmsshared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"types": "./dist/communication/ws.d.ts",
|
|
25
25
|
"default": "./dist/communication/ws.js"
|
|
26
26
|
},
|
|
27
|
+
"./geo/chunks": {
|
|
28
|
+
"types": "./dist/geo/chunks.d.ts",
|
|
29
|
+
"default": "./dist/geo/chunks.js"
|
|
30
|
+
},
|
|
27
31
|
"./types": {
|
|
28
32
|
"types": "./dist/types/types.d.ts",
|
|
29
33
|
"default": "./dist/types/types.js"
|