bruce-models 0.1.6 → 0.1.7
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 +407 -11
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +260 -10
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/ann-document/ann-document.js +4 -0
- package/dist/lib/ann-document/ann-document.js.map +1 -1
- package/dist/lib/api/abstract-api.js +3 -0
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/api/api.js +25 -7
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/api/bruce-api.js +10 -0
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/api/cam-api.js +10 -0
- package/dist/lib/api/cam-api.js.map +1 -1
- package/dist/lib/api/global-api.js +10 -0
- package/dist/lib/api/global-api.js.map +1 -1
- package/dist/lib/api/idm-api.js +10 -0
- package/dist/lib/api/idm-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -0
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/calculator/calculator.js +12 -0
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/common/bruce-event.js +4 -0
- package/dist/lib/common/bruce-event.js.map +1 -1
- package/dist/lib/common/bruce-variable.js +13 -0
- package/dist/lib/common/bruce-variable.js.map +1 -1
- package/dist/lib/common/cache.js +3 -0
- package/dist/lib/common/cache.js.map +1 -1
- package/dist/lib/common/cartes.js +6 -0
- package/dist/lib/common/cartes.js.map +1 -1
- package/dist/lib/common/carto.js +5 -0
- package/dist/lib/common/carto.js.map +1 -1
- package/dist/lib/common/color.js +5 -0
- package/dist/lib/common/color.js.map +1 -1
- package/dist/lib/common/delay-queue.js +4 -0
- package/dist/lib/common/delay-queue.js.map +1 -1
- package/dist/lib/common/geometry.js +21 -0
- package/dist/lib/common/geometry.js.map +1 -1
- package/dist/lib/common/utc.js +3 -0
- package/dist/lib/common/utc.js.map +1 -1
- package/dist/lib/custom-form/custom-form.js +137 -0
- package/dist/lib/custom-form/custom-form.js.map +1 -0
- package/dist/lib/entity/entity-attachment-type.js +4 -3
- package/dist/lib/entity/entity-attachment-type.js.map +1 -1
- package/dist/lib/entity/entity-attachment.js +5 -0
- package/dist/lib/entity/entity-attachment.js.map +1 -1
- package/dist/lib/entity/entity-comment.js +4 -0
- package/dist/lib/entity/entity-comment.js.map +1 -1
- package/dist/lib/entity/entity-link.js +4 -0
- package/dist/lib/entity/entity-link.js.map +1 -1
- package/dist/lib/entity/entity-lod.js +6 -0
- package/dist/lib/entity/entity-lod.js.map +1 -1
- package/dist/lib/entity/entity-relation-type.js +4 -0
- package/dist/lib/entity/entity-relation-type.js.map +1 -1
- package/dist/lib/entity/entity-relation.js +5 -0
- package/dist/lib/entity/entity-relation.js.map +1 -1
- package/dist/lib/entity/entity-source.js +5 -0
- package/dist/lib/entity/entity-source.js.map +1 -1
- package/dist/lib/entity/entity-tag.js +5 -0
- package/dist/lib/entity/entity-tag.js.map +1 -1
- package/dist/lib/entity/entity-type.js +5 -0
- package/dist/lib/entity/entity-type.js.map +1 -1
- package/dist/lib/entity/entity.js +5 -0
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/entity/getters/batched-data-getter.js +4 -0
- package/dist/lib/entity/getters/batched-data-getter.js.map +1 -1
- package/dist/lib/entity/getters/entity-filter-getter.js +5 -0
- package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/entity/getters/entity-globe.js +5 -0
- package/dist/lib/entity/getters/entity-globe.js.map +1 -1
- package/dist/lib/file/client-file.js +4 -0
- package/dist/lib/file/client-file.js.map +1 -1
- package/dist/lib/markup/markup.js +3 -0
- package/dist/lib/markup/markup.js.map +1 -1
- package/dist/lib/program-key/program-key.js +4 -0
- package/dist/lib/program-key/program-key.js.map +1 -1
- package/dist/lib/project/menu-item.js +5 -0
- package/dist/lib/project/menu-item.js.map +1 -1
- package/dist/lib/project/project-view-bookmark.js +6 -0
- package/dist/lib/project/project-view-bookmark.js.map +1 -1
- package/dist/lib/project/project-view-tile-source.js +5 -0
- package/dist/lib/project/project-view-tile-source.js.map +1 -1
- package/dist/lib/project/project-view.js +5 -0
- package/dist/lib/project/project-view.js.map +1 -1
- package/dist/lib/project/zoom-control.js +4 -0
- package/dist/lib/project/zoom-control.js.map +1 -1
- package/dist/lib/server/pending-action.js +5 -0
- package/dist/lib/server/pending-action.js.map +1 -1
- package/dist/lib/style/style.js +7 -0
- package/dist/lib/style/style.js.map +1 -1
- package/dist/lib/tileset/tileset-entities-map-tiles.js +5 -0
- package/dist/lib/tileset/tileset-entities-map-tiles.js.map +1 -1
- package/dist/lib/tileset/tileset-ext-map-tiles.js +4 -0
- package/dist/lib/tileset/tileset-ext-map-tiles.js.map +1 -1
- package/dist/lib/tileset/tileset.js +10 -0
- package/dist/lib/tileset/tileset.js.map +1 -1
- package/dist/lib/ucs/ucs.js +5 -0
- package/dist/lib/ucs/ucs.js.map +1 -1
- package/dist/lib/user/session.js +5 -0
- package/dist/lib/user/session.js.map +1 -1
- package/dist/lib/user/user-group.js +4 -0
- package/dist/lib/user/user-group.js.map +1 -1
- package/dist/lib/user/user.js +7 -0
- package/dist/lib/user/user.js.map +1 -1
- package/dist/lib/util/math-utils.js +12 -0
- package/dist/lib/util/math-utils.js.map +1 -1
- package/dist/lib/util/object-utils.js +4 -0
- package/dist/lib/util/object-utils.js.map +1 -1
- package/dist/lib/util/path-utils.js +3 -0
- package/dist/lib/util/path-utils.js.map +1 -1
- package/dist/lib/util/url-utils.js +6 -0
- package/dist/lib/util/url-utils.js.map +1 -1
- package/dist/types/ann-document/ann-document.d.ts +4 -0
- package/dist/types/api/abstract-api.d.ts +3 -0
- package/dist/types/api/api.d.ts +26 -8
- package/dist/types/api/bruce-api.d.ts +5 -0
- package/dist/types/api/cam-api.d.ts +5 -0
- package/dist/types/api/global-api.d.ts +5 -0
- package/dist/types/api/idm-api.d.ts +5 -0
- package/dist/types/bruce-models.d.ts +1 -0
- package/dist/types/calculator/calculator.d.ts +12 -0
- package/dist/types/common/bounds.d.ts +6 -0
- package/dist/types/common/bruce-event.d.ts +4 -0
- package/dist/types/common/bruce-variable.d.ts +13 -0
- package/dist/types/common/cache.d.ts +3 -0
- package/dist/types/common/cartes.d.ts +6 -0
- package/dist/types/common/carto.d.ts +5 -0
- package/dist/types/common/color.d.ts +5 -0
- package/dist/types/common/delay-queue.d.ts +4 -0
- package/dist/types/common/geometry.d.ts +21 -0
- package/dist/types/common/transform.d.ts +4 -0
- package/dist/types/common/utc.d.ts +3 -0
- package/dist/types/custom-form/custom-form.d.ts +25 -0
- package/dist/types/entity/entity-attachment-type.d.ts +5 -4
- package/dist/types/entity/entity-attachment.d.ts +5 -0
- package/dist/types/entity/entity-comment.d.ts +4 -0
- package/dist/types/entity/entity-link.d.ts +4 -0
- package/dist/types/entity/entity-lod.d.ts +6 -0
- package/dist/types/entity/entity-relation-type.d.ts +4 -0
- package/dist/types/entity/entity-relation.d.ts +5 -0
- package/dist/types/entity/entity-source.d.ts +5 -0
- package/dist/types/entity/entity-tag.d.ts +5 -0
- package/dist/types/entity/entity-type.d.ts +5 -0
- package/dist/types/entity/entity.d.ts +5 -0
- package/dist/types/entity/getters/batched-data-getter.d.ts +4 -0
- package/dist/types/entity/getters/entity-filter-getter.d.ts +5 -0
- package/dist/types/entity/getters/entity-globe.d.ts +5 -0
- package/dist/types/file/client-file.d.ts +4 -0
- package/dist/types/markup/markup.d.ts +3 -0
- package/dist/types/program-key/program-key.d.ts +4 -0
- package/dist/types/project/menu-item.d.ts +5 -0
- package/dist/types/project/project-view-bookmark.d.ts +6 -0
- package/dist/types/project/project-view-tile-source.d.ts +5 -0
- package/dist/types/project/project-view.d.ts +5 -0
- package/dist/types/project/zoom-control.d.ts +4 -0
- package/dist/types/server/pending-action.d.ts +5 -0
- package/dist/types/style/style.d.ts +7 -0
- package/dist/types/tileset/tileset-cad.d.ts +4 -0
- package/dist/types/tileset/tileset-entities-map-tiles.d.ts +5 -0
- package/dist/types/tileset/tileset-entities.d.ts +4 -0
- package/dist/types/tileset/tileset-ext-map-tiles.d.ts +4 -0
- package/dist/types/tileset/tileset-ext-terrain-tiles.d.ts +4 -0
- package/dist/types/tileset/tileset-map-tiles.d.ts +4 -0
- package/dist/types/tileset/tileset-pointcloud.d.ts +4 -0
- package/dist/types/tileset/tileset-terrain-tiles.d.ts +4 -0
- package/dist/types/tileset/tileset.d.ts +10 -0
- package/dist/types/ucs/ucs.d.ts +5 -0
- package/dist/types/user/session.d.ts +5 -0
- package/dist/types/user/user-group.d.ts +4 -0
- package/dist/types/user/user.d.ts +7 -0
- package/dist/types/util/math-utils.d.ts +12 -0
- package/dist/types/util/object-utils.d.ts +4 -0
- package/dist/types/util/path-utils.d.ts +3 -0
- package/dist/types/util/url-utils.d.ts +6 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -81,6 +81,9 @@
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Contains generic descriptions used for Bruce requests.
|
|
86
|
+
*/
|
|
84
87
|
(function (Api) {
|
|
85
88
|
var ECacheKey;
|
|
86
89
|
(function (ECacheKey) {
|
|
@@ -111,10 +114,27 @@
|
|
|
111
114
|
ECacheKey["AccessToken"] = "accesstoken";
|
|
112
115
|
ECacheKey["UserGroup"] = "usergroup";
|
|
113
116
|
ECacheKey["Account"] = "account";
|
|
117
|
+
ECacheKey["CustomForm"] = "customform";
|
|
114
118
|
})(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
|
|
115
119
|
Api.DEFAULT_CACHE_DURATION = 60 * 5; // 5 minutes.
|
|
116
120
|
Api.TEMPLATE_ACCOUNT_ID = "template";
|
|
117
121
|
Api.ACCESS_TOKEN_HEADER = "X-Access-Token";
|
|
122
|
+
/**
|
|
123
|
+
* Possible environments we host Bruce apps on.
|
|
124
|
+
* When these are matched, they should be case-insensitive.
|
|
125
|
+
*/
|
|
126
|
+
var EEnv;
|
|
127
|
+
(function (EEnv) {
|
|
128
|
+
EEnv["DEV"] = "DEV";
|
|
129
|
+
EEnv["STG"] = "STG";
|
|
130
|
+
EEnv["UAT"] = "UAT";
|
|
131
|
+
EEnv["PROD"] = "PROD";
|
|
132
|
+
})(EEnv = Api.EEnv || (Api.EEnv = {}));
|
|
133
|
+
/**
|
|
134
|
+
* Prepares a string to be included in a url.
|
|
135
|
+
* @param str
|
|
136
|
+
* @returns
|
|
137
|
+
*/
|
|
118
138
|
function Encode(str) {
|
|
119
139
|
return encodeURIComponent(str.replace(/\+/g, "%2B").replace(/\./g, "%2E"));
|
|
120
140
|
}
|
|
@@ -130,13 +150,11 @@
|
|
|
130
150
|
EEncoding["UTF8"] = "UTF-8";
|
|
131
151
|
EEncoding["UTF16"] = "UTF-16BE";
|
|
132
152
|
})(EEncoding = Api.EEncoding || (Api.EEncoding = {}));
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
EEnv["PROD"] = "PROD";
|
|
139
|
-
})(EEnv = Api.EEnv || (Api.EEnv = {}));
|
|
153
|
+
/**
|
|
154
|
+
* Prepares default settings for a request to Bruce Api.
|
|
155
|
+
* Our requests WRONGLY have utf-16 for 95% of them. Please be wary of that.
|
|
156
|
+
* @returns
|
|
157
|
+
*/
|
|
140
158
|
function PrepReqParams() {
|
|
141
159
|
return { response: { encoding: Api.EEncoding.UTF16 } };
|
|
142
160
|
}
|
|
@@ -215,6 +233,98 @@
|
|
|
215
233
|
AnnDocument.GetList = GetList;
|
|
216
234
|
})(exports.AnnDocument || (exports.AnnDocument = {}));
|
|
217
235
|
|
|
236
|
+
(function (CustomForm) {
|
|
237
|
+
function GetCacheKey(id) {
|
|
238
|
+
return exports.Api.ECacheKey.CustomForm + exports.Api.ECacheKey.Id + id;
|
|
239
|
+
}
|
|
240
|
+
CustomForm.GetCacheKey = GetCacheKey;
|
|
241
|
+
function GetListCacheKey(typeId) {
|
|
242
|
+
if (typeId) {
|
|
243
|
+
return exports.Api.ECacheKey.CustomForm + exports.Api.ECacheKey.EntityType + exports.Api.ECacheKey.Id + typeId;
|
|
244
|
+
}
|
|
245
|
+
return exports.Api.ECacheKey.CustomForm;
|
|
246
|
+
}
|
|
247
|
+
CustomForm.GetListCacheKey = GetListCacheKey;
|
|
248
|
+
var EType;
|
|
249
|
+
(function (EType) {
|
|
250
|
+
EType["Form"] = "GENERIC";
|
|
251
|
+
EType["Markup"] = "MARKUP";
|
|
252
|
+
})(EType = CustomForm.EType || (CustomForm.EType = {}));
|
|
253
|
+
function Get(api, id) {
|
|
254
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
+
var cacheData, req;
|
|
256
|
+
return __generator(this, function (_a) {
|
|
257
|
+
if (!id) {
|
|
258
|
+
throw ("Id is required.");
|
|
259
|
+
}
|
|
260
|
+
cacheData = api.Cache.Get(GetCacheKey(id));
|
|
261
|
+
if (cacheData) {
|
|
262
|
+
return [2 /*return*/, cacheData];
|
|
263
|
+
}
|
|
264
|
+
req = api.GET("customForm/" + id, exports.Api.PrepReqParams());
|
|
265
|
+
api.Cache.Set(GetCacheKey(id), req, exports.Api.DEFAULT_CACHE_DURATION);
|
|
266
|
+
return [2 /*return*/, req];
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
CustomForm.Get = Get;
|
|
271
|
+
function Delete(api, id) {
|
|
272
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
273
|
+
return __generator(this, function (_a) {
|
|
274
|
+
switch (_a.label) {
|
|
275
|
+
case 0:
|
|
276
|
+
if (!id) {
|
|
277
|
+
throw ("Id is required.");
|
|
278
|
+
}
|
|
279
|
+
return [4 /*yield*/, api.DELETE("customForm/" + id, exports.Api.PrepReqParams())];
|
|
280
|
+
case 1:
|
|
281
|
+
_a.sent();
|
|
282
|
+
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.CustomForm);
|
|
283
|
+
return [2 /*return*/];
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
CustomForm.Delete = Delete;
|
|
289
|
+
function GetList(api, typeId) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
291
|
+
var url, cacheData, req, prom;
|
|
292
|
+
return __generator(this, function (_a) {
|
|
293
|
+
url = typeId ? "entityType/" + typeId + "/customForms" : "customForms";
|
|
294
|
+
cacheData = api.Cache.Get(GetListCacheKey(typeId));
|
|
295
|
+
if (cacheData) {
|
|
296
|
+
return [2 /*return*/, cacheData];
|
|
297
|
+
}
|
|
298
|
+
req = api.GET(url, exports.Api.PrepReqParams());
|
|
299
|
+
prom = req.then(function (data) {
|
|
300
|
+
return data.Items;
|
|
301
|
+
});
|
|
302
|
+
api.Cache.Set(GetListCacheKey(typeId), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
303
|
+
return [2 /*return*/, prom];
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
CustomForm.GetList = GetList;
|
|
308
|
+
function Update(api, data) {
|
|
309
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
310
|
+
return __generator(this, function (_a) {
|
|
311
|
+
switch (_a.label) {
|
|
312
|
+
case 0:
|
|
313
|
+
if (!data.ID) {
|
|
314
|
+
data.ID = 0;
|
|
315
|
+
}
|
|
316
|
+
return [4 /*yield*/, api.POST("customForm/" + data.ID, data, exports.Api.PrepReqParams())];
|
|
317
|
+
case 1:
|
|
318
|
+
data = _a.sent();
|
|
319
|
+
api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.CustomForm);
|
|
320
|
+
return [2 /*return*/, data];
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
CustomForm.Update = Update;
|
|
326
|
+
})(exports.CustomForm || (exports.CustomForm = {}));
|
|
327
|
+
|
|
218
328
|
var CacheItem = /** @class */ (function () {
|
|
219
329
|
function CacheItem(id, data, duration) {
|
|
220
330
|
this.Id = id;
|
|
@@ -230,6 +340,9 @@
|
|
|
230
340
|
};
|
|
231
341
|
return CacheItem;
|
|
232
342
|
}());
|
|
343
|
+
/**
|
|
344
|
+
* Simple local cache controller.
|
|
345
|
+
*/
|
|
233
346
|
var CacheControl = /** @class */ (function () {
|
|
234
347
|
function CacheControl() {
|
|
235
348
|
this.data = {};
|
|
@@ -318,6 +431,9 @@
|
|
|
318
431
|
});
|
|
319
432
|
});
|
|
320
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* This is a base class for communication with an arbitrary Bruce Api.
|
|
436
|
+
*/
|
|
321
437
|
var AbstractApi = /** @class */ (function () {
|
|
322
438
|
function AbstractApi(ssidHeader) {
|
|
323
439
|
this.ssid = "";
|
|
@@ -472,6 +588,10 @@
|
|
|
472
588
|
return AbstractApi;
|
|
473
589
|
}());
|
|
474
590
|
|
|
591
|
+
/**
|
|
592
|
+
* This is the request handler for Bruce Api,
|
|
593
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
594
|
+
*/
|
|
475
595
|
var BruceApi = /** @class */ (function (_super) {
|
|
476
596
|
__extends(BruceApi, _super);
|
|
477
597
|
function BruceApi(accountId, env) {
|
|
@@ -507,6 +627,12 @@
|
|
|
507
627
|
BruceApi.prototype.GetBaseUrl = function () {
|
|
508
628
|
return this.baseUrl;
|
|
509
629
|
};
|
|
630
|
+
BruceApi.prototype.SetBaseUrl = function (url) {
|
|
631
|
+
this.baseUrl = url;
|
|
632
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
633
|
+
this.baseUrl += "/";
|
|
634
|
+
}
|
|
635
|
+
};
|
|
510
636
|
BruceApi.prototype.GET = function (url, params) {
|
|
511
637
|
return __awaiter(this, void 0, void 0, function () {
|
|
512
638
|
return __generator(this, function (_a) {
|
|
@@ -538,6 +664,10 @@
|
|
|
538
664
|
return BruceApi;
|
|
539
665
|
}(AbstractApi));
|
|
540
666
|
|
|
667
|
+
/**
|
|
668
|
+
* This is the request handler for Cam Api,
|
|
669
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
670
|
+
*/
|
|
541
671
|
var CamApi = /** @class */ (function (_super) {
|
|
542
672
|
__extends(CamApi, _super);
|
|
543
673
|
function CamApi(env) {
|
|
@@ -572,6 +702,12 @@
|
|
|
572
702
|
CamApi.prototype.GetBaseUrl = function () {
|
|
573
703
|
return this.baseUrl;
|
|
574
704
|
};
|
|
705
|
+
CamApi.prototype.SetBaseUrl = function (url) {
|
|
706
|
+
this.baseUrl = url;
|
|
707
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
708
|
+
this.baseUrl += "/";
|
|
709
|
+
}
|
|
710
|
+
};
|
|
575
711
|
CamApi.prototype.GET = function (url, params) {
|
|
576
712
|
return __awaiter(this, void 0, void 0, function () {
|
|
577
713
|
return __generator(this, function (_a) {
|
|
@@ -603,6 +739,10 @@
|
|
|
603
739
|
return CamApi;
|
|
604
740
|
}(AbstractApi));
|
|
605
741
|
|
|
742
|
+
/**
|
|
743
|
+
* This is the request handler for Idm Api,
|
|
744
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
745
|
+
*/
|
|
606
746
|
var IdmApi = /** @class */ (function (_super) {
|
|
607
747
|
__extends(IdmApi, _super);
|
|
608
748
|
function IdmApi(env) {
|
|
@@ -637,6 +777,12 @@
|
|
|
637
777
|
IdmApi.prototype.GetBaseUrl = function () {
|
|
638
778
|
return this.baseUrl;
|
|
639
779
|
};
|
|
780
|
+
IdmApi.prototype.SetBaseUrl = function (url) {
|
|
781
|
+
this.baseUrl = url;
|
|
782
|
+
if (!this.baseUrl.endsWith("/")) {
|
|
783
|
+
this.baseUrl += "/";
|
|
784
|
+
}
|
|
785
|
+
};
|
|
640
786
|
IdmApi.prototype.GET = function (url, params) {
|
|
641
787
|
return __awaiter(this, void 0, void 0, function () {
|
|
642
788
|
return __generator(this, function (_a) {
|
|
@@ -687,6 +833,11 @@
|
|
|
687
833
|
return ColorFromStr(str);
|
|
688
834
|
}
|
|
689
835
|
Color.RandomColor = RandomColor;
|
|
836
|
+
/**
|
|
837
|
+
* Attempts to parse a given color string into a model.
|
|
838
|
+
* @param str
|
|
839
|
+
* @returns
|
|
840
|
+
*/
|
|
690
841
|
function ColorFromStr(str) {
|
|
691
842
|
var r, g, b, a;
|
|
692
843
|
var rgba = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([^\)]+)\s*)?\)$/.exec(str);
|
|
@@ -747,6 +898,10 @@
|
|
|
747
898
|
})(exports.Color || (exports.Color = {}));
|
|
748
899
|
|
|
749
900
|
(function (ObjectUtils) {
|
|
901
|
+
/**
|
|
902
|
+
* Generates a Bruce compatible UID.
|
|
903
|
+
* @returns
|
|
904
|
+
*/
|
|
750
905
|
function UId() {
|
|
751
906
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
752
907
|
var r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
|
|
@@ -756,6 +911,9 @@
|
|
|
756
911
|
ObjectUtils.UId = UId;
|
|
757
912
|
})(exports.ObjectUtils || (exports.ObjectUtils = {}));
|
|
758
913
|
|
|
914
|
+
/**
|
|
915
|
+
* Utility to help with parsing and wrapping Bruce paths.
|
|
916
|
+
*/
|
|
759
917
|
(function (PathUtils) {
|
|
760
918
|
function Parse(str) {
|
|
761
919
|
if (!str) {
|
|
@@ -1090,8 +1248,21 @@
|
|
|
1090
1248
|
}
|
|
1091
1249
|
return null;
|
|
1092
1250
|
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Utilities for parsing "Bruce variables", typically within strings.
|
|
1253
|
+
*
|
|
1254
|
+
* A Bruce variable is a string that starts with "${" and ends with "}".
|
|
1255
|
+
* Within those brackets is a path to an attribute in an entity.
|
|
1256
|
+
*/
|
|
1093
1257
|
var BruceVariable;
|
|
1094
1258
|
(function (BruceVariable) {
|
|
1259
|
+
/**
|
|
1260
|
+
* Replaces all Bruce variables in a string with the value of the attribute.
|
|
1261
|
+
* @param str
|
|
1262
|
+
* @param data
|
|
1263
|
+
* @param legacyParse
|
|
1264
|
+
* @returns
|
|
1265
|
+
*/
|
|
1095
1266
|
function SwapValues(str, data, legacyParse) {
|
|
1096
1267
|
if (!legacyParse) {
|
|
1097
1268
|
legacyParse = false;
|
|
@@ -1125,6 +1296,14 @@
|
|
|
1125
1296
|
EValueType[EValueType["TagColor"] = 4] = "TagColor";
|
|
1126
1297
|
EValueType[EValueType["RandomColor"] = 5] = "RandomColor";
|
|
1127
1298
|
})(EValueType = Calculator.EValueType || (Calculator.EValueType = {}));
|
|
1299
|
+
/**
|
|
1300
|
+
* Calculates the value of arbitrary field options.
|
|
1301
|
+
* The context calling this should validate results and parse stuff if needed.
|
|
1302
|
+
* @param fields
|
|
1303
|
+
* @param entity
|
|
1304
|
+
* @param tags
|
|
1305
|
+
* @returns
|
|
1306
|
+
*/
|
|
1128
1307
|
function GetValue(fields, entity, tags) {
|
|
1129
1308
|
if (!tags) {
|
|
1130
1309
|
tags = [];
|
|
@@ -1246,6 +1425,10 @@
|
|
|
1246
1425
|
Calculator.GetInputValue = GetInputValue;
|
|
1247
1426
|
})(exports.Calculator || (exports.Calculator = {}));
|
|
1248
1427
|
|
|
1428
|
+
/**
|
|
1429
|
+
* Simple event utility.
|
|
1430
|
+
* Instantiate the model, then subscribe and trigger events.
|
|
1431
|
+
*/
|
|
1249
1432
|
var BruceEvent = /** @class */ (function () {
|
|
1250
1433
|
function BruceEvent() {
|
|
1251
1434
|
// Counter to help differentiate subscriptions.
|
|
@@ -1295,6 +1478,12 @@
|
|
|
1295
1478
|
})(EFrustum = Camera.EFrustum || (Camera.EFrustum = {}));
|
|
1296
1479
|
})(exports.Camera || (exports.Camera = {}));
|
|
1297
1480
|
|
|
1481
|
+
/**
|
|
1482
|
+
* Describes 2d and 3d coordinates.
|
|
1483
|
+
*
|
|
1484
|
+
* In 2d the x/y typically refers to a window left/top offset.
|
|
1485
|
+
* In 3d the x/y/z, the units are in meters.
|
|
1486
|
+
*/
|
|
1298
1487
|
(function (Cartes) {
|
|
1299
1488
|
function ValidateCartes2(cartes) {
|
|
1300
1489
|
if (!cartes) {
|
|
@@ -1341,6 +1530,11 @@
|
|
|
1341
1530
|
Cartes.IsEqualCartes3 = IsEqualCartes3;
|
|
1342
1531
|
})(exports.Cartes || (exports.Cartes = {}));
|
|
1343
1532
|
|
|
1533
|
+
/**
|
|
1534
|
+
* Describes a geographic point.
|
|
1535
|
+
* The units of the stored data should be in Degrees.
|
|
1536
|
+
* Utilities may use this in Radians for temporary calculations.
|
|
1537
|
+
*/
|
|
1344
1538
|
(function (Carto) {
|
|
1345
1539
|
function ValidateCarto(carto) {
|
|
1346
1540
|
if (!carto) {
|
|
@@ -1393,6 +1587,10 @@
|
|
|
1393
1587
|
Carto.GetCenter = GetCenter;
|
|
1394
1588
|
})(exports.Carto || (exports.Carto = {}));
|
|
1395
1589
|
|
|
1590
|
+
/**
|
|
1591
|
+
* Controls the flow of method calls.
|
|
1592
|
+
* If you have a method that may be called often, but you don't want it to run often, use this.
|
|
1593
|
+
*/
|
|
1396
1594
|
var DelayQueue = /** @class */ (function () {
|
|
1397
1595
|
function DelayQueue(callback, delay) {
|
|
1398
1596
|
if (delay === void 0) { delay = 200; }
|
|
@@ -1446,12 +1644,21 @@
|
|
|
1446
1644
|
return DelayQueue;
|
|
1447
1645
|
}());
|
|
1448
1646
|
|
|
1647
|
+
/**
|
|
1648
|
+
* Describes vector geometry that Bruce uses.
|
|
1649
|
+
*/
|
|
1449
1650
|
(function (Geometry) {
|
|
1450
1651
|
var EPolygonRingType;
|
|
1451
1652
|
(function (EPolygonRingType) {
|
|
1452
1653
|
EPolygonRingType["Boundaries"] = "out";
|
|
1453
1654
|
EPolygonRingType["Hole"] = "in";
|
|
1454
1655
|
})(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
|
|
1656
|
+
/**
|
|
1657
|
+
* Turns an array of points into string vector geometry that Bruce can use.
|
|
1658
|
+
* This is used for saving polyline and polygon data.
|
|
1659
|
+
* @param points
|
|
1660
|
+
* @returns
|
|
1661
|
+
*/
|
|
1455
1662
|
function LineStrFromPoints(points) {
|
|
1456
1663
|
if (!points.length) {
|
|
1457
1664
|
throw ("points is empty.");
|
|
@@ -1465,6 +1672,12 @@
|
|
|
1465
1672
|
return lineString;
|
|
1466
1673
|
}
|
|
1467
1674
|
Geometry.LineStrFromPoints = LineStrFromPoints;
|
|
1675
|
+
/**
|
|
1676
|
+
* Removes same points that occur in a row.
|
|
1677
|
+
* This will not modify the original array.
|
|
1678
|
+
* @param positions
|
|
1679
|
+
* @returns
|
|
1680
|
+
*/
|
|
1468
1681
|
function RemoveRepeatPoints(positions) {
|
|
1469
1682
|
var filteredList = [];
|
|
1470
1683
|
for (var i = 0; i < positions.length; i++) {
|
|
@@ -1512,6 +1725,12 @@
|
|
|
1512
1725
|
return result;
|
|
1513
1726
|
}
|
|
1514
1727
|
Geometry.ParsePoints = ParsePoints;
|
|
1728
|
+
/**
|
|
1729
|
+
* Parses both string and object Bruce geometry.
|
|
1730
|
+
* String geometry is legacy Bruce data.
|
|
1731
|
+
* @param geometry
|
|
1732
|
+
* @returns
|
|
1733
|
+
*/
|
|
1515
1734
|
function ParseGeometry(geometry) {
|
|
1516
1735
|
if (typeof geometry == "string") {
|
|
1517
1736
|
var positions = [];
|
|
@@ -1542,6 +1761,9 @@
|
|
|
1542
1761
|
Geometry.ParseGeometry = ParseGeometry;
|
|
1543
1762
|
})(exports.Geometry || (exports.Geometry = {}));
|
|
1544
1763
|
|
|
1764
|
+
/**
|
|
1765
|
+
* Describes a Bruce stored date.
|
|
1766
|
+
*/
|
|
1545
1767
|
(function (UTC) {
|
|
1546
1768
|
var EMonth;
|
|
1547
1769
|
(function (EMonth) {
|
|
@@ -1588,9 +1810,6 @@
|
|
|
1588
1810
|
(function (EType) {
|
|
1589
1811
|
EType["Photo"] = "photo";
|
|
1590
1812
|
EType["Document"] = "document";
|
|
1591
|
-
EType["Video"] = "video";
|
|
1592
|
-
EType["Drawing"] = "drawing";
|
|
1593
|
-
EType["Model"] = "model";
|
|
1594
1813
|
})(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
|
|
1595
1814
|
function Delete(api, id) {
|
|
1596
1815
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3436,6 +3655,10 @@
|
|
|
3436
3655
|
ProgramKey.Update = Update;
|
|
3437
3656
|
})(exports.ProgramKey || (exports.ProgramKey = {}));
|
|
3438
3657
|
|
|
3658
|
+
/**
|
|
3659
|
+
* Describes an expectation on what should be rendered for a menu item-
|
|
3660
|
+
* between a min-max distance of an entity to the camera.
|
|
3661
|
+
*/
|
|
3439
3662
|
(function (ZoomControl) {
|
|
3440
3663
|
var EDisplayType;
|
|
3441
3664
|
(function (EDisplayType) {
|
|
@@ -4265,6 +4488,11 @@
|
|
|
4265
4488
|
Style.Delete = Delete;
|
|
4266
4489
|
})(exports.Style || (exports.Style = {}));
|
|
4267
4490
|
|
|
4491
|
+
/**
|
|
4492
|
+
* Describes expected settings for an entities-map tileset.
|
|
4493
|
+
* This is the kind of tileset generated from arbitrary Bruce entities-
|
|
4494
|
+
* which produced map tiles of the entity vector geometry.
|
|
4495
|
+
*/
|
|
4268
4496
|
(function (TilesetEntitiesMapTiles) {
|
|
4269
4497
|
var ETileSize;
|
|
4270
4498
|
(function (ETileSize) {
|
|
@@ -4275,6 +4503,10 @@
|
|
|
4275
4503
|
})(ETileSize = TilesetEntitiesMapTiles.ETileSize || (TilesetEntitiesMapTiles.ETileSize = {}));
|
|
4276
4504
|
})(exports.TilesetEntitiesMapTiles || (exports.TilesetEntitiesMapTiles = {}));
|
|
4277
4505
|
|
|
4506
|
+
/**
|
|
4507
|
+
* Describes settings for an external map-tiles tileset.
|
|
4508
|
+
* This will serve content from elsewhere with the assumption that the data is valid map tiles.
|
|
4509
|
+
*/
|
|
4278
4510
|
(function (TilesetExtMapTiles) {
|
|
4279
4511
|
var EType;
|
|
4280
4512
|
(function (EType) {
|
|
@@ -4802,6 +5034,12 @@
|
|
|
4802
5034
|
})(exports.EncryptUtils || (exports.EncryptUtils = {}));
|
|
4803
5035
|
|
|
4804
5036
|
(function (MathUtils) {
|
|
5037
|
+
/**
|
|
5038
|
+
* Rounds a number to a given number of decimal places.
|
|
5039
|
+
* @param num
|
|
5040
|
+
* @param decimals
|
|
5041
|
+
* @returns
|
|
5042
|
+
*/
|
|
4805
5043
|
function Round(num, decimals) {
|
|
4806
5044
|
if (decimals === void 0) { decimals = 0; }
|
|
4807
5045
|
if (decimals <= 0) {
|
|
@@ -4815,6 +5053,12 @@
|
|
|
4815
5053
|
return Math.round((num + Number.EPSILON) * d) / d;
|
|
4816
5054
|
}
|
|
4817
5055
|
MathUtils.Round = Round;
|
|
5056
|
+
/**
|
|
5057
|
+
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
5058
|
+
* @param min
|
|
5059
|
+
* @param max
|
|
5060
|
+
* @returns
|
|
5061
|
+
*/
|
|
4818
5062
|
function RandInt(min, max) {
|
|
4819
5063
|
if (min == max) {
|
|
4820
5064
|
return min;
|
|
@@ -4827,6 +5071,9 @@
|
|
|
4827
5071
|
MathUtils.RandInt = RandInt;
|
|
4828
5072
|
})(exports.MathUtils || (exports.MathUtils = {}));
|
|
4829
5073
|
|
|
5074
|
+
/**
|
|
5075
|
+
* Utility to help with url manipulation.
|
|
5076
|
+
*/
|
|
4830
5077
|
(function (UrlUtils) {
|
|
4831
5078
|
function GetQueryString(doc) {
|
|
4832
5079
|
var qs = {};
|
|
@@ -4844,6 +5091,9 @@
|
|
|
4844
5091
|
return qs;
|
|
4845
5092
|
}
|
|
4846
5093
|
UrlUtils.GetQueryString = GetQueryString;
|
|
5094
|
+
/**
|
|
5095
|
+
* Helper to get and set url params for a given window.
|
|
5096
|
+
*/
|
|
4847
5097
|
var Handler = /** @class */ (function () {
|
|
4848
5098
|
function Handler(window, allowedKeys) {
|
|
4849
5099
|
this._allowedKeys = null;
|