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.
- package/dist/bruce-models.es5.js +47 -570
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +44 -557
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +3 -5
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/client-file/client-file.js.map +1 -1
- package/dist/lib/custom-form/custom-form.js.map +1 -1
- package/dist/lib/project/project-view-bookmark.js +0 -8
- package/dist/lib/project/project-view-bookmark.js.map +1 -1
- package/dist/lib/project/project-view-legacy-bookmark.js +12 -0
- package/dist/lib/project/project-view-legacy-bookmark.js.map +1 -0
- package/dist/lib/project/project-view-legacy-tile.js.map +1 -1
- package/dist/lib/project/project-view-legacy.js +12 -0
- package/dist/lib/project/project-view-legacy.js.map +1 -0
- package/dist/lib/project/project-view.js +1 -9
- package/dist/lib/project/project-view.js.map +1 -1
- package/dist/lib/user/permission.js +1 -0
- package/dist/lib/user/permission.js.map +1 -1
- package/dist/lib/util/object-utils.js +25 -6
- package/dist/lib/util/object-utils.js.map +1 -1
- package/dist/types/bruce-models.d.ts +3 -5
- package/dist/types/client-file/client-file.d.ts +5 -5
- package/dist/types/entity/entity-attachment.d.ts +1 -1
- package/dist/types/entity/entity-lod.d.ts +1 -1
- package/dist/types/entity/entity-type.d.ts +5 -5
- package/dist/types/entity/entity.d.ts +1 -1
- package/dist/types/import/imported-file.d.ts +1 -1
- package/dist/types/project/project-view-bookmark.d.ts +56 -113
- package/dist/types/project/project-view-legacy-bookmark.d.ts +62 -0
- package/dist/types/project/project-view-legacy.d.ts +49 -0
- package/dist/types/project/project-view.d.ts +30 -82
- package/dist/types/user/permission.d.ts +1 -0
- package/dist/types/util/object-utils.d.ts +2 -2
- 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
|
@@ -1934,15 +1934,34 @@
|
|
|
1934
1934
|
})(exports.Color || (exports.Color = {}));
|
|
1935
1935
|
|
|
1936
1936
|
(function (ObjectUtils) {
|
|
1937
|
+
const DEFAULT_LENGTH = 36;
|
|
1937
1938
|
/**
|
|
1938
|
-
* Generates a
|
|
1939
|
+
* Generates a Nextspace compatible UID.
|
|
1939
1940
|
* @returns
|
|
1940
1941
|
*/
|
|
1941
|
-
function UId() {
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1942
|
+
function UId(length = DEFAULT_LENGTH) {
|
|
1943
|
+
if (!length) {
|
|
1944
|
+
length = DEFAULT_LENGTH;
|
|
1945
|
+
}
|
|
1946
|
+
if (length <= 0) {
|
|
1947
|
+
return "";
|
|
1948
|
+
}
|
|
1949
|
+
// Our default spec.
|
|
1950
|
+
if (length === DEFAULT_LENGTH) {
|
|
1951
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
1952
|
+
const r = Math.random() * 16 | 0, v = c === "x" ? r : (r & 0x3 | 0x8);
|
|
1953
|
+
return v.toString(16);
|
|
1954
|
+
});
|
|
1955
|
+
}
|
|
1956
|
+
// Arbitrary random hex string.
|
|
1957
|
+
else {
|
|
1958
|
+
let result = "";
|
|
1959
|
+
for (let i = 0; i < length; i++) {
|
|
1960
|
+
const randomHex = Math.random() * 16 | 0;
|
|
1961
|
+
result += randomHex.toString(16);
|
|
1962
|
+
}
|
|
1963
|
+
return result;
|
|
1964
|
+
}
|
|
1946
1965
|
}
|
|
1947
1966
|
ObjectUtils.UId = UId;
|
|
1948
1967
|
})(exports.ObjectUtils || (exports.ObjectUtils = {}));
|
|
@@ -4682,539 +4701,6 @@
|
|
|
4682
4701
|
EntityType.Update = Update;
|
|
4683
4702
|
})(exports.EntityType || (exports.EntityType = {}));
|
|
4684
4703
|
|
|
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
4704
|
(function (MathUtils) {
|
|
5219
4705
|
/**
|
|
5220
4706
|
* Rounds a number to a given number of decimal places.
|
|
@@ -6550,14 +6036,6 @@
|
|
|
6550
6036
|
// This is the expected default version for the DataVersion value.
|
|
6551
6037
|
// This value should NOT be changed without looking at our API and seeing what the default value is.
|
|
6552
6038
|
ProjectViewBookmark.DEFAULT_DATA_VERSION = 1;
|
|
6553
|
-
let LegacyNavigator;
|
|
6554
|
-
(function (LegacyNavigator) {
|
|
6555
|
-
LegacyNavigator.DATA_VERSION = 1;
|
|
6556
|
-
})(LegacyNavigator = ProjectViewBookmark.LegacyNavigator || (ProjectViewBookmark.LegacyNavigator = {}));
|
|
6557
|
-
let Navigator;
|
|
6558
|
-
(function (Navigator) {
|
|
6559
|
-
Navigator.DATA_VERSION = 2;
|
|
6560
|
-
})(Navigator = ProjectViewBookmark.Navigator || (ProjectViewBookmark.Navigator = {}));
|
|
6561
6039
|
function Get(params) {
|
|
6562
6040
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6563
6041
|
let { api, viewId, bookmarkId, req: reqParams } = params;
|
|
@@ -6703,15 +6181,7 @@
|
|
|
6703
6181
|
ProjectView.GetListCacheKey = GetListCacheKey;
|
|
6704
6182
|
// This is the expected default version for the DataVersion value.
|
|
6705
6183
|
// This value should NOT be changed without looking at our API and seeing what the default value is.
|
|
6706
|
-
ProjectView.DEFAULT_DATA_VERSION =
|
|
6707
|
-
let LegacyNavigator;
|
|
6708
|
-
(function (LegacyNavigator) {
|
|
6709
|
-
LegacyNavigator.DATA_VERSION = 1;
|
|
6710
|
-
})(LegacyNavigator = ProjectView.LegacyNavigator || (ProjectView.LegacyNavigator = {}));
|
|
6711
|
-
let Navigator;
|
|
6712
|
-
(function (Navigator) {
|
|
6713
|
-
Navigator.DATA_VERSION = 2;
|
|
6714
|
-
})(Navigator = ProjectView.Navigator || (ProjectView.Navigator = {}));
|
|
6184
|
+
ProjectView.DEFAULT_DATA_VERSION = 2;
|
|
6715
6185
|
function Get(params) {
|
|
6716
6186
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6717
6187
|
let { api, viewId, req: reqParams } = params;
|
|
@@ -7012,6 +6482,22 @@
|
|
|
7012
6482
|
];
|
|
7013
6483
|
})(exports.ProjectViewTile || (exports.ProjectViewTile = {}));
|
|
7014
6484
|
|
|
6485
|
+
/**
|
|
6486
|
+
* Deprecated Project View record.
|
|
6487
|
+
* This was used in the legacy web Navigator.
|
|
6488
|
+
*/
|
|
6489
|
+
(function (ProjectViewLegacy) {
|
|
6490
|
+
ProjectViewLegacy.DATA_VERSION = 1;
|
|
6491
|
+
})(exports.ProjectViewLegacy || (exports.ProjectViewLegacy = {}));
|
|
6492
|
+
|
|
6493
|
+
/**
|
|
6494
|
+
* Deprecated Project View Bookmark record.
|
|
6495
|
+
* This was used in the legacy web Navigator.
|
|
6496
|
+
*/
|
|
6497
|
+
(function (ProjectViewLegacyBookmark) {
|
|
6498
|
+
ProjectViewLegacyBookmark.DATA_VERSION = 1;
|
|
6499
|
+
})(exports.ProjectViewLegacyBookmark || (exports.ProjectViewLegacyBookmark = {}));
|
|
6500
|
+
|
|
7015
6501
|
(function (PendingAction) {
|
|
7016
6502
|
let EStatus;
|
|
7017
6503
|
(function (EStatus) {
|
|
@@ -7211,6 +6697,7 @@
|
|
|
7211
6697
|
let EPerm;
|
|
7212
6698
|
(function (EPerm) {
|
|
7213
6699
|
EPerm["ADMIN"] = "ADMIN";
|
|
6700
|
+
EPerm["ADMIN_VIEW"] = "ADMIN_VIEW";
|
|
7214
6701
|
EPerm["LOGIN"] = "LOGIN";
|
|
7215
6702
|
EPerm["DELETE_ENTITY_TYPE"] = "DELETE_ENTITY_TYPE";
|
|
7216
6703
|
EPerm["CREATE_ENTITY_TYPE"] = "CREATE_ENTITY_TYPE";
|
|
@@ -8924,7 +8411,7 @@
|
|
|
8924
8411
|
DataSource.GetList = GetList;
|
|
8925
8412
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
8926
8413
|
|
|
8927
|
-
const VERSION = "3.1.
|
|
8414
|
+
const VERSION = "3.1.6";
|
|
8928
8415
|
|
|
8929
8416
|
exports.VERSION = VERSION;
|
|
8930
8417
|
exports.AbstractApi = AbstractApi;
|