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.
@@ -229,12 +229,16 @@ var CacheItem = /** @class */ (function () {
229
229
  var CacheControl = /** @class */ (function () {
230
230
  function CacheControl() {
231
231
  this.data = {};
232
+ this.Disabled = false;
232
233
  }
233
234
  CacheControl.prototype.Set = function (id, data, duration) {
234
235
  if (duration === void 0) { duration = -1; }
235
236
  this.data[id + ""] = new CacheItem(id + "", data, duration);
236
237
  };
237
238
  CacheControl.prototype.Get = function (id) {
239
+ if (this.Disabled) {
240
+ return null;
241
+ }
238
242
  var item = this.data[id + ""];
239
243
  if (item == null) {
240
244
  return null;
@@ -266,9 +270,15 @@ var CacheControl = /** @class */ (function () {
266
270
  }
267
271
  };
268
272
  CacheControl.prototype.GetKeys = function () {
273
+ if (this.Disabled) {
274
+ return [];
275
+ }
269
276
  return Object.keys(this.data);
270
277
  };
271
278
  CacheControl.prototype.GetValues = function () {
279
+ if (this.Disabled) {
280
+ return [];
281
+ }
272
282
  var values = [];
273
283
  for (var key in this.data) {
274
284
  var data = this.Get(key);
@@ -771,7 +781,7 @@ var Entity;
771
781
  Entity.Get = Get;
772
782
  function GetListByIds(api, entityIds) {
773
783
  return __awaiter(this, void 0, void 0, function () {
774
- var reqs, reqIds, i, entityId, key, cacheData, reqData, req, _loop_1, i;
784
+ var reqs, reqIds, i, entityId, key, cacheData, reqData, req_1, _loop_1, i;
775
785
  var _this = this;
776
786
  return __generator(this, function (_a) {
777
787
  switch (_a.label) {
@@ -800,36 +810,38 @@ var Entity;
800
810
  },
801
811
  PageSize: reqIds.length
802
812
  };
803
- req = api.POST("entities", reqData, Api.PrepReqParams());
804
- _loop_1 = function (i) {
805
- var entityId = reqIds[i];
806
- var key = GetCacheKey(entityId);
807
- var prom = new Promise(function (res) { return __awaiter(_this, void 0, void 0, function () {
808
- var data, item, e_1;
809
- return __generator(this, function (_a) {
810
- switch (_a.label) {
811
- case 0:
812
- _a.trys.push([0, 2, , 3]);
813
- return [4 /*yield*/, req];
814
- case 1:
815
- data = _a.sent();
816
- item = data.Items.find(function (x) { return x.Bruce.ID == entityId; });
817
- res(item);
818
- return [3 /*break*/, 3];
819
- case 2:
820
- e_1 = _a.sent();
821
- return [3 /*break*/, 3];
822
- case 3:
823
- res(null);
824
- return [2 /*return*/];
825
- }
826
- });
827
- }); });
828
- api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
829
- reqs.push(prom);
830
- };
831
- for (i = 0; i < reqIds.length; i++) {
832
- _loop_1(i);
813
+ if (reqIds.length > 0) {
814
+ req_1 = api.POST("entities", reqData, Api.PrepReqParams());
815
+ _loop_1 = function (i) {
816
+ var entityId = reqIds[i];
817
+ var key = GetCacheKey(entityId);
818
+ var prom = new Promise(function (res) { return __awaiter(_this, void 0, void 0, function () {
819
+ var data, item, e_1;
820
+ return __generator(this, function (_a) {
821
+ switch (_a.label) {
822
+ case 0:
823
+ _a.trys.push([0, 2, , 3]);
824
+ return [4 /*yield*/, req_1];
825
+ case 1:
826
+ data = _a.sent();
827
+ item = data.Items.find(function (x) { return x.Bruce.ID == entityId; });
828
+ res(item);
829
+ return [3 /*break*/, 3];
830
+ case 2:
831
+ e_1 = _a.sent();
832
+ return [3 /*break*/, 3];
833
+ case 3:
834
+ res(null);
835
+ return [2 /*return*/];
836
+ }
837
+ });
838
+ }); });
839
+ api.Cache.Set(key, prom, Api.DEFAULT_CACHE_DURATION);
840
+ reqs.push(prom);
841
+ };
842
+ for (i = 0; i < reqIds.length; i++) {
843
+ _loop_1(i);
844
+ }
833
845
  }
834
846
  return [4 /*yield*/, Promise.all(reqs)];
835
847
  case 1: return [2 /*return*/, (_a.sent()).filter(function (x) { return !!x; })];
@@ -3211,6 +3223,14 @@ var ClientFile;
3211
3223
  return "" + Api.ECacheKey.ClientFile + Api.ECacheKey.Id + fileId;
3212
3224
  }
3213
3225
  ClientFile.GetCacheKey = GetCacheKey;
3226
+ function GetUrl(api, fileId) {
3227
+ return api.GetBaseUrl() + "/file/" + fileId;
3228
+ }
3229
+ ClientFile.GetUrl = GetUrl;
3230
+ function GetUrlWithExt(api, file) {
3231
+ return api.GetBaseUrl() + "/file/" + file + (file.FileExt ? file.FileExt : "");
3232
+ }
3233
+ ClientFile.GetUrlWithExt = GetUrlWithExt;
3214
3234
  function Get(api, fileId) {
3215
3235
  return __awaiter(this, void 0, void 0, function () {
3216
3236
  var key, cacheData, req;
@@ -3418,16 +3438,16 @@ var ProgramKey;
3418
3438
  ProgramKey.Update = Update;
3419
3439
  })(ProgramKey || (ProgramKey = {}));
3420
3440
 
3421
- var MenuItemZoomControl;
3422
- (function (MenuItemZoomControl) {
3441
+ var ZoomControl;
3442
+ (function (ZoomControl) {
3423
3443
  var EDisplayType;
3424
3444
  (function (EDisplayType) {
3425
3445
  EDisplayType["Hidden"] = "hidden";
3426
3446
  EDisplayType["Point"] = "point";
3427
3447
  EDisplayType["Geometry"] = "geometry";
3428
3448
  EDisplayType["Model3D"] = "3d";
3429
- })(EDisplayType = MenuItemZoomControl.EDisplayType || (MenuItemZoomControl.EDisplayType = {}));
3430
- })(MenuItemZoomControl || (MenuItemZoomControl = {}));
3449
+ })(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
3450
+ })(ZoomControl || (ZoomControl = {}));
3431
3451
 
3432
3452
  var Tileset;
3433
3453
  (function (Tileset) {
@@ -3792,7 +3812,7 @@ var MenuItem;
3792
3812
  },
3793
3813
  CameraZoomSettings: [
3794
3814
  {
3795
- DisplayType: MenuItemZoomControl.EDisplayType.Model3D,
3815
+ DisplayType: ZoomControl.EDisplayType.Model3D,
3796
3816
  MaxZoom: 8000,
3797
3817
  MinZoom: 0,
3798
3818
  StyleID: styleId
@@ -3811,7 +3831,7 @@ var MenuItem;
3811
3831
  },
3812
3832
  CameraZoomSettings: [
3813
3833
  {
3814
- DisplayType: MenuItemZoomControl.EDisplayType.Model3D,
3834
+ DisplayType: ZoomControl.EDisplayType.Model3D,
3815
3835
  MaxZoom: 8000,
3816
3836
  MinZoom: 0,
3817
3837
  StyleID: styleId
@@ -4161,6 +4181,12 @@ var Style;
4161
4181
  EType["Entity"] = "ENTITY";
4162
4182
  EType["EntityRelationship"] = "ENTITY_RELATIONSHIP";
4163
4183
  })(EType = Style.EType || (Style.EType = {}));
4184
+ var EPointType;
4185
+ (function (EPointType) {
4186
+ EPointType["Point"] = "POINT";
4187
+ EPointType["Icon"] = "ICON";
4188
+ EPointType["Cylinder"] = "CYLINDER";
4189
+ })(EPointType = Style.EPointType || (Style.EPointType = {}));
4164
4190
  function GetList(api) {
4165
4191
  var _this = this;
4166
4192
  var cacheData = api.Cache.Get(GetListCacheKey());
@@ -4817,5 +4843,5 @@ var MathUtils;
4817
4843
  MathUtils.RandInt = RandInt;
4818
4844
  })(MathUtils || (MathUtils = {}));
4819
4845
 
4820
- export { AnnDocument, AbstractApi, Api, BruceApi, CamApi, IdmApi, 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, MenuItemZoomControl, MenuItem, ProjectViewBookmark, ProjectView, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Ucs, Permission, Session, UserGroup, User, EncryptUtils, MathUtils, ObjectUtils, PathUtils };
4846
+ export { AnnDocument, AbstractApi, Api, BruceApi, CamApi, IdmApi, 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, PendingAction, Style, TilesetEntitiesMapTiles, TilesetExtMapTiles, Tileset, Ucs, Permission, Session, UserGroup, User, EncryptUtils, MathUtils, ObjectUtils, PathUtils };
4821
4847
  //# sourceMappingURL=bruce-models.es5.js.map