bruce-models 0.7.8 → 0.8.0
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/bruce-models.es5.js +167 -8
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +165 -7
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +244 -244
- package/dist/lib/ann-document/ann-document.js +116 -116
- package/dist/lib/api/abstract-api.js +269 -269
- package/dist/lib/api/api.js +85 -85
- package/dist/lib/api/bruce-api.js +243 -228
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/api/cam-api.js +132 -132
- package/dist/lib/api/global-api.js +131 -131
- package/dist/lib/api/idm-api.js +132 -132
- package/dist/lib/bruce-models.js +85 -84
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/calculator/calculator.js +159 -158
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/client-file/client-file.js +188 -188
- package/dist/lib/common/bounds.js +2 -2
- package/dist/lib/common/bruce-event.js +48 -48
- package/dist/lib/common/bruce-variable.js +54 -54
- package/dist/lib/common/cache.js +86 -86
- package/dist/lib/common/camera.js +11 -11
- package/dist/lib/common/cartes.js +55 -55
- package/dist/lib/common/carto.js +60 -60
- package/dist/lib/common/color.js +86 -86
- package/dist/lib/common/delay-queue.js +60 -60
- package/dist/lib/common/dictionary.js +2 -2
- package/dist/lib/common/geometry.js +120 -120
- package/dist/lib/common/transform.js +2 -2
- package/dist/lib/common/utc.js +39 -39
- package/dist/lib/custom-form/custom-form.js +136 -136
- package/dist/lib/data-lab/data-lab.js +90 -90
- package/dist/lib/entity/entity-attachment-type.js +132 -132
- package/dist/lib/entity/entity-attachment.js +208 -208
- package/dist/lib/entity/entity-comment.js +132 -132
- package/dist/lib/entity/entity-coords.js +181 -181
- package/dist/lib/entity/entity-link.js +132 -132
- package/dist/lib/entity/entity-lod.js +189 -189
- package/dist/lib/entity/entity-relation-type.js +150 -150
- package/dist/lib/entity/entity-relation.js +189 -189
- package/dist/lib/entity/entity-source.js +176 -176
- package/dist/lib/entity/entity-tag.js +229 -229
- package/dist/lib/entity/entity-type.js +163 -163
- package/dist/lib/entity/entity.js +358 -358
- package/dist/lib/entity/getters/batched-data-getter.js +91 -91
- package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
- package/dist/lib/entity/getters/entity-globe.js +135 -135
- package/dist/lib/entity/getters/view-monitor.js +2 -2
- package/dist/lib/import/import-cad.js +82 -82
- package/dist/lib/import/import-csv.js +51 -51
- package/dist/lib/import/import-json.js +51 -51
- package/dist/lib/import/import-kml.js +51 -51
- package/dist/lib/import/imported-file.js +121 -121
- package/dist/lib/import/imported-file.js.map +1 -1
- package/dist/lib/markup/markup.js +40 -40
- package/dist/lib/program-key/program-key.js +152 -152
- package/dist/lib/project/menu-item.js +115 -115
- package/dist/lib/project/project-view-bookmark.js +183 -183
- package/dist/lib/project/project-view-legacy-tile.js +115 -115
- package/dist/lib/project/project-view-tile.js +119 -119
- package/dist/lib/project/project-view-tile.js.map +1 -1
- package/dist/lib/project/project-view.js +177 -177
- package/dist/lib/project/zoom-control.js +17 -17
- package/dist/lib/server/message-broker.js +159 -0
- package/dist/lib/server/message-broker.js.map +1 -0
- package/dist/lib/server/pending-action.js +106 -106
- package/dist/lib/server/task.js +113 -113
- package/dist/lib/style/style.js +152 -152
- package/dist/lib/tileset/tileset-cad.js +2 -2
- package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
- package/dist/lib/tileset/tileset-entities.js +2 -2
- package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
- package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
- package/dist/lib/tileset/tileset-map-tiles.js +2 -2
- package/dist/lib/tileset/tileset-pointcloud.js +2 -2
- package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
- package/dist/lib/tileset/tileset.js +403 -403
- package/dist/lib/user/permission.js +20 -20
- package/dist/lib/user/session.js +160 -160
- package/dist/lib/user/user-group.js +139 -139
- package/dist/lib/user/user.js +451 -451
- package/dist/lib/util/encrypt-utils.js +20 -20
- package/dist/lib/util/math-utils.js +41 -41
- package/dist/lib/util/object-utils.js +17 -17
- package/dist/lib/util/path-utils.js +61 -61
- package/dist/lib/util/url-utils.js +107 -107
- package/dist/types/api/bruce-api.d.ts +9 -1
- package/dist/types/bruce-models.d.ts +1 -0
- package/dist/types/project/project-view-tile.d.ts +2 -6
- package/dist/types/server/message-broker.d.ts +108 -0
- package/package.json +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EncryptUtils = void 0;
|
|
4
|
-
var EncryptUtils;
|
|
5
|
-
(function (EncryptUtils) {
|
|
6
|
-
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
7
|
-
function Cyrb53Hash(str, seed) {
|
|
8
|
-
if (seed === void 0) { seed = 0; }
|
|
9
|
-
var h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
10
|
-
for (var i = 0, ch = void 0; i < str.length; i++) {
|
|
11
|
-
ch = str.charCodeAt(i);
|
|
12
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
13
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
14
|
-
}
|
|
15
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
16
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
17
|
-
return (4294967296 * (2097151 & h2) + (h1 >>> 0));
|
|
18
|
-
}
|
|
19
|
-
EncryptUtils.Cyrb53Hash = Cyrb53Hash;
|
|
20
|
-
})(EncryptUtils = exports.EncryptUtils || (exports.EncryptUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EncryptUtils = void 0;
|
|
4
|
+
var EncryptUtils;
|
|
5
|
+
(function (EncryptUtils) {
|
|
6
|
+
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
7
|
+
function Cyrb53Hash(str, seed) {
|
|
8
|
+
if (seed === void 0) { seed = 0; }
|
|
9
|
+
var h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
10
|
+
for (var i = 0, ch = void 0; i < str.length; i++) {
|
|
11
|
+
ch = str.charCodeAt(i);
|
|
12
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
13
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
14
|
+
}
|
|
15
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
16
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
17
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0));
|
|
18
|
+
}
|
|
19
|
+
EncryptUtils.Cyrb53Hash = Cyrb53Hash;
|
|
20
|
+
})(EncryptUtils = exports.EncryptUtils || (exports.EncryptUtils = {}));
|
|
21
21
|
//# sourceMappingURL=encrypt-utils.js.map
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MathUtils = void 0;
|
|
4
|
-
var MathUtils;
|
|
5
|
-
(function (MathUtils) {
|
|
6
|
-
/**
|
|
7
|
-
* Rounds a number to a given number of decimal places.
|
|
8
|
-
* @param num
|
|
9
|
-
* @param decimals
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
function Round(num, decimals) {
|
|
13
|
-
if (decimals === void 0) { decimals = 0; }
|
|
14
|
-
if (decimals <= 0) {
|
|
15
|
-
return Math.round(num);
|
|
16
|
-
}
|
|
17
|
-
var tmp = "1";
|
|
18
|
-
for (var i = 0; i < decimals; i++) {
|
|
19
|
-
tmp += "0";
|
|
20
|
-
}
|
|
21
|
-
var d = parseFloat(tmp);
|
|
22
|
-
return Math.round((num + Number.EPSILON) * d) / d;
|
|
23
|
-
}
|
|
24
|
-
MathUtils.Round = Round;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
27
|
-
* @param min
|
|
28
|
-
* @param max
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
function RandInt(min, max) {
|
|
32
|
-
if (min == max) {
|
|
33
|
-
return min;
|
|
34
|
-
}
|
|
35
|
-
else if (min > max) {
|
|
36
|
-
throw ("Min is greater than max.");
|
|
37
|
-
}
|
|
38
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
39
|
-
}
|
|
40
|
-
MathUtils.RandInt = RandInt;
|
|
41
|
-
})(MathUtils = exports.MathUtils || (exports.MathUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MathUtils = void 0;
|
|
4
|
+
var MathUtils;
|
|
5
|
+
(function (MathUtils) {
|
|
6
|
+
/**
|
|
7
|
+
* Rounds a number to a given number of decimal places.
|
|
8
|
+
* @param num
|
|
9
|
+
* @param decimals
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
function Round(num, decimals) {
|
|
13
|
+
if (decimals === void 0) { decimals = 0; }
|
|
14
|
+
if (decimals <= 0) {
|
|
15
|
+
return Math.round(num);
|
|
16
|
+
}
|
|
17
|
+
var tmp = "1";
|
|
18
|
+
for (var i = 0; i < decimals; i++) {
|
|
19
|
+
tmp += "0";
|
|
20
|
+
}
|
|
21
|
+
var d = parseFloat(tmp);
|
|
22
|
+
return Math.round((num + Number.EPSILON) * d) / d;
|
|
23
|
+
}
|
|
24
|
+
MathUtils.Round = Round;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
27
|
+
* @param min
|
|
28
|
+
* @param max
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
function RandInt(min, max) {
|
|
32
|
+
if (min == max) {
|
|
33
|
+
return min;
|
|
34
|
+
}
|
|
35
|
+
else if (min > max) {
|
|
36
|
+
throw ("Min is greater than max.");
|
|
37
|
+
}
|
|
38
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
39
|
+
}
|
|
40
|
+
MathUtils.RandInt = RandInt;
|
|
41
|
+
})(MathUtils = exports.MathUtils || (exports.MathUtils = {}));
|
|
42
42
|
//# sourceMappingURL=math-utils.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectUtils = void 0;
|
|
4
|
-
var ObjectUtils;
|
|
5
|
-
(function (ObjectUtils) {
|
|
6
|
-
/**
|
|
7
|
-
* Generates a Bruce compatible UID.
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
function UId() {
|
|
11
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
12
|
-
var r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
|
|
13
|
-
return v.toString(16);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
ObjectUtils.UId = UId;
|
|
17
|
-
})(ObjectUtils = exports.ObjectUtils || (exports.ObjectUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectUtils = void 0;
|
|
4
|
+
var ObjectUtils;
|
|
5
|
+
(function (ObjectUtils) {
|
|
6
|
+
/**
|
|
7
|
+
* Generates a Bruce compatible UID.
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
function UId() {
|
|
11
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
12
|
+
var r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
|
|
13
|
+
return v.toString(16);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
ObjectUtils.UId = UId;
|
|
17
|
+
})(ObjectUtils = exports.ObjectUtils || (exports.ObjectUtils = {}));
|
|
18
18
|
//# sourceMappingURL=object-utils.js.map
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PathUtils = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Utility to help with parsing and wrapping Bruce paths.
|
|
6
|
-
*/
|
|
7
|
-
var PathUtils;
|
|
8
|
-
(function (PathUtils) {
|
|
9
|
-
function Parse(str) {
|
|
10
|
-
if (!str) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
var broken = str.split("\"/\"");
|
|
14
|
-
if (broken.length > 0) {
|
|
15
|
-
var top_1 = broken[0];
|
|
16
|
-
if (top_1.length > 0) {
|
|
17
|
-
if (top_1.charAt(0) == "\"") {
|
|
18
|
-
top_1 = top_1.substring(1);
|
|
19
|
-
}
|
|
20
|
-
broken[0] = top_1;
|
|
21
|
-
}
|
|
22
|
-
var endIndex = broken.length - 1;
|
|
23
|
-
var bot = broken[endIndex];
|
|
24
|
-
if (bot.length > 0) {
|
|
25
|
-
if (bot.charAt(bot.length - 1) == "\"") {
|
|
26
|
-
bot = bot.substring(0, bot.length - 1);
|
|
27
|
-
}
|
|
28
|
-
broken[endIndex] = bot;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return broken;
|
|
32
|
-
}
|
|
33
|
-
PathUtils.Parse = Parse;
|
|
34
|
-
function Wrap(path) {
|
|
35
|
-
var tmp = "\"";
|
|
36
|
-
for (var i = 0; i < path.length; i++) {
|
|
37
|
-
var section = path[i];
|
|
38
|
-
tmp += section;
|
|
39
|
-
if (i < path.length - 1) {
|
|
40
|
-
tmp += "\"/\"";
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
tmp += "\"";
|
|
44
|
-
return tmp;
|
|
45
|
-
}
|
|
46
|
-
PathUtils.Wrap = Wrap;
|
|
47
|
-
function ParseLegacy(str) {
|
|
48
|
-
var broken = str.split(".");
|
|
49
|
-
for (var i = 0; i < broken.length; i++) {
|
|
50
|
-
var piece = broken[0];
|
|
51
|
-
if (piece.charAt(0) == "\"") {
|
|
52
|
-
piece = broken[0] = piece.substring(1);
|
|
53
|
-
}
|
|
54
|
-
if (piece.charAt(piece.length - 1) == "\"") {
|
|
55
|
-
broken[0] = piece.substring(0, piece.length - 1);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return broken;
|
|
59
|
-
}
|
|
60
|
-
PathUtils.ParseLegacy = ParseLegacy;
|
|
61
|
-
})(PathUtils = exports.PathUtils || (exports.PathUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PathUtils = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility to help with parsing and wrapping Bruce paths.
|
|
6
|
+
*/
|
|
7
|
+
var PathUtils;
|
|
8
|
+
(function (PathUtils) {
|
|
9
|
+
function Parse(str) {
|
|
10
|
+
if (!str) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
var broken = str.split("\"/\"");
|
|
14
|
+
if (broken.length > 0) {
|
|
15
|
+
var top_1 = broken[0];
|
|
16
|
+
if (top_1.length > 0) {
|
|
17
|
+
if (top_1.charAt(0) == "\"") {
|
|
18
|
+
top_1 = top_1.substring(1);
|
|
19
|
+
}
|
|
20
|
+
broken[0] = top_1;
|
|
21
|
+
}
|
|
22
|
+
var endIndex = broken.length - 1;
|
|
23
|
+
var bot = broken[endIndex];
|
|
24
|
+
if (bot.length > 0) {
|
|
25
|
+
if (bot.charAt(bot.length - 1) == "\"") {
|
|
26
|
+
bot = bot.substring(0, bot.length - 1);
|
|
27
|
+
}
|
|
28
|
+
broken[endIndex] = bot;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return broken;
|
|
32
|
+
}
|
|
33
|
+
PathUtils.Parse = Parse;
|
|
34
|
+
function Wrap(path) {
|
|
35
|
+
var tmp = "\"";
|
|
36
|
+
for (var i = 0; i < path.length; i++) {
|
|
37
|
+
var section = path[i];
|
|
38
|
+
tmp += section;
|
|
39
|
+
if (i < path.length - 1) {
|
|
40
|
+
tmp += "\"/\"";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
tmp += "\"";
|
|
44
|
+
return tmp;
|
|
45
|
+
}
|
|
46
|
+
PathUtils.Wrap = Wrap;
|
|
47
|
+
function ParseLegacy(str) {
|
|
48
|
+
var broken = str.split(".");
|
|
49
|
+
for (var i = 0; i < broken.length; i++) {
|
|
50
|
+
var piece = broken[0];
|
|
51
|
+
if (piece.charAt(0) == "\"") {
|
|
52
|
+
piece = broken[0] = piece.substring(1);
|
|
53
|
+
}
|
|
54
|
+
if (piece.charAt(piece.length - 1) == "\"") {
|
|
55
|
+
broken[0] = piece.substring(0, piece.length - 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return broken;
|
|
59
|
+
}
|
|
60
|
+
PathUtils.ParseLegacy = ParseLegacy;
|
|
61
|
+
})(PathUtils = exports.PathUtils || (exports.PathUtils = {}));
|
|
62
62
|
//# sourceMappingURL=path-utils.js.map
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UrlUtils = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Utility to help with url manipulation.
|
|
6
|
-
*/
|
|
7
|
-
var UrlUtils;
|
|
8
|
-
(function (UrlUtils) {
|
|
9
|
-
function GetQueryString(doc) {
|
|
10
|
-
var qs = {};
|
|
11
|
-
var p0 = doc.location.href.indexOf("?");
|
|
12
|
-
if (p0 >= 0) {
|
|
13
|
-
var str = doc.location.href.substring(p0 + 1);
|
|
14
|
-
var tokens = str.split("&");
|
|
15
|
-
tokens.forEach(function (token) {
|
|
16
|
-
var p = token.split("=");
|
|
17
|
-
if (p.length == 2) {
|
|
18
|
-
qs[p[0]] = p[1];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return qs;
|
|
23
|
-
}
|
|
24
|
-
UrlUtils.GetQueryString = GetQueryString;
|
|
25
|
-
/**
|
|
26
|
-
* Helper to get and set url params for a given window.
|
|
27
|
-
*/
|
|
28
|
-
var Handler = /** @class */ (function () {
|
|
29
|
-
function Handler(window, allowedKeys) {
|
|
30
|
-
this._allowedKeys = null;
|
|
31
|
-
this._window = window;
|
|
32
|
-
this._allowedKeys = allowedKeys;
|
|
33
|
-
}
|
|
34
|
-
Object.defineProperty(Handler.prototype, "window", {
|
|
35
|
-
get: function () {
|
|
36
|
-
return this._window;
|
|
37
|
-
},
|
|
38
|
-
enumerable: false,
|
|
39
|
-
configurable: true
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(Handler.prototype, "document", {
|
|
42
|
-
get: function () {
|
|
43
|
-
var _a;
|
|
44
|
-
return (_a = this.window) === null || _a === void 0 ? void 0 : _a.document;
|
|
45
|
-
},
|
|
46
|
-
enumerable: false,
|
|
47
|
-
configurable: true
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(Handler.prototype, "allowedKeys", {
|
|
50
|
-
get: function () {
|
|
51
|
-
return this._allowedKeys;
|
|
52
|
-
},
|
|
53
|
-
enumerable: false,
|
|
54
|
-
configurable: true
|
|
55
|
-
});
|
|
56
|
-
Handler.prototype.UpdateAllowedKeys = function (allowedKeys) {
|
|
57
|
-
this._allowedKeys = allowedKeys;
|
|
58
|
-
var params = this.GetParams();
|
|
59
|
-
this.refresh(params);
|
|
60
|
-
};
|
|
61
|
-
Handler.prototype.UpdateParam = function (key, value) {
|
|
62
|
-
var params = this.GetParams();
|
|
63
|
-
params[key + ""] = value + "";
|
|
64
|
-
this.refresh(params);
|
|
65
|
-
};
|
|
66
|
-
Handler.prototype.RemoveParam = function (key) {
|
|
67
|
-
var params = this.GetParams();
|
|
68
|
-
params[key + ""] = null;
|
|
69
|
-
this.refresh(params);
|
|
70
|
-
};
|
|
71
|
-
Handler.prototype.GetParamKeys = function () {
|
|
72
|
-
var params = GetQueryString(this.document);
|
|
73
|
-
return Object.keys(params);
|
|
74
|
-
};
|
|
75
|
-
Handler.prototype.GetParams = function () {
|
|
76
|
-
return GetQueryString(this.document);
|
|
77
|
-
};
|
|
78
|
-
Handler.prototype.GetParam = function (key) {
|
|
79
|
-
var params = this.GetParams();
|
|
80
|
-
return params[key + ""];
|
|
81
|
-
};
|
|
82
|
-
Handler.prototype.Clear = function () {
|
|
83
|
-
this.refresh({});
|
|
84
|
-
};
|
|
85
|
-
Handler.prototype.refresh = function (data) {
|
|
86
|
-
var params = [];
|
|
87
|
-
var keys = Object.keys(data);
|
|
88
|
-
for (var i = 0; i < keys.length; i++) {
|
|
89
|
-
var key = keys[i];
|
|
90
|
-
if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
|
|
91
|
-
var val = data[key];
|
|
92
|
-
if (!!val || val == 0) {
|
|
93
|
-
params.push(key + "=" + val);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (params.length > 0) {
|
|
98
|
-
this.window.history.replaceState({}, null, "?" + params.join("&"));
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
this.window.history.replaceState({}, null, "");
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
return Handler;
|
|
105
|
-
}());
|
|
106
|
-
UrlUtils.Handler = Handler;
|
|
107
|
-
})(UrlUtils = exports.UrlUtils || (exports.UrlUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UrlUtils = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility to help with url manipulation.
|
|
6
|
+
*/
|
|
7
|
+
var UrlUtils;
|
|
8
|
+
(function (UrlUtils) {
|
|
9
|
+
function GetQueryString(doc) {
|
|
10
|
+
var qs = {};
|
|
11
|
+
var p0 = doc.location.href.indexOf("?");
|
|
12
|
+
if (p0 >= 0) {
|
|
13
|
+
var str = doc.location.href.substring(p0 + 1);
|
|
14
|
+
var tokens = str.split("&");
|
|
15
|
+
tokens.forEach(function (token) {
|
|
16
|
+
var p = token.split("=");
|
|
17
|
+
if (p.length == 2) {
|
|
18
|
+
qs[p[0]] = p[1];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return qs;
|
|
23
|
+
}
|
|
24
|
+
UrlUtils.GetQueryString = GetQueryString;
|
|
25
|
+
/**
|
|
26
|
+
* Helper to get and set url params for a given window.
|
|
27
|
+
*/
|
|
28
|
+
var Handler = /** @class */ (function () {
|
|
29
|
+
function Handler(window, allowedKeys) {
|
|
30
|
+
this._allowedKeys = null;
|
|
31
|
+
this._window = window;
|
|
32
|
+
this._allowedKeys = allowedKeys;
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(Handler.prototype, "window", {
|
|
35
|
+
get: function () {
|
|
36
|
+
return this._window;
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(Handler.prototype, "document", {
|
|
42
|
+
get: function () {
|
|
43
|
+
var _a;
|
|
44
|
+
return (_a = this.window) === null || _a === void 0 ? void 0 : _a.document;
|
|
45
|
+
},
|
|
46
|
+
enumerable: false,
|
|
47
|
+
configurable: true
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(Handler.prototype, "allowedKeys", {
|
|
50
|
+
get: function () {
|
|
51
|
+
return this._allowedKeys;
|
|
52
|
+
},
|
|
53
|
+
enumerable: false,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
Handler.prototype.UpdateAllowedKeys = function (allowedKeys) {
|
|
57
|
+
this._allowedKeys = allowedKeys;
|
|
58
|
+
var params = this.GetParams();
|
|
59
|
+
this.refresh(params);
|
|
60
|
+
};
|
|
61
|
+
Handler.prototype.UpdateParam = function (key, value) {
|
|
62
|
+
var params = this.GetParams();
|
|
63
|
+
params[key + ""] = value + "";
|
|
64
|
+
this.refresh(params);
|
|
65
|
+
};
|
|
66
|
+
Handler.prototype.RemoveParam = function (key) {
|
|
67
|
+
var params = this.GetParams();
|
|
68
|
+
params[key + ""] = null;
|
|
69
|
+
this.refresh(params);
|
|
70
|
+
};
|
|
71
|
+
Handler.prototype.GetParamKeys = function () {
|
|
72
|
+
var params = GetQueryString(this.document);
|
|
73
|
+
return Object.keys(params);
|
|
74
|
+
};
|
|
75
|
+
Handler.prototype.GetParams = function () {
|
|
76
|
+
return GetQueryString(this.document);
|
|
77
|
+
};
|
|
78
|
+
Handler.prototype.GetParam = function (key) {
|
|
79
|
+
var params = this.GetParams();
|
|
80
|
+
return params[key + ""];
|
|
81
|
+
};
|
|
82
|
+
Handler.prototype.Clear = function () {
|
|
83
|
+
this.refresh({});
|
|
84
|
+
};
|
|
85
|
+
Handler.prototype.refresh = function (data) {
|
|
86
|
+
var params = [];
|
|
87
|
+
var keys = Object.keys(data);
|
|
88
|
+
for (var i = 0; i < keys.length; i++) {
|
|
89
|
+
var key = keys[i];
|
|
90
|
+
if (this._allowedKeys == null || this._allowedKeys.includes(key)) {
|
|
91
|
+
var val = data[key];
|
|
92
|
+
if (!!val || val == 0) {
|
|
93
|
+
params.push(key + "=" + val);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (params.length > 0) {
|
|
98
|
+
this.window.history.replaceState({}, null, "?" + params.join("&"));
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.window.history.replaceState({}, null, "");
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
return Handler;
|
|
105
|
+
}());
|
|
106
|
+
UrlUtils.Handler = Handler;
|
|
107
|
+
})(UrlUtils = exports.UrlUtils || (exports.UrlUtils = {}));
|
|
108
108
|
//# sourceMappingURL=url-utils.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AbstractApi } from "./abstract-api";
|
|
2
2
|
import { Api as A } from "./api";
|
|
3
3
|
import { CamApi } from "./cam-api";
|
|
4
|
+
import { MessageBroker } from "../server/message-broker";
|
|
4
5
|
export declare namespace BruceApi {
|
|
5
6
|
interface IGetter {
|
|
6
7
|
env: A.EEnv;
|
|
@@ -17,6 +18,8 @@ export declare namespace BruceApi {
|
|
|
17
18
|
private env;
|
|
18
19
|
private loadProm;
|
|
19
20
|
private loadCancelled;
|
|
21
|
+
private messageBroker;
|
|
22
|
+
get MessageBroker(): MessageBroker.IBroker;
|
|
20
23
|
get Loading(): Promise<void>;
|
|
21
24
|
/**
|
|
22
25
|
* @param accountId
|
|
@@ -24,7 +27,12 @@ export declare namespace BruceApi {
|
|
|
24
27
|
* @param cam (Optional) cam instance to use for loading the regional base url.
|
|
25
28
|
*/
|
|
26
29
|
constructor(accountId: string, env?: A.Env, cam?: CamApi.Api);
|
|
27
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Loads regional base url and sets up message broker.
|
|
32
|
+
* @param cam
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
private init;
|
|
28
36
|
/**
|
|
29
37
|
* Warning: This method does not wait for init to finish loading.
|
|
30
38
|
* This means the url could be changed once fully initialized.
|
|
@@ -44,6 +44,7 @@ export * from "./project/project-view";
|
|
|
44
44
|
export * from "./project/project-view-legacy-tile";
|
|
45
45
|
export * from "./project/project-view-tile";
|
|
46
46
|
export * from "./server/pending-action";
|
|
47
|
+
export * from "./server/message-broker";
|
|
47
48
|
export * from "./style/style";
|
|
48
49
|
export * from "./tileset/tileset-cad";
|
|
49
50
|
export * from "./tileset/tileset-entities-map-tiles";
|
|
@@ -11,9 +11,7 @@ export declare namespace ProjectViewTile {
|
|
|
11
11
|
interface IViewImagery extends ITileMeta {
|
|
12
12
|
tilesetId: MapTileId;
|
|
13
13
|
}
|
|
14
|
-
interface IBookmarkImagery {
|
|
15
|
-
tilesetId: MapTileId;
|
|
16
|
-
accountId: string;
|
|
14
|
+
interface IBookmarkImagery extends IViewImagery {
|
|
17
15
|
alpha?: number;
|
|
18
16
|
brightness?: number;
|
|
19
17
|
saturation?: number;
|
|
@@ -21,9 +19,7 @@ export declare namespace ProjectViewTile {
|
|
|
21
19
|
gamma?: number;
|
|
22
20
|
hue?: number;
|
|
23
21
|
}
|
|
24
|
-
interface IBookmarkTerrain {
|
|
25
|
-
tilesetId: TerrainTileId;
|
|
26
|
-
accountId: string;
|
|
22
|
+
interface IBookmarkTerrain extends IViewTerrain {
|
|
27
23
|
}
|
|
28
24
|
enum EDefaultImagery {
|
|
29
25
|
BingMapsAerial = "bingmapsaerial",
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Api } from "../api/api";
|
|
2
|
+
export declare namespace MessageBroker {
|
|
3
|
+
export enum Action {
|
|
4
|
+
SUBSCRIBE = "subscribe",
|
|
5
|
+
SUBSCRIBE_SHADOW = "subscribeShadow",
|
|
6
|
+
UNSUBSCRIBE = "unsubscribe",
|
|
7
|
+
BROADCAST = "broadcast",
|
|
8
|
+
GET_TOPIC_SUBSCRIBERS = "getTopicSubscribers"
|
|
9
|
+
}
|
|
10
|
+
/** Events types any component may get from server */
|
|
11
|
+
export enum Event {
|
|
12
|
+
SAVED = "saved",
|
|
13
|
+
UPDATED = "updated",
|
|
14
|
+
DELETED = "deleted",
|
|
15
|
+
EDIT_STARTED = "editStarted",
|
|
16
|
+
EDIT_FINISHED = "editFinished",
|
|
17
|
+
USERS_UPDATE = "usersUpdate"
|
|
18
|
+
}
|
|
19
|
+
interface IMessageBase {
|
|
20
|
+
action: Action;
|
|
21
|
+
topic: string;
|
|
22
|
+
}
|
|
23
|
+
interface IBroadcastMessage extends IMessageBase {
|
|
24
|
+
action: Action.BROADCAST;
|
|
25
|
+
event: Event;
|
|
26
|
+
user: string;
|
|
27
|
+
}
|
|
28
|
+
export type SubscribeMessage = IMessageBase & {
|
|
29
|
+
action: Action.SUBSCRIBE | Action.SUBSCRIBE_SHADOW;
|
|
30
|
+
user: string;
|
|
31
|
+
};
|
|
32
|
+
export type UnsubscribeMessage = IMessageBase & {
|
|
33
|
+
action: Action.UNSUBSCRIBE;
|
|
34
|
+
};
|
|
35
|
+
export type GetTopicSubscribersMessage = IMessageBase & {
|
|
36
|
+
action: Action.GET_TOPIC_SUBSCRIBERS;
|
|
37
|
+
};
|
|
38
|
+
export type BroadcastMessageSaved = IBroadcastMessage & {
|
|
39
|
+
event: Event.SAVED;
|
|
40
|
+
};
|
|
41
|
+
export type BroadcastMessageUpdated = IBroadcastMessage & {
|
|
42
|
+
event: Event.UPDATED;
|
|
43
|
+
};
|
|
44
|
+
export type BroadcastMessageDeleted = IBroadcastMessage & {
|
|
45
|
+
event: Event.DELETED;
|
|
46
|
+
};
|
|
47
|
+
export type BroadcastMessageEditionStarted = IBroadcastMessage & {
|
|
48
|
+
event: Event.EDIT_STARTED;
|
|
49
|
+
};
|
|
50
|
+
export type BroadcastMessageEditionFinished = IBroadcastMessage & {
|
|
51
|
+
event: Event.EDIT_FINISHED;
|
|
52
|
+
};
|
|
53
|
+
export type BroadcastMessageUsersUpdate = IBroadcastMessage & {
|
|
54
|
+
event: Event.USERS_UPDATE;
|
|
55
|
+
data: string[];
|
|
56
|
+
};
|
|
57
|
+
export interface OutgoingMessageBase {
|
|
58
|
+
topic: string;
|
|
59
|
+
event?: Event;
|
|
60
|
+
}
|
|
61
|
+
export type OutgoingBroadcastMessage = IMessageBase & {
|
|
62
|
+
action: Action.BROADCAST;
|
|
63
|
+
time: number;
|
|
64
|
+
};
|
|
65
|
+
export type IncomingMessage = BroadcastMessageSaved | BroadcastMessageUpdated | BroadcastMessageDeleted | BroadcastMessageEditionStarted | BroadcastMessageEditionFinished | BroadcastMessageUsersUpdate;
|
|
66
|
+
export type OutgoingMessage = (SubscribeMessage | UnsubscribeMessage | GetTopicSubscribersMessage | OutgoingBroadcastMessage) & {
|
|
67
|
+
user: string;
|
|
68
|
+
time: number;
|
|
69
|
+
};
|
|
70
|
+
export interface IBroker {
|
|
71
|
+
subscribe: (topic: string, callback: (msg: IncomingMessage) => void) => void;
|
|
72
|
+
subscribeShadow: (topic: string, callback: (msg: IncomingMessage) => void) => void;
|
|
73
|
+
unsubscribe: (topic: string, callback: (msg: IncomingMessage) => void) => void;
|
|
74
|
+
sendBroadcastMessage: (msg: OutgoingMessageBase) => void;
|
|
75
|
+
connected: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** Communicates with a server message broker */
|
|
78
|
+
export class WebSocketBroker implements IBroker {
|
|
79
|
+
private uri;
|
|
80
|
+
private env;
|
|
81
|
+
private subscriptions;
|
|
82
|
+
private ws;
|
|
83
|
+
private reconnects;
|
|
84
|
+
private maxReconnects;
|
|
85
|
+
private user;
|
|
86
|
+
constructor(uri: string, env: Api.Env);
|
|
87
|
+
private connect;
|
|
88
|
+
private formatApiUri;
|
|
89
|
+
setUser(user: string): void;
|
|
90
|
+
private onOpen;
|
|
91
|
+
private onClose;
|
|
92
|
+
private onMessage;
|
|
93
|
+
private onError;
|
|
94
|
+
private addSubscriber;
|
|
95
|
+
/** Send message to server */
|
|
96
|
+
private sendMessage;
|
|
97
|
+
get connected(): boolean;
|
|
98
|
+
/** Add a subscriber to a topic */
|
|
99
|
+
subscribe(topic: string, callback: (msg: IncomingMessage) => void, action?: Action): void;
|
|
100
|
+
/** Add a shadow subscriber to a topic */
|
|
101
|
+
subscribeShadow(topic: string, callback: (msg: IncomingMessage) => void): void;
|
|
102
|
+
/** Remove a subscriber from a topic */
|
|
103
|
+
unsubscribe(topic: string, callback: (msg: IncomingMessage) => void): void;
|
|
104
|
+
sendBroadcastMessage(msg: OutgoingMessageBase): void;
|
|
105
|
+
requestTopicUsers(topic: string, callback: (msg: IncomingMessage) => void): void;
|
|
106
|
+
}
|
|
107
|
+
export {};
|
|
108
|
+
}
|