@itwin/core-frontend 3.1.0-dev.1 → 3.1.0-dev.8
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/lib/cjs/BriefcaseConnection.d.ts.map +1 -1
- package/lib/cjs/BriefcaseConnection.js +6 -5
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/DrawingViewState.js +3 -3
- package/lib/cjs/DrawingViewState.js.map +1 -1
- package/lib/cjs/SheetViewState.js +3 -3
- package/lib/cjs/SheetViewState.js.map +1 -1
- package/lib/cjs/Viewport.d.ts +6 -3
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +16 -9
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/render/webgl/Texture.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Texture.js +2 -2
- package/lib/cjs/render/webgl/Texture.js.map +1 -1
- package/lib/cjs/tile/DynamicIModelTile.d.ts.map +1 -1
- package/lib/cjs/tile/DynamicIModelTile.js +1 -1
- package/lib/cjs/tile/DynamicIModelTile.js.map +1 -1
- package/lib/cjs/tile/LRUTileList.d.ts +29 -29
- package/lib/cjs/tile/LRUTileList.d.ts.map +1 -1
- package/lib/cjs/tile/LRUTileList.js +50 -50
- package/lib/cjs/tile/LRUTileList.js.map +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.js +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityTile.d.ts +2 -2
- package/lib/cjs/tile/RealityTile.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTile.js +2 -2
- package/lib/cjs/tile/RealityTile.js.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.d.ts +2 -2
- package/lib/cjs/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.js +1 -1
- package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/tile/RealityTileTree.js +1 -1
- package/lib/cjs/tile/RealityTileTree.js.map +1 -1
- package/lib/cjs/tile/Tile.d.ts +5 -4
- package/lib/cjs/tile/Tile.d.ts.map +1 -1
- package/lib/cjs/tile/Tile.js +3 -2
- package/lib/cjs/tile/Tile.js.map +1 -1
- package/lib/cjs/tile/TileAdmin.d.ts +43 -45
- package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
- package/lib/cjs/tile/TileAdmin.js +104 -99
- package/lib/cjs/tile/TileAdmin.js.map +1 -1
- package/lib/cjs/tile/TileRequest.d.ts +12 -9
- package/lib/cjs/tile/TileRequest.d.ts.map +1 -1
- package/lib/cjs/tile/TileRequest.js +19 -11
- package/lib/cjs/tile/TileRequest.js.map +1 -1
- package/lib/cjs/tile/TileRequestChannel.js +3 -3
- package/lib/cjs/tile/TileRequestChannel.js.map +1 -1
- package/lib/cjs/tile/TileTree.js +1 -1
- package/lib/cjs/tile/TileTree.js.map +1 -1
- package/lib/cjs/tile/TileTreeReference.d.ts +1 -1
- package/lib/cjs/tile/TileTreeReference.js +1 -1
- package/lib/cjs/tile/TileTreeReference.js.map +1 -1
- package/lib/cjs/tile/TileUsageMarker.d.ts +9 -9
- package/lib/cjs/tile/TileUsageMarker.d.ts.map +1 -1
- package/lib/cjs/tile/TileUsageMarker.js +9 -9
- package/lib/cjs/tile/TileUsageMarker.js.map +1 -1
- package/lib/cjs/tile/TileUser.d.ts +33 -0
- package/lib/cjs/tile/TileUser.d.ts.map +1 -0
- package/lib/cjs/tile/TileUser.js +28 -0
- package/lib/cjs/tile/TileUser.js.map +1 -0
- package/lib/cjs/tile/TileUserSet.d.ts +28 -0
- package/lib/cjs/tile/TileUserSet.d.ts.map +1 -0
- package/lib/cjs/tile/TileUserSet.js +123 -0
- package/lib/cjs/tile/TileUserSet.js.map +1 -0
- package/lib/cjs/tile/internal.d.ts +2 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +2 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +1 -2
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts +1 -2
- package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts +1 -2
- package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js +1 -1
- package/lib/cjs/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.d.ts +2 -2
- package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.d.ts +3 -3
- package/lib/cjs/tile/map/MapTileTree.js +4 -4
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/BriefcaseConnection.d.ts.map +1 -1
- package/lib/esm/BriefcaseConnection.js +6 -5
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/DrawingViewState.js +3 -3
- package/lib/esm/DrawingViewState.js.map +1 -1
- package/lib/esm/SheetViewState.js +3 -3
- package/lib/esm/SheetViewState.js.map +1 -1
- package/lib/esm/Viewport.d.ts +6 -3
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +17 -10
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/render/webgl/Texture.d.ts.map +1 -1
- package/lib/esm/render/webgl/Texture.js +2 -2
- package/lib/esm/render/webgl/Texture.js.map +1 -1
- package/lib/esm/tile/DynamicIModelTile.d.ts.map +1 -1
- package/lib/esm/tile/DynamicIModelTile.js +1 -1
- package/lib/esm/tile/DynamicIModelTile.js.map +1 -1
- package/lib/esm/tile/LRUTileList.d.ts +29 -29
- package/lib/esm/tile/LRUTileList.d.ts.map +1 -1
- package/lib/esm/tile/LRUTileList.js +47 -47
- package/lib/esm/tile/LRUTileList.js.map +1 -1
- package/lib/esm/tile/OrbitGtTileTree.js +1 -1
- package/lib/esm/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.js +1 -1
- package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/tile/RealityTile.d.ts +2 -2
- package/lib/esm/tile/RealityTile.d.ts.map +1 -1
- package/lib/esm/tile/RealityTile.js +2 -2
- package/lib/esm/tile/RealityTile.js.map +1 -1
- package/lib/esm/tile/RealityTileLoader.d.ts +2 -2
- package/lib/esm/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileLoader.js +1 -1
- package/lib/esm/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/tile/RealityTileTree.js +1 -1
- package/lib/esm/tile/RealityTileTree.js.map +1 -1
- package/lib/esm/tile/Tile.d.ts +5 -4
- package/lib/esm/tile/Tile.d.ts.map +1 -1
- package/lib/esm/tile/Tile.js +3 -2
- package/lib/esm/tile/Tile.js.map +1 -1
- package/lib/esm/tile/TileAdmin.d.ts +43 -45
- package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
- package/lib/esm/tile/TileAdmin.js +105 -100
- package/lib/esm/tile/TileAdmin.js.map +1 -1
- package/lib/esm/tile/TileRequest.d.ts +12 -9
- package/lib/esm/tile/TileRequest.d.ts.map +1 -1
- package/lib/esm/tile/TileRequest.js +19 -11
- package/lib/esm/tile/TileRequest.js.map +1 -1
- package/lib/esm/tile/TileRequestChannel.js +3 -3
- package/lib/esm/tile/TileRequestChannel.js.map +1 -1
- package/lib/esm/tile/TileTree.js +1 -1
- package/lib/esm/tile/TileTree.js.map +1 -1
- package/lib/esm/tile/TileTreeReference.d.ts +1 -1
- package/lib/esm/tile/TileTreeReference.js +1 -1
- package/lib/esm/tile/TileTreeReference.js.map +1 -1
- package/lib/esm/tile/TileUsageMarker.d.ts +9 -9
- package/lib/esm/tile/TileUsageMarker.d.ts.map +1 -1
- package/lib/esm/tile/TileUsageMarker.js +9 -9
- package/lib/esm/tile/TileUsageMarker.js.map +1 -1
- package/lib/esm/tile/TileUser.d.ts +33 -0
- package/lib/esm/tile/TileUser.d.ts.map +1 -0
- package/lib/esm/tile/TileUser.js +25 -0
- package/lib/esm/tile/TileUser.js.map +1 -0
- package/lib/esm/tile/TileUserSet.d.ts +28 -0
- package/lib/esm/tile/TileUserSet.d.ts.map +1 -0
- package/lib/esm/tile/TileUserSet.js +118 -0
- package/lib/esm/tile/TileUserSet.js.map +1 -0
- package/lib/esm/tile/internal.d.ts +2 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +2 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +1 -2
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts +1 -2
- package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts +1 -2
- package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/ImageryProviders/MapBoxLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.d.ts +2 -2
- package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.d.ts +3 -3
- package/lib/esm/tile/map/MapTileTree.js +4 -4
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/package.json +20 -20
- package/lib/cjs/ViewportSet.d.ts +0 -28
- package/lib/cjs/ViewportSet.d.ts.map +0 -1
- package/lib/cjs/ViewportSet.js +0 -126
- package/lib/cjs/ViewportSet.js.map +0 -1
- package/lib/esm/ViewportSet.d.ts +0 -28
- package/lib/esm/ViewportSet.d.ts.map +0 -1
- package/lib/esm/ViewportSet.js +0 -121
- package/lib/esm/ViewportSet.js.map +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Utils
|
|
7
|
+
*/
|
|
8
|
+
import { ReadonlySortedArray, SortedArray } from "@itwin/core-bentley";
|
|
9
|
+
/** An immutable set of [[TileUser]]s wherein uniqueness is determined by each TileUser's unique integer identifier.
|
|
10
|
+
* @see [[UniqueTileUserSets]].
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export class ReadonlyTileUserSet extends ReadonlySortedArray {
|
|
14
|
+
constructor(user) {
|
|
15
|
+
super((lhs, rhs) => lhs.tileUserId - rhs.tileUserId);
|
|
16
|
+
if (undefined !== user)
|
|
17
|
+
this._array.push(user);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class TileUserSet extends ReadonlyTileUserSet {
|
|
21
|
+
copyFrom(src) {
|
|
22
|
+
this._array.length = src.length;
|
|
23
|
+
let i = 0;
|
|
24
|
+
for (const user of src)
|
|
25
|
+
this._array[i++] = user;
|
|
26
|
+
}
|
|
27
|
+
clone() {
|
|
28
|
+
const clone = new TileUserSet();
|
|
29
|
+
clone.copyFrom(this);
|
|
30
|
+
return clone;
|
|
31
|
+
}
|
|
32
|
+
insert(user) { return this._insert(user); }
|
|
33
|
+
remove(user) { return this._remove(user); }
|
|
34
|
+
clear() { this._clear(); }
|
|
35
|
+
}
|
|
36
|
+
function compareTileUserSets(lhs, rhs) {
|
|
37
|
+
if (lhs === rhs)
|
|
38
|
+
return 0;
|
|
39
|
+
let diff = lhs.length - rhs.length;
|
|
40
|
+
if (0 === diff) {
|
|
41
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
42
|
+
diff = lhs.get(i).tileUserId - rhs.get(i).tileUserId;
|
|
43
|
+
if (0 !== diff)
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return diff;
|
|
48
|
+
}
|
|
49
|
+
const emptySet = new ReadonlyTileUserSet();
|
|
50
|
+
const scratchSet = new TileUserSet();
|
|
51
|
+
class TileUserSetSet extends SortedArray {
|
|
52
|
+
constructor() {
|
|
53
|
+
super((lhs, rhs) => compareTileUserSets(lhs, rhs));
|
|
54
|
+
}
|
|
55
|
+
getForUser(user) {
|
|
56
|
+
for (let i = 0; i < this.length; i++) {
|
|
57
|
+
const set = this._array[i];
|
|
58
|
+
if (1 === set.length && set.get(0) === user)
|
|
59
|
+
return set;
|
|
60
|
+
}
|
|
61
|
+
const newSet = new TileUserSet(user);
|
|
62
|
+
this.insert(newSet);
|
|
63
|
+
return newSet;
|
|
64
|
+
}
|
|
65
|
+
getTileUserSet(user, users) {
|
|
66
|
+
if (undefined === users || users.isEmpty)
|
|
67
|
+
return this.getForUser(user);
|
|
68
|
+
// Use the scratch set for equality comparison - only allocate if no equivalent set already exists.
|
|
69
|
+
const toFind = scratchSet;
|
|
70
|
+
toFind.copyFrom(users);
|
|
71
|
+
toFind.insert(user);
|
|
72
|
+
const found = this.findEqual(toFind);
|
|
73
|
+
if (undefined !== found) {
|
|
74
|
+
toFind.clear();
|
|
75
|
+
return found;
|
|
76
|
+
}
|
|
77
|
+
const newSet = toFind.clone();
|
|
78
|
+
toFind.clear();
|
|
79
|
+
this.insert(newSet);
|
|
80
|
+
return newSet;
|
|
81
|
+
}
|
|
82
|
+
clearAll() {
|
|
83
|
+
this.forEach((set) => set.clear());
|
|
84
|
+
this.clear();
|
|
85
|
+
}
|
|
86
|
+
forgetUser(user) {
|
|
87
|
+
for (const set of this)
|
|
88
|
+
set.remove(user);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** Maintains a set of [[TileUserSets]] designed to minimize duplication.
|
|
92
|
+
* For example, the tile request scheduler needs to associate with each [[TileRequest]] the set of [[TileUser]]s awaiting the request's response.
|
|
93
|
+
* Using UniqueTileUserSets ensures all tiles requested by the same user use the same TileUserSet object.
|
|
94
|
+
* Additionally, whenever a user is unregistered there is no need to track down every associated tile request - the user can just be removed from the TileUserSets managed by this object.
|
|
95
|
+
* The TileUserSets managed by this object should be treated as immutable - "adding" a user to an existing set should be done using [[getTileUserSet]].
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
export class UniqueTileUserSets {
|
|
99
|
+
constructor() {
|
|
100
|
+
this._sets = new TileUserSetSet();
|
|
101
|
+
}
|
|
102
|
+
getTileUserSet(user, users) {
|
|
103
|
+
return this._sets.getTileUserSet(user, users);
|
|
104
|
+
}
|
|
105
|
+
clearAll() {
|
|
106
|
+
this._sets.clearAll();
|
|
107
|
+
}
|
|
108
|
+
clear() {
|
|
109
|
+
this._sets.clear();
|
|
110
|
+
}
|
|
111
|
+
remove(user) {
|
|
112
|
+
this._sets.forgetUser(user);
|
|
113
|
+
}
|
|
114
|
+
static get emptySet() {
|
|
115
|
+
return emptySet;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=TileUserSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TileUserSet.js","sourceRoot":"","sources":["../../../src/tile/TileUserSet.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvE;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,mBAA6B;IACpE,YAAmB,IAAe;QAChC,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,SAAS,KAAK,IAAI;YACpB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,WAAY,SAAQ,mBAAmB;IACpC,QAAQ,CAAC,GAAwB;QACtC,IA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B,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAEM,UAAU,CAAC,IAAc;QAC9B,KAAK,MAAM,GAAG,IAAI,IAAI;YACpB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IAA/B;QACmB,UAAK,GAAG,IAAI,cAAc,EAAE,CAAC;IAqBhD,CAAC;IAnBQ,cAAc,CAAC,IAAc,EAAE,KAA2B;QAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,IAAc;QAC1B,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAEM,MAAM,KAAK,QAAQ;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\nimport { ReadonlySortedArray, SortedArray } from \"@itwin/core-bentley\";\r\nimport { TileUser } from \"./internal\";\r\n\r\n/** An immutable set of [[TileUser]]s wherein uniqueness is determined by each TileUser's unique integer identifier.\r\n * @see [[UniqueTileUserSets]].\r\n * @internal\r\n */\r\nexport class ReadonlyTileUserSet extends ReadonlySortedArray<TileUser> {\r\n public constructor(user?: TileUser) {\r\n super((lhs, rhs) => lhs.tileUserId - rhs.tileUserId);\r\n if (undefined !== user)\r\n this._array.push(user);\r\n }\r\n}\r\n\r\nclass TileUserSet extends ReadonlyTileUserSet {\r\n public copyFrom(src: ReadonlyTileUserSet): void {\r\n this._array.length = src.length;\r\n let i = 0;\r\n for (const user of src)\r\n this._array[i++] = user;\r\n }\r\n\r\n public clone(): TileUserSet {\r\n const clone = new TileUserSet();\r\n clone.copyFrom(this);\r\n return clone;\r\n }\r\n\r\n public insert(user: TileUser): number { return this._insert(user); }\r\n public remove(user: TileUser): number { return this._remove(user); }\r\n public clear(): void { this._clear(); }\r\n}\r\n\r\nfunction compareTileUserSets(lhs: TileUserSet, rhs: TileUserSet): number {\r\n if (lhs === rhs)\r\n return 0;\r\n\r\n let diff = lhs.length - rhs.length;\r\n if (0 === diff) {\r\n for (let i = 0; i < lhs.length; i++) {\r\n diff = lhs.get(i)!.tileUserId - rhs.get(i)!.tileUserId;\r\n if (0 !== diff)\r\n break;\r\n }\r\n }\r\n\r\n return diff;\r\n}\r\n\r\nconst emptySet = new ReadonlyTileUserSet();\r\nconst scratchSet = new TileUserSet();\r\n\r\nclass TileUserSetSet extends SortedArray<TileUserSet> {\r\n public constructor() {\r\n super((lhs, rhs) => compareTileUserSets(lhs, rhs));\r\n }\r\n\r\n private getForUser(user: TileUser): TileUserSet {\r\n for (let i = 0; i < this.length; i++) {\r\n const set = this._array[i];\r\n if (1 === set.length && set.get(0)! === user)\r\n return set;\r\n }\r\n\r\n const newSet = new TileUserSet(user);\r\n this.insert(newSet);\r\n return newSet;\r\n }\r\n\r\n public getTileUserSet(user: TileUser, users?: ReadonlyTileUserSet): TileUserSet {\r\n if (undefined === users || users.isEmpty)\r\n return this.getForUser(user);\r\n\r\n // Use the scratch set for equality comparison - only allocate if no equivalent set already exists.\r\n const toFind = scratchSet;\r\n toFind.copyFrom(users);\r\n toFind.insert(user);\r\n const found = this.findEqual(toFind);\r\n if (undefined !== found) {\r\n toFind.clear();\r\n return found;\r\n }\r\n\r\n const newSet = toFind.clone();\r\n toFind.clear();\r\n this.insert(newSet);\r\n return newSet;\r\n }\r\n\r\n public clearAll(): void {\r\n this.forEach((set) => set.clear());\r\n this.clear();\r\n }\r\n\r\n public forgetUser(user: TileUser): void {\r\n for (const set of this)\r\n set.remove(user);\r\n }\r\n}\r\n\r\n/** Maintains a set of [[TileUserSets]] designed to minimize duplication.\r\n * For example, the tile request scheduler needs to associate with each [[TileRequest]] the set of [[TileUser]]s awaiting the request's response.\r\n * Using UniqueTileUserSets ensures all tiles requested by the same user use the same TileUserSet object.\r\n * Additionally, whenever a user is unregistered there is no need to track down every associated tile request - the user can just be removed from the TileUserSets managed by this object.\r\n * The TileUserSets managed by this object should be treated as immutable - \"adding\" a user to an existing set should be done using [[getTileUserSet]].\r\n * @internal\r\n */\r\nexport class UniqueTileUserSets {\r\n private readonly _sets = new TileUserSetSet();\r\n\r\n public getTileUserSet(user: TileUser, users?: ReadonlyTileUserSet): ReadonlyTileUserSet {\r\n return this._sets.getTileUserSet(user, users);\r\n }\r\n\r\n public clearAll(): void {\r\n this._sets.clearAll();\r\n }\r\n\r\n public clear(): void {\r\n this._sets.clear();\r\n }\r\n\r\n public remove(user: TileUser): void {\r\n this._sets.forgetUser(user);\r\n }\r\n\r\n public static get emptySet(): ReadonlyTileUserSet {\r\n return emptySet;\r\n }\r\n}\r\n"]}
|
|
@@ -27,6 +27,8 @@ export * from "./TileRequestChannel";
|
|
|
27
27
|
export * from "./IModelTileRequestChannels";
|
|
28
28
|
export * from "./TileRequestChannels";
|
|
29
29
|
export * from "./TileUsageMarker";
|
|
30
|
+
export * from "./TileUser";
|
|
31
|
+
export * from "./TileUserSet";
|
|
30
32
|
export * from "./GltfReader";
|
|
31
33
|
export * from "./I3dmReader";
|
|
32
34
|
export * from "./B3dmReader";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/tile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C;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
package/lib/esm/tile/internal.js
CHANGED
|
@@ -40,6 +40,8 @@ export * from "./TileRequestChannel";
|
|
|
40
40
|
export * from "./IModelTileRequestChannels";
|
|
41
41
|
export * from "./TileRequestChannels";
|
|
42
42
|
export * from "./TileUsageMarker";
|
|
43
|
+
export * from "./TileUser";
|
|
44
|
+
export * from "./TileUserSet";
|
|
43
45
|
export * from "./GltfReader";
|
|
44
46
|
export * from "./I3dmReader";
|
|
45
47
|
export * from "./B3dmReader";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tile/internal.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;;;;;GAQG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAA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AClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/* The order of exports below is based on dependencies between the types in each file.\r\n * For example, IModelTileTree derives from TileTree, so TileTree must be exported first.\r\n * No file inside core-frontend should import from *any* file in /tile/ *except* for this one.\r\n * e.g.:\r\n * import { TileTree } from \"./tile/TileTree\"; // NO...\r\n * import { TileTree } from \"./tile/internal\"; // YES!\r\n * Failure to follow either of these two guidelines is very likely to produce difficult-to-debug run-time errors due\r\n * to circular dependencies.\r\n */\r\n\r\nexport * from \"./ViewFlagOverrides\";\r\nexport * from \"./map/MapCartoRectangle\";\r\nexport * from \"./map/QuadId\";\r\nexport * from \"./DisclosedTileTreeSet\";\r\nexport * from \"./Tile\";\r\nexport * from \"./LRUTileList\";\r\nexport * from \"./RealityTile\";\r\nexport * from \"./TileParams\";\r\nexport * from \"./TileContent\";\r\nexport * from \"./TileDrawArgs\";\r\nexport * from \"./RealityTileDrawArgs\";\r\nexport * from \"./GraphicsCollector\";\r\nexport * from \"./BatchedTileIdMap\";\r\nexport * from \"./TileTreeParams\";\r\nexport * from \"./TileTree\";\r\nexport * from \"./RealityTileTree\";\r\nexport * from \"./TileTreeSupplier\";\r\nexport * from \"./TileTreeOwner\";\r\nexport * from \"./TileTreeReference\";\r\nexport * from \"./TiledGraphicsProvider\";\r\nexport * from \"./TileAdmin\";\r\nexport * from \"./TileRequest\";\r\nexport * from \"./TileRequestChannel\";\r\nexport * from \"./IModelTileRequestChannels\";\r\nexport * from \"./TileRequestChannels\";\r\nexport * from \"./TileUsageMarker\";\r\nexport * from \"./GltfReader\";\r\nexport * from \"./I3dmReader\";\r\nexport * from \"./B3dmReader\";\r\nexport * from \"./ImdlReader\";\r\nexport * from \"./map/ArcGISTileMap\";\r\nexport * from \"./map/MapLayerAuthentication\";\r\nexport * from \"./map/ArcGisTokenGenerator\";\r\nexport * from \"./map/ArcGisTokenManager\";\r\nexport * from \"./map/MapLayerFormatRegistry\";\r\nexport * from \"./map/ArcGisUtilities\";\r\nexport * from \"./map/WmsUtilities\";\r\nexport * from \"./map/WmsCapabilities\";\r\nexport * from \"./map/WmtsCapabilities\";\r\nexport * from \"./map/MapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/ArcGISMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/AzureMapsLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/BingImageryProvider\";\r\nexport * from \"./map/ImageryProviders/MapBoxLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/TileUrlImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmsMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmtsMapLayerImageryProvider\";\r\nexport * from \"./map/MapLayerImageryFormats\";\r\nexport * from \"./map/MapLayerTileTreeReference\";\r\nexport * from \"./map/MapTileTree\";\r\nexport * from \"./map/TerrainMeshProvider\";\r\nexport * from \"./map/CesiumTerrainProvider\";\r\nexport * from \"./map/EllipsoidTerrainProvider\";\r\nexport * from \"./map/MapTile\";\r\nexport * from \"./RealityTileLoader\";\r\nexport * from \"./map/MapTileLoader\";\r\nexport * from \"./map/BingElevation\";\r\nexport * from \"./map/MapTilingScheme\";\r\nexport * from \"./map/MapTileAvailability\";\r\nexport * from \"./PntsReader\";\r\nexport * from \"./RealityModelTileTree\";\r\nexport * from \"./IModelTile\";\r\nexport * from \"./DynamicIModelTile\";\r\nexport * from \"./IModelTileTree\";\r\nexport * from \"./PrimaryTileTree\";\r\nexport * from \"./ClassifierTileTree\";\r\nexport * from \"./OrbitGtTileTree\";\r\nexport * from \"./map/ImageryTileTree\";\r\nexport * from \"./map/MapLayerSources\";\r\nexport * from \"./map/MapTiledGraphicsProvider\";\r\nexport * from \"./CesiumAssetProvider\";\r\nexport * from \"./ContextShareProvider\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tile/internal.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;;;;;GAQG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sDAAsD,CAAC;AACrE,cAAc,sDAAsD,CAAC;AACrE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mDAAmD,CAAC;AAClE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mDAAmD,CAAC;AAClE,cAAc,oDAAoD,CAAC;AACnE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/* The order of exports below is based on dependencies between the types in each file.\r\n * For example, IModelTileTree derives from TileTree, so TileTree must be exported first.\r\n * No file inside core-frontend should import from *any* file in /tile/ *except* for this one.\r\n * e.g.:\r\n * import { TileTree } from \"./tile/TileTree\"; // NO...\r\n * import { TileTree } from \"./tile/internal\"; // YES!\r\n * Failure to follow either of these two guidelines is very likely to produce difficult-to-debug run-time errors due\r\n * to circular dependencies.\r\n */\r\n\r\nexport * from \"./ViewFlagOverrides\";\r\nexport * from \"./map/MapCartoRectangle\";\r\nexport * from \"./map/QuadId\";\r\nexport * from \"./DisclosedTileTreeSet\";\r\nexport * from \"./Tile\";\r\nexport * from \"./LRUTileList\";\r\nexport * from \"./RealityTile\";\r\nexport * from \"./TileParams\";\r\nexport * from \"./TileContent\";\r\nexport * from \"./TileDrawArgs\";\r\nexport * from \"./RealityTileDrawArgs\";\r\nexport * from \"./GraphicsCollector\";\r\nexport * from \"./BatchedTileIdMap\";\r\nexport * from \"./TileTreeParams\";\r\nexport * from \"./TileTree\";\r\nexport * from \"./RealityTileTree\";\r\nexport * from \"./TileTreeSupplier\";\r\nexport * from \"./TileTreeOwner\";\r\nexport * from \"./TileTreeReference\";\r\nexport * from \"./TiledGraphicsProvider\";\r\nexport * from \"./TileAdmin\";\r\nexport * from \"./TileRequest\";\r\nexport * from \"./TileRequestChannel\";\r\nexport * from \"./IModelTileRequestChannels\";\r\nexport * from \"./TileRequestChannels\";\r\nexport * from \"./TileUsageMarker\";\r\nexport * from \"./TileUser\";\r\nexport * from \"./TileUserSet\";\r\nexport * from \"./GltfReader\";\r\nexport * from \"./I3dmReader\";\r\nexport * from \"./B3dmReader\";\r\nexport * from \"./ImdlReader\";\r\nexport * from \"./map/ArcGISTileMap\";\r\nexport * from \"./map/MapLayerAuthentication\";\r\nexport * from \"./map/ArcGisTokenGenerator\";\r\nexport * from \"./map/ArcGisTokenManager\";\r\nexport * from \"./map/MapLayerFormatRegistry\";\r\nexport * from \"./map/ArcGisUtilities\";\r\nexport * from \"./map/WmsUtilities\";\r\nexport * from \"./map/WmsCapabilities\";\r\nexport * from \"./map/WmtsCapabilities\";\r\nexport * from \"./map/MapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/ArcGISMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/AzureMapsLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/BingImageryProvider\";\r\nexport * from \"./map/ImageryProviders/MapBoxLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/TileUrlImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmsMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmtsMapLayerImageryProvider\";\r\nexport * from \"./map/MapLayerImageryFormats\";\r\nexport * from \"./map/MapLayerTileTreeReference\";\r\nexport * from \"./map/MapTileTree\";\r\nexport * from \"./map/TerrainMeshProvider\";\r\nexport * from \"./map/CesiumTerrainProvider\";\r\nexport * from \"./map/EllipsoidTerrainProvider\";\r\nexport * from \"./map/MapTile\";\r\nexport * from \"./RealityTileLoader\";\r\nexport * from \"./map/MapTileLoader\";\r\nexport * from \"./map/BingElevation\";\r\nexport * from \"./map/MapTilingScheme\";\r\nexport * from \"./map/MapTileAvailability\";\r\nexport * from \"./PntsReader\";\r\nexport * from \"./RealityModelTileTree\";\r\nexport * from \"./IModelTile\";\r\nexport * from \"./DynamicIModelTile\";\r\nexport * from \"./IModelTileTree\";\r\nexport * from \"./PrimaryTileTree\";\r\nexport * from \"./ClassifierTileTree\";\r\nexport * from \"./OrbitGtTileTree\";\r\nexport * from \"./map/ImageryTileTree\";\r\nexport * from \"./map/MapLayerSources\";\r\nexport * from \"./map/MapTiledGraphicsProvider\";\r\nexport * from \"./CesiumAssetProvider\";\r\nexport * from \"./ContextShareProvider\";\r\n"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @module Tiles
|
|
3
3
|
*/
|
|
4
4
|
import { Cartographic, ImageSource, MapLayerSettings } from "@itwin/core-common";
|
|
5
|
-
import { ScreenViewport } from "../../../Viewport";
|
|
6
5
|
import { ImageryMapTile, ImageryMapTileTree, MapLayerImageryProvider, QuadId } from "../../internal";
|
|
7
6
|
/** @internal */
|
|
8
7
|
export declare class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {
|
|
@@ -26,7 +25,7 @@ export declare class ArcGISMapLayerImageryProvider extends MapLayerImageryProvid
|
|
|
26
25
|
protected _generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void): void;
|
|
27
26
|
private isEpsg3857Compatible;
|
|
28
27
|
initialize(): Promise<void>;
|
|
29
|
-
getLogo(
|
|
28
|
+
getLogo(): HTMLTableRowElement;
|
|
30
29
|
getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void>;
|
|
31
30
|
protected getLayerString(prefix?: string): string;
|
|
32
31
|
constructUrl(row: number, column: number, zoomLevel: number): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGISMapLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAgB,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAI5G,OAAO,
|
|
1
|
+
{"version":3,"file":"ArcGISMapLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAgB,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAI5G,OAAO,EACuF,cAAc,EAAE,kBAAkB,EAC9H,uBAAuB,EAAiC,MAAM,EAC/D,MAAM,gBAAgB,CAAC;AAKxB,gBAAgB;AAChB,qBAAa,6BAA8B,SAAQ,uBAAuB;IACxE,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,cAAc,CAAe;IACrC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,QAAQ,CAA0B;IACnC,WAAW,EAAE,GAAG,CAAC;gBACZ,QAAQ,EAAE,gBAAgB;IAItC,cAAuB,mBAAmB,YAAoB;IAE9D,IAAoB,gBAAgB,WAAsE;IAC1G,IAAoB,gBAAgB,WAAyF;IAEtH,YAAY,CAAC,SAAS,EAAE,GAAG;;;;YAKpB,SAAS;IAUD,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;cAqD7F,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI;IAoBxG,OAAO,CAAC,oBAAoB;IAQN,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA6CjC,OAAO;IAID,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkDjI,SAAS,CAAC,cAAc,CAAC,MAAM,SAAS,GAAG,MAAM;IAMpC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAY5E,mBAAmB;CAgBlC"}
|
|
@@ -147,7 +147,7 @@ export class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
getLogo(
|
|
150
|
+
getLogo() {
|
|
151
151
|
return IModelApp.makeLogoCard({ heading: "ArcGIS", notice: this._copyrightText });
|
|
152
152
|
}
|
|
153
153
|
async getToolTip(strings, quadId, carto, tree) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGISMapLayerImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA6B,YAAY,EAAoB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,OAAO,EAA4B,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE3F,OAAO,EACL,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,eAAe,EAAsC,iBAAiB,EACjJ,uBAAuB,EAAE,6BAA6B,GACvD,MAAM,gBAAgB,CAAC;AAExB,wCAAwC;AACxC,IAAI,UAAU,GAAG,IAAI,CAAC;AAEtB,gBAAgB;AAChB,MAAM,OAAO,6BAA8B,SAAQ,uBAAuB;IAQxE,YAAY,QAA0B;QACpC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QARjB,qBAAgB,GAAG,CAAC,CAAC;QACrB,qBAAgB,GAAG,CAAC,CAAC;QACrB,mBAAc,GAAG,WAAW,CAAC;QAC7B,oBAAe,GAAG,KAAK,CAAC;QACxB,sBAAiB,GAAG,KAAK,CAAC;IAKlC,CAAC;IAED,IAAuB,mBAAmB,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,CAAM,4CAA4C;IAEhH,IAAoB,gBAAgB,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC1G,IAAoB,gBAAgB,KAAK,OAAO,IAAI,CAAC,gBAAgB,GAAG,CAA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AAC,2BAA2B,+BAA+B,CAAC;SAC3N;QACD,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,0CAA0C;IAClC,KAAK,CAAC,mBAAmB,CAAC,GAAW;QAC3C,oCAAoC;QACpC,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;YACtD,IAAI;gBACF,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAClH;oBACE,MAAM,EAAE,qBAAqB,CAAC,OAAO;iBACtC,CAAC,CAAC;gBACL,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;oBACd,UAAU,GAAG,UAAU,KAAK,CAAC,KAAK,EAAE,CAAC;aACxC;YAAC,MAAM;aACP;SACF;QACD,OAAO,GAAG,GAAG,GAAG,UAAU,EAAE,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { Cartographic, ImageSource, IModelStatus, MapLayerSettings, ServerError } from \"@itwin/core-common\";\r\nimport { getJson, request, RequestOptions, Response } from \"../../../request/Request\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { NotifyMessageDetails, OutputMessagePriority } from \"../../../NotificationManager\";\r\nimport { ScreenViewport } from \"../../../Viewport\";\r\nimport {\r\n ArcGisErrorCode, ArcGISTileMap, ArcGisTokenClientType, ArcGisTokenManager, ArcGisUtilities, ImageryMapTile, ImageryMapTileTree, MapCartoRectangle,\r\n MapLayerImageryProvider, MapLayerImageryProviderStatus, QuadId,\r\n} from \"../../internal\";\r\n\r\n// eslint-disable-next-line prefer-const\r\nlet doToolTips = true;\r\n\r\n/** @internal */\r\nexport class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {\r\n private _maxDepthFromLod = 0;\r\n private _minDepthFromLod = 0;\r\n private _copyrightText = \"Copyright\";\r\n private _querySupported = false;\r\n private _tileMapSupported = false;\r\n private _tileMap: ArcGISTileMap|undefined;\r\n public serviceJson: any;\r\n constructor(settings: MapLayerSettings) {\r\n super(settings, false);\r\n }\r\n\r\n protected override get _filterByCartoRange() { return false; } // Can't trust footprint ranges (USGS Hydro)\r\n\r\n public override get minimumZoomLevel() { return Math.max(super.minimumZoomLevel, this._minDepthFromLod); }\r\n public override get maximumZoomLevel() { return this._maxDepthFromLod > 0 ? this._maxDepthFromLod : super.maximumZoomLevel; }\r\n\r\n public uintToString(uintArray: any) {\r\n return Buffer.from(uintArray).toJSON();\r\n\r\n }\r\n\r\n private async fetchTile(row: number, column: number, zoomLevel: number): Promise<Response | undefined> {\r\n const tileRequestOptions: RequestOptions = { method: \"GET\", responseType: \"arraybuffer\" };\r\n tileRequestOptions.auth = this.getRequestAuthorization();\r\n const tileUrl: string = await this.constructUrl(row, column, zoomLevel);\r\n if (tileUrl.length === 0)\r\n return undefined;\r\n\r\n return request(tileUrl, tileRequestOptions);\r\n }\r\n\r\n public override async loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined> {\r\n\r\n if ((this.status === MapLayerImageryProviderStatus.RequireAuth)) {\r\n return undefined;\r\n }\r\n\r\n try {\r\n let tileResponse = await this.fetchTile(row, column, zoomLevel);\r\n if (tileResponse === undefined)\r\n return undefined;\r\n\r\n // Check the content type from the response, it might contain an authentication error that need to be reported.\r\n // Skip if the layer state was already invalid\r\n if (ArcGisUtilities.hasTokenError(tileResponse)) {\r\n\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._settings.userName && this._settings.userName.length > 0) {\r\n ArcGisTokenManager.invalidateToken(this._settings.url, this._settings.userName);\r\n tileResponse = await this.fetchTile(row, column, zoomLevel);\r\n if (tileResponse === undefined)\r\n return undefined;\r\n }\r\n\r\n // OK at this point, if response still contain a token error, we assume end-user will\r\n // have to provide credentials again. Change the layer status so we\r\n // don't make additional invalid requests..\r\n if (tileResponse && ArcGisUtilities.hasTokenError(tileResponse)) {\r\n // Check again layer status, it might have change during await.\r\n if (this.status === MapLayerImageryProviderStatus.Valid) {\r\n this.status = MapLayerImageryProviderStatus.RequireAuth;\r\n this.onStatusChanged.raiseEvent(this);\r\n\r\n // Only report error to end-user if we were previously able to fetch tiles\r\n // and then encountered an error, otherwise I assume an error was already reported\r\n // through the source validation process.\r\n if (this._hasSuccessfullyFetchedTile) {\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.LoadTileTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n }\r\n\r\n if (!this._hasSuccessfullyFetchedTile) {\r\n this._hasSuccessfullyFetchedTile = true;\r\n }\r\n return this.getImageFromTileResponse(tileResponse, zoomLevel);\r\n } catch (error) {\r\n return undefined;\r\n }\r\n }\r\n protected override _generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void) {\r\n const childIds = this.getPotentialChildIds(tile);\r\n if (!this._tileMap || tile.quadId.level < Math.max(4, this.minimumZoomLevel-1)) {\r\n resolveChildren(childIds);\r\n return;\r\n }\r\n\r\n if (this._tileMap) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._tileMap.getChildrenAvailability(childIds).then((availability) => {\r\n const availableChildIds = new Array<QuadId>();\r\n for (let i = 0; i < availability.length; i++)\r\n if (availability[i])\r\n availableChildIds.push(childIds[i]);\r\n\r\n resolveChildren (availableChildIds);\r\n });\r\n }\r\n }\r\n\r\n private isEpsg3857Compatible(tileInfo: any) {\r\n if (tileInfo.spatialReference?.latestWkid !== 3857 || !Array.isArray(tileInfo.lods))\r\n return false;\r\n\r\n const zeroLod = tileInfo.lods[0];\r\n return zeroLod.level === 0 && Math.abs(zeroLod.resolution - 156543.03392800014) < .001;\r\n }\r\n\r\n public override async initialize(): Promise<void> {\r\n const json = await ArcGisUtilities.getServiceJson(this._settings.url, this.getRequestAuthorization());\r\n if (json === undefined)\r\n throw new ServerError(IModelStatus.ValidationFailed, \"\");\r\n\r\n if (json !== undefined) {\r\n this.serviceJson = json;\r\n if (json.capabilities) {\r\n\r\n this._querySupported = json.capabilities.indexOf(\"Query\") >= 0;\r\n this._tileMapSupported = json.capabilities.indexOf(\"Tilemap\") >= 0;\r\n }\r\n if (json.copyrightText) this._copyrightText = json.copyrightText;\r\n if (false !== (this._usesCachedTiles = json.tileInfo !== undefined && this.isEpsg3857Compatible(json.tileInfo))) {\r\n if (json.maxScale !== undefined && json.maxScale !== 0 && Array.isArray(json.tileInfo.lods)) {\r\n for (; this._maxDepthFromLod < json.tileInfo.lods.length && json.tileInfo.lods[this._maxDepthFromLod].scale > json.maxScale; this._maxDepthFromLod++)\r\n ;\r\n }\r\n }\r\n\r\n // Create tile map object only if we are going to request tiles from this server and it support tilemap requests.\r\n if (this._usesCachedTiles && this._tileMapSupported) {\r\n this._tileMap = new ArcGISTileMap(this._settings.url, json.tileInfo?.lods?.length);\r\n }\r\n\r\n const footprintJson = await ArcGisUtilities.getFootprintJson(this._settings.url, this.getRequestAuthorization());\r\n if (undefined !== footprintJson && undefined !== footprintJson.featureCollection && Array.isArray(footprintJson.featureCollection.layers)) {\r\n for (const layer of footprintJson.featureCollection.layers) {\r\n if (layer.layerDefinition && layer.layerDefinition.extent) {\r\n this.cartoRange = MapCartoRectangle.createFromDegrees(layer.layerDefinition.extent.xmin, layer.layerDefinition.extent.ymin, layer.layerDefinition.extent.xmax, layer.layerDefinition.extent.ymax);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Read minLOD if available\r\n if (json.minLOD !== undefined) {\r\n const minLod = parseInt(json.minLOD, 10);\r\n if (!Number.isNaN(minLod)) {\r\n this._minDepthFromLod = minLod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n public override getLogo(_vp: ScreenViewport) {\r\n return IModelApp.makeLogoCard({ heading: \"ArcGIS\", notice: this._copyrightText });\r\n }\r\n\r\n public override async getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void> {\r\n await super.getToolTip(strings, quadId, carto, tree);\r\n if (!doToolTips)\r\n return;\r\n\r\n if (!this._querySupported)\r\n return;\r\n\r\n const stringSet = new Set<string>();\r\n const bboxString = this.getEPSG3857ExtentString(quadId.row, quadId.column, quadId.level);\r\n const x = this.getEPSG3857X(carto.longitudeDegrees);\r\n const y = this.getEPSG3857Y(carto.latitudeDegrees);\r\n const tmpUrl = `${this._settings.url}/identify?f=json&tolerance=1&returnGeometry=false&sr=3857&imageDisplay=${this.tileSize},${this.tileSize},96&layers=${this.getLayerString(\"visible\")}&geometry=${x},${y}&geometryType=esriGeometryPoint&mapExtent=${bboxString}`;\r\n const url = await this.appendSecurityToken(tmpUrl);\r\n\r\n let json = await getJson(url);\r\n if (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken) {\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._settings.userName && this._settings.userName.length > 0) {\r\n ArcGisTokenManager.invalidateToken(this._settings.url, this._settings.userName);\r\n json = await getJson(url);\r\n }\r\n\r\n // OK at this point, if response still contain a token error, we assume end-user will\r\n // have to provide credentials again. Change the layer status so we\r\n // don't make additional invalid requests..\r\n if (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken) {\r\n // Check again layer status, it might have change during await.\r\n if (this.status === MapLayerImageryProviderStatus.Valid) {\r\n this.status = MapLayerImageryProviderStatus.RequireAuth;\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.FetchTooltipTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n\r\n return;\r\n }\r\n }\r\n\r\n if (json && Array.isArray(json.results)) {\r\n for (const result of json.results) {\r\n if (result.attributes !== undefined && result.attributes[result.displayFieldName] !== undefined) {\r\n const thisString = `${result.displayFieldName}: ${result.attributes[result.displayFieldName]}`;\r\n if (!stringSet.has(thisString)) {\r\n strings.push(thisString);\r\n stringSet.add(thisString);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n protected getLayerString(prefix = \"show\"): string {\r\n const layers = new Array<string>();\r\n this._settings.subLayers.forEach((subLayer) => { if (this._settings.isSubLayerVisible(subLayer)) layers.push(subLayer.idString); });\r\n return `${prefix}: ${layers.join(\",\")} `;\r\n }\r\n // construct the Url from the desired Tile\r\n public async constructUrl(row: number, column: number, zoomLevel: number): Promise<string> {\r\n let tmpUrl;\r\n if (this._usesCachedTiles) {\r\n tmpUrl = `${this._settings.url}/tile/${zoomLevel}/${row}/${column} `;\r\n } else {\r\n const bboxString = `${this.getEPSG3857ExtentString(row, column, zoomLevel)}&bboxSR=3857`;\r\n tmpUrl = `${this._settings.url}/export?bbox=${bboxString}&size=${this.tileSize},${this.tileSize}&layers=${this.getLayerString()}&format=png&transparent=${this.transparentBackgroundString}&f=image&sr=3857&imagesr=3857`;\r\n }\r\n return this.appendSecurityToken(tmpUrl);\r\n }\r\n\r\n // construct the Url from the desired Tile\r\n private async appendSecurityToken(url: string): Promise<string> {\r\n // Append security token if required\r\n let tokenParam = \"\";\r\n if (this._settings.userName && this._settings.password) {\r\n try {\r\n const token = await ArcGisTokenManager.getToken(this._settings.url, this._settings.userName, this._settings.password,\r\n {\r\n client: ArcGisTokenClientType.referer,\r\n });\r\n if (token?.token)\r\n tokenParam = `&token=${token.token}`;\r\n } catch {\r\n }\r\n }\r\n return `${url}${tokenParam}`;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ArcGISMapLayerImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA6B,YAAY,EAAoB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,OAAO,EAA4B,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,EACL,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,eAAe,EAAsC,iBAAiB,EACjJ,uBAAuB,EAAE,6BAA6B,GACvD,MAAM,gBAAgB,CAAC;AAExB,wCAAwC;AACxC,IAAI,UAAU,GAAG,IAAI,CAAC;AAEtB,gBAAgB;AAChB,MAAM,OAAO,6BAA8B,SAAQ,uBAAuB;IAQxE,YAAY,QAA0B;QACpC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QARjB,qBAAgB,GAAG,CAAC,CAAC;QACrB,qBAAgB,GAAG,CAAC,CAAC;QACrB,mBAAc,GAAG,WAAW,CAAC;QAC7B,oBAAe,GAAG,KAAK,CAAC;QACxB,sBAAiB,GAAG,KAAK,CAAC;IAKlC,CAAC;IAED,IAAuB,mBAAmB,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,CAAM,4CAA4C;IAEhH,IAAoB,gBAAgB,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC1G,IAAoB,gBAAgB,KAAK,OAAO,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB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AAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,0CAA0C;IAClC,KAAK,CAAC,mBAAmB,CAAC,GAAW;QAC3C,oCAAoC;QACpC,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;YACtD,IAAI;gBACF,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAClH;oBACE,MAAM,EAAE,qBAAqB,CAAC,OAAO;iBACtC,CAAC,CAAC;gBACL,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;oBACd,UAAU,GAAG,UAAU,KAAK,CAAC,KAAK,EAAE,CAAC;aACxC;YAAC,MAAM;aACP;SACF;QACD,OAAO,GAAG,GAAG,GAAG,UAAU,EAAE,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { Cartographic, ImageSource, IModelStatus, MapLayerSettings, ServerError } from \"@itwin/core-common\";\r\nimport { getJson, request, RequestOptions, Response } from \"../../../request/Request\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { NotifyMessageDetails, OutputMessagePriority } from \"../../../NotificationManager\";\r\nimport {\r\n ArcGisErrorCode, ArcGISTileMap, ArcGisTokenClientType, ArcGisTokenManager, ArcGisUtilities, ImageryMapTile, ImageryMapTileTree, MapCartoRectangle,\r\n MapLayerImageryProvider, MapLayerImageryProviderStatus, QuadId,\r\n} from \"../../internal\";\r\n\r\n// eslint-disable-next-line prefer-const\r\nlet doToolTips = true;\r\n\r\n/** @internal */\r\nexport class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {\r\n private _maxDepthFromLod = 0;\r\n private _minDepthFromLod = 0;\r\n private _copyrightText = \"Copyright\";\r\n private _querySupported = false;\r\n private _tileMapSupported = false;\r\n private _tileMap: ArcGISTileMap|undefined;\r\n public serviceJson: any;\r\n constructor(settings: MapLayerSettings) {\r\n super(settings, false);\r\n }\r\n\r\n protected override get _filterByCartoRange() { return false; } // Can't trust footprint ranges (USGS Hydro)\r\n\r\n public override get minimumZoomLevel() { return Math.max(super.minimumZoomLevel, this._minDepthFromLod); }\r\n public override get maximumZoomLevel() { return this._maxDepthFromLod > 0 ? this._maxDepthFromLod : super.maximumZoomLevel; }\r\n\r\n public uintToString(uintArray: any) {\r\n return Buffer.from(uintArray).toJSON();\r\n\r\n }\r\n\r\n private async fetchTile(row: number, column: number, zoomLevel: number): Promise<Response | undefined> {\r\n const tileRequestOptions: RequestOptions = { method: \"GET\", responseType: \"arraybuffer\" };\r\n tileRequestOptions.auth = this.getRequestAuthorization();\r\n const tileUrl: string = await this.constructUrl(row, column, zoomLevel);\r\n if (tileUrl.length === 0)\r\n return undefined;\r\n\r\n return request(tileUrl, tileRequestOptions);\r\n }\r\n\r\n public override async loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined> {\r\n\r\n if ((this.status === MapLayerImageryProviderStatus.RequireAuth)) {\r\n return undefined;\r\n }\r\n\r\n try {\r\n let tileResponse = await this.fetchTile(row, column, zoomLevel);\r\n if (tileResponse === undefined)\r\n return undefined;\r\n\r\n // Check the content type from the response, it might contain an authentication error that need to be reported.\r\n // Skip if the layer state was already invalid\r\n if (ArcGisUtilities.hasTokenError(tileResponse)) {\r\n\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._settings.userName && this._settings.userName.length > 0) {\r\n ArcGisTokenManager.invalidateToken(this._settings.url, this._settings.userName);\r\n tileResponse = await this.fetchTile(row, column, zoomLevel);\r\n if (tileResponse === undefined)\r\n return undefined;\r\n }\r\n\r\n // OK at this point, if response still contain a token error, we assume end-user will\r\n // have to provide credentials again. Change the layer status so we\r\n // don't make additional invalid requests..\r\n if (tileResponse && ArcGisUtilities.hasTokenError(tileResponse)) {\r\n // Check again layer status, it might have change during await.\r\n if (this.status === MapLayerImageryProviderStatus.Valid) {\r\n this.status = MapLayerImageryProviderStatus.RequireAuth;\r\n this.onStatusChanged.raiseEvent(this);\r\n\r\n // Only report error to end-user if we were previously able to fetch tiles\r\n // and then encountered an error, otherwise I assume an error was already reported\r\n // through the source validation process.\r\n if (this._hasSuccessfullyFetchedTile) {\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.LoadTileTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n }\r\n\r\n if (!this._hasSuccessfullyFetchedTile) {\r\n this._hasSuccessfullyFetchedTile = true;\r\n }\r\n return this.getImageFromTileResponse(tileResponse, zoomLevel);\r\n } catch (error) {\r\n return undefined;\r\n }\r\n }\r\n protected override _generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void) {\r\n const childIds = this.getPotentialChildIds(tile);\r\n if (!this._tileMap || tile.quadId.level < Math.max(4, this.minimumZoomLevel-1)) {\r\n resolveChildren(childIds);\r\n return;\r\n }\r\n\r\n if (this._tileMap) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._tileMap.getChildrenAvailability(childIds).then((availability) => {\r\n const availableChildIds = new Array<QuadId>();\r\n for (let i = 0; i < availability.length; i++)\r\n if (availability[i])\r\n availableChildIds.push(childIds[i]);\r\n\r\n resolveChildren (availableChildIds);\r\n });\r\n }\r\n }\r\n\r\n private isEpsg3857Compatible(tileInfo: any) {\r\n if (tileInfo.spatialReference?.latestWkid !== 3857 || !Array.isArray(tileInfo.lods))\r\n return false;\r\n\r\n const zeroLod = tileInfo.lods[0];\r\n return zeroLod.level === 0 && Math.abs(zeroLod.resolution - 156543.03392800014) < .001;\r\n }\r\n\r\n public override async initialize(): Promise<void> {\r\n const json = await ArcGisUtilities.getServiceJson(this._settings.url, this.getRequestAuthorization());\r\n if (json === undefined)\r\n throw new ServerError(IModelStatus.ValidationFailed, \"\");\r\n\r\n if (json !== undefined) {\r\n this.serviceJson = json;\r\n if (json.capabilities) {\r\n\r\n this._querySupported = json.capabilities.indexOf(\"Query\") >= 0;\r\n this._tileMapSupported = json.capabilities.indexOf(\"Tilemap\") >= 0;\r\n }\r\n if (json.copyrightText) this._copyrightText = json.copyrightText;\r\n if (false !== (this._usesCachedTiles = json.tileInfo !== undefined && this.isEpsg3857Compatible(json.tileInfo))) {\r\n if (json.maxScale !== undefined && json.maxScale !== 0 && Array.isArray(json.tileInfo.lods)) {\r\n for (; this._maxDepthFromLod < json.tileInfo.lods.length && json.tileInfo.lods[this._maxDepthFromLod].scale > json.maxScale; this._maxDepthFromLod++)\r\n ;\r\n }\r\n }\r\n\r\n // Create tile map object only if we are going to request tiles from this server and it support tilemap requests.\r\n if (this._usesCachedTiles && this._tileMapSupported) {\r\n this._tileMap = new ArcGISTileMap(this._settings.url, json.tileInfo?.lods?.length);\r\n }\r\n\r\n const footprintJson = await ArcGisUtilities.getFootprintJson(this._settings.url, this.getRequestAuthorization());\r\n if (undefined !== footprintJson && undefined !== footprintJson.featureCollection && Array.isArray(footprintJson.featureCollection.layers)) {\r\n for (const layer of footprintJson.featureCollection.layers) {\r\n if (layer.layerDefinition && layer.layerDefinition.extent) {\r\n this.cartoRange = MapCartoRectangle.createFromDegrees(layer.layerDefinition.extent.xmin, layer.layerDefinition.extent.ymin, layer.layerDefinition.extent.xmax, layer.layerDefinition.extent.ymax);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Read minLOD if available\r\n if (json.minLOD !== undefined) {\r\n const minLod = parseInt(json.minLOD, 10);\r\n if (!Number.isNaN(minLod)) {\r\n this._minDepthFromLod = minLod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n public override getLogo() {\r\n return IModelApp.makeLogoCard({ heading: \"ArcGIS\", notice: this._copyrightText });\r\n }\r\n\r\n public override async getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void> {\r\n await super.getToolTip(strings, quadId, carto, tree);\r\n if (!doToolTips)\r\n return;\r\n\r\n if (!this._querySupported)\r\n return;\r\n\r\n const stringSet = new Set<string>();\r\n const bboxString = this.getEPSG3857ExtentString(quadId.row, quadId.column, quadId.level);\r\n const x = this.getEPSG3857X(carto.longitudeDegrees);\r\n const y = this.getEPSG3857Y(carto.latitudeDegrees);\r\n const tmpUrl = `${this._settings.url}/identify?f=json&tolerance=1&returnGeometry=false&sr=3857&imageDisplay=${this.tileSize},${this.tileSize},96&layers=${this.getLayerString(\"visible\")}&geometry=${x},${y}&geometryType=esriGeometryPoint&mapExtent=${bboxString}`;\r\n const url = await this.appendSecurityToken(tmpUrl);\r\n\r\n let json = await getJson(url);\r\n if (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken) {\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._settings.userName && this._settings.userName.length > 0) {\r\n ArcGisTokenManager.invalidateToken(this._settings.url, this._settings.userName);\r\n json = await getJson(url);\r\n }\r\n\r\n // OK at this point, if response still contain a token error, we assume end-user will\r\n // have to provide credentials again. Change the layer status so we\r\n // don't make additional invalid requests..\r\n if (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken) {\r\n // Check again layer status, it might have change during await.\r\n if (this.status === MapLayerImageryProviderStatus.Valid) {\r\n this.status = MapLayerImageryProviderStatus.RequireAuth;\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.FetchTooltipTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n\r\n return;\r\n }\r\n }\r\n\r\n if (json && Array.isArray(json.results)) {\r\n for (const result of json.results) {\r\n if (result.attributes !== undefined && result.attributes[result.displayFieldName] !== undefined) {\r\n const thisString = `${result.displayFieldName}: ${result.attributes[result.displayFieldName]}`;\r\n if (!stringSet.has(thisString)) {\r\n strings.push(thisString);\r\n stringSet.add(thisString);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n protected getLayerString(prefix = \"show\"): string {\r\n const layers = new Array<string>();\r\n this._settings.subLayers.forEach((subLayer) => { if (this._settings.isSubLayerVisible(subLayer)) layers.push(subLayer.idString); });\r\n return `${prefix}: ${layers.join(\",\")} `;\r\n }\r\n // construct the Url from the desired Tile\r\n public async constructUrl(row: number, column: number, zoomLevel: number): Promise<string> {\r\n let tmpUrl;\r\n if (this._usesCachedTiles) {\r\n tmpUrl = `${this._settings.url}/tile/${zoomLevel}/${row}/${column} `;\r\n } else {\r\n const bboxString = `${this.getEPSG3857ExtentString(row, column, zoomLevel)}&bboxSR=3857`;\r\n tmpUrl = `${this._settings.url}/export?bbox=${bboxString}&size=${this.tileSize},${this.tileSize}&layers=${this.getLayerString()}&format=png&transparent=${this.transparentBackgroundString}&f=image&sr=3857&imagesr=3857`;\r\n }\r\n return this.appendSecurityToken(tmpUrl);\r\n }\r\n\r\n // construct the Url from the desired Tile\r\n private async appendSecurityToken(url: string): Promise<string> {\r\n // Append security token if required\r\n let tokenParam = \"\";\r\n if (this._settings.userName && this._settings.password) {\r\n try {\r\n const token = await ArcGisTokenManager.getToken(this._settings.url, this._settings.userName, this._settings.password,\r\n {\r\n client: ArcGisTokenClientType.referer,\r\n });\r\n if (token?.token)\r\n tokenParam = `&token=${token.token}`;\r\n } catch {\r\n }\r\n }\r\n return `${url}${tokenParam}`;\r\n }\r\n}\r\n"]}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
* @module Tiles
|
|
3
3
|
*/
|
|
4
4
|
import { MapLayerSettings } from "@itwin/core-common";
|
|
5
|
-
import { ScreenViewport } from "../../../Viewport";
|
|
6
5
|
import { MapLayerImageryProvider } from "../../internal";
|
|
7
6
|
/** @internal */
|
|
8
7
|
export declare class AzureMapsLayerImageryProvider extends MapLayerImageryProvider {
|
|
9
8
|
constructor(settings: MapLayerSettings);
|
|
10
9
|
constructUrl(y: number, x: number, zoom: number): Promise<string>;
|
|
11
|
-
getLogo(
|
|
10
|
+
getLogo(): HTMLTableRowElement;
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=AzureMapsLayerImageryProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureMapsLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AzureMapsLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,gBAAgB;AAChB,qBAAa,6BAA8B,SAAQ,uBAAuB;gBAC5D,QAAQ,EAAE,gBAAgB;IAGzB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM9D,OAAO;CAGxB"}
|
|
@@ -16,7 +16,7 @@ export class AzureMapsLayerImageryProvider extends MapLayerImageryProvider {
|
|
|
16
16
|
return "";
|
|
17
17
|
return `${this._settings.url}&${this._settings.accessKey.key}=${this._settings.accessKey.value}&api-version=2.0&zoom=${zoom}&x=${x}&y=${y}`;
|
|
18
18
|
}
|
|
19
|
-
getLogo(
|
|
19
|
+
getLogo() {
|
|
20
20
|
return IModelApp.makeLogoCard({ heading: "Azure Maps", notice: IModelApp.localization.getLocalizedString("iModelJs:BackgroundMap.AzureMapsCopyright") });
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureMapsLayerImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"AzureMapsLayerImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/AzureMapsLayerImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,gBAAgB;AAChB,MAAM,OAAO,6BAA8B,SAAQ,uBAAuB;IACxE,YAAY,QAA0B,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAElE,0CAA0C;IACnC,KAAK,CAAC,YAAY,CAAC,CAAS,EAAE,CAAS,EAAE,IAAY;QAC1D,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS;YAC3B,OAAO,EAAE,CAAC;QACZ,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,yBAAyB,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC9I,CAAC;IAEe,OAAO;QACrB,OAAO,SAAS,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,2CAA2C,CAAC,EAAE,CAAC,CAAC;IAC3J,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { MapLayerSettings } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { MapLayerImageryProvider } from \"../../internal\";\r\n\r\n/** @internal */\r\nexport class AzureMapsLayerImageryProvider extends MapLayerImageryProvider {\r\n constructor(settings: MapLayerSettings) { super(settings, true); }\r\n\r\n // construct the Url from the desired Tile\r\n public async constructUrl(y: number, x: number, zoom: number): Promise<string> {\r\n if (!this._settings.accessKey)\r\n return \"\";\r\n return `${this._settings.url}&${this._settings.accessKey.key}=${this._settings.accessKey.value}&api-version=2.0&zoom=${zoom}&x=${x}&y=${y}`;\r\n }\r\n\r\n public override getLogo() {\r\n return IModelApp.makeLogoCard({ heading: \"Azure Maps\", notice: IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.AzureMapsCopyright\") });\r\n }\r\n}\r\n"]}
|
|
@@ -121,7 +121,7 @@ export class BingMapsImageryLayerProvider extends MapLayerImageryProvider {
|
|
|
121
121
|
}
|
|
122
122
|
getLogo(vp) {
|
|
123
123
|
var _a;
|
|
124
|
-
const tiles = (_a = IModelApp.tileAdmin.
|
|
124
|
+
const tiles = (_a = IModelApp.tileAdmin.getTilesForUser(vp)) === null || _a === void 0 ? void 0 : _a.selected;
|
|
125
125
|
const matchingAttributions = this.getMatchingAttributions(tiles);
|
|
126
126
|
const copyrights = [];
|
|
127
127
|
for (const match of matchingAttributions)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BingImageryProvider.js","sour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M,eAAe,GAAoB,IAAI,eAAe,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;YAC1F,IAAI,CAAC,IAAI,CAAC,aAAa;gBACrB,IAAI,CAAC,aAAa,GAAG,IAAI,KAAK,EAAmB,CAAC;YACpD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC1C;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, BentleyError, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { Range2d } from \"@itwin/core-geometry\";\r\nimport { ImageSource, MapLayerSettings } from \"@itwin/core-common\";\r\nimport { request, RequestOptions, Response } from \"../../../request/Request\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { ScreenViewport } from \"../../../Viewport\";\r\nimport {\r\n MapLayerImageryProvider, MapTile, MapTilingScheme, QuadId,\r\n Tile, WebMercatorTilingScheme,\r\n} from \"../../internal\";\r\n\r\n/** Represents one range of geography and tile zoom levels for a bing data provider\r\n * @internal\r\n */\r\nclass Coverage {\r\n constructor(private _lowerLeftLatitude: number,\r\n private _lowerLeftLongitude: number,\r\n private _upperRightLatitude: number,\r\n private _upperRightLongitude: number,\r\n private _minimumZoomLevel: number,\r\n private _maximumZoomLevel: number) { }\r\n\r\n public overlaps(quadId: QuadId, tilingScheme: MapTilingScheme): boolean {\r\n const range: Range2d = quadId.getLatLongRange(tilingScheme);\r\n if (quadId.level < this._minimumZoomLevel)\r\n return false;\r\n if (quadId.level > this._maximumZoomLevel)\r\n return false;\r\n if (range.low.x > this._upperRightLongitude)\r\n return false;\r\n if (range.low.y > this._upperRightLatitude)\r\n return false;\r\n if (range.high.x < this._lowerLeftLongitude)\r\n return false;\r\n if (range.high.y < this._lowerLeftLatitude)\r\n return false;\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/** Represents the copyright message and an array of coverage data for one of bing's data providers (HERE for example).\r\n * @internal\r\n */\r\nclass BingAttribution {\r\n constructor(public copyrightMessage: string, private _coverages: Coverage[]) { }\r\n\r\n public matchesTile(tile: Tile, tilingScheme: MapTilingScheme): boolean {\r\n const quadId = QuadId.createFromContentId(tile.contentId);\r\n for (const coverage of this._coverages) {\r\n if (coverage.overlaps(quadId, tilingScheme))\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n// in deployed applications, we can only make https requests, but the Bing Maps metadata request returns templates with \"http:\".\r\n// This function fixes those.\r\nfunction replaceHttpWithHttps(originalUrl: string) {\r\n return originalUrl.startsWith(\"http:\") ? \"https:\".concat(originalUrl.slice(5)) : originalUrl;\r\n}\r\n\r\n/** @internal */\r\nexport class BingMapsImageryLayerProvider extends MapLayerImageryProvider {\r\n private _urlTemplate?: string;\r\n private _urlSubdomains?: string[];\r\n private _zoomMax: number;\r\n private _tileHeight: number;\r\n private _tileWidth: number;\r\n private _attributions?: BingAttribution[]; // array of Bing's data providers.\r\n private _mapTilingScheme: MapTilingScheme;\r\n private _urlBase: string;\r\n\r\n constructor(settings: MapLayerSettings) {\r\n super(settings, true);\r\n this._urlBase = settings.url;\r\n this._zoomMax = 0;\r\n this._tileHeight = this._tileWidth = 0;\r\n this._mapTilingScheme = new WebMercatorTilingScheme();\r\n }\r\n\r\n public get tileWidth(): number { return this._tileWidth; }\r\n public get tileHeight(): number { return this._tileHeight; }\r\n\r\n private tileXYToQuadKey(tileX: number, tileY: number, zoomLevel: number) {\r\n // from C# example in bing documentation https://msdn.microsoft.com/en-us/library/bb259689.aspx\r\n let quadKey: string = \"\";\r\n\r\n // Root tile is not displayable. Returns 0 for _GetMaximumSize(). Should not end up here.\r\n assert(0 !== zoomLevel);\r\n\r\n for (let i: number = zoomLevel; i > 0; i--) {\r\n let digit: number = 0x30; // '0'\r\n const mask: number = 1 << (i - 1);\r\n if ((tileX & mask) !== 0) {\r\n digit++;\r\n }\r\n if ((tileY & mask) !== 0) {\r\n digit++;\r\n digit++;\r\n }\r\n quadKey = quadKey.concat(String.fromCharCode(digit));\r\n }\r\n return quadKey;\r\n }\r\n\r\n // construct the Url from the desired Tile\r\n public async constructUrl(row: number, column: number, zoomLevel: number): Promise<string> {\r\n // From the tile, get a \"quadKey\" the Microsoft way.\r\n const quadKey: string = this.tileXYToQuadKey(column, row, zoomLevel);\r\n const subdomain: string = this._urlSubdomains![(row + column) % this._urlSubdomains!.length];\r\n\r\n // from the template url, construct the tile url.\r\n let url: string = this._urlTemplate!.replace(\"{subdomain}\", subdomain);\r\n url = url.replace(\"{quadkey}\", quadKey);\r\n\r\n return url;\r\n }\r\n\r\n // gets the attributions that match the tile set.\r\n private getMatchingAttributions(tiles: Set<Tile> | undefined): BingAttribution[] {\r\n const matchingAttributions: BingAttribution[] = new Array<BingAttribution>();\r\n if (!this._attributions || !tiles)\r\n return matchingAttributions;\r\n\r\n const unmatchedSet: BingAttribution[] = this._attributions.slice();\r\n for (const tile of tiles) {\r\n if (tile instanceof MapTile)\r\n // compare to the set of Bing attributions that we have not yet matched.\r\n for (let iAttr = 0; iAttr < unmatchedSet.length; iAttr++) {\r\n const attribution = unmatchedSet[iAttr];\r\n if (attribution && attribution.matchesTile(tile, this._mapTilingScheme)) {\r\n matchingAttributions.push(attribution);\r\n delete unmatchedSet[iAttr];\r\n }\r\n }\r\n }\r\n return matchingAttributions;\r\n }\r\n\r\n public override getLogo(vp: ScreenViewport): HTMLTableRowElement | undefined {\r\n const tiles = IModelApp.tileAdmin.getTilesForViewport(vp)?.selected;\r\n const matchingAttributions = this.getMatchingAttributions(tiles);\r\n const copyrights: string[] = [];\r\n for (const match of matchingAttributions)\r\n copyrights.push(match.copyrightMessage);\r\n\r\n let copyrightMsg = \"\";\r\n for (let i = 0; i < copyrights.length; ++i) {\r\n if (i > 0)\r\n copyrightMsg += \"<br>\";\r\n copyrightMsg += copyrights[i];\r\n }\r\n return IModelApp.makeLogoCard({ iconSrc: `${IModelApp.publicPath}images/bing.svg`, heading: \"Microsoft Bing\", notice: copyrightMsg });\r\n }\r\n\r\n // initializes the BingImageryProvider by reading the templateUrl, logo image, and attribution list.\r\n public override async initialize(): Promise<void> {\r\n // get the template url\r\n const bingRequestUrl = this._urlBase.replace(\"{bingKey}\", this._settings.accessKey ? this._settings.accessKey.value : \"\");\r\n const requestOptions: RequestOptions = { method: \"GET\" };\r\n\r\n try {\r\n const response: Response = await request(bingRequestUrl, requestOptions);\r\n const bingResponseProps: any = response.body;\r\n\r\n const thisResourceSetProps = bingResponseProps.resourceSets[0];\r\n const thisResourceProps = thisResourceSetProps.resources[0];\r\n this._zoomMax = thisResourceProps.zoomMax;\r\n this._tileHeight = thisResourceProps.imageHeight;\r\n this._tileWidth = thisResourceProps.imageWidth;\r\n this._urlTemplate = replaceHttpWithHttps(thisResourceProps.imageUrl.replace(\"{culture}\", \"en-US\")); // NEEDSWORK - get locale from somewhere.\r\n this._urlSubdomains = thisResourceProps.imageUrlSubdomains;\r\n // read the list of Bing's data suppliers and the range of data they provide. Used in calculation of copyright message.\r\n this.readAttributions(thisResourceProps.imageryProviders);\r\n\r\n // Bing sometimes provides tiles that have nothing but a camera icon in the middle of them when you ask\r\n // for tiles at zoom levels where they don't have data. Their application stops you from zooming in when that's the\r\n // case, but we can't stop - the user might want to look at design data a closer zoom. So we intentionally load such\r\n // a tile, and then compare other tiles to it, rejecting them if they match.\r\n this.loadTile(0, 0, this._zoomMax - 1).then((tileData: ImageSource | undefined) => { // eslint-disable-line @typescript-eslint/no-floating-promises\r\n if (tileData !== undefined) this._missingTileData = tileData.data as Uint8Array;\r\n });\r\n } catch (error) {\r\n throw new BentleyError(IModelStatus.BadModel, \"Error in Bing Server communications\");\r\n }\r\n }\r\n\r\n // reads the list of Bing data providers and the map range for which they each provide data.\r\n private readAttributions(attributionProps: any) {\r\n for (const thisAttributionProps of attributionProps) {\r\n const copyrightMessage: string = thisAttributionProps.attribution;\r\n const coverages: Coverage[] = new Array<Coverage>();\r\n for (const thisCoverageProps of thisAttributionProps.coverageAreas) {\r\n const thisCoverage = new Coverage(thisCoverageProps.bbox[0], thisCoverageProps.bbox[1], thisCoverageProps.bbox[2], thisCoverageProps.bbox[3],\r\n thisCoverageProps.zoomMin, thisCoverageProps.zoomMax);\r\n coverages.push(thisCoverage);\r\n }\r\n const thisAttribution: BingAttribution = new BingAttribution(copyrightMessage, coverages);\r\n if (!this._attributions)\r\n this._attributions = new Array<BingAttribution>();\r\n this._attributions.push(thisAttribution);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"BingImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/BingImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGzE,OAAO,EAAE,OAAO,EAA4B,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EACL,uBAAuB,EAAE,OAAO,EAAmB,MAAM,EACnD,uBAAuB,GAC9B,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,QAAQ;IACZ,YAAoB,kBAA0B,EACpC,mBAA2B,EAC3B,mBAA2B,EAC3B,oBAA4B,EAC5B,iBAAyB,EACzB,iBAAyB;QALf,uBAAkB,GAAlB,kBAAkB,CAAQ;QACpC,wBAAmB,GAAnB,mBAAmB,CAAQ;QAC3B,wBAAmB,GAAnB,mBAAmB,CAAQ;QAC3B,yBAAoB,GAApB,oBAAoB,CAAQ;QAC5B,sBAAiB,GAAjB,iBAAiB,CAAQ;QACzB,sBAAiB,GAAjB,iBAAiB,CAAQ;IAAI,CAAC;IAEjC,QAAQ,CAAC,MAAc,EAAE,YAA6B;QAC3D,MAAM,KAAK,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Ae,IAAI,KAAK,EAAY,CAAC;YACpD,KAAK,MAAM,iBAAiB,IAAI,oBAAoB,CAAC,aAAa,EAAE;gBAClE,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAC1I,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBACxD,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAC9B;YACD,MAAM,eAAe,GAAoB,IAAI,eAAe,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;YAC1F,IAAI,CAAC,IAAI,CAAC,aAAa;gBACrB,IAAI,CAAC,aAAa,GAAG,IAAI,KAAK,EAAmB,CAAC;YACpD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SAC1C;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, BentleyError, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { Range2d } from \"@itwin/core-geometry\";\r\nimport { ImageSource, MapLayerSettings } from \"@itwin/core-common\";\r\nimport { request, RequestOptions, Response } from \"../../../request/Request\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { ScreenViewport } from \"../../../Viewport\";\r\nimport {\r\n MapLayerImageryProvider, MapTile, MapTilingScheme, QuadId,\r\n Tile, WebMercatorTilingScheme,\r\n} from \"../../internal\";\r\n\r\n/** Represents one range of geography and tile zoom levels for a bing data provider\r\n * @internal\r\n */\r\nclass Coverage {\r\n constructor(private _lowerLeftLatitude: number,\r\n private _lowerLeftLongitude: number,\r\n private _upperRightLatitude: number,\r\n private _upperRightLongitude: number,\r\n private _minimumZoomLevel: number,\r\n private _maximumZoomLevel: number) { }\r\n\r\n public overlaps(quadId: QuadId, tilingScheme: MapTilingScheme): boolean {\r\n const range: Range2d = quadId.getLatLongRange(tilingScheme);\r\n if (quadId.level < this._minimumZoomLevel)\r\n return false;\r\n if (quadId.level > this._maximumZoomLevel)\r\n return false;\r\n if (range.low.x > this._upperRightLongitude)\r\n return false;\r\n if (range.low.y > this._upperRightLatitude)\r\n return false;\r\n if (range.high.x < this._lowerLeftLongitude)\r\n return false;\r\n if (range.high.y < this._lowerLeftLatitude)\r\n return false;\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/** Represents the copyright message and an array of coverage data for one of bing's data providers (HERE for example).\r\n * @internal\r\n */\r\nclass BingAttribution {\r\n constructor(public copyrightMessage: string, private _coverages: Coverage[]) { }\r\n\r\n public matchesTile(tile: Tile, tilingScheme: MapTilingScheme): boolean {\r\n const quadId = QuadId.createFromContentId(tile.contentId);\r\n for (const coverage of this._coverages) {\r\n if (coverage.overlaps(quadId, tilingScheme))\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n\r\n// in deployed applications, we can only make https requests, but the Bing Maps metadata request returns templates with \"http:\".\r\n// This function fixes those.\r\nfunction replaceHttpWithHttps(originalUrl: string) {\r\n return originalUrl.startsWith(\"http:\") ? \"https:\".concat(originalUrl.slice(5)) : originalUrl;\r\n}\r\n\r\n/** @internal */\r\nexport class BingMapsImageryLayerProvider extends MapLayerImageryProvider {\r\n private _urlTemplate?: string;\r\n private _urlSubdomains?: string[];\r\n private _zoomMax: number;\r\n private _tileHeight: number;\r\n private _tileWidth: number;\r\n private _attributions?: BingAttribution[]; // array of Bing's data providers.\r\n private _mapTilingScheme: MapTilingScheme;\r\n private _urlBase: string;\r\n\r\n constructor(settings: MapLayerSettings) {\r\n super(settings, true);\r\n this._urlBase = settings.url;\r\n this._zoomMax = 0;\r\n this._tileHeight = this._tileWidth = 0;\r\n this._mapTilingScheme = new WebMercatorTilingScheme();\r\n }\r\n\r\n public get tileWidth(): number { return this._tileWidth; }\r\n public get tileHeight(): number { return this._tileHeight; }\r\n\r\n private tileXYToQuadKey(tileX: number, tileY: number, zoomLevel: number) {\r\n // from C# example in bing documentation https://msdn.microsoft.com/en-us/library/bb259689.aspx\r\n let quadKey: string = \"\";\r\n\r\n // Root tile is not displayable. Returns 0 for _GetMaximumSize(). Should not end up here.\r\n assert(0 !== zoomLevel);\r\n\r\n for (let i: number = zoomLevel; i > 0; i--) {\r\n let digit: number = 0x30; // '0'\r\n const mask: number = 1 << (i - 1);\r\n if ((tileX & mask) !== 0) {\r\n digit++;\r\n }\r\n if ((tileY & mask) !== 0) {\r\n digit++;\r\n digit++;\r\n }\r\n quadKey = quadKey.concat(String.fromCharCode(digit));\r\n }\r\n return quadKey;\r\n }\r\n\r\n // construct the Url from the desired Tile\r\n public async constructUrl(row: number, column: number, zoomLevel: number): Promise<string> {\r\n // From the tile, get a \"quadKey\" the Microsoft way.\r\n const quadKey: string = this.tileXYToQuadKey(column, row, zoomLevel);\r\n const subdomain: string = this._urlSubdomains![(row + column) % this._urlSubdomains!.length];\r\n\r\n // from the template url, construct the tile url.\r\n let url: string = this._urlTemplate!.replace(\"{subdomain}\", subdomain);\r\n url = url.replace(\"{quadkey}\", quadKey);\r\n\r\n return url;\r\n }\r\n\r\n // gets the attributions that match the tile set.\r\n private getMatchingAttributions(tiles: Set<Tile> | undefined): BingAttribution[] {\r\n const matchingAttributions: BingAttribution[] = new Array<BingAttribution>();\r\n if (!this._attributions || !tiles)\r\n return matchingAttributions;\r\n\r\n const unmatchedSet: BingAttribution[] = this._attributions.slice();\r\n for (const tile of tiles) {\r\n if (tile instanceof MapTile)\r\n // compare to the set of Bing attributions that we have not yet matched.\r\n for (let iAttr = 0; iAttr < unmatchedSet.length; iAttr++) {\r\n const attribution = unmatchedSet[iAttr];\r\n if (attribution && attribution.matchesTile(tile, this._mapTilingScheme)) {\r\n matchingAttributions.push(attribution);\r\n delete unmatchedSet[iAttr];\r\n }\r\n }\r\n }\r\n return matchingAttributions;\r\n }\r\n\r\n public override getLogo(vp: ScreenViewport): HTMLTableRowElement | undefined {\r\n const tiles = IModelApp.tileAdmin.getTilesForUser(vp)?.selected;\r\n const matchingAttributions = this.getMatchingAttributions(tiles);\r\n const copyrights: string[] = [];\r\n for (const match of matchingAttributions)\r\n copyrights.push(match.copyrightMessage);\r\n\r\n let copyrightMsg = \"\";\r\n for (let i = 0; i < copyrights.length; ++i) {\r\n if (i > 0)\r\n copyrightMsg += \"<br>\";\r\n copyrightMsg += copyrights[i];\r\n }\r\n return IModelApp.makeLogoCard({ iconSrc: `${IModelApp.publicPath}images/bing.svg`, heading: \"Microsoft Bing\", notice: copyrightMsg });\r\n }\r\n\r\n // initializes the BingImageryProvider by reading the templateUrl, logo image, and attribution list.\r\n public override async initialize(): Promise<void> {\r\n // get the template url\r\n const bingRequestUrl = this._urlBase.replace(\"{bingKey}\", this._settings.accessKey ? this._settings.accessKey.value : \"\");\r\n const requestOptions: RequestOptions = { method: \"GET\" };\r\n\r\n try {\r\n const response: Response = await request(bingRequestUrl, requestOptions);\r\n const bingResponseProps: any = response.body;\r\n\r\n const thisResourceSetProps = bingResponseProps.resourceSets[0];\r\n const thisResourceProps = thisResourceSetProps.resources[0];\r\n this._zoomMax = thisResourceProps.zoomMax;\r\n this._tileHeight = thisResourceProps.imageHeight;\r\n this._tileWidth = thisResourceProps.imageWidth;\r\n this._urlTemplate = replaceHttpWithHttps(thisResourceProps.imageUrl.replace(\"{culture}\", \"en-US\")); // NEEDSWORK - get locale from somewhere.\r\n this._urlSubdomains = thisResourceProps.imageUrlSubdomains;\r\n // read the list of Bing's data suppliers and the range of data they provide. Used in calculation of copyright message.\r\n this.readAttributions(thisResourceProps.imageryProviders);\r\n\r\n // Bing sometimes provides tiles that have nothing but a camera icon in the middle of them when you ask\r\n // for tiles at zoom levels where they don't have data. Their application stops you from zooming in when that's the\r\n // case, but we can't stop - the user might want to look at design data a closer zoom. So we intentionally load such\r\n // a tile, and then compare other tiles to it, rejecting them if they match.\r\n this.loadTile(0, 0, this._zoomMax - 1).then((tileData: ImageSource | undefined) => { // eslint-disable-line @typescript-eslint/no-floating-promises\r\n if (tileData !== undefined) this._missingTileData = tileData.data as Uint8Array;\r\n });\r\n } catch (error) {\r\n throw new BentleyError(IModelStatus.BadModel, \"Error in Bing Server communications\");\r\n }\r\n }\r\n\r\n // reads the list of Bing data providers and the map range for which they each provide data.\r\n private readAttributions(attributionProps: any) {\r\n for (const thisAttributionProps of attributionProps) {\r\n const copyrightMessage: string = thisAttributionProps.attribution;\r\n const coverages: Coverage[] = new Array<Coverage>();\r\n for (const thisCoverageProps of thisAttributionProps.coverageAreas) {\r\n const thisCoverage = new Coverage(thisCoverageProps.bbox[0], thisCoverageProps.bbox[1], thisCoverageProps.bbox[2], thisCoverageProps.bbox[3],\r\n thisCoverageProps.zoomMin, thisCoverageProps.zoomMax);\r\n coverages.push(thisCoverage);\r\n }\r\n const thisAttribution: BingAttribution = new BingAttribution(copyrightMessage, coverages);\r\n if (!this._attributions)\r\n this._attributions = new Array<BingAttribution>();\r\n this._attributions.push(thisAttribution);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @module Tiles
|
|
3
3
|
*/
|
|
4
4
|
import { MapLayerSettings } from "@itwin/core-common";
|
|
5
|
-
import { ScreenViewport } from "../../../Viewport";
|
|
6
5
|
import { MapLayerImageryProvider } from "../../internal";
|
|
7
6
|
/** Base class imagery map layer formats. Subclasses should override formatId and [[MapLayerFormat.createImageryProvider]].
|
|
8
7
|
* @internal
|
|
@@ -17,7 +16,7 @@ export declare class MapBoxLayerImageryProvider extends MapLayerImageryProvider
|
|
|
17
16
|
get minimumZoomLevel(): number;
|
|
18
17
|
get maximumZoomLevel(): number;
|
|
19
18
|
constructUrl(row: number, column: number, zoomLevel: number): Promise<string>;
|
|
20
|
-
getLogo(
|
|
19
|
+
getLogo(): HTMLTableRowElement | undefined;
|
|
21
20
|
initialize(): Promise<void>;
|
|
22
21
|
}
|
|
23
22
|
//# sourceMappingURL=MapBoxLayerImageryProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapBoxLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/MapBoxLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"MapBoxLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/MapBoxLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,uBAAuB;IACrE,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,gBAAgB;IAMtC,IAAW,SAAS,IAAI,MAAM,CAAgB;IAC9C,IAAW,UAAU,IAAI,MAAM,CAAgB;IAC/C,IAAoB,gBAAgB,IAAI,MAAM,CAA0B;IACxE,IAAoB,gBAAgB,IAAI,MAAM,CAA0B;IAG3D,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAa1E,OAAO,IAAI,mBAAmB,GAAG,SAAS;IAKpC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAClD"}
|
|
@@ -32,7 +32,7 @@ export class MapBoxLayerImageryProvider extends MapLayerImageryProvider {
|
|
|
32
32
|
url = url.concat(`.jpg80?${this._settings.accessKey.key}=${this._settings.accessKey.value}`);
|
|
33
33
|
return url;
|
|
34
34
|
}
|
|
35
|
-
getLogo(
|
|
35
|
+
getLogo() {
|
|
36
36
|
return IModelApp.makeLogoCard({ heading: "Mapbox", notice: IModelApp.localization.getLocalizedString("iModelJs:BackgroundMap.MapBoxCopyright") });
|
|
37
37
|
}
|
|
38
38
|
// no initialization needed for MapBoxImageryProvider.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapBoxLayerImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/MapBoxLayerImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"MapBoxLayerImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/MapBoxLayerImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,uBAAuB;IAKrE,YAAY,QAA0B;QACpC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACxC,CAAC;IAED,IAAW,SAAS,KAAa,OAAO,GAAG,CAAC,CAAC,CAAC;IAC9C,IAAW,UAAU,KAAa,OAAO,GAAG,CAAC,CAAC,CAAC;IAC/C,IAAoB,gBAAgB,KAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxE,IAAoB,gBAAgB,KAAa,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAExE,0CAA0C;IACnC,KAAK,CAAC,YAAY,CAAC,GAAW,EAAE,MAAc,EAAE,SAAiB;QACtE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC7B,OAAO,EAAE,CAAC;SACX;QAED,iDAAiD;QACjD,IAAI,GAAG,GAAW,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7D,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnF,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;QAE7F,OAAO,GAAG,CAAC;IACb,CAAC;IAEe,OAAO;QACrB,OAAO,SAAS,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,wCAAwC,CAAC,EAAE,CAAC,CAAC;IACpJ,CAAC;IAED,sDAAsD;IACtC,KAAK,CAAC,UAAU,KAAoB,CAAC;CACtD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { MapLayerSettings } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { MapLayerImageryProvider } from \"../../internal\";\r\n\r\n/** Base class imagery map layer formats. Subclasses should override formatId and [[MapLayerFormat.createImageryProvider]].\r\n * @internal\r\n */\r\nexport class MapBoxLayerImageryProvider extends MapLayerImageryProvider {\r\n private _zoomMin: number;\r\n private _zoomMax: number;\r\n private _baseUrl: string;\r\n\r\n constructor(settings: MapLayerSettings) {\r\n super(settings, true);\r\n this._baseUrl = settings.url;\r\n this._zoomMin = 1; this._zoomMax = 20;\r\n }\r\n\r\n public get tileWidth(): number { return 256; }\r\n public get tileHeight(): number { return 256; }\r\n public override get minimumZoomLevel(): number { return this._zoomMin; }\r\n public override get maximumZoomLevel(): number { return this._zoomMax; }\r\n\r\n // construct the Url from the desired Tile\r\n public async constructUrl(row: number, column: number, zoomLevel: number): Promise<string> {\r\n if (!this._settings.accessKey) {\r\n return \"\";\r\n }\r\n\r\n // from the template url, construct the tile url.\r\n let url: string = this._baseUrl.concat(zoomLevel.toString());\r\n url = url.concat(\"/\").concat(column.toString()).concat(\"/\").concat(row.toString());\r\n url = url.concat(`.jpg80?${this._settings.accessKey.key}=${this._settings.accessKey.value}`);\r\n\r\n return url;\r\n }\r\n\r\n public override getLogo(): HTMLTableRowElement | undefined {\r\n return IModelApp.makeLogoCard({ heading: \"Mapbox\", notice: IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.MapBoxCopyright\") });\r\n }\r\n\r\n // no initialization needed for MapBoxImageryProvider.\r\n public override async initialize(): Promise<void> { }\r\n}\r\n"]}
|
|
@@ -5,7 +5,7 @@ import { Cartographic, MapLayerSettings, RenderTexture, ViewFlagOverrides } from
|
|
|
5
5
|
import { IModelConnection } from "../../IModelConnection";
|
|
6
6
|
import { RenderMemory } from "../../render/RenderMemory";
|
|
7
7
|
import { RenderSystem } from "../../render/RenderSystem";
|
|
8
|
-
import { ScreenViewport
|
|
8
|
+
import { ScreenViewport } from "../../Viewport";
|
|
9
9
|
import { MapCartoRectangle, MapLayerImageryProvider, MapLayerTileTreeReference, MapTile, MapTilingScheme, QuadId, RealityTile, RealityTileLoader, RealityTileTree, RealityTileTreeParams, Tile, TileContent, TileDrawArgs, TileLoadPriority, TileParams, TileRequest, TileTreeLoadStatus, TileTreeOwner } from "../internal";
|
|
10
10
|
/** @internal */
|
|
11
11
|
export interface ImageryTileContent extends TileContent {
|
|
@@ -57,7 +57,7 @@ declare class ImageryTileLoader extends RealityTileLoader {
|
|
|
57
57
|
private _imageryProvider;
|
|
58
58
|
private _iModel;
|
|
59
59
|
constructor(_imageryProvider: MapLayerImageryProvider, _iModel: IModelConnection);
|
|
60
|
-
computeTilePriority(tile: Tile
|
|
60
|
+
computeTilePriority(tile: Tile): number;
|
|
61
61
|
get maxDepth(): number;
|
|
62
62
|
get minDepth(): number;
|
|
63
63
|
get priority(): TileLoadPriority;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageryTileTree.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/ImageryTileTree.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,YAAY,EAAe,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEnH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"ImageryTileTree.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/ImageryTileTree.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,YAAY,EAAe,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEnH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;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ealityTileLoader {
|
|
|
144
144
|
this._imageryProvider = _imageryProvider;
|
|
145
145
|
this._iModel = _iModel;
|
|
146
146
|
}
|
|
147
|
-
computeTilePriority(tile
|
|
147
|
+
computeTilePriority(tile) {
|
|
148
148
|
return 25 * (this._imageryProvider.usesCachedTiles ? 2 : 1) - tile.depth; // Always cached first then descending by depth (high resolution/front first)
|
|
149
149
|
} // Prioritized fast, cached tiles first.
|
|
150
150
|
get maxDepth() { return this._imageryProvider.maximumZoomLevel; }
|