bruce-models 0.1.5 → 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 +479 -67
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +331 -65
- 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 +22 -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 +8 -1
- 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,64 @@
|
|
|
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
|
+
*/
|
|
917
|
+
(function (PathUtils) {
|
|
918
|
+
function Parse(str) {
|
|
919
|
+
if (!str) {
|
|
920
|
+
return [];
|
|
921
|
+
}
|
|
922
|
+
var broken = str.split("\"/\"");
|
|
923
|
+
if (broken.length > 0) {
|
|
924
|
+
var top_1 = broken[0];
|
|
925
|
+
if (top_1.length > 0) {
|
|
926
|
+
if (top_1.charAt(0) == "\"") {
|
|
927
|
+
top_1 = top_1.substring(1);
|
|
928
|
+
}
|
|
929
|
+
broken[0] = top_1;
|
|
930
|
+
}
|
|
931
|
+
var endIndex = broken.length - 1;
|
|
932
|
+
var bot = broken[endIndex];
|
|
933
|
+
if (bot.length > 0) {
|
|
934
|
+
if (bot.charAt(bot.length - 1) == "\"") {
|
|
935
|
+
bot = bot.substring(0, bot.length - 1);
|
|
936
|
+
}
|
|
937
|
+
broken[endIndex] = bot;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return broken;
|
|
941
|
+
}
|
|
942
|
+
PathUtils.Parse = Parse;
|
|
943
|
+
function Wrap(path) {
|
|
944
|
+
var tmp = "\"";
|
|
945
|
+
for (var i = 0; i < path.length; i++) {
|
|
946
|
+
var section = path[i];
|
|
947
|
+
tmp += section;
|
|
948
|
+
if (i < path.length - 1) {
|
|
949
|
+
tmp += "\"/\"";
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
tmp += "\"";
|
|
953
|
+
return tmp;
|
|
954
|
+
}
|
|
955
|
+
PathUtils.Wrap = Wrap;
|
|
956
|
+
function ParseLegacy(str) {
|
|
957
|
+
var broken = str.split(".");
|
|
958
|
+
for (var i = 0; i < broken.length; i++) {
|
|
959
|
+
var piece = broken[0];
|
|
960
|
+
if (piece.charAt(0) == "\"") {
|
|
961
|
+
piece = broken[0] = piece.substring(1);
|
|
962
|
+
}
|
|
963
|
+
if (piece.charAt(piece.length - 1) == "\"") {
|
|
964
|
+
broken[0] = piece.substring(0, piece.length - 1);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
return broken;
|
|
968
|
+
}
|
|
969
|
+
PathUtils.ParseLegacy = ParseLegacy;
|
|
970
|
+
})(exports.PathUtils || (exports.PathUtils = {}));
|
|
971
|
+
|
|
759
972
|
(function (Entity) {
|
|
760
973
|
function GetCacheKey(entityId) {
|
|
761
974
|
return "" + exports.Api.ECacheKey.Entity + exports.Api.ECacheKey.Id + entityId;
|
|
@@ -942,6 +1155,22 @@
|
|
|
942
1155
|
return null;
|
|
943
1156
|
}
|
|
944
1157
|
Entity.GetValue = GetValue;
|
|
1158
|
+
function CalculateName(entity, type) {
|
|
1159
|
+
var attrStr = type.DisplayNameAttributePath;
|
|
1160
|
+
if (attrStr) {
|
|
1161
|
+
var attrPaths = attrStr.split(",");
|
|
1162
|
+
for (var i = 0; i < attrPaths.length; i++) {
|
|
1163
|
+
var pathStr = attrPaths[i];
|
|
1164
|
+
var path = exports.PathUtils.Parse(pathStr);
|
|
1165
|
+
var name_1 = Entity.GetValue(entity, path);
|
|
1166
|
+
if (name_1) {
|
|
1167
|
+
return name_1;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
return entity.Bruce.ID;
|
|
1172
|
+
}
|
|
1173
|
+
Entity.CalculateName = CalculateName;
|
|
945
1174
|
var Filter;
|
|
946
1175
|
(function (Filter) {
|
|
947
1176
|
var V1;
|
|
@@ -1007,61 +1236,6 @@
|
|
|
1007
1236
|
})(Filter = Entity.Filter || (Entity.Filter = {}));
|
|
1008
1237
|
})(exports.Entity || (exports.Entity = {}));
|
|
1009
1238
|
|
|
1010
|
-
(function (PathUtils) {
|
|
1011
|
-
function Parse(str) {
|
|
1012
|
-
if (!str) {
|
|
1013
|
-
return [];
|
|
1014
|
-
}
|
|
1015
|
-
var broken = str.split("\"/\"");
|
|
1016
|
-
if (broken.length > 0) {
|
|
1017
|
-
var top_1 = broken[0];
|
|
1018
|
-
if (top_1.length > 0) {
|
|
1019
|
-
if (top_1.charAt(0) == "\"") {
|
|
1020
|
-
top_1 = top_1.substring(1);
|
|
1021
|
-
}
|
|
1022
|
-
broken[0] = top_1;
|
|
1023
|
-
}
|
|
1024
|
-
var endIndex = broken.length - 1;
|
|
1025
|
-
var bot = broken[endIndex];
|
|
1026
|
-
if (bot.length > 0) {
|
|
1027
|
-
if (bot.charAt(bot.length - 1) == "\"") {
|
|
1028
|
-
bot = bot.substring(0, bot.length - 1);
|
|
1029
|
-
}
|
|
1030
|
-
broken[endIndex] = bot;
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
return broken;
|
|
1034
|
-
}
|
|
1035
|
-
PathUtils.Parse = Parse;
|
|
1036
|
-
function Wrap(path) {
|
|
1037
|
-
var tmp = "\"";
|
|
1038
|
-
for (var i = 0; i < path.length; i++) {
|
|
1039
|
-
var section = path[i];
|
|
1040
|
-
tmp += section;
|
|
1041
|
-
if (i < path.length - 1) {
|
|
1042
|
-
tmp += "\"/\"";
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
tmp += "\"";
|
|
1046
|
-
return tmp;
|
|
1047
|
-
}
|
|
1048
|
-
PathUtils.Wrap = Wrap;
|
|
1049
|
-
function ParseLegacy(str) {
|
|
1050
|
-
var broken = str.split(".");
|
|
1051
|
-
for (var i = 0; i < broken.length; i++) {
|
|
1052
|
-
var piece = broken[0];
|
|
1053
|
-
if (piece.charAt(0) == "\"") {
|
|
1054
|
-
piece = broken[0] = piece.substring(1);
|
|
1055
|
-
}
|
|
1056
|
-
if (piece.charAt(piece.length - 1) == "\"") {
|
|
1057
|
-
broken[0] = piece.substring(0, piece.length - 1);
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
return broken;
|
|
1061
|
-
}
|
|
1062
|
-
PathUtils.ParseLegacy = ParseLegacy;
|
|
1063
|
-
})(exports.PathUtils || (exports.PathUtils = {}));
|
|
1064
|
-
|
|
1065
1239
|
function getVariable(str) {
|
|
1066
1240
|
var start = str.indexOf("${");
|
|
1067
1241
|
if (start > -1) {
|
|
@@ -1074,8 +1248,21 @@
|
|
|
1074
1248
|
}
|
|
1075
1249
|
return null;
|
|
1076
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
|
+
*/
|
|
1077
1257
|
var BruceVariable;
|
|
1078
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
|
+
*/
|
|
1079
1266
|
function SwapValues(str, data, legacyParse) {
|
|
1080
1267
|
if (!legacyParse) {
|
|
1081
1268
|
legacyParse = false;
|
|
@@ -1109,6 +1296,14 @@
|
|
|
1109
1296
|
EValueType[EValueType["TagColor"] = 4] = "TagColor";
|
|
1110
1297
|
EValueType[EValueType["RandomColor"] = 5] = "RandomColor";
|
|
1111
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
|
+
*/
|
|
1112
1307
|
function GetValue(fields, entity, tags) {
|
|
1113
1308
|
if (!tags) {
|
|
1114
1309
|
tags = [];
|
|
@@ -1230,6 +1425,10 @@
|
|
|
1230
1425
|
Calculator.GetInputValue = GetInputValue;
|
|
1231
1426
|
})(exports.Calculator || (exports.Calculator = {}));
|
|
1232
1427
|
|
|
1428
|
+
/**
|
|
1429
|
+
* Simple event utility.
|
|
1430
|
+
* Instantiate the model, then subscribe and trigger events.
|
|
1431
|
+
*/
|
|
1233
1432
|
var BruceEvent = /** @class */ (function () {
|
|
1234
1433
|
function BruceEvent() {
|
|
1235
1434
|
// Counter to help differentiate subscriptions.
|
|
@@ -1279,6 +1478,12 @@
|
|
|
1279
1478
|
})(EFrustum = Camera.EFrustum || (Camera.EFrustum = {}));
|
|
1280
1479
|
})(exports.Camera || (exports.Camera = {}));
|
|
1281
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
|
+
*/
|
|
1282
1487
|
(function (Cartes) {
|
|
1283
1488
|
function ValidateCartes2(cartes) {
|
|
1284
1489
|
if (!cartes) {
|
|
@@ -1325,6 +1530,11 @@
|
|
|
1325
1530
|
Cartes.IsEqualCartes3 = IsEqualCartes3;
|
|
1326
1531
|
})(exports.Cartes || (exports.Cartes = {}));
|
|
1327
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
|
+
*/
|
|
1328
1538
|
(function (Carto) {
|
|
1329
1539
|
function ValidateCarto(carto) {
|
|
1330
1540
|
if (!carto) {
|
|
@@ -1377,6 +1587,10 @@
|
|
|
1377
1587
|
Carto.GetCenter = GetCenter;
|
|
1378
1588
|
})(exports.Carto || (exports.Carto = {}));
|
|
1379
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
|
+
*/
|
|
1380
1594
|
var DelayQueue = /** @class */ (function () {
|
|
1381
1595
|
function DelayQueue(callback, delay) {
|
|
1382
1596
|
if (delay === void 0) { delay = 200; }
|
|
@@ -1430,12 +1644,21 @@
|
|
|
1430
1644
|
return DelayQueue;
|
|
1431
1645
|
}());
|
|
1432
1646
|
|
|
1647
|
+
/**
|
|
1648
|
+
* Describes vector geometry that Bruce uses.
|
|
1649
|
+
*/
|
|
1433
1650
|
(function (Geometry) {
|
|
1434
1651
|
var EPolygonRingType;
|
|
1435
1652
|
(function (EPolygonRingType) {
|
|
1436
1653
|
EPolygonRingType["Boundaries"] = "out";
|
|
1437
1654
|
EPolygonRingType["Hole"] = "in";
|
|
1438
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
|
+
*/
|
|
1439
1662
|
function LineStrFromPoints(points) {
|
|
1440
1663
|
if (!points.length) {
|
|
1441
1664
|
throw ("points is empty.");
|
|
@@ -1449,6 +1672,12 @@
|
|
|
1449
1672
|
return lineString;
|
|
1450
1673
|
}
|
|
1451
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
|
+
*/
|
|
1452
1681
|
function RemoveRepeatPoints(positions) {
|
|
1453
1682
|
var filteredList = [];
|
|
1454
1683
|
for (var i = 0; i < positions.length; i++) {
|
|
@@ -1496,6 +1725,12 @@
|
|
|
1496
1725
|
return result;
|
|
1497
1726
|
}
|
|
1498
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
|
+
*/
|
|
1499
1734
|
function ParseGeometry(geometry) {
|
|
1500
1735
|
if (typeof geometry == "string") {
|
|
1501
1736
|
var positions = [];
|
|
@@ -1526,6 +1761,9 @@
|
|
|
1526
1761
|
Geometry.ParseGeometry = ParseGeometry;
|
|
1527
1762
|
})(exports.Geometry || (exports.Geometry = {}));
|
|
1528
1763
|
|
|
1764
|
+
/**
|
|
1765
|
+
* Describes a Bruce stored date.
|
|
1766
|
+
*/
|
|
1529
1767
|
(function (UTC) {
|
|
1530
1768
|
var EMonth;
|
|
1531
1769
|
(function (EMonth) {
|
|
@@ -1572,9 +1810,6 @@
|
|
|
1572
1810
|
(function (EType) {
|
|
1573
1811
|
EType["Photo"] = "photo";
|
|
1574
1812
|
EType["Document"] = "document";
|
|
1575
|
-
EType["Video"] = "video";
|
|
1576
|
-
EType["Drawing"] = "drawing";
|
|
1577
|
-
EType["Model"] = "model";
|
|
1578
1813
|
})(EType = EntityAttachmentType.EType || (EntityAttachmentType.EType = {}));
|
|
1579
1814
|
function Delete(api, id) {
|
|
1580
1815
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3420,6 +3655,10 @@
|
|
|
3420
3655
|
ProgramKey.Update = Update;
|
|
3421
3656
|
})(exports.ProgramKey || (exports.ProgramKey = {}));
|
|
3422
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
|
+
*/
|
|
3423
3662
|
(function (ZoomControl) {
|
|
3424
3663
|
var EDisplayType;
|
|
3425
3664
|
(function (EDisplayType) {
|
|
@@ -4249,6 +4488,11 @@
|
|
|
4249
4488
|
Style.Delete = Delete;
|
|
4250
4489
|
})(exports.Style || (exports.Style = {}));
|
|
4251
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
|
+
*/
|
|
4252
4496
|
(function (TilesetEntitiesMapTiles) {
|
|
4253
4497
|
var ETileSize;
|
|
4254
4498
|
(function (ETileSize) {
|
|
@@ -4259,6 +4503,10 @@
|
|
|
4259
4503
|
})(ETileSize = TilesetEntitiesMapTiles.ETileSize || (TilesetEntitiesMapTiles.ETileSize = {}));
|
|
4260
4504
|
})(exports.TilesetEntitiesMapTiles || (exports.TilesetEntitiesMapTiles = {}));
|
|
4261
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
|
+
*/
|
|
4262
4510
|
(function (TilesetExtMapTiles) {
|
|
4263
4511
|
var EType;
|
|
4264
4512
|
(function (EType) {
|
|
@@ -4786,6 +5034,12 @@
|
|
|
4786
5034
|
})(exports.EncryptUtils || (exports.EncryptUtils = {}));
|
|
4787
5035
|
|
|
4788
5036
|
(function (MathUtils) {
|
|
5037
|
+
/**
|
|
5038
|
+
* Rounds a number to a given number of decimal places.
|
|
5039
|
+
* @param num
|
|
5040
|
+
* @param decimals
|
|
5041
|
+
* @returns
|
|
5042
|
+
*/
|
|
4789
5043
|
function Round(num, decimals) {
|
|
4790
5044
|
if (decimals === void 0) { decimals = 0; }
|
|
4791
5045
|
if (decimals <= 0) {
|
|
@@ -4799,6 +5053,12 @@
|
|
|
4799
5053
|
return Math.round((num + Number.EPSILON) * d) / d;
|
|
4800
5054
|
}
|
|
4801
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
|
+
*/
|
|
4802
5062
|
function RandInt(min, max) {
|
|
4803
5063
|
if (min == max) {
|
|
4804
5064
|
return min;
|
|
@@ -4811,6 +5071,9 @@
|
|
|
4811
5071
|
MathUtils.RandInt = RandInt;
|
|
4812
5072
|
})(exports.MathUtils || (exports.MathUtils = {}));
|
|
4813
5073
|
|
|
5074
|
+
/**
|
|
5075
|
+
* Utility to help with url manipulation.
|
|
5076
|
+
*/
|
|
4814
5077
|
(function (UrlUtils) {
|
|
4815
5078
|
function GetQueryString(doc) {
|
|
4816
5079
|
var qs = {};
|
|
@@ -4828,6 +5091,9 @@
|
|
|
4828
5091
|
return qs;
|
|
4829
5092
|
}
|
|
4830
5093
|
UrlUtils.GetQueryString = GetQueryString;
|
|
5094
|
+
/**
|
|
5095
|
+
* Helper to get and set url params for a given window.
|
|
5096
|
+
*/
|
|
4831
5097
|
var Handler = /** @class */ (function () {
|
|
4832
5098
|
function Handler(window, allowedKeys) {
|
|
4833
5099
|
this._allowedKeys = null;
|