bruce-models 0.0.8 → 0.1.0

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 (34) hide show
  1. package/dist/bruce-models.es5.js +63 -8
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +61 -6
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/bruce-models.js +1 -1
  6. package/dist/lib/bruce-models.js.map +1 -1
  7. package/dist/lib/common/cache.js +10 -0
  8. package/dist/lib/common/cache.js.map +1 -1
  9. package/dist/lib/common/carto.js +26 -0
  10. package/dist/lib/common/carto.js.map +1 -1
  11. package/dist/lib/common/geometry.js +6 -1
  12. package/dist/lib/common/geometry.js.map +1 -1
  13. package/dist/lib/file/client-file.js +8 -0
  14. package/dist/lib/file/client-file.js.map +1 -1
  15. package/dist/lib/project/menu-item.js +3 -3
  16. package/dist/lib/project/menu-item.js.map +1 -1
  17. package/dist/lib/project/zoom-control.js +14 -0
  18. package/dist/lib/project/zoom-control.js.map +1 -0
  19. package/dist/lib/style/style.js +6 -0
  20. package/dist/lib/style/style.js.map +1 -1
  21. package/dist/lib/util/url-utils.js +15 -15
  22. package/dist/lib/util/url-utils.js.map +1 -1
  23. package/dist/types/bruce-models.d.ts +1 -1
  24. package/dist/types/common/cache.d.ts +1 -0
  25. package/dist/types/common/carto.d.ts +1 -0
  26. package/dist/types/common/geometry.d.ts +10 -1
  27. package/dist/types/file/client-file.d.ts +2 -0
  28. package/dist/types/project/menu-item.d.ts +3 -3
  29. package/dist/types/project/{menu-item-zoom-control.d.ts → zoom-control.d.ts} +1 -1
  30. package/dist/types/style/style.d.ts +55 -9
  31. package/dist/types/util/url-utils.d.ts +1 -1
  32. package/package.json +2 -1
  33. package/dist/lib/project/menu-item-zoom-control.js +0 -14
  34. package/dist/lib/project/menu-item-zoom-control.js.map +0 -1
@@ -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);
@@ -1334,6 +1344,32 @@
1334
1344
  return true;
1335
1345
  }
1336
1346
  Carto.IsEqual = IsEqual;
1347
+ function GetCenter(list) {
1348
+ var center = {
1349
+ longitude: 0,
1350
+ latitude: 0,
1351
+ altitude: 0
1352
+ };
1353
+ for (var i = 0; i < list.length; i++) {
1354
+ var carto = list[i];
1355
+ center.longitude += carto.longitude;
1356
+ center.latitude += carto.latitude;
1357
+ if (carto.altitude) {
1358
+ center.altitude += carto.altitude;
1359
+ }
1360
+ }
1361
+ if (center.longitude) {
1362
+ center.longitude /= list.length;
1363
+ }
1364
+ if (center.latitude) {
1365
+ center.latitude /= list.length;
1366
+ }
1367
+ if (center.altitude) {
1368
+ center.altitude /= list.length;
1369
+ }
1370
+ return center;
1371
+ }
1372
+ Carto.GetCenter = GetCenter;
1337
1373
  })(exports.Carto || (exports.Carto = {}));
1338
1374
 
1339
1375
  var DelayQueue = /** @class */ (function () {
@@ -1390,6 +1426,11 @@
1390
1426
  }());
1391
1427
 
1392
1428
  (function (Geometry) {
1429
+ var EPolygonRingType;
1430
+ (function (EPolygonRingType) {
1431
+ EPolygonRingType["Boundaries"] = "out";
1432
+ EPolygonRingType["Hole"] = "in";
1433
+ })(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
1393
1434
  function LineStrFromPoints(points) {
1394
1435
  if (!points.length) {
1395
1436
  throw ("points is empty.");
@@ -1467,7 +1508,7 @@
1467
1508
  var topPoint = positions[0];
1468
1509
  newGeometry.Point = topPoint.latitude + "," + topPoint.longitude + (topPoint.altitude != null ? "," + topPoint.altitude : "");
1469
1510
  if (positions.length > 1) {
1470
- newGeometry.Polygon = [{ Facing: "out", LinearRing: LineStrFromPoints(positions) }];
1511
+ newGeometry.Polygon = [{ Facing: EPolygonRingType.Boundaries, LinearRing: LineStrFromPoints(positions) }];
1471
1512
  }
1472
1513
  if (positions.length > 2) {
1473
1514
  newGeometry.LineString = LineStrFromPoints(positions);
@@ -3160,6 +3201,14 @@
3160
3201
  return "" + exports.Api.ECacheKey.ClientFile + exports.Api.ECacheKey.Id + fileId;
3161
3202
  }
3162
3203
  ClientFile.GetCacheKey = GetCacheKey;
3204
+ function GetUrl(api, fileId) {
3205
+ return api.GetBaseUrl() + "/file/" + fileId;
3206
+ }
3207
+ ClientFile.GetUrl = GetUrl;
3208
+ function GetUrlWithExt(api, file) {
3209
+ return api.GetBaseUrl() + "/file/" + file + (file.FileExt ? file.FileExt : "");
3210
+ }
3211
+ ClientFile.GetUrlWithExt = GetUrlWithExt;
3163
3212
  function Get(api, fileId) {
3164
3213
  return __awaiter(this, void 0, void 0, function () {
3165
3214
  var key, cacheData, req;
@@ -3366,15 +3415,15 @@
3366
3415
  ProgramKey.Update = Update;
3367
3416
  })(exports.ProgramKey || (exports.ProgramKey = {}));
3368
3417
 
3369
- (function (MenuItemZoomControl) {
3418
+ (function (ZoomControl) {
3370
3419
  var EDisplayType;
3371
3420
  (function (EDisplayType) {
3372
3421
  EDisplayType["Hidden"] = "hidden";
3373
3422
  EDisplayType["Point"] = "point";
3374
3423
  EDisplayType["Geometry"] = "geometry";
3375
3424
  EDisplayType["Model3D"] = "3d";
3376
- })(EDisplayType = MenuItemZoomControl.EDisplayType || (MenuItemZoomControl.EDisplayType = {}));
3377
- })(exports.MenuItemZoomControl || (exports.MenuItemZoomControl = {}));
3425
+ })(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
3426
+ })(exports.ZoomControl || (exports.ZoomControl = {}));
3378
3427
 
3379
3428
  (function (Tileset) {
3380
3429
  function GetCacheKey(tilesetId, loadFiles) {
@@ -3737,7 +3786,7 @@
3737
3786
  },
3738
3787
  CameraZoomSettings: [
3739
3788
  {
3740
- DisplayType: exports.MenuItemZoomControl.EDisplayType.Model3D,
3789
+ DisplayType: exports.ZoomControl.EDisplayType.Model3D,
3741
3790
  MaxZoom: 8000,
3742
3791
  MinZoom: 0,
3743
3792
  StyleID: styleId
@@ -3756,7 +3805,7 @@
3756
3805
  },
3757
3806
  CameraZoomSettings: [
3758
3807
  {
3759
- DisplayType: exports.MenuItemZoomControl.EDisplayType.Model3D,
3808
+ DisplayType: exports.ZoomControl.EDisplayType.Model3D,
3760
3809
  MaxZoom: 8000,
3761
3810
  MinZoom: 0,
3762
3811
  StyleID: styleId
@@ -4102,6 +4151,12 @@
4102
4151
  EType["Entity"] = "ENTITY";
4103
4152
  EType["EntityRelationship"] = "ENTITY_RELATIONSHIP";
4104
4153
  })(EType = Style.EType || (Style.EType = {}));
4154
+ var EPointType;
4155
+ (function (EPointType) {
4156
+ EPointType["Point"] = "POINT";
4157
+ EPointType["Icon"] = "ICON";
4158
+ EPointType["Cylinder"] = "CYLINDER";
4159
+ })(EPointType = Style.EPointType || (Style.EPointType = {}));
4105
4160
  function GetList(api) {
4106
4161
  var _this = this;
4107
4162
  var cacheData = api.Cache.Get(GetListCacheKey());