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
@@ -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);
@@ -1338,6 +1348,32 @@ var Carto;
1338
1348
  return true;
1339
1349
  }
1340
1350
  Carto.IsEqual = IsEqual;
1351
+ function GetCenter(list) {
1352
+ var center = {
1353
+ longitude: 0,
1354
+ latitude: 0,
1355
+ altitude: 0
1356
+ };
1357
+ for (var i = 0; i < list.length; i++) {
1358
+ var carto = list[i];
1359
+ center.longitude += carto.longitude;
1360
+ center.latitude += carto.latitude;
1361
+ if (carto.altitude) {
1362
+ center.altitude += carto.altitude;
1363
+ }
1364
+ }
1365
+ if (center.longitude) {
1366
+ center.longitude /= list.length;
1367
+ }
1368
+ if (center.latitude) {
1369
+ center.latitude /= list.length;
1370
+ }
1371
+ if (center.altitude) {
1372
+ center.altitude /= list.length;
1373
+ }
1374
+ return center;
1375
+ }
1376
+ Carto.GetCenter = GetCenter;
1341
1377
  })(Carto || (Carto = {}));
1342
1378
 
1343
1379
  var DelayQueue = /** @class */ (function () {
@@ -1395,6 +1431,11 @@ var DelayQueue = /** @class */ (function () {
1395
1431
 
1396
1432
  var Geometry;
1397
1433
  (function (Geometry) {
1434
+ var EPolygonRingType;
1435
+ (function (EPolygonRingType) {
1436
+ EPolygonRingType["Boundaries"] = "out";
1437
+ EPolygonRingType["Hole"] = "in";
1438
+ })(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
1398
1439
  function LineStrFromPoints(points) {
1399
1440
  if (!points.length) {
1400
1441
  throw ("points is empty.");
@@ -1472,7 +1513,7 @@ var Geometry;
1472
1513
  var topPoint = positions[0];
1473
1514
  newGeometry.Point = topPoint.latitude + "," + topPoint.longitude + (topPoint.altitude != null ? "," + topPoint.altitude : "");
1474
1515
  if (positions.length > 1) {
1475
- newGeometry.Polygon = [{ Facing: "out", LinearRing: LineStrFromPoints(positions) }];
1516
+ newGeometry.Polygon = [{ Facing: EPolygonRingType.Boundaries, LinearRing: LineStrFromPoints(positions) }];
1476
1517
  }
1477
1518
  if (positions.length > 2) {
1478
1519
  newGeometry.LineString = LineStrFromPoints(positions);
@@ -3180,6 +3221,14 @@ var ClientFile;
3180
3221
  return "" + Api.ECacheKey.ClientFile + Api.ECacheKey.Id + fileId;
3181
3222
  }
3182
3223
  ClientFile.GetCacheKey = GetCacheKey;
3224
+ function GetUrl(api, fileId) {
3225
+ return api.GetBaseUrl() + "/file/" + fileId;
3226
+ }
3227
+ ClientFile.GetUrl = GetUrl;
3228
+ function GetUrlWithExt(api, file) {
3229
+ return api.GetBaseUrl() + "/file/" + file + (file.FileExt ? file.FileExt : "");
3230
+ }
3231
+ ClientFile.GetUrlWithExt = GetUrlWithExt;
3183
3232
  function Get(api, fileId) {
3184
3233
  return __awaiter(this, void 0, void 0, function () {
3185
3234
  var key, cacheData, req;
@@ -3387,16 +3436,16 @@ var ProgramKey;
3387
3436
  ProgramKey.Update = Update;
3388
3437
  })(ProgramKey || (ProgramKey = {}));
3389
3438
 
3390
- var MenuItemZoomControl;
3391
- (function (MenuItemZoomControl) {
3439
+ var ZoomControl;
3440
+ (function (ZoomControl) {
3392
3441
  var EDisplayType;
3393
3442
  (function (EDisplayType) {
3394
3443
  EDisplayType["Hidden"] = "hidden";
3395
3444
  EDisplayType["Point"] = "point";
3396
3445
  EDisplayType["Geometry"] = "geometry";
3397
3446
  EDisplayType["Model3D"] = "3d";
3398
- })(EDisplayType = MenuItemZoomControl.EDisplayType || (MenuItemZoomControl.EDisplayType = {}));
3399
- })(MenuItemZoomControl || (MenuItemZoomControl = {}));
3447
+ })(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
3448
+ })(ZoomControl || (ZoomControl = {}));
3400
3449
 
3401
3450
  var Tileset;
3402
3451
  (function (Tileset) {
@@ -3761,7 +3810,7 @@ var MenuItem;
3761
3810
  },
3762
3811
  CameraZoomSettings: [
3763
3812
  {
3764
- DisplayType: MenuItemZoomControl.EDisplayType.Model3D,
3813
+ DisplayType: ZoomControl.EDisplayType.Model3D,
3765
3814
  MaxZoom: 8000,
3766
3815
  MinZoom: 0,
3767
3816
  StyleID: styleId
@@ -3780,7 +3829,7 @@ var MenuItem;
3780
3829
  },
3781
3830
  CameraZoomSettings: [
3782
3831
  {
3783
- DisplayType: MenuItemZoomControl.EDisplayType.Model3D,
3832
+ DisplayType: ZoomControl.EDisplayType.Model3D,
3784
3833
  MaxZoom: 8000,
3785
3834
  MinZoom: 0,
3786
3835
  StyleID: styleId
@@ -4130,6 +4179,12 @@ var Style;
4130
4179
  EType["Entity"] = "ENTITY";
4131
4180
  EType["EntityRelationship"] = "ENTITY_RELATIONSHIP";
4132
4181
  })(EType = Style.EType || (Style.EType = {}));
4182
+ var EPointType;
4183
+ (function (EPointType) {
4184
+ EPointType["Point"] = "POINT";
4185
+ EPointType["Icon"] = "ICON";
4186
+ EPointType["Cylinder"] = "CYLINDER";
4187
+ })(EPointType = Style.EPointType || (Style.EPointType = {}));
4133
4188
  function GetList(api) {
4134
4189
  var _this = this;
4135
4190
  var cacheData = api.Cache.Get(GetListCacheKey());
@@ -4786,5 +4841,5 @@ var MathUtils;
4786
4841
  MathUtils.RandInt = RandInt;
4787
4842
  })(MathUtils || (MathUtils = {}));
4788
4843
 
4789
- 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 };
4844
+ 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 };
4790
4845
  //# sourceMappingURL=bruce-models.es5.js.map