bruce-models 3.1.4 → 3.1.6

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 (47) hide show
  1. package/dist/bruce-models.es5.js +47 -570
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +44 -557
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/bruce-models.js +3 -5
  6. package/dist/lib/bruce-models.js.map +1 -1
  7. package/dist/lib/client-file/client-file.js.map +1 -1
  8. package/dist/lib/custom-form/custom-form.js.map +1 -1
  9. package/dist/lib/project/project-view-bookmark.js +0 -8
  10. package/dist/lib/project/project-view-bookmark.js.map +1 -1
  11. package/dist/lib/project/project-view-legacy-bookmark.js +12 -0
  12. package/dist/lib/project/project-view-legacy-bookmark.js.map +1 -0
  13. package/dist/lib/project/project-view-legacy-tile.js.map +1 -1
  14. package/dist/lib/project/project-view-legacy.js +12 -0
  15. package/dist/lib/project/project-view-legacy.js.map +1 -0
  16. package/dist/lib/project/project-view.js +1 -9
  17. package/dist/lib/project/project-view.js.map +1 -1
  18. package/dist/lib/user/permission.js +1 -0
  19. package/dist/lib/user/permission.js.map +1 -1
  20. package/dist/lib/util/object-utils.js +25 -6
  21. package/dist/lib/util/object-utils.js.map +1 -1
  22. package/dist/types/bruce-models.d.ts +3 -5
  23. package/dist/types/client-file/client-file.d.ts +5 -5
  24. package/dist/types/entity/entity-attachment.d.ts +1 -1
  25. package/dist/types/entity/entity-lod.d.ts +1 -1
  26. package/dist/types/entity/entity-type.d.ts +5 -5
  27. package/dist/types/entity/entity.d.ts +1 -1
  28. package/dist/types/import/imported-file.d.ts +1 -1
  29. package/dist/types/project/project-view-bookmark.d.ts +56 -113
  30. package/dist/types/project/project-view-legacy-bookmark.d.ts +62 -0
  31. package/dist/types/project/project-view-legacy.d.ts +49 -0
  32. package/dist/types/project/project-view.d.ts +30 -82
  33. package/dist/types/user/permission.d.ts +1 -0
  34. package/dist/types/util/object-utils.d.ts +2 -2
  35. package/package.json +1 -1
  36. package/dist/lib/entity/getters/batched-data-getter.js +0 -85
  37. package/dist/lib/entity/getters/batched-data-getter.js.map +0 -1
  38. package/dist/lib/entity/getters/entity-filter-getter.js +0 -321
  39. package/dist/lib/entity/getters/entity-filter-getter.js.map +0 -1
  40. package/dist/lib/entity/getters/entity-globe.js +0 -192
  41. package/dist/lib/entity/getters/entity-globe.js.map +0 -1
  42. package/dist/lib/entity/getters/view-monitor.js +0 -3
  43. package/dist/lib/entity/getters/view-monitor.js.map +0 -1
  44. package/dist/types/entity/getters/batched-data-getter.d.ts +0 -26
  45. package/dist/types/entity/getters/entity-filter-getter.d.ts +0 -61
  46. package/dist/types/entity/getters/entity-globe.d.ts +0 -21
  47. package/dist/types/entity/getters/view-monitor.d.ts +0 -13
@@ -1970,15 +1970,34 @@ var Color;
1970
1970
 
1971
1971
  var ObjectUtils;
1972
1972
  (function (ObjectUtils) {
1973
+ const DEFAULT_LENGTH = 36;
1973
1974
  /**
1974
- * Generates a Bruce compatible UID.
1975
+ * Generates a Nextspace compatible UID.
1975
1976
  * @returns
1976
1977
  */
1977
- function UId() {
1978
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
1979
- const r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
1980
- return v.toString(16);
1981
- });
1978
+ function UId(length = DEFAULT_LENGTH) {
1979
+ if (!length) {
1980
+ length = DEFAULT_LENGTH;
1981
+ }
1982
+ if (length <= 0) {
1983
+ return "";
1984
+ }
1985
+ // Our default spec.
1986
+ if (length === DEFAULT_LENGTH) {
1987
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
1988
+ const r = Math.random() * 16 | 0, v = c === "x" ? r : (r & 0x3 | 0x8);
1989
+ return v.toString(16);
1990
+ });
1991
+ }
1992
+ // Arbitrary random hex string.
1993
+ else {
1994
+ let result = "";
1995
+ for (let i = 0; i < length; i++) {
1996
+ const randomHex = Math.random() * 16 | 0;
1997
+ result += randomHex.toString(16);
1998
+ }
1999
+ return result;
2000
+ }
1982
2001
  }
1983
2002
  ObjectUtils.UId = UId;
1984
2003
  })(ObjectUtils || (ObjectUtils = {}));
@@ -4801,551 +4820,6 @@ var EntityType;
4801
4820
  EntityType.Update = Update;
4802
4821
  })(EntityType || (EntityType = {}));
4803
4822
 
4804
- /**
4805
- * This is a helper for making entity requests based on a grid area.
4806
- * It will return grid cells based on given view-area then will remember when stuff-
4807
- * was fully-fetched for those cells to avoid making duplicate requests.
4808
- */
4809
- var EntityGlobe;
4810
- (function (EntityGlobe) {
4811
- class Cell {
4812
- constructor() {
4813
- this.Fetched = false;
4814
- this.IsFetched = null;
4815
- this.FetchPageIndex = 0;
4816
- this.Boundaries = null;
4817
- this.Fetching = false;
4818
- }
4819
- GetBounds() {
4820
- // Entity data works in -180 to 180 range.
4821
- function prepareRangeForBounds(range) {
4822
- if (range > 180) {
4823
- return range - 360;
4824
- }
4825
- return range;
4826
- }
4827
- // Add minor decimal as API crashes when giving it whole numbers.
4828
- const maxLon = prepareRangeForBounds(this.Boundaries.maxLongitude) + 0.00001;
4829
- const minLon = prepareRangeForBounds(this.Boundaries.minLongitude) - 0.00001;
4830
- const maxLat = prepareRangeForBounds(this.Boundaries.maxLatitude) + 0.00001;
4831
- const minLat = prepareRangeForBounds(this.Boundaries.minLatitude) - 0.00001;
4832
- return {
4833
- east: maxLon,
4834
- north: maxLat,
4835
- south: minLat,
4836
- west: minLon
4837
- };
4838
- }
4839
- }
4840
- EntityGlobe.Cell = Cell;
4841
- class Grid {
4842
- constructor() {
4843
- this.cells = {};
4844
- }
4845
- GetCellsForView(cameraPos, viewRect) {
4846
- const cells = [];
4847
- const minLat = viewRect.south;
4848
- const minLon = viewRect.west;
4849
- const maxLat = viewRect.north;
4850
- const maxLon = viewRect.east;
4851
- const MAX_CELLS = 150;
4852
- const cellDegreeSize = getCellSizeFromHeight(viewRect.alt);
4853
- let curMinLon = floorValueToCellSize(cellDegreeSize, minLon);
4854
- let curMinLat = floorValueToCellSize(cellDegreeSize, minLat);
4855
- // For larger views we add additional padding because our view-area culling is too strong.
4856
- if (cellDegreeSize >= 2) {
4857
- curMinLon -= cellDegreeSize;
4858
- curMinLat -= cellDegreeSize;
4859
- }
4860
- let centerX = cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.longitude;
4861
- let centerY = cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.latitude;
4862
- if (isNaN(centerX) || isNaN(centerY)) {
4863
- centerX = (minLon + maxLon) / 2;
4864
- centerY = (minLat + maxLat) / 2;
4865
- }
4866
- let width = Math.ceil((maxLon - curMinLon) / cellDegreeSize);
4867
- let height = Math.ceil((maxLat - curMinLat) / cellDegreeSize);
4868
- // For larger views we add additional padding because our view-area culling is too strong.
4869
- if (cellDegreeSize >= 2) {
4870
- width += 1;
4871
- height += 1;
4872
- }
4873
- const cellDistances = [];
4874
- for (let x = 0; x < width; x++) {
4875
- for (let y = 0; y < height; y++) {
4876
- const lon = x * cellDegreeSize + curMinLon;
4877
- const lat = y * cellDegreeSize + curMinLat;
4878
- const cellCenterX = lon + cellDegreeSize / 2;
4879
- const cellCenterY = lat + cellDegreeSize / 2;
4880
- const dist = Math.sqrt(Math.pow(cellCenterX - centerX, 2) + Math.pow(cellCenterY - centerY, 2));
4881
- cellDistances.push({ x, y, dist });
4882
- }
4883
- }
4884
- cellDistances.sort((a, b) => a.dist - b.dist);
4885
- for (const { x, y } of cellDistances) {
4886
- const lon = x * cellDegreeSize + curMinLon;
4887
- const lat = y * cellDegreeSize + curMinLat;
4888
- const [id, cell] = getOrCreateCell(this.cells, cellDegreeSize, lon, lon + cellDegreeSize, lat, lat + cellDegreeSize);
4889
- cells.push(cell);
4890
- if (cells.length >= MAX_CELLS) {
4891
- break;
4892
- }
4893
- }
4894
- return cells;
4895
- }
4896
- }
4897
- EntityGlobe.Grid = Grid;
4898
- })(EntityGlobe || (EntityGlobe = {}));
4899
- function floorValueToCellSize(size, value) {
4900
- return Math.floor(value / size) * size;
4901
- }
4902
- function getCellSizeFromHeight(height) {
4903
- if (height < 1000) {
4904
- return 0.01;
4905
- }
4906
- if (height < 5000) {
4907
- return 0.025;
4908
- }
4909
- else if (height < 10000) {
4910
- return 0.05;
4911
- }
4912
- else if (height < 30000) {
4913
- return 0.1;
4914
- }
4915
- else if (height < 70000) {
4916
- return 0.2;
4917
- }
4918
- else if (height < 100000) {
4919
- return 0.3;
4920
- }
4921
- else if (height < 150000) {
4922
- return 0.4;
4923
- }
4924
- else if (height < 200000) {
4925
- return 0.5;
4926
- }
4927
- else if (height < 300000) {
4928
- return 0.6;
4929
- }
4930
- else if (height < 500000) {
4931
- return 1;
4932
- }
4933
- else if (height < 1000000) {
4934
- return 1.3;
4935
- }
4936
- else if (height < 1200000) {
4937
- return 1.8;
4938
- }
4939
- return 4;
4940
- }
4941
- function isCellFetched(cell) {
4942
- if (cell.Fetched) {
4943
- return true;
4944
- }
4945
- return false;
4946
- }
4947
- function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
4948
- const id = cellSize + "_" + lon + "_" + maxLon + "_" + lat + "_" + maxLat;
4949
- let cell = cells[id];
4950
- if (!cell) {
4951
- cell = cells[id] = new EntityGlobe.Cell();
4952
- cell.Boundaries = {
4953
- minLatitude: lat,
4954
- maxLatitude: maxLat,
4955
- minLongitude: lon,
4956
- maxLongitude: maxLon
4957
- };
4958
- cell.IsFetched = () => isCellFetched(cell);
4959
- }
4960
- return [id, cell];
4961
- }
4962
-
4963
- const MAX_AREA_IN_DEGREES = 90;
4964
- const MAX_RETRY_ATTEMPTS = 1;
4965
- const RETRY_DELAY_INCREMENT = 500;
4966
- const REQUEST_PAGE_DELAY = 50;
4967
- class regMenuItemGetter {
4968
- constructor(tagIds, minHeight, maxHeight) {
4969
- this.TagIds = tagIds;
4970
- this.MinHeight = minHeight;
4971
- this.MaxHeight = maxHeight;
4972
- }
4973
- }
4974
- function delay(milliseconds) {
4975
- return __awaiter(this, void 0, void 0, function* () {
4976
- return new Promise((res) => {
4977
- setTimeout(() => {
4978
- res();
4979
- }, milliseconds);
4980
- });
4981
- });
4982
- }
4983
- /**
4984
- * This is a batched entity getter.
4985
- * It will scan for entity records in a view-area and emit them in batches.
4986
- * It will restart scanning if the camera moves.
4987
- */
4988
- var EntityFilterGetter;
4989
- (function (EntityFilterGetter) {
4990
- let EStatus;
4991
- (function (EStatus) {
4992
- EStatus["Scanning"] = "SCANNING";
4993
- EStatus["Loading"] = "LOADING";
4994
- })(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
4995
- class Getter {
4996
- get OnUpdate() {
4997
- if (!this.onUpdate) {
4998
- this.onUpdate = new BruceEvent();
4999
- }
5000
- return this.onUpdate;
5001
- }
5002
- get OnStateUpdate() {
5003
- if (!this.onStateUpdate) {
5004
- this.onStateUpdate = new BruceEvent();
5005
- }
5006
- return this.onStateUpdate;
5007
- }
5008
- get OnScanUpdate() {
5009
- if (!this.onScanUpdate) {
5010
- this.onScanUpdate = new BruceEvent();
5011
- }
5012
- return this.onScanUpdate;
5013
- }
5014
- constructor(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
5015
- this.onUpdate = null;
5016
- this.LastStateUpdates = {};
5017
- this.onStateUpdate = null;
5018
- this.onScanUpdate = null;
5019
- this.viewPortChangeRemoval = null;
5020
- this.cells = null;
5021
- this.registeredItems = {};
5022
- this.getterLoopId = 0;
5023
- this.tagIds = null;
5024
- this.minHeight = 0;
5025
- this.maxHeight = 100000;
5026
- this.viewRect = null;
5027
- this.viewCenter = null;
5028
- this.api = api;
5029
- this.typeId = typeId;
5030
- this.viaCdn = Boolean(viaCdn);
5031
- this.batchSize = isNaN(batchSize) ? 300 : batchSize;
5032
- this.viewPort = viewPort;
5033
- this.attrFilter = attrFilter;
5034
- this.updateBounds();
5035
- }
5036
- /**
5037
- * Returns id that represents the combined menu item parameters.
5038
- * If integrity changes while a request is running, the request will not emit a response.
5039
- * @returns
5040
- */
5041
- getIntegrityId() {
5042
- return this.tagIds == null ? "" : this.tagIds.join();
5043
- }
5044
- viewAreaSub() {
5045
- this.viewAreaDispose();
5046
- this.viewPortChangeRemoval = this.viewPort.Updated().Subscribe(() => {
5047
- this.updateBounds();
5048
- this.startGetterLoop();
5049
- });
5050
- }
5051
- viewAreaDispose() {
5052
- var _a;
5053
- (_a = this.viewPortChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
5054
- }
5055
- GetMenuItems() {
5056
- return Object.keys(this.registeredItems);
5057
- }
5058
- IncludeMenuItem(menuItemId, layerIds, minHeight, maxHeight) {
5059
- this.registeredItems[menuItemId] = new regMenuItemGetter(layerIds, minHeight, maxHeight);
5060
- this.updateState();
5061
- }
5062
- ExcludeMenuItem(menuItemId) {
5063
- this.registeredItems[menuItemId] = null;
5064
- delete this.registeredItems[menuItemId];
5065
- this.updateState();
5066
- }
5067
- updateBounds() {
5068
- const viewRect = this.viewPort.GetBounds();
5069
- const poi = this.viewPort.GetTarget();
5070
- if (viewRect && poi) {
5071
- if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES) {
5072
- return;
5073
- }
5074
- if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES) {
5075
- return;
5076
- }
5077
- this.viewRect = viewRect;
5078
- this.viewCenter = poi;
5079
- }
5080
- }
5081
- updateState() {
5082
- const tagIds = [];
5083
- const menuItemIds = this.GetMenuItems();
5084
- let minHeight = null;
5085
- let maxHeight = null;
5086
- for (let i = 0; i < menuItemIds.length; i++) {
5087
- const menuItem = this.registeredItems[menuItemIds[i]];
5088
- if (menuItem) {
5089
- if (maxHeight == null || maxHeight < menuItem.MaxHeight) {
5090
- maxHeight = menuItem.MaxHeight;
5091
- }
5092
- if (minHeight == null || minHeight > menuItem.MinHeight) {
5093
- minHeight = menuItem.MinHeight;
5094
- }
5095
- const itemLayerIds = menuItem.TagIds;
5096
- if (itemLayerIds) {
5097
- for (let j = 0; j < itemLayerIds.length; j++) {
5098
- const itemLayerId = itemLayerIds[j];
5099
- if (!tagIds.includes(itemLayerId)) {
5100
- tagIds.push(itemLayerId);
5101
- }
5102
- }
5103
- }
5104
- }
5105
- }
5106
- if (menuItemIds.length > 0) {
5107
- // Reset cells so none are marked as fetched.
5108
- this.cells = new EntityGlobe.Grid();
5109
- this.tagIds = tagIds;
5110
- this.minHeight = minHeight;
5111
- this.maxHeight = maxHeight;
5112
- this.updateBounds();
5113
- this.startGetterLoop();
5114
- this.viewAreaSub();
5115
- }
5116
- else {
5117
- this.getterLoopId += 1;
5118
- this.viewAreaDispose();
5119
- }
5120
- }
5121
- postStatus(status) {
5122
- var _a;
5123
- this.LastStateUpdates[status.msg] = status;
5124
- (_a = this.onStateUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(status);
5125
- }
5126
- startGetterLoop() {
5127
- // Increase id so that existing loops stop.
5128
- this.getterLoopId += 1;
5129
- const loopId = this.getterLoopId;
5130
- const loopIntegrity = this.getIntegrityId();
5131
- new Promise(() => __awaiter(this, void 0, void 0, function* () {
5132
- var _a, _b, _c, _d, _e, _f, _g, _h;
5133
- // Minor delay to stop 50 menu items enabling doing their first request all together.
5134
- // This gives it time to recognize only 1 request is needed.
5135
- // Would be better to not use this delay but we're on a clock.
5136
- yield delay(100);
5137
- const MIN_HEIGHT = this.minHeight;
5138
- const MAX_HEIGHT = this.maxHeight;
5139
- const PAGE_SIZE = this.batchSize;
5140
- let retryAttempts = MAX_RETRY_ATTEMPTS;
5141
- let retryDelay = 0;
5142
- let prevFirstId = "";
5143
- let prevLastId = "";
5144
- let prevTicks = 0;
5145
- while ((!this.viewCenter || !this.viewRect) && this.getterLoopId == loopId) {
5146
- yield delay(RETRY_DELAY_INCREMENT);
5147
- }
5148
- if (this.getterLoopId != loopId) {
5149
- return;
5150
- }
5151
- const alt = this.viewRect.alt;
5152
- if (alt > MAX_HEIGHT || (alt < MIN_HEIGHT && MIN_HEIGHT > 0)) {
5153
- return;
5154
- }
5155
- const cells = this.cells.GetCellsForView(this.viewCenter, this.viewRect);
5156
- (_a = this.onScanUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(cells);
5157
- let curCellIndex = cells.length > 0 ? 0 : null;
5158
- let postedScanning = false;
5159
- let postedLoading = false;
5160
- let total = 0;
5161
- while (retryAttempts > 0 && curCellIndex != null) {
5162
- if (retryDelay > 0) {
5163
- yield delay(retryDelay);
5164
- }
5165
- if (this.getterLoopId != loopId) {
5166
- break;
5167
- }
5168
- if (!postedScanning) {
5169
- this.postStatus({ msg: EStatus.Scanning, revoking: false });
5170
- postedScanning = true;
5171
- }
5172
- const curCell = cells[curCellIndex];
5173
- if (curCell.IsFetched()) {
5174
- curCell.Fetching = false;
5175
- curCellIndex += 1;
5176
- if (cells[curCellIndex]) {
5177
- cells[curCellIndex].Fetching = true;
5178
- }
5179
- else {
5180
- curCellIndex = null;
5181
- }
5182
- (_b = this.onScanUpdate) === null || _b === void 0 ? void 0 : _b.Trigger(cells);
5183
- continue;
5184
- }
5185
- try {
5186
- let { entities } = yield Entity.GetList({
5187
- api: this.api,
5188
- filter: {
5189
- pageSize: PAGE_SIZE,
5190
- pageIndex: curCell.FetchPageIndex,
5191
- entityTypeId: this.typeId,
5192
- layerIds: this.tagIds,
5193
- // Any tag specified will be allowed.
5194
- layerIdsOperator: "in",
5195
- bounds: curCell.GetBounds(),
5196
- sortOrder: Api.ESortOrder.Asc,
5197
- entityTypeConditions: this.attrFilter
5198
- },
5199
- viaCdn: this.viaCdn,
5200
- req: {
5201
- noCache: true
5202
- }
5203
- });
5204
- const integrity = this.getIntegrityId();
5205
- if (loopIntegrity == integrity && entities) {
5206
- (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
5207
- }
5208
- if (this.getterLoopId != loopId) {
5209
- break;
5210
- }
5211
- if (entities.length) {
5212
- total += entities.length;
5213
- }
5214
- if (!postedLoading) {
5215
- this.postStatus({ msg: EStatus.Loading, revoking: false });
5216
- postedLoading = true;
5217
- }
5218
- // Only mark as fetched when ALL pages are done.
5219
- // Known issue where external sources may return less than page size.
5220
- // Right now we're making it as fetched as we're siding with the majority use-case.
5221
- if (entities.length <= 0 || entities.length < PAGE_SIZE) {
5222
- curCell.Fetched = true;
5223
- curCell.Fetching = false;
5224
- (_d = this.onScanUpdate) === null || _d === void 0 ? void 0 : _d.Trigger(cells);
5225
- continue;
5226
- }
5227
- // Checking to make sure it's not just the same batch over and over again.
5228
- if (entities.length > 0) {
5229
- const first = (_f = (_e = entities[0]) === null || _e === void 0 ? void 0 : _e.Bruce) === null || _f === void 0 ? void 0 : _f.ID;
5230
- const last = (_h = (_g = entities[entities.length - 1]) === null || _g === void 0 ? void 0 : _g.Bruce) === null || _h === void 0 ? void 0 : _h.ID;
5231
- if (prevFirstId == first && prevLastId == last) {
5232
- prevTicks += 1;
5233
- if (prevTicks > 3) {
5234
- break;
5235
- }
5236
- }
5237
- else {
5238
- prevFirstId = first;
5239
- prevLastId = last;
5240
- prevTicks = 0;
5241
- }
5242
- }
5243
- curCell.FetchPageIndex++;
5244
- // Request passed so let's assume it was server hiccup and refresh counts.
5245
- retryAttempts = MAX_RETRY_ATTEMPTS;
5246
- retryDelay = 0;
5247
- }
5248
- catch (e) {
5249
- console.error(e);
5250
- // Request failed so let's add a delay and try again soon.
5251
- retryDelay += RETRY_DELAY_INCREMENT;
5252
- retryAttempts -= 1;
5253
- }
5254
- yield delay(REQUEST_PAGE_DELAY);
5255
- }
5256
- if (postedLoading) {
5257
- this.postStatus({ msg: EStatus.Loading, revoking: true });
5258
- }
5259
- if (postedScanning) {
5260
- this.postStatus({ msg: EStatus.Scanning, revoking: true });
5261
- }
5262
- }));
5263
- }
5264
- }
5265
- EntityFilterGetter.Getter = Getter;
5266
- })(EntityFilterGetter || (EntityFilterGetter = {}));
5267
-
5268
- const MAX_AREA_IN_DEGREES$1 = 90;
5269
- const GETTER_DELAY = 50;
5270
- /**
5271
- * This is a batched "arbitrary data" getter.
5272
- * You feed it an array of data, then it will emit that data in batches when the view changes.
5273
- */
5274
- var BatchedDataGetter;
5275
- (function (BatchedDataGetter) {
5276
- class Getter {
5277
- get OnUpdate() {
5278
- if (!this.onUpdate) {
5279
- this.onUpdate = new BruceEvent();
5280
- }
5281
- return this.onUpdate;
5282
- }
5283
- constructor(data, viewPort, batchSize) {
5284
- this.viewPortRemoval = null;
5285
- this.viewRect = null;
5286
- this.viewCenter = null;
5287
- this.onUpdate = null;
5288
- this.data = data;
5289
- this.viewPort = viewPort;
5290
- this.batchSize = batchSize;
5291
- }
5292
- Start() {
5293
- this.viewPortRemoval = this.viewPort.Updated().Subscribe(() => {
5294
- this.updateViewport();
5295
- });
5296
- this.updateViewport();
5297
- }
5298
- Dispose() {
5299
- var _a;
5300
- (_a = this.viewPortRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
5301
- }
5302
- updateViewport() {
5303
- this.updateBounds();
5304
- this.startGetterLoop();
5305
- }
5306
- updateBounds() {
5307
- const viewRect = this.viewPort.GetBounds();
5308
- const poi = this.viewPort.GetTarget();
5309
- if (viewRect && poi) {
5310
- if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES$1) {
5311
- return;
5312
- }
5313
- if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES$1) {
5314
- return;
5315
- }
5316
- this.viewRect = viewRect;
5317
- this.viewCenter = poi;
5318
- }
5319
- }
5320
- startGetterLoop() {
5321
- clearInterval(this.getterInterval);
5322
- if (!this.viewRect || !this.viewCenter) {
5323
- return;
5324
- }
5325
- let index = 0;
5326
- const onTick = () => {
5327
- this.processBatch(this.data.slice(index, index + this.batchSize));
5328
- index += this.batchSize;
5329
- return index >= this.data.length;
5330
- };
5331
- if (!onTick()) {
5332
- this.getterInterval = setInterval(() => {
5333
- if (onTick()) {
5334
- clearInterval(this.getterInterval);
5335
- }
5336
- }, GETTER_DELAY);
5337
- }
5338
- }
5339
- processBatch(batch) {
5340
- var _a;
5341
- if (batch.length > 0) {
5342
- (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(batch);
5343
- }
5344
- }
5345
- }
5346
- BatchedDataGetter.Getter = Getter;
5347
- })(BatchedDataGetter || (BatchedDataGetter = {}));
5348
-
5349
4823
  var MathUtils;
5350
4824
  (function (MathUtils) {
5351
4825
  /**
@@ -6721,14 +6195,6 @@ var ProjectViewBookmark;
6721
6195
  // This is the expected default version for the DataVersion value.
6722
6196
  // This value should NOT be changed without looking at our API and seeing what the default value is.
6723
6197
  ProjectViewBookmark.DEFAULT_DATA_VERSION = 1;
6724
- let LegacyNavigator;
6725
- (function (LegacyNavigator) {
6726
- LegacyNavigator.DATA_VERSION = 1;
6727
- })(LegacyNavigator = ProjectViewBookmark.LegacyNavigator || (ProjectViewBookmark.LegacyNavigator = {}));
6728
- let Navigator;
6729
- (function (Navigator) {
6730
- Navigator.DATA_VERSION = 2;
6731
- })(Navigator = ProjectViewBookmark.Navigator || (ProjectViewBookmark.Navigator = {}));
6732
6198
  function Get(params) {
6733
6199
  return __awaiter(this, void 0, void 0, function* () {
6734
6200
  let { api, viewId, bookmarkId, req: reqParams } = params;
@@ -6880,15 +6346,7 @@ var ProjectView;
6880
6346
  ProjectView.GetListCacheKey = GetListCacheKey;
6881
6347
  // This is the expected default version for the DataVersion value.
6882
6348
  // This value should NOT be changed without looking at our API and seeing what the default value is.
6883
- ProjectView.DEFAULT_DATA_VERSION = 1;
6884
- let LegacyNavigator;
6885
- (function (LegacyNavigator) {
6886
- LegacyNavigator.DATA_VERSION = 1;
6887
- })(LegacyNavigator = ProjectView.LegacyNavigator || (ProjectView.LegacyNavigator = {}));
6888
- let Navigator;
6889
- (function (Navigator) {
6890
- Navigator.DATA_VERSION = 2;
6891
- })(Navigator = ProjectView.Navigator || (ProjectView.Navigator = {}));
6349
+ ProjectView.DEFAULT_DATA_VERSION = 2;
6892
6350
  function Get(params) {
6893
6351
  return __awaiter(this, void 0, void 0, function* () {
6894
6352
  let { api, viewId, req: reqParams } = params;
@@ -7196,6 +6654,24 @@ var ProjectViewTile;
7196
6654
  ];
7197
6655
  })(ProjectViewTile || (ProjectViewTile = {}));
7198
6656
 
6657
+ /**
6658
+ * Deprecated Project View record.
6659
+ * This was used in the legacy web Navigator.
6660
+ */
6661
+ var ProjectViewLegacy;
6662
+ (function (ProjectViewLegacy) {
6663
+ ProjectViewLegacy.DATA_VERSION = 1;
6664
+ })(ProjectViewLegacy || (ProjectViewLegacy = {}));
6665
+
6666
+ /**
6667
+ * Deprecated Project View Bookmark record.
6668
+ * This was used in the legacy web Navigator.
6669
+ */
6670
+ var ProjectViewLegacyBookmark;
6671
+ (function (ProjectViewLegacyBookmark) {
6672
+ ProjectViewLegacyBookmark.DATA_VERSION = 1;
6673
+ })(ProjectViewLegacyBookmark || (ProjectViewLegacyBookmark = {}));
6674
+
7199
6675
  /**
7200
6676
  * Describes the "Pending Action" concept within Bruce.
7201
6677
  * A pending action is a record of a server-side background process.
@@ -7410,6 +6886,7 @@ var Permission;
7410
6886
  let EPerm;
7411
6887
  (function (EPerm) {
7412
6888
  EPerm["ADMIN"] = "ADMIN";
6889
+ EPerm["ADMIN_VIEW"] = "ADMIN_VIEW";
7413
6890
  EPerm["LOGIN"] = "LOGIN";
7414
6891
  EPerm["DELETE_ENTITY_TYPE"] = "DELETE_ENTITY_TYPE";
7415
6892
  EPerm["CREATE_ENTITY_TYPE"] = "CREATE_ENTITY_TYPE";
@@ -9158,7 +8635,7 @@ var DataSource;
9158
8635
  DataSource.GetList = GetList;
9159
8636
  })(DataSource || (DataSource = {}));
9160
8637
 
9161
- const VERSION = "3.1.4";
8638
+ const VERSION = "3.1.6";
9162
8639
 
9163
- export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityGlobe, EntityFilterGetter, BatchedDataGetter, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
8640
+ export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, CamApi, IdmApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
9164
8641
  //# sourceMappingURL=bruce-models.es5.js.map