bruce-models 0.0.9 → 0.1.1

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.
@@ -233,12 +233,16 @@
233
233
  var CacheControl = /** @class */ (function () {
234
234
  function CacheControl() {
235
235
  this.data = {};
236
+ this.Disabled = false;
236
237
  }
237
238
  CacheControl.prototype.Set = function (id, data, duration) {
238
239
  if (duration === void 0) { duration = -1; }
239
240
  this.data[id + ""] = new CacheItem(id + "", data, duration);
240
241
  };
241
242
  CacheControl.prototype.Get = function (id) {
243
+ if (this.Disabled) {
244
+ return null;
245
+ }
242
246
  var item = this.data[id + ""];
243
247
  if (item == null) {
244
248
  return null;
@@ -270,9 +274,15 @@
270
274
  }
271
275
  };
272
276
  CacheControl.prototype.GetKeys = function () {
277
+ if (this.Disabled) {
278
+ return [];
279
+ }
273
280
  return Object.keys(this.data);
274
281
  };
275
282
  CacheControl.prototype.GetValues = function () {
283
+ if (this.Disabled) {
284
+ return [];
285
+ }
276
286
  var values = [];
277
287
  for (var key in this.data) {
278
288
  var data = this.Get(key);
@@ -772,7 +782,7 @@
772
782
  Entity.Get = Get;
773
783
  function GetListByIds(api, entityIds) {
774
784
  return __awaiter(this, void 0, void 0, function () {
775
- var reqs, reqIds, i, entityId, key, cacheData, reqData, req, _loop_1, i;
785
+ var reqs, reqIds, i, entityId, key, cacheData, reqData, req_1, _loop_1, i;
776
786
  var _this = this;
777
787
  return __generator(this, function (_a) {
778
788
  switch (_a.label) {
@@ -801,36 +811,38 @@
801
811
  },
802
812
  PageSize: reqIds.length
803
813
  };
804
- req = api.POST("entities", reqData, exports.Api.PrepReqParams());
805
- _loop_1 = function (i) {
806
- var entityId = reqIds[i];
807
- var key = GetCacheKey(entityId);
808
- var prom = new Promise(function (res) { return __awaiter(_this, void 0, void 0, function () {
809
- var data, item, e_1;
810
- return __generator(this, function (_a) {
811
- switch (_a.label) {
812
- case 0:
813
- _a.trys.push([0, 2, , 3]);
814
- return [4 /*yield*/, req];
815
- case 1:
816
- data = _a.sent();
817
- item = data.Items.find(function (x) { return x.Bruce.ID == entityId; });
818
- res(item);
819
- return [3 /*break*/, 3];
820
- case 2:
821
- e_1 = _a.sent();
822
- return [3 /*break*/, 3];
823
- case 3:
824
- res(null);
825
- return [2 /*return*/];
826
- }
827
- });
828
- }); });
829
- api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
830
- reqs.push(prom);
831
- };
832
- for (i = 0; i < reqIds.length; i++) {
833
- _loop_1(i);
814
+ if (reqIds.length > 0) {
815
+ req_1 = api.POST("entities", reqData, exports.Api.PrepReqParams());
816
+ _loop_1 = function (i) {
817
+ var entityId = reqIds[i];
818
+ var key = GetCacheKey(entityId);
819
+ var prom = new Promise(function (res) { return __awaiter(_this, void 0, void 0, function () {
820
+ var data, item, e_1;
821
+ return __generator(this, function (_a) {
822
+ switch (_a.label) {
823
+ case 0:
824
+ _a.trys.push([0, 2, , 3]);
825
+ return [4 /*yield*/, req_1];
826
+ case 1:
827
+ data = _a.sent();
828
+ item = data.Items.find(function (x) { return x.Bruce.ID == entityId; });
829
+ res(item);
830
+ return [3 /*break*/, 3];
831
+ case 2:
832
+ e_1 = _a.sent();
833
+ return [3 /*break*/, 3];
834
+ case 3:
835
+ res(null);
836
+ return [2 /*return*/];
837
+ }
838
+ });
839
+ }); });
840
+ api.Cache.Set(key, prom, exports.Api.DEFAULT_CACHE_DURATION);
841
+ reqs.push(prom);
842
+ };
843
+ for (i = 0; i < reqIds.length; i++) {
844
+ _loop_1(i);
845
+ }
834
846
  }
835
847
  return [4 /*yield*/, Promise.all(reqs)];
836
848
  case 1: return [2 /*return*/, (_a.sent()).filter(function (x) { return !!x; })];
@@ -3191,6 +3203,14 @@
3191
3203
  return "" + exports.Api.ECacheKey.ClientFile + exports.Api.ECacheKey.Id + fileId;
3192
3204
  }
3193
3205
  ClientFile.GetCacheKey = GetCacheKey;
3206
+ function GetUrl(api, fileId) {
3207
+ return api.GetBaseUrl() + "/file/" + fileId;
3208
+ }
3209
+ ClientFile.GetUrl = GetUrl;
3210
+ function GetUrlWithExt(api, file) {
3211
+ return api.GetBaseUrl() + "/file/" + file + (file.FileExt ? file.FileExt : "");
3212
+ }
3213
+ ClientFile.GetUrlWithExt = GetUrlWithExt;
3194
3214
  function Get(api, fileId) {
3195
3215
  return __awaiter(this, void 0, void 0, function () {
3196
3216
  var key, cacheData, req;
@@ -3397,15 +3417,15 @@
3397
3417
  ProgramKey.Update = Update;
3398
3418
  })(exports.ProgramKey || (exports.ProgramKey = {}));
3399
3419
 
3400
- (function (MenuItemZoomControl) {
3420
+ (function (ZoomControl) {
3401
3421
  var EDisplayType;
3402
3422
  (function (EDisplayType) {
3403
3423
  EDisplayType["Hidden"] = "hidden";
3404
3424
  EDisplayType["Point"] = "point";
3405
3425
  EDisplayType["Geometry"] = "geometry";
3406
3426
  EDisplayType["Model3D"] = "3d";
3407
- })(EDisplayType = MenuItemZoomControl.EDisplayType || (MenuItemZoomControl.EDisplayType = {}));
3408
- })(exports.MenuItemZoomControl || (exports.MenuItemZoomControl = {}));
3427
+ })(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
3428
+ })(exports.ZoomControl || (exports.ZoomControl = {}));
3409
3429
 
3410
3430
  (function (Tileset) {
3411
3431
  function GetCacheKey(tilesetId, loadFiles) {
@@ -3768,7 +3788,7 @@
3768
3788
  },
3769
3789
  CameraZoomSettings: [
3770
3790
  {
3771
- DisplayType: exports.MenuItemZoomControl.EDisplayType.Model3D,
3791
+ DisplayType: exports.ZoomControl.EDisplayType.Model3D,
3772
3792
  MaxZoom: 8000,
3773
3793
  MinZoom: 0,
3774
3794
  StyleID: styleId
@@ -3787,7 +3807,7 @@
3787
3807
  },
3788
3808
  CameraZoomSettings: [
3789
3809
  {
3790
- DisplayType: exports.MenuItemZoomControl.EDisplayType.Model3D,
3810
+ DisplayType: exports.ZoomControl.EDisplayType.Model3D,
3791
3811
  MaxZoom: 8000,
3792
3812
  MinZoom: 0,
3793
3813
  StyleID: styleId
@@ -4133,6 +4153,12 @@
4133
4153
  EType["Entity"] = "ENTITY";
4134
4154
  EType["EntityRelationship"] = "ENTITY_RELATIONSHIP";
4135
4155
  })(EType = Style.EType || (Style.EType = {}));
4156
+ var EPointType;
4157
+ (function (EPointType) {
4158
+ EPointType["Point"] = "POINT";
4159
+ EPointType["Icon"] = "ICON";
4160
+ EPointType["Cylinder"] = "CYLINDER";
4161
+ })(EPointType = Style.EPointType || (Style.EPointType = {}));
4136
4162
  function GetList(api) {
4137
4163
  var _this = this;
4138
4164
  var cacheData = api.Cache.Get(GetListCacheKey());