@itwin/map-layers-formats 4.0.0-dev.8 → 4.0.0-dev.80
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/965fc94c-e7e4-4e85-bf72-aecce4f5ac8c.json +1 -0
- package/lib/cjs/test/coverage/.nyc_output/processinfo/4935e330-732e-4dc9-9cc7-6639c02bf614.json +1 -0
- package/lib/cjs/test/coverage/.nyc_output/processinfo/965fc94c-e7e4-4e85-bf72-aecce4f5ac8c.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 +48 -48
- 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 → 4935e330-732e-4dc9-9cc7-6639c02bf614.json} +0 -0
|
@@ -1,166 +1,166 @@
|
|
|
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
|
-
import { Logger } from "@itwin/core-bentley";
|
|
6
|
-
import { Base64EncodedString, ImageMapLayerSettings } from "@itwin/core-common";
|
|
7
|
-
import { expect } from "chai";
|
|
8
|
-
import * as sinon from "sinon";
|
|
9
|
-
import { ArcGisFeaturePBF } from "../../ArcGisFeature/ArcGisFeaturePBF";
|
|
10
|
-
import { ArcGisFeatureRenderer } from "../../ArcGisFeature/ArcGisFeatureRenderer";
|
|
11
|
-
import { ArcGisSymbologyRenderer } from "../../ArcGisFeature/ArcGisSymbologyRenderer";
|
|
12
|
-
import { esriPBuffer } from "../../ArcGisFeature/esriPBuffer.gen";
|
|
13
|
-
import { esriFeatureSampleSource, fakeContext } from "./Mocks";
|
|
14
|
-
import { PhillyLandmarksDataset } from "./PhillyLandmarksDataset";
|
|
15
|
-
const createFeaturePBF = () => {
|
|
16
|
-
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
17
|
-
const featurePbf = new ArcGisFeaturePBF(settings, { name: "SampleLayer" });
|
|
18
|
-
// Locale configuration depends on the testing machine (i.e. linux vs windows),
|
|
19
|
-
// so we need to force date display to Iso to get a consistent value.
|
|
20
|
-
// In real scenario, we still want dates to be displayed in end-user's locale.
|
|
21
|
-
featurePbf.forceDateDisplayValueToIso = true;
|
|
22
|
-
return featurePbf;
|
|
23
|
-
};
|
|
24
|
-
describe("ArcGisFeaturePBF", () => {
|
|
25
|
-
const sandbox = sinon.createSandbox();
|
|
26
|
-
afterEach(async () => {
|
|
27
|
-
sandbox.restore();
|
|
28
|
-
});
|
|
29
|
-
it("should convert pbf geometry type to Esri types", async () => {
|
|
30
|
-
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipatch))
|
|
31
|
-
.to.equals("esriGeometryMultiPatch");
|
|
32
|
-
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipoint))
|
|
33
|
-
.to.equals("esriGeometryMultipoint");
|
|
34
|
-
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePoint))
|
|
35
|
-
.to.equals("esriGeometryPoint");
|
|
36
|
-
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolygon))
|
|
37
|
-
.to.equals("esriGeometryPolygon");
|
|
38
|
-
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolyline))
|
|
39
|
-
.to.equals("esriGeometryPolyline");
|
|
40
|
-
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(""))
|
|
41
|
-
.to.equals("esriGeometryNull");
|
|
42
|
-
});
|
|
43
|
-
it("should read FeatureInfo in PBF", async () => {
|
|
44
|
-
const byteArray = Base64EncodedString.toUint8Array(PhillyLandmarksDataset.phillyAirportGetFeatureInfoQueryPbf);
|
|
45
|
-
const featureCollection = esriPBuffer.FeatureCollectionPBuffer.deserialize(byteArray);
|
|
46
|
-
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
47
|
-
const featurePbf = new ArcGisFeaturePBF(settings, { name: "SampleLayer" });
|
|
48
|
-
// In some cases, PBF gives more floating-point precision than JSON.
|
|
49
|
-
// Since I want to use the same output reference for both formats, I force a max precision of 8.
|
|
50
|
-
featurePbf.floatPrecision = 8;
|
|
51
|
-
const results = [];
|
|
52
|
-
featurePbf.readFeatureInfo({ data: featureCollection, exceedTransferLimit: false }, results);
|
|
53
|
-
// Make deep comparison by using JSON.stringify
|
|
54
|
-
expect(JSON.stringify(results)).equals(JSON.stringify(PhillyLandmarksDataset.phillyAirportGetFeatureInfoResultRef));
|
|
55
|
-
});
|
|
56
|
-
it("should read FeatureInfo from PBF (philly transportation)", async () => {
|
|
57
|
-
const byteArray = Base64EncodedString.toUint8Array(PhillyLandmarksDataset.phillyTransportationGetFeatureInfoQueryEncodedPbf);
|
|
58
|
-
const featureCollection = esriPBuffer.FeatureCollectionPBuffer.deserialize(byteArray);
|
|
59
|
-
const featurePbf = createFeaturePBF();
|
|
60
|
-
// In some cases, PBF gives more floating-point precision than JSON.
|
|
61
|
-
// Since I want to use the same output reference for both formats, I force a max precision.
|
|
62
|
-
featurePbf.floatPrecision = 2;
|
|
63
|
-
const results = [];
|
|
64
|
-
featurePbf.readFeatureInfo({ data: featureCollection, exceedTransferLimit: false }, results);
|
|
65
|
-
// Make deep comparison by using JSON.stringify
|
|
66
|
-
expect(JSON.stringify(results)).equals(JSON.stringify(PhillyLandmarksDataset.phillyTansportationGetFeatureInfoResultRef));
|
|
67
|
-
});
|
|
68
|
-
it("should read all data types from FeatureInfo ", async () => {
|
|
69
|
-
// In this test we use a synthetic PBuffer object to initialize a feature collection object.
|
|
70
|
-
// The is to ensure we cover correctly all possible attribute value types.
|
|
71
|
-
const featureCollection = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.fieldsCoveragePbufferCollection);
|
|
72
|
-
const featurePbf = createFeaturePBF();
|
|
73
|
-
const results = [];
|
|
74
|
-
featurePbf.readFeatureInfo({ data: featureCollection, exceedTransferLimit: false }, results);
|
|
75
|
-
// Make deep comparison by using JSON.stringify
|
|
76
|
-
expect(JSON.stringify(results)).equals(JSON.stringify(PhillyLandmarksDataset.fieldsCoverageGetFeatureInfoResultRef));
|
|
77
|
-
});
|
|
78
|
-
it("should readAndRender single ring polygon feature", async () => {
|
|
79
|
-
const featurePbf = createFeaturePBF();
|
|
80
|
-
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillySimplePolyQueryPbf);
|
|
81
|
-
const geomType = ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillySimplePolyQueryPbf.queryResult.featureResult.geometryType);
|
|
82
|
-
const symbolRenderer = new ArcGisSymbologyRenderer(geomType, PhillyLandmarksDataset.phillySimplePolyDrawingInfo.drawingInfo.renderer);
|
|
83
|
-
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
84
|
-
const renderPathSpy = sinon.spy(featureRenderer, "renderPath");
|
|
85
|
-
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
86
|
-
expect(renderPathSpy.calledOnce);
|
|
87
|
-
const firstCall = renderPathSpy.getCalls()[0];
|
|
88
|
-
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillySimplePolyQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
89
|
-
expect(firstCall.args[1]).to.eql(PhillyLandmarksDataset.phillySimplePolyQueryPbf.queryResult.featureResult.features[0].geometry.coords); // geometryCoords
|
|
90
|
-
expect(firstCall.args[2]).to.eql(true); // fill
|
|
91
|
-
expect(firstCall.args[3]).to.eql(2); // stride
|
|
92
|
-
});
|
|
93
|
-
it("should readAndRender multiple ring polygon feature", async () => {
|
|
94
|
-
const featurePbf = createFeaturePBF();
|
|
95
|
-
const geomType = ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillyDoubleRingPolyQueryPbf.queryResult.featureResult.geometryType);
|
|
96
|
-
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillyDoubleRingPolyQueryPbf);
|
|
97
|
-
const symbolRenderer = new ArcGisSymbologyRenderer(geomType, PhillyLandmarksDataset.phillySimplePolyDrawingInfo.drawingInfo.renderer);
|
|
98
|
-
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
99
|
-
const renderPathSpy = sinon.spy(featureRenderer, "renderPath");
|
|
100
|
-
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
101
|
-
expect(renderPathSpy.calledOnce);
|
|
102
|
-
const firstCall = renderPathSpy.getCalls()[0];
|
|
103
|
-
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillyDoubleRingPolyQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
104
|
-
expect(firstCall.args[1]).to.eql(PhillyLandmarksDataset.phillyDoubleRingPolyQueryPbf.queryResult.featureResult.features[0].geometry.coords); // geometryCoords
|
|
105
|
-
expect(firstCall.args[2]).to.eql(true); // fill
|
|
106
|
-
expect(firstCall.args[3]).to.eql(2); // stride
|
|
107
|
-
});
|
|
108
|
-
it("should readAndRender simple path", async () => {
|
|
109
|
-
const featurePbf = createFeaturePBF();
|
|
110
|
-
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillySimplePathQueryPbf);
|
|
111
|
-
const symbolRenderer = new ArcGisSymbologyRenderer(ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillySimplePathQueryPbf.queryResult.featureResult.geometryType), PhillyLandmarksDataset.phillySimpleLineDrawingInfo.drawingInfo.renderer);
|
|
112
|
-
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
113
|
-
const renderPathSpy = sinon.spy(featureRenderer, "renderPath");
|
|
114
|
-
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
115
|
-
expect(renderPathSpy.calledOnce);
|
|
116
|
-
const firstCall = renderPathSpy.getCalls()[0];
|
|
117
|
-
expect(firstCall).to.not.undefined;
|
|
118
|
-
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillySimplePathQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
119
|
-
expect(firstCall.args[1]).to.eql(PhillyLandmarksDataset.phillySimplePathQueryPbf.queryResult.featureResult.features[0].geometry.coords); // geometryCoords
|
|
120
|
-
expect(firstCall.args[2]).to.eql(false); // fill
|
|
121
|
-
expect(firstCall.args[3]).to.eql(2); // stride
|
|
122
|
-
});
|
|
123
|
-
it("should readAndRender multi path", async () => {
|
|
124
|
-
const featurePbf = createFeaturePBF();
|
|
125
|
-
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillyMultiPathQueryPbf);
|
|
126
|
-
const geomType = ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillyMultiPathQueryPbf.queryResult.featureResult.geometryType);
|
|
127
|
-
const symbolRenderer = new ArcGisSymbologyRenderer(geomType, PhillyLandmarksDataset.phillySimpleLineDrawingInfo.drawingInfo.renderer);
|
|
128
|
-
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
129
|
-
const renderPathSpy = sinon.spy(featureRenderer, "renderPath");
|
|
130
|
-
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
131
|
-
expect(renderPathSpy.calledOnce);
|
|
132
|
-
const firstCall = renderPathSpy.getCalls()[0];
|
|
133
|
-
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillyMultiPathQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
134
|
-
expect(firstCall.args[1]).to.eql(PhillyLandmarksDataset.phillyMultiPathQueryPbf.queryResult.featureResult.features[0].geometry.coords); // geometryCoords
|
|
135
|
-
expect(firstCall.args[2]).to.eql(false); // fill
|
|
136
|
-
expect(firstCall.args[3]).to.eql(2); // stride
|
|
137
|
-
});
|
|
138
|
-
it("should readAndRender simple point", async () => {
|
|
139
|
-
const featurePbf = createFeaturePBF();
|
|
140
|
-
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillySimplePointQueryPbf);
|
|
141
|
-
const geomType = ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillyMultiPathQueryPbf.queryResult.featureResult.geometryType);
|
|
142
|
-
const symbolRenderer = new ArcGisSymbologyRenderer(geomType, PhillyLandmarksDataset.phillySimplePointDrawingInfo.drawingInfo.renderer);
|
|
143
|
-
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
144
|
-
const spy = sinon.spy(featureRenderer, "renderPoint");
|
|
145
|
-
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
146
|
-
expect(spy.calledOnce);
|
|
147
|
-
// Pbf contains already the right output format expect, lets rely on that.
|
|
148
|
-
const geometryCoords = PhillyLandmarksDataset.phillySimplePointQueryPbf.queryResult.featureResult.features[0].geometry.coords;
|
|
149
|
-
const firstCall = spy.getCalls()[0];
|
|
150
|
-
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillySimplePointQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
151
|
-
expect(firstCall.args[1]).to.eql(geometryCoords); // geometryCoords
|
|
152
|
-
expect(firstCall.args[2]).to.eql(2); // stride
|
|
153
|
-
});
|
|
154
|
-
it("should log error when readAndRender / readFeatureInfo is called invalid response Data", async () => {
|
|
155
|
-
const featurePbf = createFeaturePBF();
|
|
156
|
-
const symbolRenderer = new ArcGisSymbologyRenderer("esriGeometryAny", PhillyLandmarksDataset.phillySimplePointDrawingInfo.drawingInfo.renderer);
|
|
157
|
-
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
158
|
-
const logErrorSpy = sandbox.spy(Logger, "logError");
|
|
159
|
-
featurePbf.readAndRender({ data: { test: "test" }, exceedTransferLimit: false }, featureRenderer);
|
|
160
|
-
expect(logErrorSpy.calledOnce);
|
|
161
|
-
logErrorSpy.resetHistory();
|
|
162
|
-
featurePbf.readFeatureInfo({ data: { test: "test" }, exceedTransferLimit: false }, []);
|
|
163
|
-
expect(logErrorSpy.calledOnce);
|
|
164
|
-
});
|
|
165
|
-
});
|
|
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
|
+
import { Logger } from "@itwin/core-bentley";
|
|
6
|
+
import { Base64EncodedString, ImageMapLayerSettings } from "@itwin/core-common";
|
|
7
|
+
import { expect } from "chai";
|
|
8
|
+
import * as sinon from "sinon";
|
|
9
|
+
import { ArcGisFeaturePBF } from "../../ArcGisFeature/ArcGisFeaturePBF";
|
|
10
|
+
import { ArcGisFeatureRenderer } from "../../ArcGisFeature/ArcGisFeatureRenderer";
|
|
11
|
+
import { ArcGisSymbologyRenderer } from "../../ArcGisFeature/ArcGisSymbologyRenderer";
|
|
12
|
+
import { esriPBuffer } from "../../ArcGisFeature/esriPBuffer.gen";
|
|
13
|
+
import { esriFeatureSampleSource, fakeContext } from "./Mocks";
|
|
14
|
+
import { PhillyLandmarksDataset } from "./PhillyLandmarksDataset";
|
|
15
|
+
const createFeaturePBF = () => {
|
|
16
|
+
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
17
|
+
const featurePbf = new ArcGisFeaturePBF(settings, { name: "SampleLayer" });
|
|
18
|
+
// Locale configuration depends on the testing machine (i.e. linux vs windows),
|
|
19
|
+
// so we need to force date display to Iso to get a consistent value.
|
|
20
|
+
// In real scenario, we still want dates to be displayed in end-user's locale.
|
|
21
|
+
featurePbf.forceDateDisplayValueToIso = true;
|
|
22
|
+
return featurePbf;
|
|
23
|
+
};
|
|
24
|
+
describe("ArcGisFeaturePBF", () => {
|
|
25
|
+
const sandbox = sinon.createSandbox();
|
|
26
|
+
afterEach(async () => {
|
|
27
|
+
sandbox.restore();
|
|
28
|
+
});
|
|
29
|
+
it("should convert pbf geometry type to Esri types", async () => {
|
|
30
|
+
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipatch))
|
|
31
|
+
.to.equals("esriGeometryMultiPatch");
|
|
32
|
+
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipoint))
|
|
33
|
+
.to.equals("esriGeometryMultipoint");
|
|
34
|
+
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePoint))
|
|
35
|
+
.to.equals("esriGeometryPoint");
|
|
36
|
+
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolygon))
|
|
37
|
+
.to.equals("esriGeometryPolygon");
|
|
38
|
+
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolyline))
|
|
39
|
+
.to.equals("esriGeometryPolyline");
|
|
40
|
+
expect(ArcGisFeaturePBF.getArcGisFeatureGeometryType(""))
|
|
41
|
+
.to.equals("esriGeometryNull");
|
|
42
|
+
});
|
|
43
|
+
it("should read FeatureInfo in PBF", async () => {
|
|
44
|
+
const byteArray = Base64EncodedString.toUint8Array(PhillyLandmarksDataset.phillyAirportGetFeatureInfoQueryPbf);
|
|
45
|
+
const featureCollection = esriPBuffer.FeatureCollectionPBuffer.deserialize(byteArray);
|
|
46
|
+
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
47
|
+
const featurePbf = new ArcGisFeaturePBF(settings, { name: "SampleLayer" });
|
|
48
|
+
// In some cases, PBF gives more floating-point precision than JSON.
|
|
49
|
+
// Since I want to use the same output reference for both formats, I force a max precision of 8.
|
|
50
|
+
featurePbf.floatPrecision = 8;
|
|
51
|
+
const results = [];
|
|
52
|
+
featurePbf.readFeatureInfo({ data: featureCollection, exceedTransferLimit: false }, results);
|
|
53
|
+
// Make deep comparison by using JSON.stringify
|
|
54
|
+
expect(JSON.stringify(results)).equals(JSON.stringify(PhillyLandmarksDataset.phillyAirportGetFeatureInfoResultRef));
|
|
55
|
+
});
|
|
56
|
+
it("should read FeatureInfo from PBF (philly transportation)", async () => {
|
|
57
|
+
const byteArray = Base64EncodedString.toUint8Array(PhillyLandmarksDataset.phillyTransportationGetFeatureInfoQueryEncodedPbf);
|
|
58
|
+
const featureCollection = esriPBuffer.FeatureCollectionPBuffer.deserialize(byteArray);
|
|
59
|
+
const featurePbf = createFeaturePBF();
|
|
60
|
+
// In some cases, PBF gives more floating-point precision than JSON.
|
|
61
|
+
// Since I want to use the same output reference for both formats, I force a max precision.
|
|
62
|
+
featurePbf.floatPrecision = 2;
|
|
63
|
+
const results = [];
|
|
64
|
+
featurePbf.readFeatureInfo({ data: featureCollection, exceedTransferLimit: false }, results);
|
|
65
|
+
// Make deep comparison by using JSON.stringify
|
|
66
|
+
expect(JSON.stringify(results)).equals(JSON.stringify(PhillyLandmarksDataset.phillyTansportationGetFeatureInfoResultRef));
|
|
67
|
+
});
|
|
68
|
+
it("should read all data types from FeatureInfo ", async () => {
|
|
69
|
+
// In this test we use a synthetic PBuffer object to initialize a feature collection object.
|
|
70
|
+
// The is to ensure we cover correctly all possible attribute value types.
|
|
71
|
+
const featureCollection = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.fieldsCoveragePbufferCollection);
|
|
72
|
+
const featurePbf = createFeaturePBF();
|
|
73
|
+
const results = [];
|
|
74
|
+
featurePbf.readFeatureInfo({ data: featureCollection, exceedTransferLimit: false }, results);
|
|
75
|
+
// Make deep comparison by using JSON.stringify
|
|
76
|
+
expect(JSON.stringify(results)).equals(JSON.stringify(PhillyLandmarksDataset.fieldsCoverageGetFeatureInfoResultRef));
|
|
77
|
+
});
|
|
78
|
+
it("should readAndRender single ring polygon feature", async () => {
|
|
79
|
+
const featurePbf = createFeaturePBF();
|
|
80
|
+
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillySimplePolyQueryPbf);
|
|
81
|
+
const geomType = ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillySimplePolyQueryPbf.queryResult.featureResult.geometryType);
|
|
82
|
+
const symbolRenderer = new ArcGisSymbologyRenderer(geomType, PhillyLandmarksDataset.phillySimplePolyDrawingInfo.drawingInfo.renderer);
|
|
83
|
+
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
84
|
+
const renderPathSpy = sinon.spy(featureRenderer, "renderPath");
|
|
85
|
+
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
86
|
+
expect(renderPathSpy.calledOnce);
|
|
87
|
+
const firstCall = renderPathSpy.getCalls()[0];
|
|
88
|
+
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillySimplePolyQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
89
|
+
expect(firstCall.args[1]).to.eql(PhillyLandmarksDataset.phillySimplePolyQueryPbf.queryResult.featureResult.features[0].geometry.coords); // geometryCoords
|
|
90
|
+
expect(firstCall.args[2]).to.eql(true); // fill
|
|
91
|
+
expect(firstCall.args[3]).to.eql(2); // stride
|
|
92
|
+
});
|
|
93
|
+
it("should readAndRender multiple ring polygon feature", async () => {
|
|
94
|
+
const featurePbf = createFeaturePBF();
|
|
95
|
+
const geomType = ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillyDoubleRingPolyQueryPbf.queryResult.featureResult.geometryType);
|
|
96
|
+
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillyDoubleRingPolyQueryPbf);
|
|
97
|
+
const symbolRenderer = new ArcGisSymbologyRenderer(geomType, PhillyLandmarksDataset.phillySimplePolyDrawingInfo.drawingInfo.renderer);
|
|
98
|
+
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
99
|
+
const renderPathSpy = sinon.spy(featureRenderer, "renderPath");
|
|
100
|
+
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
101
|
+
expect(renderPathSpy.calledOnce);
|
|
102
|
+
const firstCall = renderPathSpy.getCalls()[0];
|
|
103
|
+
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillyDoubleRingPolyQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
104
|
+
expect(firstCall.args[1]).to.eql(PhillyLandmarksDataset.phillyDoubleRingPolyQueryPbf.queryResult.featureResult.features[0].geometry.coords); // geometryCoords
|
|
105
|
+
expect(firstCall.args[2]).to.eql(true); // fill
|
|
106
|
+
expect(firstCall.args[3]).to.eql(2); // stride
|
|
107
|
+
});
|
|
108
|
+
it("should readAndRender simple path", async () => {
|
|
109
|
+
const featurePbf = createFeaturePBF();
|
|
110
|
+
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillySimplePathQueryPbf);
|
|
111
|
+
const symbolRenderer = new ArcGisSymbologyRenderer(ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillySimplePathQueryPbf.queryResult.featureResult.geometryType), PhillyLandmarksDataset.phillySimpleLineDrawingInfo.drawingInfo.renderer);
|
|
112
|
+
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
113
|
+
const renderPathSpy = sinon.spy(featureRenderer, "renderPath");
|
|
114
|
+
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
115
|
+
expect(renderPathSpy.calledOnce);
|
|
116
|
+
const firstCall = renderPathSpy.getCalls()[0];
|
|
117
|
+
expect(firstCall).to.not.undefined;
|
|
118
|
+
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillySimplePathQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
119
|
+
expect(firstCall.args[1]).to.eql(PhillyLandmarksDataset.phillySimplePathQueryPbf.queryResult.featureResult.features[0].geometry.coords); // geometryCoords
|
|
120
|
+
expect(firstCall.args[2]).to.eql(false); // fill
|
|
121
|
+
expect(firstCall.args[3]).to.eql(2); // stride
|
|
122
|
+
});
|
|
123
|
+
it("should readAndRender multi path", async () => {
|
|
124
|
+
const featurePbf = createFeaturePBF();
|
|
125
|
+
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillyMultiPathQueryPbf);
|
|
126
|
+
const geomType = ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillyMultiPathQueryPbf.queryResult.featureResult.geometryType);
|
|
127
|
+
const symbolRenderer = new ArcGisSymbologyRenderer(geomType, PhillyLandmarksDataset.phillySimpleLineDrawingInfo.drawingInfo.renderer);
|
|
128
|
+
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
129
|
+
const renderPathSpy = sinon.spy(featureRenderer, "renderPath");
|
|
130
|
+
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
131
|
+
expect(renderPathSpy.calledOnce);
|
|
132
|
+
const firstCall = renderPathSpy.getCalls()[0];
|
|
133
|
+
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillyMultiPathQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
134
|
+
expect(firstCall.args[1]).to.eql(PhillyLandmarksDataset.phillyMultiPathQueryPbf.queryResult.featureResult.features[0].geometry.coords); // geometryCoords
|
|
135
|
+
expect(firstCall.args[2]).to.eql(false); // fill
|
|
136
|
+
expect(firstCall.args[3]).to.eql(2); // stride
|
|
137
|
+
});
|
|
138
|
+
it("should readAndRender simple point", async () => {
|
|
139
|
+
const featurePbf = createFeaturePBF();
|
|
140
|
+
const data = esriPBuffer.FeatureCollectionPBuffer.fromObject(PhillyLandmarksDataset.phillySimplePointQueryPbf);
|
|
141
|
+
const geomType = ArcGisFeaturePBF.getArcGisFeatureGeometryType(PhillyLandmarksDataset.phillyMultiPathQueryPbf.queryResult.featureResult.geometryType);
|
|
142
|
+
const symbolRenderer = new ArcGisSymbologyRenderer(geomType, PhillyLandmarksDataset.phillySimplePointDrawingInfo.drawingInfo.renderer);
|
|
143
|
+
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
144
|
+
const spy = sinon.spy(featureRenderer, "renderPoint");
|
|
145
|
+
featurePbf.readAndRender({ data, exceedTransferLimit: false }, featureRenderer);
|
|
146
|
+
expect(spy.calledOnce);
|
|
147
|
+
// Pbf contains already the right output format expect, lets rely on that.
|
|
148
|
+
const geometryCoords = PhillyLandmarksDataset.phillySimplePointQueryPbf.queryResult.featureResult.features[0].geometry.coords;
|
|
149
|
+
const firstCall = spy.getCalls()[0];
|
|
150
|
+
expect(firstCall.args[0]).to.eql(PhillyLandmarksDataset.phillySimplePointQueryPbf.queryResult.featureResult.features[0].geometry.lengths); // geometryLengths
|
|
151
|
+
expect(firstCall.args[1]).to.eql(geometryCoords); // geometryCoords
|
|
152
|
+
expect(firstCall.args[2]).to.eql(2); // stride
|
|
153
|
+
});
|
|
154
|
+
it("should log error when readAndRender / readFeatureInfo is called invalid response Data", async () => {
|
|
155
|
+
const featurePbf = createFeaturePBF();
|
|
156
|
+
const symbolRenderer = new ArcGisSymbologyRenderer("esriGeometryAny", PhillyLandmarksDataset.phillySimplePointDrawingInfo.drawingInfo.renderer);
|
|
157
|
+
const featureRenderer = new ArcGisFeatureRenderer(fakeContext, symbolRenderer);
|
|
158
|
+
const logErrorSpy = sandbox.spy(Logger, "logError");
|
|
159
|
+
featurePbf.readAndRender({ data: { test: "test" }, exceedTransferLimit: false }, featureRenderer);
|
|
160
|
+
expect(logErrorSpy.calledOnce);
|
|
161
|
+
logErrorSpy.resetHistory();
|
|
162
|
+
featurePbf.readFeatureInfo({ data: { test: "test" }, exceedTransferLimit: false }, []);
|
|
163
|
+
expect(logErrorSpy.calledOnce);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
166
|
//# sourceMappingURL=ArcGisFeaturePBF.test.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=ArcGisFeatureProvider.test.d.ts.map
|