bruce-models 0.7.9 → 0.8.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.
Files changed (85) hide show
  1. package/dist/bruce-models.es5.js +107 -21
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +107 -21
  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 +269 -269
  8. package/dist/lib/api/api.js +85 -85
  9. package/dist/lib/api/bruce-api.js +243 -243
  10. package/dist/lib/api/cam-api.js +132 -132
  11. package/dist/lib/api/global-api.js +131 -131
  12. package/dist/lib/api/idm-api.js +132 -132
  13. package/dist/lib/bruce-models.js +85 -85
  14. package/dist/lib/calculator/calculator.js +159 -159
  15. package/dist/lib/client-file/client-file.js +188 -188
  16. package/dist/lib/common/bounds.js +2 -2
  17. package/dist/lib/common/bruce-event.js +48 -48
  18. package/dist/lib/common/bruce-variable.js +54 -54
  19. package/dist/lib/common/cache.js +86 -86
  20. package/dist/lib/common/camera.js +11 -11
  21. package/dist/lib/common/cartes.js +55 -55
  22. package/dist/lib/common/carto.js +60 -60
  23. package/dist/lib/common/color.js +86 -86
  24. package/dist/lib/common/delay-queue.js +60 -60
  25. package/dist/lib/common/dictionary.js +2 -2
  26. package/dist/lib/common/geometry.js +120 -120
  27. package/dist/lib/common/transform.js +2 -2
  28. package/dist/lib/common/utc.js +39 -39
  29. package/dist/lib/custom-form/custom-form.js +136 -136
  30. package/dist/lib/data-lab/data-lab.js +90 -90
  31. package/dist/lib/entity/entity-attachment-type.js +132 -132
  32. package/dist/lib/entity/entity-attachment.js +208 -208
  33. package/dist/lib/entity/entity-comment.js +132 -132
  34. package/dist/lib/entity/entity-coords.js +181 -181
  35. package/dist/lib/entity/entity-link.js +132 -132
  36. package/dist/lib/entity/entity-lod.js +189 -189
  37. package/dist/lib/entity/entity-relation-type.js +150 -150
  38. package/dist/lib/entity/entity-relation.js +189 -189
  39. package/dist/lib/entity/entity-source.js +176 -176
  40. package/dist/lib/entity/entity-tag.js +229 -229
  41. package/dist/lib/entity/entity-type.js +163 -163
  42. package/dist/lib/entity/entity.js +358 -358
  43. package/dist/lib/entity/getters/batched-data-getter.js +91 -91
  44. package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
  45. package/dist/lib/entity/getters/entity-globe.js +221 -135
  46. package/dist/lib/entity/getters/entity-globe.js.map +1 -1
  47. package/dist/lib/entity/getters/view-monitor.js +2 -2
  48. package/dist/lib/import/import-cad.js +82 -82
  49. package/dist/lib/import/import-csv.js +51 -51
  50. package/dist/lib/import/import-json.js +51 -51
  51. package/dist/lib/import/import-kml.js +51 -51
  52. package/dist/lib/import/imported-file.js +121 -121
  53. package/dist/lib/import/imported-file.js.map +1 -1
  54. package/dist/lib/markup/markup.js +40 -40
  55. package/dist/lib/program-key/program-key.js +152 -152
  56. package/dist/lib/project/menu-item.js +115 -115
  57. package/dist/lib/project/project-view-bookmark.js +183 -183
  58. package/dist/lib/project/project-view-legacy-tile.js +115 -115
  59. package/dist/lib/project/project-view-tile.js +119 -119
  60. package/dist/lib/project/project-view.js +177 -177
  61. package/dist/lib/project/zoom-control.js +17 -17
  62. package/dist/lib/server/message-broker.js +158 -158
  63. package/dist/lib/server/pending-action.js +106 -106
  64. package/dist/lib/server/task.js +113 -113
  65. package/dist/lib/style/style.js +152 -152
  66. package/dist/lib/tileset/tileset-cad.js +2 -2
  67. package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
  68. package/dist/lib/tileset/tileset-entities.js +2 -2
  69. package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
  70. package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
  71. package/dist/lib/tileset/tileset-map-tiles.js +2 -2
  72. package/dist/lib/tileset/tileset-pointcloud.js +2 -2
  73. package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
  74. package/dist/lib/tileset/tileset.js +403 -403
  75. package/dist/lib/user/permission.js +20 -20
  76. package/dist/lib/user/session.js +160 -160
  77. package/dist/lib/user/user-group.js +139 -139
  78. package/dist/lib/user/user.js +451 -451
  79. package/dist/lib/util/encrypt-utils.js +20 -20
  80. package/dist/lib/util/math-utils.js +41 -41
  81. package/dist/lib/util/object-utils.js +17 -17
  82. package/dist/lib/util/path-utils.js +61 -61
  83. package/dist/lib/util/url-utils.js +107 -107
  84. package/dist/types/entity/getters/entity-globe.d.ts +2 -0
  85. package/package.json +1 -1
@@ -3724,15 +3724,13 @@
3724
3724
  if (cell.Fetched) {
3725
3725
  return true;
3726
3726
  }
3727
- // TODO: If all cells of the size smaller are fetched then this is fetched.
3728
- // TODO: If this is a cell within a larger cell that is fetched then this is fetched.
3729
3727
  return false;
3730
3728
  }
3731
3729
  function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
3732
3730
  var id = cellSize + "_" + lon + "_" + maxLon + "_" + lat + "_" + maxLat;
3733
3731
  var cell = getCell(cells, cellSize, lon, maxLon, lat, maxLat);
3734
3732
  if (!cell) {
3735
- cell = cells[id] = new Cell();
3733
+ cell = new Cell();
3736
3734
  cell.Boundaries = {
3737
3735
  minLatitude: lat,
3738
3736
  maxLatitude: maxLat,
@@ -3741,7 +3739,7 @@
3741
3739
  };
3742
3740
  cell.IsFetched = function () { return isCellFetched(cell); };
3743
3741
  }
3744
- return cell;
3742
+ return [id, cell];
3745
3743
  }
3746
3744
  (function (EntityGlobe) {
3747
3745
  var Grid = /** @class */ (function () {
@@ -3749,34 +3747,122 @@
3749
3747
  this.cells = {};
3750
3748
  }
3751
3749
  Grid.prototype.GetCellsForView = function (viewRect) {
3752
- var cells = [];
3753
- var minLat = viewRect.south;
3754
- var minLon = viewRect.west;
3755
- var maxLat = viewRect.north;
3756
- var maxLon = viewRect.east;
3750
+ var _this = this;
3757
3751
  var MAX_CELLS = 150;
3752
+ var minLat = viewRect.south, minLon = viewRect.west, maxLat = viewRect.north, maxLon = viewRect.east;
3758
3753
  var cellDegreeSize = getCellSizeFromHeight(viewRect.alt);
3759
- var curMinLon = floorValueToCellSize(cellDegreeSize, minLon);
3760
- var curMinLat = floorValueToCellSize(cellDegreeSize, minLat);
3761
- var width = (maxLon - curMinLon) / cellDegreeSize;
3762
- var height = (maxLat - curMinLat) / cellDegreeSize;
3754
+ var _a = [minLon, minLat].map(function (v) { return floorValueToCellSize(cellDegreeSize, v); }), curMinLon = _a[0], curMinLat = _a[1];
3755
+ var _b = [maxLon - curMinLon, maxLat - curMinLat].map(function (v) { return v / cellDegreeSize; }), width = _b[0], height = _b[1];
3756
+ var ids = [];
3757
+ var cells = [];
3758
+ var max = [curMinLon, curMinLat];
3759
+ var intersections = this.intersections(viewRect);
3760
+ var addCell = function (x, y) {
3761
+ var lon1 = x * cellDegreeSize + curMinLon;
3762
+ var lat1 = y * cellDegreeSize + curMinLat;
3763
+ var lon2 = lon1 + cellDegreeSize;
3764
+ var lat2 = lat1 + cellDegreeSize;
3765
+ var _a = getOrCreateCell(_this.cells, cellDegreeSize, lon1, lon2, lat1, lat2), id = _a[0], cell = _a[1];
3766
+ {
3767
+ var cell_bounds = { south: lat1, west: lon1, north: lat2, east: lon2 };
3768
+ var subcells = [];
3769
+ for (var _i = 0, intersections_1 = intersections; _i < intersections_1.length; _i++) {
3770
+ var id_1 = intersections_1[_i];
3771
+ var c = _this.cells[id_1].GetBounds();
3772
+ if (contains(c, cell_bounds)) {
3773
+ cell.Fetched = true;
3774
+ return;
3775
+ }
3776
+ if (intersects(c, cell_bounds)) {
3777
+ var cropped = crop(c, cell.GetBounds());
3778
+ subcells.push(cropped);
3779
+ }
3780
+ }
3781
+ var filled = 0;
3782
+ while (subcells.length > 0) {
3783
+ var c = subcells.pop();
3784
+ filled += area(c);
3785
+ for (var _b = 0, subcells_1 = subcells; _b < subcells_1.length; _b++) {
3786
+ var s = subcells_1[_b];
3787
+ filled -= intersection(s, c);
3788
+ }
3789
+ }
3790
+ if (filled + Number.EPSILON * 2 > area(cell.GetBounds())) {
3791
+ cell.Fetched = true;
3792
+ return;
3793
+ }
3794
+ var x2_1 = max[0], y2_1 = max[1];
3795
+ x2_1 = Math.max(x2_1, lon2);
3796
+ y2_1 = Math.max(y2_1, lat2);
3797
+ max = [x2_1, y2_1];
3798
+ }
3799
+ ids.push(id);
3800
+ cells.push(cell);
3801
+ cells[id] = cell;
3802
+ };
3763
3803
  for (var x = 0; x < width; x++) {
3764
3804
  for (var y = 0; y < height; y++) {
3765
- var lon = x * cellDegreeSize + curMinLon;
3766
- var lat = y * cellDegreeSize + curMinLat;
3767
- var cell = getOrCreateCell(this.cells, cellDegreeSize, lon, lon + cellDegreeSize, lat, lat + cellDegreeSize);
3768
- cells.push(cell);
3769
- if (cells.length > MAX_CELLS) {
3805
+ addCell(x, y);
3806
+ if (cells.length >= MAX_CELLS) {
3770
3807
  break;
3771
3808
  }
3772
3809
  }
3773
3810
  }
3811
+ var x2 = max[0], y2 = max[1];
3812
+ if (x2 != curMinLon && y2 != curMinLat) {
3813
+ this.patches.push([{ west: curMinLon, east: x2, south: curMinLat, north: y2 }, ids]);
3814
+ }
3774
3815
  return cells;
3775
3816
  };
3817
+ Grid.prototype.intersections = function (withRect) {
3818
+ return this.patches
3819
+ .filter(function (_a) {
3820
+ var rect = _a[0], _ = _a[1];
3821
+ return intersects(rect, withRect);
3822
+ })
3823
+ .map(function (_a) {
3824
+ var _ = _a[0], ids = _a[1];
3825
+ return ids;
3826
+ })
3827
+ .reduce(function (all, ids) {
3828
+ all.push.apply(all, ids);
3829
+ return all;
3830
+ }, []);
3831
+ };
3776
3832
  return Grid;
3777
3833
  }());
3778
3834
  EntityGlobe.Grid = Grid;
3779
- })(exports.EntityGlobe || (exports.EntityGlobe = {}));
3835
+ })(exports.EntityGlobe || (exports.EntityGlobe = {}));
3836
+ function intersects(l, r) {
3837
+ var w = l.west, s = l.south, n = l.north, e = l.east;
3838
+ var wr = r.west, sr = r.south, nr = r.north, er = r.east;
3839
+ return !(e <= wr || w >= er || n <= sr || s >= nr);
3840
+ }
3841
+ function contains(l, r) {
3842
+ var w = l.west, s = l.south, n = l.north, e = l.east;
3843
+ var wr = r.west, sr = r.south, nr = r.north, er = r.east;
3844
+ return !(er < e || wr > w || nr > n || sr < s);
3845
+ }
3846
+ function crop(rect, by) {
3847
+ var w = rect.west, s = rect.south, n = rect.north, e = rect.east;
3848
+ var wc = by.west, sc = by.south, nc = by.north, ec = by.east;
3849
+ w = Math.max(w, ec);
3850
+ e = Math.min(e, wc);
3851
+ s = Math.max(s, nc);
3852
+ n = Math.min(n, sc);
3853
+ return { west: w, south: s, north: n, east: e };
3854
+ }
3855
+ function intersection(l, r) {
3856
+ var w = l.west, s = l.south, n = l.north, e = l.east;
3857
+ var wr = r.west, sr = r.south, nr = r.north, er = r.east;
3858
+ var x = Math.min(e, er) - Math.max(w, wr);
3859
+ var y = Math.min(n, nr) - Math.max(s, sr);
3860
+ return (x > 0 && y > 0) ? x * y : 0;
3861
+ }
3862
+ function area(rect) {
3863
+ var w = rect.west, s = rect.south, n = rect.north, e = rect.east;
3864
+ return Math.abs((e - w) * (n - s));
3865
+ }
3780
3866
 
3781
3867
  var MAX_AREA_IN_DEGREES = 90;
3782
3868
  var MAX_RETRY_ATTEMPTS = 1;
@@ -6605,7 +6691,7 @@
6605
6691
  if (pageIndex > 0) {
6606
6692
  url += (first ? "?" : "&") + "pageIndex=" + pageIndex;
6607
6693
  }
6608
- req = api.GET(url);
6694
+ req = api.GET(url, exports.Api.PrepReqParams());
6609
6695
  prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
6610
6696
  var data, e_1;
6611
6697
  return __generator(this, function (_a) {
@@ -6639,7 +6725,7 @@
6639
6725
  if (cacheData) {
6640
6726
  return [2 /*return*/, cacheData];
6641
6727
  }
6642
- req = api.GET("entityImportFile/" + fileId);
6728
+ req = api.GET("entityImportFile/" + fileId, exports.Api.PrepReqParams());
6643
6729
  api.Cache.Set(GetCacheKey(fileId), req, exports.Api.DEFAULT_CACHE_DURATION);
6644
6730
  return [2 /*return*/, req];
6645
6731
  });