bruce-models 3.1.3 → 3.1.5
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.
- package/dist/bruce-models.es5.js +2 -547
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +1 -534
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -5
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -5
- package/dist/types/custom-form/custom-form-content.d.ts +1 -1
- package/package.json +1 -1
- package/dist/lib/entity/getters/batched-data-getter.js +0 -85
- package/dist/lib/entity/getters/batched-data-getter.js.map +0 -1
- package/dist/lib/entity/getters/entity-filter-getter.js +0 -321
- package/dist/lib/entity/getters/entity-filter-getter.js.map +0 -1
- package/dist/lib/entity/getters/entity-globe.js +0 -192
- package/dist/lib/entity/getters/entity-globe.js.map +0 -1
- package/dist/lib/entity/getters/view-monitor.js +0 -3
- package/dist/lib/entity/getters/view-monitor.js.map +0 -1
- package/dist/types/entity/getters/batched-data-getter.d.ts +0 -26
- package/dist/types/entity/getters/entity-filter-getter.d.ts +0 -61
- package/dist/types/entity/getters/entity-globe.d.ts +0 -21
- package/dist/types/entity/getters/view-monitor.d.ts +0 -13
package/dist/bruce-models.umd.js
CHANGED
|
@@ -4682,539 +4682,6 @@
|
|
|
4682
4682
|
EntityType.Update = Update;
|
|
4683
4683
|
})(exports.EntityType || (exports.EntityType = {}));
|
|
4684
4684
|
|
|
4685
|
-
/**
|
|
4686
|
-
* This is a helper for making entity requests based on a grid area.
|
|
4687
|
-
* It will return grid cells based on given view-area then will remember when stuff-
|
|
4688
|
-
* was fully-fetched for those cells to avoid making duplicate requests.
|
|
4689
|
-
*/
|
|
4690
|
-
(function (EntityGlobe) {
|
|
4691
|
-
class Cell {
|
|
4692
|
-
constructor() {
|
|
4693
|
-
this.Fetched = false;
|
|
4694
|
-
this.IsFetched = null;
|
|
4695
|
-
this.FetchPageIndex = 0;
|
|
4696
|
-
this.Boundaries = null;
|
|
4697
|
-
this.Fetching = false;
|
|
4698
|
-
}
|
|
4699
|
-
GetBounds() {
|
|
4700
|
-
// Entity data works in -180 to 180 range.
|
|
4701
|
-
function prepareRangeForBounds(range) {
|
|
4702
|
-
if (range > 180) {
|
|
4703
|
-
return range - 360;
|
|
4704
|
-
}
|
|
4705
|
-
return range;
|
|
4706
|
-
}
|
|
4707
|
-
// Add minor decimal as API crashes when giving it whole numbers.
|
|
4708
|
-
const maxLon = prepareRangeForBounds(this.Boundaries.maxLongitude) + 0.00001;
|
|
4709
|
-
const minLon = prepareRangeForBounds(this.Boundaries.minLongitude) - 0.00001;
|
|
4710
|
-
const maxLat = prepareRangeForBounds(this.Boundaries.maxLatitude) + 0.00001;
|
|
4711
|
-
const minLat = prepareRangeForBounds(this.Boundaries.minLatitude) - 0.00001;
|
|
4712
|
-
return {
|
|
4713
|
-
east: maxLon,
|
|
4714
|
-
north: maxLat,
|
|
4715
|
-
south: minLat,
|
|
4716
|
-
west: minLon
|
|
4717
|
-
};
|
|
4718
|
-
}
|
|
4719
|
-
}
|
|
4720
|
-
EntityGlobe.Cell = Cell;
|
|
4721
|
-
class Grid {
|
|
4722
|
-
constructor() {
|
|
4723
|
-
this.cells = {};
|
|
4724
|
-
}
|
|
4725
|
-
GetCellsForView(cameraPos, viewRect) {
|
|
4726
|
-
const cells = [];
|
|
4727
|
-
const minLat = viewRect.south;
|
|
4728
|
-
const minLon = viewRect.west;
|
|
4729
|
-
const maxLat = viewRect.north;
|
|
4730
|
-
const maxLon = viewRect.east;
|
|
4731
|
-
const MAX_CELLS = 150;
|
|
4732
|
-
const cellDegreeSize = getCellSizeFromHeight(viewRect.alt);
|
|
4733
|
-
let curMinLon = floorValueToCellSize(cellDegreeSize, minLon);
|
|
4734
|
-
let curMinLat = floorValueToCellSize(cellDegreeSize, minLat);
|
|
4735
|
-
// For larger views we add additional padding because our view-area culling is too strong.
|
|
4736
|
-
if (cellDegreeSize >= 2) {
|
|
4737
|
-
curMinLon -= cellDegreeSize;
|
|
4738
|
-
curMinLat -= cellDegreeSize;
|
|
4739
|
-
}
|
|
4740
|
-
let centerX = cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.longitude;
|
|
4741
|
-
let centerY = cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.latitude;
|
|
4742
|
-
if (isNaN(centerX) || isNaN(centerY)) {
|
|
4743
|
-
centerX = (minLon + maxLon) / 2;
|
|
4744
|
-
centerY = (minLat + maxLat) / 2;
|
|
4745
|
-
}
|
|
4746
|
-
let width = Math.ceil((maxLon - curMinLon) / cellDegreeSize);
|
|
4747
|
-
let height = Math.ceil((maxLat - curMinLat) / cellDegreeSize);
|
|
4748
|
-
// For larger views we add additional padding because our view-area culling is too strong.
|
|
4749
|
-
if (cellDegreeSize >= 2) {
|
|
4750
|
-
width += 1;
|
|
4751
|
-
height += 1;
|
|
4752
|
-
}
|
|
4753
|
-
const cellDistances = [];
|
|
4754
|
-
for (let x = 0; x < width; x++) {
|
|
4755
|
-
for (let y = 0; y < height; y++) {
|
|
4756
|
-
const lon = x * cellDegreeSize + curMinLon;
|
|
4757
|
-
const lat = y * cellDegreeSize + curMinLat;
|
|
4758
|
-
const cellCenterX = lon + cellDegreeSize / 2;
|
|
4759
|
-
const cellCenterY = lat + cellDegreeSize / 2;
|
|
4760
|
-
const dist = Math.sqrt(Math.pow(cellCenterX - centerX, 2) + Math.pow(cellCenterY - centerY, 2));
|
|
4761
|
-
cellDistances.push({ x, y, dist });
|
|
4762
|
-
}
|
|
4763
|
-
}
|
|
4764
|
-
cellDistances.sort((a, b) => a.dist - b.dist);
|
|
4765
|
-
for (const { x, y } of cellDistances) {
|
|
4766
|
-
const lon = x * cellDegreeSize + curMinLon;
|
|
4767
|
-
const lat = y * cellDegreeSize + curMinLat;
|
|
4768
|
-
const [id, cell] = getOrCreateCell(this.cells, cellDegreeSize, lon, lon + cellDegreeSize, lat, lat + cellDegreeSize);
|
|
4769
|
-
cells.push(cell);
|
|
4770
|
-
if (cells.length >= MAX_CELLS) {
|
|
4771
|
-
break;
|
|
4772
|
-
}
|
|
4773
|
-
}
|
|
4774
|
-
return cells;
|
|
4775
|
-
}
|
|
4776
|
-
}
|
|
4777
|
-
EntityGlobe.Grid = Grid;
|
|
4778
|
-
})(exports.EntityGlobe || (exports.EntityGlobe = {}));
|
|
4779
|
-
function floorValueToCellSize(size, value) {
|
|
4780
|
-
return Math.floor(value / size) * size;
|
|
4781
|
-
}
|
|
4782
|
-
function getCellSizeFromHeight(height) {
|
|
4783
|
-
if (height < 1000) {
|
|
4784
|
-
return 0.01;
|
|
4785
|
-
}
|
|
4786
|
-
if (height < 5000) {
|
|
4787
|
-
return 0.025;
|
|
4788
|
-
}
|
|
4789
|
-
else if (height < 10000) {
|
|
4790
|
-
return 0.05;
|
|
4791
|
-
}
|
|
4792
|
-
else if (height < 30000) {
|
|
4793
|
-
return 0.1;
|
|
4794
|
-
}
|
|
4795
|
-
else if (height < 70000) {
|
|
4796
|
-
return 0.2;
|
|
4797
|
-
}
|
|
4798
|
-
else if (height < 100000) {
|
|
4799
|
-
return 0.3;
|
|
4800
|
-
}
|
|
4801
|
-
else if (height < 150000) {
|
|
4802
|
-
return 0.4;
|
|
4803
|
-
}
|
|
4804
|
-
else if (height < 200000) {
|
|
4805
|
-
return 0.5;
|
|
4806
|
-
}
|
|
4807
|
-
else if (height < 300000) {
|
|
4808
|
-
return 0.6;
|
|
4809
|
-
}
|
|
4810
|
-
else if (height < 500000) {
|
|
4811
|
-
return 1;
|
|
4812
|
-
}
|
|
4813
|
-
else if (height < 1000000) {
|
|
4814
|
-
return 1.3;
|
|
4815
|
-
}
|
|
4816
|
-
else if (height < 1200000) {
|
|
4817
|
-
return 1.8;
|
|
4818
|
-
}
|
|
4819
|
-
return 4;
|
|
4820
|
-
}
|
|
4821
|
-
function isCellFetched(cell) {
|
|
4822
|
-
if (cell.Fetched) {
|
|
4823
|
-
return true;
|
|
4824
|
-
}
|
|
4825
|
-
return false;
|
|
4826
|
-
}
|
|
4827
|
-
function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
|
|
4828
|
-
const id = cellSize + "_" + lon + "_" + maxLon + "_" + lat + "_" + maxLat;
|
|
4829
|
-
let cell = cells[id];
|
|
4830
|
-
if (!cell) {
|
|
4831
|
-
cell = cells[id] = new exports.EntityGlobe.Cell();
|
|
4832
|
-
cell.Boundaries = {
|
|
4833
|
-
minLatitude: lat,
|
|
4834
|
-
maxLatitude: maxLat,
|
|
4835
|
-
minLongitude: lon,
|
|
4836
|
-
maxLongitude: maxLon
|
|
4837
|
-
};
|
|
4838
|
-
cell.IsFetched = () => isCellFetched(cell);
|
|
4839
|
-
}
|
|
4840
|
-
return [id, cell];
|
|
4841
|
-
}
|
|
4842
|
-
|
|
4843
|
-
const MAX_AREA_IN_DEGREES = 90;
|
|
4844
|
-
const MAX_RETRY_ATTEMPTS = 1;
|
|
4845
|
-
const RETRY_DELAY_INCREMENT = 500;
|
|
4846
|
-
const REQUEST_PAGE_DELAY = 50;
|
|
4847
|
-
class regMenuItemGetter {
|
|
4848
|
-
constructor(tagIds, minHeight, maxHeight) {
|
|
4849
|
-
this.TagIds = tagIds;
|
|
4850
|
-
this.MinHeight = minHeight;
|
|
4851
|
-
this.MaxHeight = maxHeight;
|
|
4852
|
-
}
|
|
4853
|
-
}
|
|
4854
|
-
function delay(milliseconds) {
|
|
4855
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4856
|
-
return new Promise((res) => {
|
|
4857
|
-
setTimeout(() => {
|
|
4858
|
-
res();
|
|
4859
|
-
}, milliseconds);
|
|
4860
|
-
});
|
|
4861
|
-
});
|
|
4862
|
-
}
|
|
4863
|
-
(function (EntityFilterGetter) {
|
|
4864
|
-
let EStatus;
|
|
4865
|
-
(function (EStatus) {
|
|
4866
|
-
EStatus["Scanning"] = "SCANNING";
|
|
4867
|
-
EStatus["Loading"] = "LOADING";
|
|
4868
|
-
})(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
|
|
4869
|
-
class Getter {
|
|
4870
|
-
get OnUpdate() {
|
|
4871
|
-
if (!this.onUpdate) {
|
|
4872
|
-
this.onUpdate = new BruceEvent();
|
|
4873
|
-
}
|
|
4874
|
-
return this.onUpdate;
|
|
4875
|
-
}
|
|
4876
|
-
get OnStateUpdate() {
|
|
4877
|
-
if (!this.onStateUpdate) {
|
|
4878
|
-
this.onStateUpdate = new BruceEvent();
|
|
4879
|
-
}
|
|
4880
|
-
return this.onStateUpdate;
|
|
4881
|
-
}
|
|
4882
|
-
get OnScanUpdate() {
|
|
4883
|
-
if (!this.onScanUpdate) {
|
|
4884
|
-
this.onScanUpdate = new BruceEvent();
|
|
4885
|
-
}
|
|
4886
|
-
return this.onScanUpdate;
|
|
4887
|
-
}
|
|
4888
|
-
constructor(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
|
|
4889
|
-
this.onUpdate = null;
|
|
4890
|
-
this.LastStateUpdates = {};
|
|
4891
|
-
this.onStateUpdate = null;
|
|
4892
|
-
this.onScanUpdate = null;
|
|
4893
|
-
this.viewPortChangeRemoval = null;
|
|
4894
|
-
this.cells = null;
|
|
4895
|
-
this.registeredItems = {};
|
|
4896
|
-
this.getterLoopId = 0;
|
|
4897
|
-
this.tagIds = null;
|
|
4898
|
-
this.minHeight = 0;
|
|
4899
|
-
this.maxHeight = 100000;
|
|
4900
|
-
this.viewRect = null;
|
|
4901
|
-
this.viewCenter = null;
|
|
4902
|
-
this.api = api;
|
|
4903
|
-
this.typeId = typeId;
|
|
4904
|
-
this.viaCdn = Boolean(viaCdn);
|
|
4905
|
-
this.batchSize = isNaN(batchSize) ? 300 : batchSize;
|
|
4906
|
-
this.viewPort = viewPort;
|
|
4907
|
-
this.attrFilter = attrFilter;
|
|
4908
|
-
this.updateBounds();
|
|
4909
|
-
}
|
|
4910
|
-
/**
|
|
4911
|
-
* Returns id that represents the combined menu item parameters.
|
|
4912
|
-
* If integrity changes while a request is running, the request will not emit a response.
|
|
4913
|
-
* @returns
|
|
4914
|
-
*/
|
|
4915
|
-
getIntegrityId() {
|
|
4916
|
-
return this.tagIds == null ? "" : this.tagIds.join();
|
|
4917
|
-
}
|
|
4918
|
-
viewAreaSub() {
|
|
4919
|
-
this.viewAreaDispose();
|
|
4920
|
-
this.viewPortChangeRemoval = this.viewPort.Updated().Subscribe(() => {
|
|
4921
|
-
this.updateBounds();
|
|
4922
|
-
this.startGetterLoop();
|
|
4923
|
-
});
|
|
4924
|
-
}
|
|
4925
|
-
viewAreaDispose() {
|
|
4926
|
-
var _a;
|
|
4927
|
-
(_a = this.viewPortChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
4928
|
-
}
|
|
4929
|
-
GetMenuItems() {
|
|
4930
|
-
return Object.keys(this.registeredItems);
|
|
4931
|
-
}
|
|
4932
|
-
IncludeMenuItem(menuItemId, layerIds, minHeight, maxHeight) {
|
|
4933
|
-
this.registeredItems[menuItemId] = new regMenuItemGetter(layerIds, minHeight, maxHeight);
|
|
4934
|
-
this.updateState();
|
|
4935
|
-
}
|
|
4936
|
-
ExcludeMenuItem(menuItemId) {
|
|
4937
|
-
this.registeredItems[menuItemId] = null;
|
|
4938
|
-
delete this.registeredItems[menuItemId];
|
|
4939
|
-
this.updateState();
|
|
4940
|
-
}
|
|
4941
|
-
updateBounds() {
|
|
4942
|
-
const viewRect = this.viewPort.GetBounds();
|
|
4943
|
-
const poi = this.viewPort.GetTarget();
|
|
4944
|
-
if (viewRect && poi) {
|
|
4945
|
-
if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES) {
|
|
4946
|
-
return;
|
|
4947
|
-
}
|
|
4948
|
-
if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES) {
|
|
4949
|
-
return;
|
|
4950
|
-
}
|
|
4951
|
-
this.viewRect = viewRect;
|
|
4952
|
-
this.viewCenter = poi;
|
|
4953
|
-
}
|
|
4954
|
-
}
|
|
4955
|
-
updateState() {
|
|
4956
|
-
const tagIds = [];
|
|
4957
|
-
const menuItemIds = this.GetMenuItems();
|
|
4958
|
-
let minHeight = null;
|
|
4959
|
-
let maxHeight = null;
|
|
4960
|
-
for (let i = 0; i < menuItemIds.length; i++) {
|
|
4961
|
-
const menuItem = this.registeredItems[menuItemIds[i]];
|
|
4962
|
-
if (menuItem) {
|
|
4963
|
-
if (maxHeight == null || maxHeight < menuItem.MaxHeight) {
|
|
4964
|
-
maxHeight = menuItem.MaxHeight;
|
|
4965
|
-
}
|
|
4966
|
-
if (minHeight == null || minHeight > menuItem.MinHeight) {
|
|
4967
|
-
minHeight = menuItem.MinHeight;
|
|
4968
|
-
}
|
|
4969
|
-
const itemLayerIds = menuItem.TagIds;
|
|
4970
|
-
if (itemLayerIds) {
|
|
4971
|
-
for (let j = 0; j < itemLayerIds.length; j++) {
|
|
4972
|
-
const itemLayerId = itemLayerIds[j];
|
|
4973
|
-
if (!tagIds.includes(itemLayerId)) {
|
|
4974
|
-
tagIds.push(itemLayerId);
|
|
4975
|
-
}
|
|
4976
|
-
}
|
|
4977
|
-
}
|
|
4978
|
-
}
|
|
4979
|
-
}
|
|
4980
|
-
if (menuItemIds.length > 0) {
|
|
4981
|
-
// Reset cells so none are marked as fetched.
|
|
4982
|
-
this.cells = new exports.EntityGlobe.Grid();
|
|
4983
|
-
this.tagIds = tagIds;
|
|
4984
|
-
this.minHeight = minHeight;
|
|
4985
|
-
this.maxHeight = maxHeight;
|
|
4986
|
-
this.updateBounds();
|
|
4987
|
-
this.startGetterLoop();
|
|
4988
|
-
this.viewAreaSub();
|
|
4989
|
-
}
|
|
4990
|
-
else {
|
|
4991
|
-
this.getterLoopId += 1;
|
|
4992
|
-
this.viewAreaDispose();
|
|
4993
|
-
}
|
|
4994
|
-
}
|
|
4995
|
-
postStatus(status) {
|
|
4996
|
-
var _a;
|
|
4997
|
-
this.LastStateUpdates[status.msg] = status;
|
|
4998
|
-
(_a = this.onStateUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(status);
|
|
4999
|
-
}
|
|
5000
|
-
startGetterLoop() {
|
|
5001
|
-
// Increase id so that existing loops stop.
|
|
5002
|
-
this.getterLoopId += 1;
|
|
5003
|
-
const loopId = this.getterLoopId;
|
|
5004
|
-
const loopIntegrity = this.getIntegrityId();
|
|
5005
|
-
new Promise(() => __awaiter(this, void 0, void 0, function* () {
|
|
5006
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5007
|
-
// Minor delay to stop 50 menu items enabling doing their first request all together.
|
|
5008
|
-
// This gives it time to recognize only 1 request is needed.
|
|
5009
|
-
// Would be better to not use this delay but we're on a clock.
|
|
5010
|
-
yield delay(100);
|
|
5011
|
-
const MIN_HEIGHT = this.minHeight;
|
|
5012
|
-
const MAX_HEIGHT = this.maxHeight;
|
|
5013
|
-
const PAGE_SIZE = this.batchSize;
|
|
5014
|
-
let retryAttempts = MAX_RETRY_ATTEMPTS;
|
|
5015
|
-
let retryDelay = 0;
|
|
5016
|
-
let prevFirstId = "";
|
|
5017
|
-
let prevLastId = "";
|
|
5018
|
-
let prevTicks = 0;
|
|
5019
|
-
while ((!this.viewCenter || !this.viewRect) && this.getterLoopId == loopId) {
|
|
5020
|
-
yield delay(RETRY_DELAY_INCREMENT);
|
|
5021
|
-
}
|
|
5022
|
-
if (this.getterLoopId != loopId) {
|
|
5023
|
-
return;
|
|
5024
|
-
}
|
|
5025
|
-
const alt = this.viewRect.alt;
|
|
5026
|
-
if (alt > MAX_HEIGHT || (alt < MIN_HEIGHT && MIN_HEIGHT > 0)) {
|
|
5027
|
-
return;
|
|
5028
|
-
}
|
|
5029
|
-
const cells = this.cells.GetCellsForView(this.viewCenter, this.viewRect);
|
|
5030
|
-
(_a = this.onScanUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(cells);
|
|
5031
|
-
let curCellIndex = cells.length > 0 ? 0 : null;
|
|
5032
|
-
let postedScanning = false;
|
|
5033
|
-
let postedLoading = false;
|
|
5034
|
-
let total = 0;
|
|
5035
|
-
while (retryAttempts > 0 && curCellIndex != null) {
|
|
5036
|
-
if (retryDelay > 0) {
|
|
5037
|
-
yield delay(retryDelay);
|
|
5038
|
-
}
|
|
5039
|
-
if (this.getterLoopId != loopId) {
|
|
5040
|
-
break;
|
|
5041
|
-
}
|
|
5042
|
-
if (!postedScanning) {
|
|
5043
|
-
this.postStatus({ msg: EStatus.Scanning, revoking: false });
|
|
5044
|
-
postedScanning = true;
|
|
5045
|
-
}
|
|
5046
|
-
const curCell = cells[curCellIndex];
|
|
5047
|
-
if (curCell.IsFetched()) {
|
|
5048
|
-
curCell.Fetching = false;
|
|
5049
|
-
curCellIndex += 1;
|
|
5050
|
-
if (cells[curCellIndex]) {
|
|
5051
|
-
cells[curCellIndex].Fetching = true;
|
|
5052
|
-
}
|
|
5053
|
-
else {
|
|
5054
|
-
curCellIndex = null;
|
|
5055
|
-
}
|
|
5056
|
-
(_b = this.onScanUpdate) === null || _b === void 0 ? void 0 : _b.Trigger(cells);
|
|
5057
|
-
continue;
|
|
5058
|
-
}
|
|
5059
|
-
try {
|
|
5060
|
-
let { entities } = yield exports.Entity.GetList({
|
|
5061
|
-
api: this.api,
|
|
5062
|
-
filter: {
|
|
5063
|
-
pageSize: PAGE_SIZE,
|
|
5064
|
-
pageIndex: curCell.FetchPageIndex,
|
|
5065
|
-
entityTypeId: this.typeId,
|
|
5066
|
-
layerIds: this.tagIds,
|
|
5067
|
-
// Any tag specified will be allowed.
|
|
5068
|
-
layerIdsOperator: "in",
|
|
5069
|
-
bounds: curCell.GetBounds(),
|
|
5070
|
-
sortOrder: exports.Api.ESortOrder.Asc,
|
|
5071
|
-
entityTypeConditions: this.attrFilter
|
|
5072
|
-
},
|
|
5073
|
-
viaCdn: this.viaCdn,
|
|
5074
|
-
req: {
|
|
5075
|
-
noCache: true
|
|
5076
|
-
}
|
|
5077
|
-
});
|
|
5078
|
-
const integrity = this.getIntegrityId();
|
|
5079
|
-
if (loopIntegrity == integrity && entities) {
|
|
5080
|
-
(_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
|
|
5081
|
-
}
|
|
5082
|
-
if (this.getterLoopId != loopId) {
|
|
5083
|
-
break;
|
|
5084
|
-
}
|
|
5085
|
-
if (entities.length) {
|
|
5086
|
-
total += entities.length;
|
|
5087
|
-
}
|
|
5088
|
-
if (!postedLoading) {
|
|
5089
|
-
this.postStatus({ msg: EStatus.Loading, revoking: false });
|
|
5090
|
-
postedLoading = true;
|
|
5091
|
-
}
|
|
5092
|
-
// Only mark as fetched when ALL pages are done.
|
|
5093
|
-
// Known issue where external sources may return less than page size.
|
|
5094
|
-
// Right now we're making it as fetched as we're siding with the majority use-case.
|
|
5095
|
-
if (entities.length <= 0 || entities.length < PAGE_SIZE) {
|
|
5096
|
-
curCell.Fetched = true;
|
|
5097
|
-
curCell.Fetching = false;
|
|
5098
|
-
(_d = this.onScanUpdate) === null || _d === void 0 ? void 0 : _d.Trigger(cells);
|
|
5099
|
-
continue;
|
|
5100
|
-
}
|
|
5101
|
-
// Checking to make sure it's not just the same batch over and over again.
|
|
5102
|
-
if (entities.length > 0) {
|
|
5103
|
-
const first = (_f = (_e = entities[0]) === null || _e === void 0 ? void 0 : _e.Bruce) === null || _f === void 0 ? void 0 : _f.ID;
|
|
5104
|
-
const last = (_h = (_g = entities[entities.length - 1]) === null || _g === void 0 ? void 0 : _g.Bruce) === null || _h === void 0 ? void 0 : _h.ID;
|
|
5105
|
-
if (prevFirstId == first && prevLastId == last) {
|
|
5106
|
-
prevTicks += 1;
|
|
5107
|
-
if (prevTicks > 3) {
|
|
5108
|
-
break;
|
|
5109
|
-
}
|
|
5110
|
-
}
|
|
5111
|
-
else {
|
|
5112
|
-
prevFirstId = first;
|
|
5113
|
-
prevLastId = last;
|
|
5114
|
-
prevTicks = 0;
|
|
5115
|
-
}
|
|
5116
|
-
}
|
|
5117
|
-
curCell.FetchPageIndex++;
|
|
5118
|
-
// Request passed so let's assume it was server hiccup and refresh counts.
|
|
5119
|
-
retryAttempts = MAX_RETRY_ATTEMPTS;
|
|
5120
|
-
retryDelay = 0;
|
|
5121
|
-
}
|
|
5122
|
-
catch (e) {
|
|
5123
|
-
console.error(e);
|
|
5124
|
-
// Request failed so let's add a delay and try again soon.
|
|
5125
|
-
retryDelay += RETRY_DELAY_INCREMENT;
|
|
5126
|
-
retryAttempts -= 1;
|
|
5127
|
-
}
|
|
5128
|
-
yield delay(REQUEST_PAGE_DELAY);
|
|
5129
|
-
}
|
|
5130
|
-
if (postedLoading) {
|
|
5131
|
-
this.postStatus({ msg: EStatus.Loading, revoking: true });
|
|
5132
|
-
}
|
|
5133
|
-
if (postedScanning) {
|
|
5134
|
-
this.postStatus({ msg: EStatus.Scanning, revoking: true });
|
|
5135
|
-
}
|
|
5136
|
-
}));
|
|
5137
|
-
}
|
|
5138
|
-
}
|
|
5139
|
-
EntityFilterGetter.Getter = Getter;
|
|
5140
|
-
})(exports.EntityFilterGetter || (exports.EntityFilterGetter = {}));
|
|
5141
|
-
|
|
5142
|
-
const MAX_AREA_IN_DEGREES$1 = 90;
|
|
5143
|
-
const GETTER_DELAY = 50;
|
|
5144
|
-
(function (BatchedDataGetter) {
|
|
5145
|
-
class Getter {
|
|
5146
|
-
get OnUpdate() {
|
|
5147
|
-
if (!this.onUpdate) {
|
|
5148
|
-
this.onUpdate = new BruceEvent();
|
|
5149
|
-
}
|
|
5150
|
-
return this.onUpdate;
|
|
5151
|
-
}
|
|
5152
|
-
constructor(data, viewPort, batchSize) {
|
|
5153
|
-
this.viewPortRemoval = null;
|
|
5154
|
-
this.viewRect = null;
|
|
5155
|
-
this.viewCenter = null;
|
|
5156
|
-
this.onUpdate = null;
|
|
5157
|
-
this.data = data;
|
|
5158
|
-
this.viewPort = viewPort;
|
|
5159
|
-
this.batchSize = batchSize;
|
|
5160
|
-
}
|
|
5161
|
-
Start() {
|
|
5162
|
-
this.viewPortRemoval = this.viewPort.Updated().Subscribe(() => {
|
|
5163
|
-
this.updateViewport();
|
|
5164
|
-
});
|
|
5165
|
-
this.updateViewport();
|
|
5166
|
-
}
|
|
5167
|
-
Dispose() {
|
|
5168
|
-
var _a;
|
|
5169
|
-
(_a = this.viewPortRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
5170
|
-
}
|
|
5171
|
-
updateViewport() {
|
|
5172
|
-
this.updateBounds();
|
|
5173
|
-
this.startGetterLoop();
|
|
5174
|
-
}
|
|
5175
|
-
updateBounds() {
|
|
5176
|
-
const viewRect = this.viewPort.GetBounds();
|
|
5177
|
-
const poi = this.viewPort.GetTarget();
|
|
5178
|
-
if (viewRect && poi) {
|
|
5179
|
-
if (Math.abs(viewRect.west - viewRect.east) > MAX_AREA_IN_DEGREES$1) {
|
|
5180
|
-
return;
|
|
5181
|
-
}
|
|
5182
|
-
if (Math.abs(viewRect.south - viewRect.north) > MAX_AREA_IN_DEGREES$1) {
|
|
5183
|
-
return;
|
|
5184
|
-
}
|
|
5185
|
-
this.viewRect = viewRect;
|
|
5186
|
-
this.viewCenter = poi;
|
|
5187
|
-
}
|
|
5188
|
-
}
|
|
5189
|
-
startGetterLoop() {
|
|
5190
|
-
clearInterval(this.getterInterval);
|
|
5191
|
-
if (!this.viewRect || !this.viewCenter) {
|
|
5192
|
-
return;
|
|
5193
|
-
}
|
|
5194
|
-
let index = 0;
|
|
5195
|
-
const onTick = () => {
|
|
5196
|
-
this.processBatch(this.data.slice(index, index + this.batchSize));
|
|
5197
|
-
index += this.batchSize;
|
|
5198
|
-
return index >= this.data.length;
|
|
5199
|
-
};
|
|
5200
|
-
if (!onTick()) {
|
|
5201
|
-
this.getterInterval = setInterval(() => {
|
|
5202
|
-
if (onTick()) {
|
|
5203
|
-
clearInterval(this.getterInterval);
|
|
5204
|
-
}
|
|
5205
|
-
}, GETTER_DELAY);
|
|
5206
|
-
}
|
|
5207
|
-
}
|
|
5208
|
-
processBatch(batch) {
|
|
5209
|
-
var _a;
|
|
5210
|
-
if (batch.length > 0) {
|
|
5211
|
-
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(batch);
|
|
5212
|
-
}
|
|
5213
|
-
}
|
|
5214
|
-
}
|
|
5215
|
-
BatchedDataGetter.Getter = Getter;
|
|
5216
|
-
})(exports.BatchedDataGetter || (exports.BatchedDataGetter = {}));
|
|
5217
|
-
|
|
5218
4685
|
(function (MathUtils) {
|
|
5219
4686
|
/**
|
|
5220
4687
|
* Rounds a number to a given number of decimal places.
|
|
@@ -8924,7 +8391,7 @@
|
|
|
8924
8391
|
DataSource.GetList = GetList;
|
|
8925
8392
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
8926
8393
|
|
|
8927
|
-
const VERSION = "3.1.
|
|
8394
|
+
const VERSION = "3.1.5";
|
|
8928
8395
|
|
|
8929
8396
|
exports.VERSION = VERSION;
|
|
8930
8397
|
exports.AbstractApi = AbstractApi;
|