bruce-models 0.7.1 → 0.7.3

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.
Files changed (94) hide show
  1. package/dist/bruce-models.es5.js +182 -137
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +179 -129
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account.js +244 -244
  6. package/dist/lib/ann-document/ann-document.js +116 -116
  7. package/dist/lib/api/abstract-api.js +267 -267
  8. package/dist/lib/api/api.js +85 -85
  9. package/dist/lib/api/api.js.map +1 -1
  10. package/dist/lib/api/bruce-api.js +202 -202
  11. package/dist/lib/api/cam-api.js +132 -132
  12. package/dist/lib/api/global-api.js +131 -131
  13. package/dist/lib/api/idm-api.js +132 -132
  14. package/dist/lib/bruce-models.js +83 -83
  15. package/dist/lib/bruce-models.js.map +1 -1
  16. package/dist/lib/calculator/calculator.js +158 -158
  17. package/dist/lib/client-file/client-file.js +188 -188
  18. package/dist/lib/common/bounds.js +2 -2
  19. package/dist/lib/common/bruce-event.js +48 -48
  20. package/dist/lib/common/bruce-variable.js +54 -54
  21. package/dist/lib/common/cache.js +86 -86
  22. package/dist/lib/common/camera.js +11 -11
  23. package/dist/lib/common/cartes.js +55 -55
  24. package/dist/lib/common/carto.js +60 -60
  25. package/dist/lib/common/color.js +86 -86
  26. package/dist/lib/common/delay-queue.js +60 -60
  27. package/dist/lib/common/dictionary.js +2 -2
  28. package/dist/lib/common/geometry.js +120 -120
  29. package/dist/lib/common/transform.js +2 -2
  30. package/dist/lib/common/utc.js +39 -39
  31. package/dist/lib/custom-form/custom-form.js +136 -136
  32. package/dist/lib/data-lab/data-lab.js +90 -90
  33. package/dist/lib/entity/entity-attachment-type.js +132 -132
  34. package/dist/lib/entity/entity-attachment.js +208 -208
  35. package/dist/lib/entity/entity-comment.js +132 -132
  36. package/dist/lib/entity/entity-coords.js +182 -0
  37. package/dist/lib/entity/entity-coords.js.map +1 -0
  38. package/dist/lib/entity/entity-link.js +132 -132
  39. package/dist/lib/entity/entity-lod.js +189 -189
  40. package/dist/lib/entity/entity-relation-type.js +150 -150
  41. package/dist/lib/entity/entity-relation.js +189 -189
  42. package/dist/lib/entity/entity-source.js +176 -176
  43. package/dist/lib/entity/entity-tag.js +229 -229
  44. package/dist/lib/entity/entity-type.js +163 -163
  45. package/dist/lib/entity/entity-type.js.map +1 -1
  46. package/dist/lib/entity/entity.js +349 -349
  47. package/dist/lib/entity/entity.js.map +1 -1
  48. package/dist/lib/entity/getters/batched-data-getter.js +91 -91
  49. package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
  50. package/dist/lib/entity/getters/entity-globe.js +135 -135
  51. package/dist/lib/entity/getters/view-monitor.js +2 -2
  52. package/dist/lib/import/import-cad.js +82 -82
  53. package/dist/lib/import/import-csv.js +51 -51
  54. package/dist/lib/import/import-json.js +51 -51
  55. package/dist/lib/import/import-kml.js +51 -51
  56. package/dist/lib/import/imported-file.js +121 -121
  57. package/dist/lib/markup/markup.js +40 -40
  58. package/dist/lib/program-key/program-key.js +152 -152
  59. package/dist/lib/project/menu-item.js +115 -115
  60. package/dist/lib/project/project-view-bookmark.js +172 -172
  61. package/dist/lib/project/project-view-tile-source.js +115 -115
  62. package/dist/lib/project/project-view.js +166 -166
  63. package/dist/lib/project/zoom-control.js +17 -17
  64. package/dist/lib/server/pending-action.js +106 -106
  65. package/dist/lib/server/task.js +113 -113
  66. package/dist/lib/style/style.js +152 -152
  67. package/dist/lib/tileset/tileset-cad.js +2 -2
  68. package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
  69. package/dist/lib/tileset/tileset-entities.js +2 -2
  70. package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
  71. package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
  72. package/dist/lib/tileset/tileset-map-tiles.js +2 -2
  73. package/dist/lib/tileset/tileset-pointcloud.js +2 -2
  74. package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
  75. package/dist/lib/tileset/tileset.js +403 -403
  76. package/dist/lib/user/permission.js +20 -20
  77. package/dist/lib/user/session.js +160 -160
  78. package/dist/lib/user/user-group.js +139 -139
  79. package/dist/lib/user/user.js +451 -451
  80. package/dist/lib/util/encrypt-utils.js +20 -20
  81. package/dist/lib/util/math-utils.js +41 -41
  82. package/dist/lib/util/object-utils.js +17 -17
  83. package/dist/lib/util/path-utils.js +61 -61
  84. package/dist/lib/util/url-utils.js +107 -107
  85. package/dist/types/api/api.d.ts +1 -1
  86. package/dist/types/bruce-models.d.ts +1 -1
  87. package/dist/types/common/transform.d.ts +3 -0
  88. package/dist/types/entity/entity-coords.d.ts +37 -0
  89. package/dist/types/entity/entity-type.d.ts +1 -0
  90. package/dist/types/entity/entity.d.ts +1 -1
  91. package/package.json +1 -1
  92. package/dist/lib/ucs/ucs.js +0 -136
  93. package/dist/lib/ucs/ucs.js.map +0 -1
  94. package/dist/types/ucs/ucs.d.ts +0 -30
@@ -93,7 +93,7 @@ var Api;
93
93
  ECacheKey["PendingAction"] = "pendingaction";
94
94
  ECacheKey["EntitySource"] = "entitysource";
95
95
  ECacheKey["ProgramKey"] = "programkey";
96
- ECacheKey["Ucs"] = "ucs";
96
+ ECacheKey["EntityCoords"] = "entitycoords";
97
97
  ECacheKey["Tag"] = "tag";
98
98
  ECacheKey["Attachment"] = "attachment";
99
99
  ECacheKey["Comment"] = "comment";
@@ -4073,6 +4073,186 @@ var BatchedDataGetter;
4073
4073
  BatchedDataGetter.Getter = Getter;
4074
4074
  })(BatchedDataGetter || (BatchedDataGetter = {}));
4075
4075
 
4076
+ var MathUtils;
4077
+ (function (MathUtils) {
4078
+ /**
4079
+ * Rounds a number to a given number of decimal places.
4080
+ * @param num
4081
+ * @param decimals
4082
+ * @returns
4083
+ */
4084
+ function Round(num, decimals) {
4085
+ if (decimals === void 0) { decimals = 0; }
4086
+ if (decimals <= 0) {
4087
+ return Math.round(num);
4088
+ }
4089
+ var tmp = "1";
4090
+ for (var i = 0; i < decimals; i++) {
4091
+ tmp += "0";
4092
+ }
4093
+ var d = parseFloat(tmp);
4094
+ return Math.round((num + Number.EPSILON) * d) / d;
4095
+ }
4096
+ MathUtils.Round = Round;
4097
+ /**
4098
+ * Returns a random integer between min (inclusive) and max (inclusive).
4099
+ * @param min
4100
+ * @param max
4101
+ * @returns
4102
+ */
4103
+ function RandInt(min, max) {
4104
+ if (min == max) {
4105
+ return min;
4106
+ }
4107
+ else if (min > max) {
4108
+ throw ("Min is greater than max.");
4109
+ }
4110
+ return Math.floor(Math.random() * (max - min + 1)) + min;
4111
+ }
4112
+ MathUtils.RandInt = RandInt;
4113
+ })(MathUtils || (MathUtils = {}));
4114
+
4115
+ var EntityCoords;
4116
+ (function (EntityCoords) {
4117
+ EntityCoords.UCS_ENTITY_TYPE_ID = "Bruce_UCS_Type";
4118
+ function GetCacheKey(entityId) {
4119
+ return Api.ECacheKey.EntityCoords + Api.ECacheKey.Entity + Api.ECacheKey.Id + entityId;
4120
+ }
4121
+ EntityCoords.GetCacheKey = GetCacheKey;
4122
+ function GetEntityCoords(api, entityId) {
4123
+ return __awaiter(this, void 0, void 0, function () {
4124
+ var cacheData, req;
4125
+ return __generator(this, function (_a) {
4126
+ cacheData = api.Cache.Get(GetCacheKey(entityId));
4127
+ if (cacheData) {
4128
+ return [2 /*return*/, cacheData];
4129
+ }
4130
+ req = api.GET("entity/" + entityId + "/ucs");
4131
+ api.Cache.Set(GetCacheKey(entityId), req, Api.DEFAULT_CACHE_DURATION);
4132
+ return [2 /*return*/, req];
4133
+ });
4134
+ });
4135
+ }
4136
+ EntityCoords.GetEntityCoords = GetEntityCoords;
4137
+ function EntityRelativeToPoint(api, entityId, params) {
4138
+ return __awaiter(this, void 0, void 0, function () {
4139
+ var point, name, res;
4140
+ return __generator(this, function (_a) {
4141
+ switch (_a.label) {
4142
+ case 0:
4143
+ if (!!params.test) return [3 /*break*/, 2];
4144
+ return [4 /*yield*/, UnlinkCoords(api, entityId)];
4145
+ case 1:
4146
+ _a.sent();
4147
+ _a.label = 2;
4148
+ case 2:
4149
+ point = params.point;
4150
+ name = params.name || MathUtils.Round(point.latitude, 4) + ", " + MathUtils.Round(point.longitude, 4);
4151
+ return [4 /*yield*/, api.POST("entity/" + entityId + "/ucs", {
4152
+ "ucs": {
4153
+ "Entity.ID": null,
4154
+ "name": name,
4155
+ "location": {
4156
+ "latitude": point.latitude,
4157
+ "longitude": point.longitude,
4158
+ "altitude": point.altitude,
4159
+ "coordinates": {
4160
+ "Entity.ID": entityId
4161
+ }
4162
+ }
4163
+ },
4164
+ "test": params.test
4165
+ })];
4166
+ case 3:
4167
+ res = _a.sent();
4168
+ if (!params.test) {
4169
+ api.Cache.Remove(GetCacheKey(entityId));
4170
+ }
4171
+ return [2 /*return*/, res];
4172
+ }
4173
+ });
4174
+ });
4175
+ }
4176
+ EntityCoords.EntityRelativeToPoint = EntityRelativeToPoint;
4177
+ function EntityRelativeToEpsg(api, entityId, params) {
4178
+ var _a;
4179
+ return __awaiter(this, void 0, void 0, function () {
4180
+ var epsg, name, res;
4181
+ return __generator(this, function (_b) {
4182
+ switch (_b.label) {
4183
+ case 0:
4184
+ if (!!params.test) return [3 /*break*/, 2];
4185
+ return [4 /*yield*/, UnlinkCoords(api, entityId)];
4186
+ case 1:
4187
+ _b.sent();
4188
+ _b.label = 2;
4189
+ case 2:
4190
+ epsg = params.epsg;
4191
+ name = (_a = params.name) !== null && _a !== void 0 ? _a : "EPSG: " + epsg;
4192
+ return [4 /*yield*/, api.POST("entity/" + entityId + "/ucs", {
4193
+ "ucs": {
4194
+ "Entity.ID": null,
4195
+ "name": name,
4196
+ "location": {
4197
+ "coordinates": {
4198
+ "SRID": "EPSG:" + epsg,
4199
+ "Entity.ID": entityId
4200
+ }
4201
+ }
4202
+ },
4203
+ "test": params.test
4204
+ })];
4205
+ case 3:
4206
+ res = _b.sent();
4207
+ if (!params.test) {
4208
+ api.Cache.Remove(GetCacheKey(entityId));
4209
+ }
4210
+ return [2 /*return*/, res];
4211
+ }
4212
+ });
4213
+ });
4214
+ }
4215
+ EntityCoords.EntityRelativeToEpsg = EntityRelativeToEpsg;
4216
+ function EntityRelativeToUcs(api, entityId, params) {
4217
+ return __awaiter(this, void 0, void 0, function () {
4218
+ var ucsId, res;
4219
+ return __generator(this, function (_a) {
4220
+ switch (_a.label) {
4221
+ case 0:
4222
+ if (!!params.test) return [3 /*break*/, 2];
4223
+ return [4 /*yield*/, UnlinkCoords(api, entityId)];
4224
+ case 1:
4225
+ _a.sent();
4226
+ _a.label = 2;
4227
+ case 2:
4228
+ ucsId = params.ucsId;
4229
+ return [4 /*yield*/, api.POST("entity/" + entityId + "/ucs", {
4230
+ "ucs": {
4231
+ "Entity.ID": ucsId
4232
+ },
4233
+ "test": params.test
4234
+ })];
4235
+ case 3:
4236
+ res = _a.sent();
4237
+ if (!params.test) {
4238
+ api.Cache.Remove(GetCacheKey(entityId));
4239
+ }
4240
+ return [2 /*return*/, res];
4241
+ }
4242
+ });
4243
+ });
4244
+ }
4245
+ EntityCoords.EntityRelativeToUcs = EntityRelativeToUcs;
4246
+ function UnlinkCoords(api, entityId) {
4247
+ return __awaiter(this, void 0, void 0, function () {
4248
+ return __generator(this, function (_a) {
4249
+ return [2 /*return*/, api.DELETE("entity/" + entityId + "/ucs")];
4250
+ });
4251
+ });
4252
+ }
4253
+ EntityCoords.UnlinkCoords = UnlinkCoords;
4254
+ })(EntityCoords || (EntityCoords = {}));
4255
+
4076
4256
  /**
4077
4257
  * Describes the "Client File" concept within Bruce.
4078
4258
  * A client file is a record of a file uploaded to Bruce.
@@ -5357,102 +5537,6 @@ var TilesetExtMapTiles;
5357
5537
  })(EType = TilesetExtMapTiles.EType || (TilesetExtMapTiles.EType = {}));
5358
5538
  })(TilesetExtMapTiles || (TilesetExtMapTiles = {}));
5359
5539
 
5360
- /**
5361
- * Describes the "UCS" concept within Bruce.
5362
- * A UCS is a user-coordinate-system.
5363
- * It is a description of an offset to apply to tilesets so that they can all align with each other.
5364
- */
5365
- var Ucs;
5366
- (function (Ucs) {
5367
- function GetCacheKey(id, expandUsage) {
5368
- return Api.ECacheKey.Ucs + Api.ECacheKey.Id + id + Api.ECacheKey + expandUsage;
5369
- }
5370
- Ucs.GetCacheKey = GetCacheKey;
5371
- function GetListCacheKey() {
5372
- return Api.ECacheKey.Ucs;
5373
- }
5374
- Ucs.GetListCacheKey = GetListCacheKey;
5375
- var EState;
5376
- (function (EState) {
5377
- EState["Undefined"] = "undef";
5378
- EState["Prepared"] = "ready";
5379
- })(EState = Ucs.EState || (Ucs.EState = {}));
5380
- function Get(api, ucsId, expandUsage) {
5381
- return __awaiter(this, void 0, void 0, function () {
5382
- var cacheData, req;
5383
- return __generator(this, function (_a) {
5384
- if (!ucsId) {
5385
- throw ("UCS ID is required.");
5386
- }
5387
- if (!expandUsage) {
5388
- expandUsage = false;
5389
- }
5390
- cacheData = api.Cache.Get(GetCacheKey(ucsId, expandUsage));
5391
- if (cacheData) {
5392
- return [2 /*return*/, cacheData];
5393
- }
5394
- req = api.GET("ucs/" + ucsId);
5395
- api.Cache.Set(GetCacheKey(ucsId, expandUsage), req, Api.DEFAULT_CACHE_DURATION);
5396
- return [2 /*return*/, req];
5397
- });
5398
- });
5399
- }
5400
- Ucs.Get = Get;
5401
- function Delete(api, ucsId) {
5402
- return __awaiter(this, void 0, void 0, function () {
5403
- return __generator(this, function (_a) {
5404
- switch (_a.label) {
5405
- case 0:
5406
- if (!ucsId) {
5407
- throw ("UCS ID is required.");
5408
- }
5409
- return [4 /*yield*/, api.DELETE("ucs/" + ucsId)];
5410
- case 1:
5411
- _a.sent();
5412
- api.Cache.RemoveByStartsWith(Api.ECacheKey.Ucs + Api.ECacheKey.Id + ucsId);
5413
- api.Cache.Remove(GetListCacheKey());
5414
- return [2 /*return*/];
5415
- }
5416
- });
5417
- });
5418
- }
5419
- Ucs.Delete = Delete;
5420
- function GetList(api) {
5421
- return __awaiter(this, void 0, void 0, function () {
5422
- var cacheData, req;
5423
- return __generator(this, function (_a) {
5424
- cacheData = api.Cache.Get(GetListCacheKey());
5425
- if (cacheData) {
5426
- return [2 /*return*/, cacheData];
5427
- }
5428
- req = api.GET("ucs");
5429
- api.Cache.Set(GetListCacheKey(), req, Api.DEFAULT_CACHE_DURATION);
5430
- return [2 /*return*/, req];
5431
- });
5432
- });
5433
- }
5434
- Ucs.GetList = GetList;
5435
- function Update(api, data) {
5436
- return __awaiter(this, void 0, void 0, function () {
5437
- return __generator(this, function (_a) {
5438
- switch (_a.label) {
5439
- case 0:
5440
- if (!(data === null || data === void 0 ? void 0 : data.name)) {
5441
- throw ("UCS name is required.");
5442
- }
5443
- return [4 /*yield*/, api.POST("ucs" + (!data.id ? "" : "/" + data.id), data)];
5444
- case 1:
5445
- data = _a.sent();
5446
- api.Cache.RemoveByStartsWith(Api.ECacheKey.Ucs + Api.ECacheKey.Id + data.id);
5447
- api.Cache.Remove(GetListCacheKey());
5448
- return [2 /*return*/, data];
5449
- }
5450
- });
5451
- });
5452
- }
5453
- Ucs.Update = Update;
5454
- })(Ucs || (Ucs = {}));
5455
-
5456
5540
  var Permission;
5457
5541
  (function (Permission) {
5458
5542
  var EPerm;
@@ -6122,45 +6206,6 @@ var EncryptUtils;
6122
6206
  EncryptUtils.Cyrb53Hash = Cyrb53Hash;
6123
6207
  })(EncryptUtils || (EncryptUtils = {}));
6124
6208
 
6125
- var MathUtils;
6126
- (function (MathUtils) {
6127
- /**
6128
- * Rounds a number to a given number of decimal places.
6129
- * @param num
6130
- * @param decimals
6131
- * @returns
6132
- */
6133
- function Round(num, decimals) {
6134
- if (decimals === void 0) { decimals = 0; }
6135
- if (decimals <= 0) {
6136
- return Math.round(num);
6137
- }
6138
- var tmp = "1";
6139
- for (var i = 0; i < decimals; i++) {
6140
- tmp += "0";
6141
- }
6142
- var d = parseFloat(tmp);
6143
- return Math.round((num + Number.EPSILON) * d) / d;
6144
- }
6145
- MathUtils.Round = Round;
6146
- /**
6147
- * Returns a random integer between min (inclusive) and max (inclusive).
6148
- * @param min
6149
- * @param max
6150
- * @returns
6151
- */
6152
- function RandInt(min, max) {
6153
- if (min == max) {
6154
- return min;
6155
- }
6156
- else if (min > max) {
6157
- throw ("Min is greater than max.");
6158
- }
6159
- return Math.floor(Math.random() * (max - min + 1)) + min;
6160
- }
6161
- MathUtils.RandInt = RandInt;
6162
- })(MathUtils || (MathUtils = {}));
6163
-
6164
6209
  /**
6165
6210
  * Utility to help with url manipulation.
6166
6211
  */
@@ -6478,5 +6523,5 @@ var ImportedFile;
6478
6523
  ImportedFile.Get = Get;
6479
6524
  })(ImportedFile || (ImportedFile = {}));
6480
6525
 
6481
- export { AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewTileSource, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Ucs, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile };
6526
+ export { AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, Calculator, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewTileSource, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Permission, Session, UserGroup, User, Account, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile };
6482
6527
  //# sourceMappingURL=bruce-models.es5.js.map