@itwin/map-layers-formats 4.0.0-dev.8 → 4.0.0-dev.81
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/.rush/temp/operation/build/all.log +3 -0
- package/.rush/temp/operation/build/state.json +3 -0
- package/.rush/temp/operation/cover/all.log +98 -0
- package/.rush/temp/operation/cover/state.json +1 -1
- package/.rush/temp/operation/docs/all.log +30 -0
- package/.rush/temp/operation/docs/state.json +1 -1
- package/.rush/temp/{package-deps_build_ci.json → package-deps_build.json} +11 -11
- package/.rush/temp/package-deps_cover.json +10 -10
- package/.rush/temp/package-deps_docs.json +10 -10
- package/.rush/temp/shrinkwrap-deps.json +190 -44
- package/CHANGELOG.json +57 -0
- package/CHANGELOG.md +44 -1
- package/config/rush-project.json +1 -2
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.d.ts +8 -8
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js +14 -14
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.d.ts +14 -14
- package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.js +132 -134
- package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.d.ts +14 -14
- package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.js +200 -202
- package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts +44 -44
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +421 -422
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts +92 -92
- package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js +82 -82
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts +17 -17
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js +33 -33
- package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.d.ts +32 -32
- package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.js +142 -142
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts +16 -16
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js +42 -43
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +85 -85
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +189 -192
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.d.ts +1063 -1063
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js +2267 -2270
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
- package/lib/cjs/map-layers-formats.d.ts +8 -8
- package/lib/cjs/map-layers-formats.js +28 -24
- package/lib/cjs/map-layers-formats.js.map +1 -1
- package/lib/cjs/mapLayersFormats.d.ts +10 -10
- package/lib/cjs/mapLayersFormats.js +28 -28
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +34 -34
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.js +161 -161
- package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.js +167 -167
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js +679 -680
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.js +103 -103
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +214 -214
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.js +94 -94
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.js.map +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +59 -59
- package/lib/cjs/test/ArcGisFeature/Mocks.d.ts +6 -6
- package/lib/cjs/test/ArcGisFeature/Mocks.js +18 -18
- package/lib/cjs/test/ArcGisFeature/NewYorkDataset.d.ts +55 -55
- package/lib/cjs/test/ArcGisFeature/NewYorkDataset.d.ts.map +1 -1
- package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js +419 -419
- package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js.map +1 -1
- package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +1042 -1042
- package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.d.ts.map +1 -1
- package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js +426 -426
- package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js.map +1 -1
- package/lib/cjs/test/coverage/.nyc_output/cd866071-e986-4027-89f6-9a70b6e25ed3.json +1 -0
- package/lib/cjs/test/coverage/.nyc_output/processinfo/4c93adb3-7e95-4a63-9814-a25d79ab4680.json +1 -0
- package/lib/cjs/test/coverage/.nyc_output/processinfo/cd866071-e986-4027-89f6-9a70b6e25ed3.json +1 -0
- package/lib/cjs/test/coverage/.nyc_output/processinfo/index.json +1 -1
- package/lib/cjs/test/coverage/cobertura-coverage.xml +72 -72
- package/lib/cjs/test/coverage/lcov-report/index.html +5 -5
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureFormat.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureJSON.ts.html +10 -10
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeaturePBF.ts.html +7 -7
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureProvider.ts.html +10 -10
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureQuery.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureReader.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureRenderer.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureResponse.ts.html +4 -4
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisSymbologyRenderer.ts.html +8 -8
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/index.html +13 -13
- package/lib/cjs/test/coverage/lcov-report/src/index.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/map-layers-formats.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/mapLayersFormats.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov.info +355 -531
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.d.ts +8 -8
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js +11 -10
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.d.ts +14 -14
- package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.js +128 -130
- package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.d.ts +14 -14
- package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.js +196 -198
- package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +44 -44
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +418 -418
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts +92 -92
- package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js +78 -78
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts +17 -17
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js +29 -29
- package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.d.ts +32 -32
- package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.js +138 -138
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts +16 -16
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js +38 -39
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +85 -85
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +183 -185
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/esm/ArcGisFeature/esriPBuffer.gen.d.ts +1063 -1063
- package/lib/esm/ArcGisFeature/esriPBuffer.gen.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/esriPBuffer.gen.js +2264 -2267
- package/lib/esm/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
- package/lib/esm/map-layers-formats.d.ts +8 -8
- package/lib/esm/map-layers-formats.js +12 -12
- package/lib/esm/mapLayersFormats.d.ts +10 -10
- package/lib/esm/mapLayersFormats.js +24 -24
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +32 -32
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.js +159 -159
- package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.js +165 -165
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js +677 -678
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.js +101 -101
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +212 -212
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.js +92 -92
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.js.map +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +57 -57
- package/lib/esm/test/ArcGisFeature/Mocks.d.ts +6 -6
- package/lib/esm/test/ArcGisFeature/Mocks.js +15 -15
- package/lib/esm/test/ArcGisFeature/NewYorkDataset.d.ts +55 -55
- package/lib/esm/test/ArcGisFeature/NewYorkDataset.d.ts.map +1 -1
- package/lib/esm/test/ArcGisFeature/NewYorkDataset.js +416 -415
- package/lib/esm/test/ArcGisFeature/NewYorkDataset.js.map +1 -1
- package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +1042 -1042
- package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.d.ts.map +1 -1
- package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js +423 -422
- package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/test/junit_results.xml +44 -44
- package/map-layers-formats.build.log +2 -2
- package/package.json +17 -17
- package/src/ArcGisFeature/esriPBuffer.gen.ts +1 -4
- package/src/test/ArcGisFeature/ArcGisFeatureProvider.test.ts +21 -21
- package/src/test/ArcGisFeature/NewYorkDataset.ts +187 -187
- package/src/test/ArcGisFeature/PhillyLandmarksDataset.ts +4 -4
- package/tsconfig.json +1 -2
- package/.rush/temp/operation/build_ci/state.json +0 -3
- package/lib/cjs/test/coverage/.nyc_output/bb9e12be-ea3c-4cee-99d0-c7a34bd2c47a.json +0 -1
- package/lib/cjs/test/coverage/.nyc_output/processinfo/5901bdfe-760d-4ca3-9674-876be7ed11b1.json +0 -1
- package/lib/cjs/test/coverage/.nyc_output/processinfo/bb9e12be-ea3c-4cee-99d0-c7a34bd2c47a.json +0 -1
- /package/lib/cjs/test/coverage/.nyc_output/{5901bdfe-760d-4ca3-9674-876be7ed11b1.json → 4c93adb3-7e95-4a63-9814-a25d79ab4680.json} +0 -0
|
@@ -1,423 +1,422 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ArcGisFeatureProvider = void 0;
|
|
8
|
-
const core_common_1 = require("@itwin/core-common");
|
|
9
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
10
|
-
const core_geometry_1 = require("@itwin/core-geometry");
|
|
11
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
|
-
const ArcGisSymbologyRenderer_1 = require("./ArcGisSymbologyRenderer");
|
|
13
|
-
const ArcGisFeatureQuery_1 = require("./ArcGisFeatureQuery");
|
|
14
|
-
const ArcGisFeatureRenderer_1 = require("./ArcGisFeatureRenderer");
|
|
15
|
-
const ArcGisFeaturePBF_1 = require("./ArcGisFeaturePBF");
|
|
16
|
-
const ArcGisFeatureJSON_1 = require("./ArcGisFeatureJSON");
|
|
17
|
-
const ArcGisFeatureResponse_1 = require("./ArcGisFeatureResponse");
|
|
18
|
-
const loggerCategory = "MapLayersFormats.ArcGISFeature";
|
|
19
|
-
/** Provide tiles from a ESRI ArcGIS Feature service
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
class ArcGisFeatureProvider extends core_frontend_1.ArcGISImageryProvider {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
async initialize() {
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
core_bentley_1.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this._querySupported
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
core_bentley_1.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
core_bentley_1.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
get
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
context.
|
|
295
|
-
context.
|
|
296
|
-
context.
|
|
297
|
-
context.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
//
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const
|
|
304
|
-
const
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
const
|
|
308
|
-
const
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
canvas.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
//
|
|
363
|
-
// the
|
|
364
|
-
//
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
let
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
exports.ArcGisFeatureProvider = ArcGisFeatureProvider;
|
|
422
|
-
ArcGisFeatureProvider._nbSubTiles = 2;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ArcGisFeatureProvider = void 0;
|
|
8
|
+
const core_common_1 = require("@itwin/core-common");
|
|
9
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
10
|
+
const core_geometry_1 = require("@itwin/core-geometry");
|
|
11
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
|
+
const ArcGisSymbologyRenderer_1 = require("./ArcGisSymbologyRenderer");
|
|
13
|
+
const ArcGisFeatureQuery_1 = require("./ArcGisFeatureQuery");
|
|
14
|
+
const ArcGisFeatureRenderer_1 = require("./ArcGisFeatureRenderer");
|
|
15
|
+
const ArcGisFeaturePBF_1 = require("./ArcGisFeaturePBF");
|
|
16
|
+
const ArcGisFeatureJSON_1 = require("./ArcGisFeatureJSON");
|
|
17
|
+
const ArcGisFeatureResponse_1 = require("./ArcGisFeatureResponse");
|
|
18
|
+
const loggerCategory = "MapLayersFormats.ArcGISFeature";
|
|
19
|
+
/** Provide tiles from a ESRI ArcGIS Feature service
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
class ArcGisFeatureProvider extends core_frontend_1.ArcGISImageryProvider {
|
|
23
|
+
get minimumZoomLevel() { return this._minDepthFromLod; }
|
|
24
|
+
get maximumZoomLevel() { return this._maxDepthFromLod; }
|
|
25
|
+
constructor(settings) {
|
|
26
|
+
super(settings, true);
|
|
27
|
+
// Debug flags, should always be commited to FALSE !
|
|
28
|
+
this._drawDebugInfo = false;
|
|
29
|
+
this._debugFeatureGeom = false;
|
|
30
|
+
this._supportsCoordinatesQuantization = false;
|
|
31
|
+
this._querySupported = false;
|
|
32
|
+
this._layerId = 0;
|
|
33
|
+
this._outSR = 102100;
|
|
34
|
+
this._maxDepthFromLod = 0;
|
|
35
|
+
this._minDepthFromLod = 0;
|
|
36
|
+
}
|
|
37
|
+
async initialize() {
|
|
38
|
+
const metadata = await this.getServiceJson();
|
|
39
|
+
const json = metadata?.content;
|
|
40
|
+
if (json === undefined) {
|
|
41
|
+
core_bentley_1.Logger.logError(loggerCategory, "Could not get service JSON");
|
|
42
|
+
throw new core_common_1.ServerError(core_bentley_1.IModelStatus.ValidationFailed, "");
|
|
43
|
+
}
|
|
44
|
+
if (json?.error?.code === core_frontend_1.ArcGisErrorCode.TokenRequired || json?.error?.code === core_frontend_1.ArcGisErrorCode.InvalidToken) {
|
|
45
|
+
// Check again layer status, it might have change during await.
|
|
46
|
+
if (this.status === core_frontend_1.MapLayerImageryProviderStatus.Valid) {
|
|
47
|
+
this.setStatus(core_frontend_1.MapLayerImageryProviderStatus.RequireAuth);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (json.capabilities) {
|
|
52
|
+
this._querySupported = json.capabilities.indexOf("Query") >= 0;
|
|
53
|
+
if (!this._querySupported)
|
|
54
|
+
throw new core_common_1.ServerError(core_bentley_1.IModelStatus.ValidationFailed, "");
|
|
55
|
+
}
|
|
56
|
+
this.serviceJson = json;
|
|
57
|
+
let foundVisibleSubLayer = false;
|
|
58
|
+
if (this._settings.subLayers.length >= 0) {
|
|
59
|
+
// There is more than sub-layer for this layer, pick the first visible one.
|
|
60
|
+
for (const layer of this._settings.subLayers) {
|
|
61
|
+
if (layer.visible && typeof layer.id === "number") {
|
|
62
|
+
this._layerId = layer.id;
|
|
63
|
+
foundVisibleSubLayer = true;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!foundVisibleSubLayer && json !== undefined) {
|
|
69
|
+
// No suitable sublayer was specified on the layerSettings object, lets find a default one in the capabilities
|
|
70
|
+
// Check layer metadata
|
|
71
|
+
if (Array.isArray(this.serviceJson.layers) && this.serviceJson.layers.length >= 1) {
|
|
72
|
+
const hasDefaultVisibility = Object.keys(this.serviceJson.layers[0]).includes("defaultVisibility");
|
|
73
|
+
if (hasDefaultVisibility) {
|
|
74
|
+
for (const layer of this.serviceJson.layers) {
|
|
75
|
+
if (layer.defaultVisibility) {
|
|
76
|
+
this._layerId = layer.id;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// On some older servers, the default visiblity is on the layer capabilities (i.e. not the service capabilities)
|
|
82
|
+
for (const layer of this.serviceJson.layers) {
|
|
83
|
+
const layerJson = await this.getLayerMetadata(layer.id);
|
|
84
|
+
if (!layerJson) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (layerJson.defaultVisibility) {
|
|
88
|
+
this._layerId = layer.id;
|
|
89
|
+
this._layerMetadata = layerJson;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// There is no layer to publish? Something is off with this server..
|
|
97
|
+
throw new core_common_1.ServerError(core_bentley_1.IModelStatus.ValidationFailed, "");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Make sure we cache layer info (i.e. rendering info)
|
|
101
|
+
if (!this._layerMetadata) {
|
|
102
|
+
this._layerMetadata = await this.getLayerMetadata(this._layerId);
|
|
103
|
+
if (!this._layerMetadata) {
|
|
104
|
+
core_bentley_1.Logger.logError(loggerCategory, "Could not layer metadata");
|
|
105
|
+
throw new core_common_1.ServerError(core_bentley_1.IModelStatus.ValidationFailed, "");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Parse server version
|
|
109
|
+
let majorVersion;
|
|
110
|
+
if (this.serviceJson?.currentVersion) {
|
|
111
|
+
try {
|
|
112
|
+
majorVersion = Math.trunc(this.serviceJson?.currentVersion);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Coordinates Quantization: If supported, server will transform for us the coordinates in the Tile coordinate space (pixels, origin = upper left corner
|
|
118
|
+
// If not supported, transformation will be applied client side.
|
|
119
|
+
// Note: For some reasons, even though 'supportsCoordinatesQuantization' is set to 'true' on the layer metadata, server will give an error message for server version < 11
|
|
120
|
+
if (majorVersion && majorVersion >= 11 && this._layerMetadata.supportsCoordinatesQuantization) {
|
|
121
|
+
this._supportsCoordinatesQuantization = true;
|
|
122
|
+
}
|
|
123
|
+
// Check supported query formats: JSON and PBF are currently implemented by this provider
|
|
124
|
+
// Note: needs to be checked on the layer metadata, service metadata advertises a different set of formats
|
|
125
|
+
// Also, since PBF format does not support floating points, there is no point using this format if supportsCoordinatesQuantization is not available.
|
|
126
|
+
if (this._layerMetadata.supportedQueryFormats) {
|
|
127
|
+
const formats = this._layerMetadata.supportedQueryFormats.split(", ");
|
|
128
|
+
if (formats.includes("PBF") && this._supportsCoordinatesQuantization) {
|
|
129
|
+
this._format = "PBF";
|
|
130
|
+
}
|
|
131
|
+
else if (formats.includes("JSON")) {
|
|
132
|
+
this._format = "JSON";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (!this._format) {
|
|
136
|
+
core_bentley_1.Logger.logError(loggerCategory, "Could not get request format from service JSON");
|
|
137
|
+
throw new core_common_1.ServerError(core_bentley_1.IModelStatus.ValidationFailed, "");
|
|
138
|
+
}
|
|
139
|
+
// Read range using full extent from service metadata
|
|
140
|
+
if (json.fullExtent) {
|
|
141
|
+
if (json.fullExtent.spatialReference.latestWkid === 3857 || json.fullExtent.spatialReference.wkid === 102100) {
|
|
142
|
+
const range3857 = core_geometry_1.Range2d.createFrom({
|
|
143
|
+
low: { x: json.fullExtent.xmin, y: json.fullExtent.ymin },
|
|
144
|
+
high: { x: json.fullExtent.xmax, y: json.fullExtent.ymax }
|
|
145
|
+
});
|
|
146
|
+
const west = this.getEPSG4326Lon(range3857.xLow);
|
|
147
|
+
const south = this.getEPSG4326Lat(range3857.yLow);
|
|
148
|
+
const east = this.getEPSG4326Lon(range3857.xHigh);
|
|
149
|
+
const north = this.getEPSG4326Lat(range3857.yHigh);
|
|
150
|
+
this.cartoRange = core_frontend_1.MapCartoRectangle.fromDegrees(west, south, east, north);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Check for minScale / max scale
|
|
154
|
+
const minScale = this._layerMetadata?.minScale || undefined; // undefined, 0 -> undefined
|
|
155
|
+
const maxScale = this._layerMetadata?.maxScale || undefined; // undefined, 0 -> undefined
|
|
156
|
+
const scales = core_frontend_1.ArcGisUtilities.getZoomLevelsScales(this.defaultMaximumZoomLevel, this.tileSize, minScale, maxScale, 1.0);
|
|
157
|
+
if (scales.minLod)
|
|
158
|
+
this._minDepthFromLod = scales.minLod;
|
|
159
|
+
// Some servers advertises a max LOD of 0, it should be interpreted as 'not defined' (otherwise a max lod of 0 would would mean never display anything)
|
|
160
|
+
this._maxDepthFromLod = (scales.maxLod ? scales.maxLod : this.defaultMaximumZoomLevel);
|
|
161
|
+
this._symbologyRenderer = new ArcGisSymbologyRenderer_1.ArcGisSymbologyRenderer(this._layerMetadata?.geometryType, this._layerMetadata?.drawingInfo?.renderer);
|
|
162
|
+
}
|
|
163
|
+
async getLayerMetadata(layerId) {
|
|
164
|
+
let metadata;
|
|
165
|
+
try {
|
|
166
|
+
const url = new URL(this._settings.url);
|
|
167
|
+
url.pathname = `${url.pathname}/${layerId}`;
|
|
168
|
+
metadata = await core_frontend_1.ArcGisUtilities.getServiceJson(url.toString(), this._settings.formatId, this._settings.userName, this._settings.password, this._accessTokenRequired);
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
}
|
|
172
|
+
return metadata?.content;
|
|
173
|
+
}
|
|
174
|
+
get tileSize() { return 512; }
|
|
175
|
+
get format() { return this._format; }
|
|
176
|
+
// We don't use this method inside this provider (see constructFeatureUrl), but since this is an abstract method, we need to define something
|
|
177
|
+
async constructUrl(_row, _column, _zoomLevel) {
|
|
178
|
+
return "";
|
|
179
|
+
}
|
|
180
|
+
constructFeatureUrl(row, column, zoomLevel, format, geomOverride, outFields, tolerance, returnGeometry) {
|
|
181
|
+
const tileExtent = this.getEPSG3857Extent(row, column, zoomLevel);
|
|
182
|
+
const tileEnvelope = {
|
|
183
|
+
xmin: tileExtent.left, ymin: tileExtent.bottom,
|
|
184
|
+
xmax: tileExtent.right, ymax: tileExtent.top,
|
|
185
|
+
spatialReference: { wkid: 102100, latestWkid: 3857 },
|
|
186
|
+
};
|
|
187
|
+
// Actual spatial filter.
|
|
188
|
+
// By default, we request the tile extent. If 'cartoPoint' is specified,
|
|
189
|
+
// we restrict the spatial to specific point. (i.e. GetFeatureInfo requests)
|
|
190
|
+
// If envelope is provided, it has the priority over 'cartoPoint'
|
|
191
|
+
let geometry;
|
|
192
|
+
if (geomOverride) {
|
|
193
|
+
geometry = geomOverride;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
geometry = { geom: tileEnvelope, type: "esriGeometryEnvelope" };
|
|
197
|
+
}
|
|
198
|
+
let quantizationParameters;
|
|
199
|
+
const toleranceWorld = (tileExtent.top - tileExtent.bottom) / this.tileSize;
|
|
200
|
+
if (this._supportsCoordinatesQuantization) {
|
|
201
|
+
quantizationParameters = {
|
|
202
|
+
mode: "view",
|
|
203
|
+
originPosition: "upperLeft",
|
|
204
|
+
tolerance: toleranceWorld,
|
|
205
|
+
extent: tileEnvelope,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const url = new ArcGisFeatureQuery_1.ArcGisFeatureQuery(this._settings.url, this._layerId, format, this._outSR, { geometry,
|
|
209
|
+
geometryType: "esriGeometryEnvelope",
|
|
210
|
+
returnExceededLimitFeatures: false,
|
|
211
|
+
maxRecordCountFactor: 3,
|
|
212
|
+
resultType: "tile",
|
|
213
|
+
quantizationParameters,
|
|
214
|
+
outFields,
|
|
215
|
+
returnGeometry,
|
|
216
|
+
distance: (tolerance ? tolerance * toleranceWorld : undefined) });
|
|
217
|
+
let envelope;
|
|
218
|
+
if (geomOverride && geomOverride.type === "esriGeometryEnvelope") {
|
|
219
|
+
envelope = geomOverride.geom;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
envelope = tileEnvelope;
|
|
223
|
+
}
|
|
224
|
+
return { url: url.toString(), envelope };
|
|
225
|
+
}
|
|
226
|
+
// Makes an identify request to ESRI MapService , and return it as a list MapLayerFeatureInfo object
|
|
227
|
+
async getFeatureInfo(featureInfos, quadId, carto, _tree) {
|
|
228
|
+
if (!this._querySupported || this.format === undefined)
|
|
229
|
+
return;
|
|
230
|
+
const cartoPoint = {
|
|
231
|
+
x: this.getEPSG3857X(carto.longitudeDegrees),
|
|
232
|
+
y: this.getEPSG3857Y(carto.latitudeDegrees),
|
|
233
|
+
spatialReference: { wkid: 102100, latestWkid: 3857 },
|
|
234
|
+
};
|
|
235
|
+
const doFeatureInfoQuery = async (format, outFields, returnGeometry) => {
|
|
236
|
+
const infoUrl = this.constructFeatureUrl(quadId.row, quadId.column, quadId.level, format, { geom: cartoPoint, type: "esriGeometryPoint" }, outFields, 3 /* tolerance in pixel*/, returnGeometry);
|
|
237
|
+
if (!infoUrl || infoUrl.url.length === 0) {
|
|
238
|
+
core_bentley_1.Logger.logError(loggerCategory, `Could not construct feature info query URL`);
|
|
239
|
+
return undefined;
|
|
240
|
+
}
|
|
241
|
+
const response = this.fetch(new URL(infoUrl.url), { method: "GET" });
|
|
242
|
+
const featureResponse = new ArcGisFeatureResponse_1.ArcGisFeatureResponse(format, response);
|
|
243
|
+
return featureResponse.getResponseData();
|
|
244
|
+
};
|
|
245
|
+
if (this._debugFeatureGeom) {
|
|
246
|
+
try {
|
|
247
|
+
let responseData = await doFeatureInfoQuery("PBF", "", true);
|
|
248
|
+
if (responseData) {
|
|
249
|
+
core_bentley_1.Logger.logInfo(loggerCategory, JSON.stringify(responseData.data.toObject()));
|
|
250
|
+
}
|
|
251
|
+
responseData = await doFeatureInfoQuery("JSON", "", true);
|
|
252
|
+
if (responseData) {
|
|
253
|
+
core_bentley_1.Logger.logInfo(loggerCategory, JSON.stringify(responseData.data));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch (e) {
|
|
257
|
+
core_bentley_1.Logger.logInfo(loggerCategory, `Error occured with debug FeatureInfo: ${e}`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
const responseData = await doFeatureInfoQuery(this.format, "*", false);
|
|
262
|
+
if (!responseData) {
|
|
263
|
+
core_bentley_1.Logger.logError(loggerCategory, `Could not get feature info data`);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (responseData.exceedTransferLimit) {
|
|
267
|
+
core_bentley_1.Logger.logError(loggerCategory, `Could not get feature info : transfert limit exeeded.`);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const featureReader = this.format === "PBF" ? new ArcGisFeaturePBF_1.ArcGisFeaturePBF(this._settings, this._layerMetadata) : new ArcGisFeatureJSON_1.ArcGisFeatureJSON(this._settings, this._layerMetadata);
|
|
271
|
+
featureReader.readFeatureInfo(responseData, featureInfos);
|
|
272
|
+
}
|
|
273
|
+
catch (e) {
|
|
274
|
+
core_bentley_1.Logger.logError(loggerCategory, `Exception occured while loading feature info data : ${e}`);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
async fetchTile(row, column, zoomLevel, refineEnvelope) {
|
|
280
|
+
if (!this.format) {
|
|
281
|
+
return undefined;
|
|
282
|
+
}
|
|
283
|
+
const geomOverride = (refineEnvelope ? { geom: refineEnvelope, type: "esriGeometryEnvelope" } : undefined);
|
|
284
|
+
const tileUrl = this.constructFeatureUrl(row, column, zoomLevel, this.format, geomOverride);
|
|
285
|
+
if (!tileUrl || tileUrl.url.length === 0) {
|
|
286
|
+
core_bentley_1.Logger.logError(loggerCategory, `Could not construct feature query URL for tile ${zoomLevel}/${row}/${column}`);
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
const response = this.fetch(new URL(tileUrl.url), { method: "GET" });
|
|
290
|
+
return new ArcGisFeatureResponse_1.ArcGisFeatureResponse(this.format, response, tileUrl.envelope);
|
|
291
|
+
}
|
|
292
|
+
drawTileDebugInfo(row, column, zoomLevel, context) {
|
|
293
|
+
context.fillStyle = "cyan";
|
|
294
|
+
context.strokeRect(0, 0, this.tileSize, this.tileSize);
|
|
295
|
+
context.font = "30px Arial";
|
|
296
|
+
context.lineWidth = 5;
|
|
297
|
+
context.fillText(`${zoomLevel}-${row}-${column}`, 10, 50);
|
|
298
|
+
}
|
|
299
|
+
// Compute transform that provides coordinates in the canvas coordinate system (pixels, origin = top-left)
|
|
300
|
+
// from coordinate in world (i.e EPSG:3857)
|
|
301
|
+
computeTileWorld2CanvasTransform(row, column, zoomLevel) {
|
|
302
|
+
const tileExtentWorld3857 = this.getEPSG3857Extent(row, column, zoomLevel);
|
|
303
|
+
const worldTileWidth = tileExtentWorld3857.right - tileExtentWorld3857.left;
|
|
304
|
+
const canvasTileWidth = this.tileSize;
|
|
305
|
+
const world2CanvasRatio = canvasTileWidth / worldTileWidth;
|
|
306
|
+
const worldTileOrigin = core_geometry_1.Point3d.create(tileExtentWorld3857.left, tileExtentWorld3857.bottom);
|
|
307
|
+
const worldTileExtent = core_geometry_1.Point3d.create(tileExtentWorld3857.right, tileExtentWorld3857.top);
|
|
308
|
+
const canvasTileOriginOffset = worldTileOrigin.clone();
|
|
309
|
+
const canvasTileExtentOffset = worldTileExtent.clone();
|
|
310
|
+
canvasTileOriginOffset.scaleInPlace(world2CanvasRatio);
|
|
311
|
+
canvasTileExtentOffset.scaleInPlace(world2CanvasRatio);
|
|
312
|
+
const xTranslate = -1 * canvasTileOriginOffset.x;
|
|
313
|
+
// Canvas origin is uppler left corner, so we need to flip the y axsis
|
|
314
|
+
const yTranslate = canvasTileExtentOffset.y; // y-axis flip
|
|
315
|
+
const yWorld2CanvasRatio = -1 * world2CanvasRatio; // y-axis flip
|
|
316
|
+
const matrix = core_geometry_1.Matrix4d.createTranslationAndScaleXYZ(xTranslate, yTranslate, 0, world2CanvasRatio, yWorld2CanvasRatio, 1);
|
|
317
|
+
return matrix.asTransform;
|
|
318
|
+
}
|
|
319
|
+
async loadTile(row, column, zoomLevel) {
|
|
320
|
+
if ((this.status === core_frontend_1.MapLayerImageryProviderStatus.RequireAuth)) {
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
const canvas = document.createElement("canvas");
|
|
324
|
+
canvas.width = this.tileSize;
|
|
325
|
+
canvas.height = this.tileSize;
|
|
326
|
+
const ctx = canvas.getContext("2d");
|
|
327
|
+
if (ctx == null) {
|
|
328
|
+
core_bentley_1.Logger.logError(loggerCategory, "No canvas context available for loading tile.");
|
|
329
|
+
return undefined;
|
|
330
|
+
}
|
|
331
|
+
if (!this._symbologyRenderer) {
|
|
332
|
+
core_bentley_1.Logger.logError(loggerCategory, "No symbology renderer available for loading tile.");
|
|
333
|
+
return undefined;
|
|
334
|
+
}
|
|
335
|
+
try {
|
|
336
|
+
// Compute transform if CoordinatesQuantization is not supported by service
|
|
337
|
+
let transfo;
|
|
338
|
+
if (!this._supportsCoordinatesQuantization) {
|
|
339
|
+
transfo = this.computeTileWorld2CanvasTransform(row, column, zoomLevel);
|
|
340
|
+
if (!transfo) {
|
|
341
|
+
core_bentley_1.Logger.logError(loggerCategory, `Could not compute data transformation for tile (${zoomLevel}/${row}/${column})`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const renderer = new ArcGisFeatureRenderer_1.ArcGisFeatureRenderer(ctx, this._symbologyRenderer, transfo);
|
|
345
|
+
const featureReader = this.format === "PBF" ? new ArcGisFeaturePBF_1.ArcGisFeaturePBF(this._settings, this._layerMetadata) : new ArcGisFeatureJSON_1.ArcGisFeatureJSON(this._settings, this._layerMetadata);
|
|
346
|
+
const getSubEnvelopes = (envelope) => {
|
|
347
|
+
const dx = (envelope.xmax - envelope.xmin) * 0.5;
|
|
348
|
+
const dy = (envelope.xmax - envelope.xmin) * 0.5;
|
|
349
|
+
const subEnvelopes = [];
|
|
350
|
+
for (let posX = 0; posX < ArcGisFeatureProvider._nbSubTiles; posX++) {
|
|
351
|
+
for (let posY = 0; posY < ArcGisFeatureProvider._nbSubTiles; posY++) {
|
|
352
|
+
subEnvelopes.push({
|
|
353
|
+
xmin: envelope.xmin + (dx * posX), ymin: envelope.ymin + (dy * posY),
|
|
354
|
+
xmax: envelope.xmin + (dx * (posX + 1)), ymax: envelope.ymin + (dy * (posY + 1)),
|
|
355
|
+
spatialReference: { wkid: 102100, latestWkid: 3857 },
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return subEnvelopes;
|
|
360
|
+
};
|
|
361
|
+
// The strategy here is simple: we make a request for an area that represents the current tile (i.e envelope),
|
|
362
|
+
// the server will either return the requested data OR a 'exceedTransferLimit' message (too much data to transfers).
|
|
363
|
+
// In the latter case, we subdivide the previous request envelope in for 4 sub-envelopes,
|
|
364
|
+
// and repeat again until we get data.
|
|
365
|
+
const renderData = async (envelope) => {
|
|
366
|
+
let response;
|
|
367
|
+
let responseData;
|
|
368
|
+
try {
|
|
369
|
+
response = await this.fetchTile(row, column, zoomLevel, envelope);
|
|
370
|
+
if (!response) {
|
|
371
|
+
core_bentley_1.Logger.logError(loggerCategory, `Error occurred while fetching tile (${zoomLevel}/${row}/${column})`);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
responseData = await response.getResponseData();
|
|
375
|
+
if (!responseData) {
|
|
376
|
+
core_bentley_1.Logger.logError(loggerCategory, `Could not get response data for tile (${zoomLevel}/${row}/${column})`);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
catch (e) {
|
|
381
|
+
core_bentley_1.Logger.logError(loggerCategory, `Exception occurred while loading tile (${zoomLevel}/${row}/${column}) : ${e}`);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (responseData.exceedTransferLimit) {
|
|
385
|
+
if (response.envelope) {
|
|
386
|
+
const subEnvelopes = getSubEnvelopes(response.envelope);
|
|
387
|
+
const renderPromises = [];
|
|
388
|
+
for (const subEnvelope of subEnvelopes) {
|
|
389
|
+
renderPromises.push(renderData(subEnvelope));
|
|
390
|
+
}
|
|
391
|
+
await Promise.all(renderPromises);
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
core_bentley_1.Logger.logError(loggerCategory, `Request exceeded transfer limit, could not refine request`);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
featureReader.readAndRender(responseData, renderer);
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
await renderData();
|
|
402
|
+
if (this._drawDebugInfo)
|
|
403
|
+
this.drawTileDebugInfo(row, column, zoomLevel, ctx);
|
|
404
|
+
}
|
|
405
|
+
catch (e) {
|
|
406
|
+
core_bentley_1.Logger.logError(loggerCategory, `Exception occurred while loading tile (${zoomLevel}/${row}/${column}) : ${e}`);
|
|
407
|
+
}
|
|
408
|
+
try {
|
|
409
|
+
const dataUrl = canvas.toDataURL("image/png");
|
|
410
|
+
const header = "data:image/png;base64,";
|
|
411
|
+
const dataUrl2 = dataUrl.substring(header.length);
|
|
412
|
+
return new core_common_1.ImageSource((0, core_bentley_1.base64StringToUint8Array)(dataUrl2), core_common_1.ImageSourceFormat.Png);
|
|
413
|
+
}
|
|
414
|
+
catch (e) {
|
|
415
|
+
core_bentley_1.Logger.logError(loggerCategory, `Exception occurred while rendering tile (${zoomLevel}/${row}/${column}) : ${e}.`);
|
|
416
|
+
}
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
ArcGisFeatureProvider._nbSubTiles = 2;
|
|
421
|
+
exports.ArcGisFeatureProvider = ArcGisFeatureProvider;
|
|
423
422
|
//# sourceMappingURL=ArcGisFeatureProvider.js.map
|