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
@@ -3819,15 +3819,13 @@ function isCellFetched(cell) {
3819
3819
  if (cell.Fetched) {
3820
3820
  return true;
3821
3821
  }
3822
- // TODO: If all cells of the size smaller are fetched then this is fetched.
3823
- // TODO: If this is a cell within a larger cell that is fetched then this is fetched.
3824
3822
  return false;
3825
3823
  }
3826
3824
  function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
3827
3825
  var id = cellSize + "_" + lon + "_" + maxLon + "_" + lat + "_" + maxLat;
3828
3826
  var cell = getCell(cells, cellSize, lon, maxLon, lat, maxLat);
3829
3827
  if (!cell) {
3830
- cell = cells[id] = new Cell();
3828
+ cell = new Cell();
3831
3829
  cell.Boundaries = {
3832
3830
  minLatitude: lat,
3833
3831
  maxLatitude: maxLat,
@@ -3836,7 +3834,7 @@ function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
3836
3834
  };
3837
3835
  cell.IsFetched = function () { return isCellFetched(cell); };
3838
3836
  }
3839
- return cell;
3837
+ return [id, cell];
3840
3838
  }
3841
3839
  /**
3842
3840
  * This is a helper for making entity requests based on a grid area.
@@ -3850,34 +3848,122 @@ var EntityGlobe;
3850
3848
  this.cells = {};
3851
3849
  }
3852
3850
  Grid.prototype.GetCellsForView = function (viewRect) {
3853
- var cells = [];
3854
- var minLat = viewRect.south;
3855
- var minLon = viewRect.west;
3856
- var maxLat = viewRect.north;
3857
- var maxLon = viewRect.east;
3851
+ var _this = this;
3858
3852
  var MAX_CELLS = 150;
3853
+ var minLat = viewRect.south, minLon = viewRect.west, maxLat = viewRect.north, maxLon = viewRect.east;
3859
3854
  var cellDegreeSize = getCellSizeFromHeight(viewRect.alt);
3860
- var curMinLon = floorValueToCellSize(cellDegreeSize, minLon);
3861
- var curMinLat = floorValueToCellSize(cellDegreeSize, minLat);
3862
- var width = (maxLon - curMinLon) / cellDegreeSize;
3863
- var height = (maxLat - curMinLat) / cellDegreeSize;
3855
+ var _a = [minLon, minLat].map(function (v) { return floorValueToCellSize(cellDegreeSize, v); }), curMinLon = _a[0], curMinLat = _a[1];
3856
+ var _b = [maxLon - curMinLon, maxLat - curMinLat].map(function (v) { return v / cellDegreeSize; }), width = _b[0], height = _b[1];
3857
+ var ids = [];
3858
+ var cells = [];
3859
+ var max = [curMinLon, curMinLat];
3860
+ var intersections = this.intersections(viewRect);
3861
+ var addCell = function (x, y) {
3862
+ var lon1 = x * cellDegreeSize + curMinLon;
3863
+ var lat1 = y * cellDegreeSize + curMinLat;
3864
+ var lon2 = lon1 + cellDegreeSize;
3865
+ var lat2 = lat1 + cellDegreeSize;
3866
+ var _a = getOrCreateCell(_this.cells, cellDegreeSize, lon1, lon2, lat1, lat2), id = _a[0], cell = _a[1];
3867
+ {
3868
+ var cell_bounds = { south: lat1, west: lon1, north: lat2, east: lon2 };
3869
+ var subcells = [];
3870
+ for (var _i = 0, intersections_1 = intersections; _i < intersections_1.length; _i++) {
3871
+ var id_1 = intersections_1[_i];
3872
+ var c = _this.cells[id_1].GetBounds();
3873
+ if (contains(c, cell_bounds)) {
3874
+ cell.Fetched = true;
3875
+ return;
3876
+ }
3877
+ if (intersects(c, cell_bounds)) {
3878
+ var cropped = crop(c, cell.GetBounds());
3879
+ subcells.push(cropped);
3880
+ }
3881
+ }
3882
+ var filled = 0;
3883
+ while (subcells.length > 0) {
3884
+ var c = subcells.pop();
3885
+ filled += area(c);
3886
+ for (var _b = 0, subcells_1 = subcells; _b < subcells_1.length; _b++) {
3887
+ var s = subcells_1[_b];
3888
+ filled -= intersection(s, c);
3889
+ }
3890
+ }
3891
+ if (filled + Number.EPSILON * 2 > area(cell.GetBounds())) {
3892
+ cell.Fetched = true;
3893
+ return;
3894
+ }
3895
+ var x2_1 = max[0], y2_1 = max[1];
3896
+ x2_1 = Math.max(x2_1, lon2);
3897
+ y2_1 = Math.max(y2_1, lat2);
3898
+ max = [x2_1, y2_1];
3899
+ }
3900
+ ids.push(id);
3901
+ cells.push(cell);
3902
+ cells[id] = cell;
3903
+ };
3864
3904
  for (var x = 0; x < width; x++) {
3865
3905
  for (var y = 0; y < height; y++) {
3866
- var lon = x * cellDegreeSize + curMinLon;
3867
- var lat = y * cellDegreeSize + curMinLat;
3868
- var cell = getOrCreateCell(this.cells, cellDegreeSize, lon, lon + cellDegreeSize, lat, lat + cellDegreeSize);
3869
- cells.push(cell);
3870
- if (cells.length > MAX_CELLS) {
3906
+ addCell(x, y);
3907
+ if (cells.length >= MAX_CELLS) {
3871
3908
  break;
3872
3909
  }
3873
3910
  }
3874
3911
  }
3912
+ var x2 = max[0], y2 = max[1];
3913
+ if (x2 != curMinLon && y2 != curMinLat) {
3914
+ this.patches.push([{ west: curMinLon, east: x2, south: curMinLat, north: y2 }, ids]);
3915
+ }
3875
3916
  return cells;
3876
3917
  };
3918
+ Grid.prototype.intersections = function (withRect) {
3919
+ return this.patches
3920
+ .filter(function (_a) {
3921
+ var rect = _a[0], _ = _a[1];
3922
+ return intersects(rect, withRect);
3923
+ })
3924
+ .map(function (_a) {
3925
+ var _ = _a[0], ids = _a[1];
3926
+ return ids;
3927
+ })
3928
+ .reduce(function (all, ids) {
3929
+ all.push.apply(all, ids);
3930
+ return all;
3931
+ }, []);
3932
+ };
3877
3933
  return Grid;
3878
3934
  }());
3879
3935
  EntityGlobe.Grid = Grid;
3880
- })(EntityGlobe || (EntityGlobe = {}));
3936
+ })(EntityGlobe || (EntityGlobe = {}));
3937
+ function intersects(l, r) {
3938
+ var w = l.west, s = l.south, n = l.north, e = l.east;
3939
+ var wr = r.west, sr = r.south, nr = r.north, er = r.east;
3940
+ return !(e <= wr || w >= er || n <= sr || s >= nr);
3941
+ }
3942
+ function contains(l, r) {
3943
+ var w = l.west, s = l.south, n = l.north, e = l.east;
3944
+ var wr = r.west, sr = r.south, nr = r.north, er = r.east;
3945
+ return !(er < e || wr > w || nr > n || sr < s);
3946
+ }
3947
+ function crop(rect, by) {
3948
+ var w = rect.west, s = rect.south, n = rect.north, e = rect.east;
3949
+ var wc = by.west, sc = by.south, nc = by.north, ec = by.east;
3950
+ w = Math.max(w, ec);
3951
+ e = Math.min(e, wc);
3952
+ s = Math.max(s, nc);
3953
+ n = Math.min(n, sc);
3954
+ return { west: w, south: s, north: n, east: e };
3955
+ }
3956
+ function intersection(l, r) {
3957
+ var w = l.west, s = l.south, n = l.north, e = l.east;
3958
+ var wr = r.west, sr = r.south, nr = r.north, er = r.east;
3959
+ var x = Math.min(e, er) - Math.max(w, wr);
3960
+ var y = Math.min(n, nr) - Math.max(s, sr);
3961
+ return (x > 0 && y > 0) ? x * y : 0;
3962
+ }
3963
+ function area(rect) {
3964
+ var w = rect.west, s = rect.south, n = rect.north, e = rect.east;
3965
+ return Math.abs((e - w) * (n - s));
3966
+ }
3881
3967
 
3882
3968
  var MAX_AREA_IN_DEGREES = 90;
3883
3969
  var MAX_RETRY_ATTEMPTS = 1;
@@ -6815,7 +6901,7 @@ var ImportedFile;
6815
6901
  if (pageIndex > 0) {
6816
6902
  url += (first ? "?" : "&") + "pageIndex=" + pageIndex;
6817
6903
  }
6818
- req = api.GET(url);
6904
+ req = api.GET(url, Api.PrepReqParams());
6819
6905
  prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
6820
6906
  var data, e_1;
6821
6907
  return __generator(this, function (_a) {
@@ -6849,7 +6935,7 @@ var ImportedFile;
6849
6935
  if (cacheData) {
6850
6936
  return [2 /*return*/, cacheData];
6851
6937
  }
6852
- req = api.GET("entityImportFile/" + fileId);
6938
+ req = api.GET("entityImportFile/" + fileId, Api.PrepReqParams());
6853
6939
  api.Cache.Set(GetCacheKey(fileId), req, Api.DEFAULT_CACHE_DURATION);
6854
6940
  return [2 /*return*/, req];
6855
6941
  });