@itwin/map-layers-formats 4.6.0-dev.18 → 4.6.0-dev.19
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/ArcGisFeature/ArcGisFeatureProvider.d.ts +15 -6
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +61 -51
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts +7 -11
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js +3 -19
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.d.ts +3 -3
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js +3 -4
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.d.ts +3 -3
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js +2 -3
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +35 -15
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +53 -47
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.d.ts +2 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.js +2 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.js.map +1 -1
- package/lib/cjs/Feature/DefaultMarkerIcon.d.ts +10 -0
- package/lib/cjs/Feature/DefaultMarkerIcon.d.ts.map +1 -0
- package/lib/cjs/Feature/DefaultMarkerIcon.js +31 -0
- package/lib/cjs/Feature/DefaultMarkerIcon.js.map +1 -0
- package/lib/cjs/Feature/FeatureCanvasRenderer.d.ts +20 -0
- package/lib/cjs/Feature/FeatureCanvasRenderer.d.ts.map +1 -0
- package/lib/cjs/{ArcGisFeature/ArcGisCanvasRenderer.js → Feature/FeatureCanvasRenderer.js} +7 -6
- package/lib/cjs/Feature/FeatureCanvasRenderer.js.map +1 -0
- package/lib/cjs/Feature/FeatureInfoReader.d.ts +11 -0
- package/lib/cjs/Feature/FeatureInfoReader.d.ts.map +1 -0
- package/lib/cjs/Feature/FeatureInfoReader.js +34 -0
- package/lib/cjs/Feature/FeatureInfoReader.js.map +1 -0
- package/lib/cjs/Feature/FeatureSymbology.d.ts +8 -0
- package/lib/cjs/Feature/FeatureSymbology.d.ts.map +1 -0
- package/lib/cjs/Feature/FeatureSymbology.js +12 -0
- package/lib/cjs/Feature/FeatureSymbology.js.map +1 -0
- package/lib/cjs/Feature/RandomMapColor.d.ts +8 -0
- package/lib/cjs/Feature/RandomMapColor.d.ts.map +1 -0
- package/lib/cjs/Feature/RandomMapColor.js +29 -0
- package/lib/cjs/Feature/RandomMapColor.js.map +1 -0
- package/lib/cjs/GeoJSON/GeoJSONGeometry.d.ts +18 -0
- package/lib/cjs/GeoJSON/GeoJSONGeometry.d.ts.map +1 -0
- package/lib/cjs/GeoJSON/GeoJSONGeometry.js +11 -0
- package/lib/cjs/GeoJSON/GeoJSONGeometry.js.map +1 -0
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.d.ts +11 -0
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.d.ts.map +1 -0
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.js +83 -0
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.js.map +1 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.d.ts +9 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.d.ts.map +1 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.js +94 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.d.ts +54 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.d.ts.map +1 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.js +477 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.d.ts +23 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.d.ts.map +1 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.js +139 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -0
- package/lib/cjs/mapLayersFormats.d.ts.map +1 -1
- package/lib/cjs/mapLayersFormats.js +4 -1
- package/lib/cjs/mapLayersFormats.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +15 -6
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +61 -51
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts +7 -11
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js +3 -19
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.d.ts +3 -3
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js +3 -4
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.d.ts +3 -3
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js +2 -3
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +35 -15
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +51 -45
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.d.ts +2 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.js +2 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.js.map +1 -1
- package/lib/esm/Feature/DefaultMarkerIcon.d.ts +10 -0
- package/lib/esm/Feature/DefaultMarkerIcon.d.ts.map +1 -0
- package/lib/esm/Feature/DefaultMarkerIcon.js +27 -0
- package/lib/esm/Feature/DefaultMarkerIcon.js.map +1 -0
- package/lib/esm/Feature/FeatureCanvasRenderer.d.ts +20 -0
- package/lib/esm/Feature/FeatureCanvasRenderer.d.ts.map +1 -0
- package/lib/esm/{ArcGisFeature/ArcGisCanvasRenderer.js → Feature/FeatureCanvasRenderer.js} +6 -5
- package/lib/esm/Feature/FeatureCanvasRenderer.js.map +1 -0
- package/lib/esm/Feature/FeatureInfoReader.d.ts +11 -0
- package/lib/esm/Feature/FeatureInfoReader.d.ts.map +1 -0
- package/lib/esm/Feature/FeatureInfoReader.js +30 -0
- package/lib/esm/Feature/FeatureInfoReader.js.map +1 -0
- package/lib/esm/Feature/FeatureSymbology.d.ts +8 -0
- package/lib/esm/Feature/FeatureSymbology.d.ts.map +1 -0
- package/lib/esm/Feature/FeatureSymbology.js +8 -0
- package/lib/esm/Feature/FeatureSymbology.js.map +1 -0
- package/lib/esm/Feature/RandomMapColor.d.ts +8 -0
- package/lib/esm/Feature/RandomMapColor.d.ts.map +1 -0
- package/lib/esm/Feature/RandomMapColor.js +26 -0
- package/lib/esm/Feature/RandomMapColor.js.map +1 -0
- package/lib/esm/GeoJSON/GeoJSONGeometry.d.ts +18 -0
- package/lib/esm/GeoJSON/GeoJSONGeometry.d.ts.map +1 -0
- package/lib/esm/GeoJSON/GeoJSONGeometry.js +7 -0
- package/lib/esm/GeoJSON/GeoJSONGeometry.js.map +1 -0
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.d.ts +11 -0
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.d.ts.map +1 -0
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.js +79 -0
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.js.map +1 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.d.ts +9 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.d.ts.map +1 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.js +91 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.d.ts +54 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.d.ts.map +1 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.js +473 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.d.ts +23 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.d.ts.map +1 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.js +135 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -0
- package/lib/esm/mapLayersFormats.d.ts.map +1 -1
- package/lib/esm/mapLayersFormats.js +4 -1
- package/lib/esm/mapLayersFormats.js.map +1 -1
- package/package.json +15 -13
- package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.d.ts +0 -19
- package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.d.ts.map +0 -1
- package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.js.map +0 -1
- package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.d.ts +0 -19
- package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.d.ts.map +0 -1
- package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.js.map +0 -1
|
@@ -0,0 +1,139 @@
|
|
|
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.OgcApiFeaturesReader = void 0;
|
|
8
|
+
const GeoJSONGeometryReader_1 = require("../GeoJSON/GeoJSONGeometryReader");
|
|
9
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
10
|
+
const FeatureInfoReader_1 = require("../Feature/FeatureInfoReader");
|
|
11
|
+
/** @internal */
|
|
12
|
+
class OgcApiFeaturesReader extends FeatureInfoReader_1.FeatureInfoReader {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
}
|
|
16
|
+
applySymbologyAttributes(attrSymbology, feature) {
|
|
17
|
+
if (attrSymbology && feature) {
|
|
18
|
+
const symbolFields = attrSymbology.rendererFields;
|
|
19
|
+
if (symbolFields && symbolFields.length > 0 && feature.properties) {
|
|
20
|
+
const featureAttr = {};
|
|
21
|
+
for (const [attrKey, attrValue] of Object.entries(feature.properties))
|
|
22
|
+
if (symbolFields.includes(attrKey)) {
|
|
23
|
+
featureAttr[attrKey] = attrValue;
|
|
24
|
+
}
|
|
25
|
+
attrSymbology.setActiveFeatureAttributes(featureAttr);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async readAndRender(data, renderer) {
|
|
30
|
+
const responseObj = data;
|
|
31
|
+
if (responseObj.type === "FeatureCollection") {
|
|
32
|
+
const geomReader = new GeoJSONGeometryReader_1.GeoJSONGeometryReader(renderer);
|
|
33
|
+
for (const feature of responseObj.features) {
|
|
34
|
+
// Each feature has potentially a different geometry type, so we need to inform the geometry renderer
|
|
35
|
+
if (renderer.hasSymbologyRenderer()) {
|
|
36
|
+
renderer.symbolRenderer.activeGeometryType = feature.geometry.type;
|
|
37
|
+
// Read attributes if needed (attribute driven symbology)
|
|
38
|
+
if (renderer.symbolRenderer.isAttributeDriven()) {
|
|
39
|
+
this.applySymbologyAttributes(renderer.symbolRenderer, feature);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
await geomReader.readGeometry(feature.geometry);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async readFeatureInfo(opts, featureInfos) {
|
|
47
|
+
if (!Array.isArray(opts.collection.features))
|
|
48
|
+
return;
|
|
49
|
+
const layerInfo = { layerName: opts.layerSettings.name };
|
|
50
|
+
// Create a signature index for every field name / type.
|
|
51
|
+
let fieldsType;
|
|
52
|
+
if (Array.isArray(opts.queryables?.properties)) {
|
|
53
|
+
fieldsType = {};
|
|
54
|
+
for (const fieldInfo of opts.queryables) {
|
|
55
|
+
fieldsType[fieldInfo.name] = fieldInfo.type;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const getStandardTypeName = (fieldType) => {
|
|
59
|
+
switch (fieldType) {
|
|
60
|
+
case "number":
|
|
61
|
+
return appui_abstract_1.StandardTypeNames.Double;
|
|
62
|
+
case "integer":
|
|
63
|
+
return appui_abstract_1.StandardTypeNames.Integer;
|
|
64
|
+
case "boolean":
|
|
65
|
+
return appui_abstract_1.StandardTypeNames.Boolean;
|
|
66
|
+
case "datetime":
|
|
67
|
+
return appui_abstract_1.StandardTypeNames.DateTime;
|
|
68
|
+
default:
|
|
69
|
+
return appui_abstract_1.StandardTypeNames.String;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const getRecordInfo = (fieldName, value) => {
|
|
73
|
+
let typename = appui_abstract_1.StandardTypeNames.String;
|
|
74
|
+
const propertyValue = { valueFormat: appui_abstract_1.PropertyValueFormat.Primitive };
|
|
75
|
+
if (value === null) {
|
|
76
|
+
value = undefined;
|
|
77
|
+
}
|
|
78
|
+
const strValue = `${value}`;
|
|
79
|
+
if (fieldsType) {
|
|
80
|
+
const fieldType = fieldsType[fieldName];
|
|
81
|
+
switch (fieldType) {
|
|
82
|
+
case "integer":
|
|
83
|
+
propertyValue.value = value;
|
|
84
|
+
break;
|
|
85
|
+
case "number":
|
|
86
|
+
propertyValue.value = this.toFixedWithoutPadding(value);
|
|
87
|
+
break;
|
|
88
|
+
case "datetime":
|
|
89
|
+
propertyValue.value = new Date(value);
|
|
90
|
+
break;
|
|
91
|
+
default:
|
|
92
|
+
if (value !== undefined)
|
|
93
|
+
propertyValue.value = strValue;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
typename = getStandardTypeName(fieldType);
|
|
97
|
+
propertyValue.displayValue = this.getDisplayValue(typename, propertyValue.value);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// Queryables are optional with OGC Features, in this case everything is string.
|
|
101
|
+
propertyValue.value = strValue;
|
|
102
|
+
propertyValue.displayValue = strValue;
|
|
103
|
+
}
|
|
104
|
+
return { value: propertyValue, property: { name: fieldName, displayLabel: fieldName, typename } };
|
|
105
|
+
};
|
|
106
|
+
let geomReader;
|
|
107
|
+
if (opts.geomRenderer) {
|
|
108
|
+
geomReader = new GeoJSONGeometryReader_1.GeoJSONGeometryReader(opts.geomRenderer);
|
|
109
|
+
}
|
|
110
|
+
// Each feature response represent a single sub-layer, no need to check for existing entry.
|
|
111
|
+
const subLayerInfo = {
|
|
112
|
+
subLayerName: opts.layerSettings.name,
|
|
113
|
+
displayFieldName: opts.layerSettings.name,
|
|
114
|
+
features: [],
|
|
115
|
+
};
|
|
116
|
+
// Read all features attributes / geometries
|
|
117
|
+
for (const responseFeature of opts.collection.features) {
|
|
118
|
+
const feature = { attributes: [] };
|
|
119
|
+
if (responseFeature.properties) {
|
|
120
|
+
for (const [key, value] of Object.entries(responseFeature.properties))
|
|
121
|
+
feature.attributes?.push(getRecordInfo(key, value));
|
|
122
|
+
}
|
|
123
|
+
if (geomReader && opts.geomRenderer) {
|
|
124
|
+
await geomReader.readGeometry(responseFeature.geometry);
|
|
125
|
+
const graphics = opts.geomRenderer.moveGraphics();
|
|
126
|
+
feature.geometries = graphics.map((graphic) => {
|
|
127
|
+
return { graphic };
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
subLayerInfo.features.push(feature);
|
|
131
|
+
}
|
|
132
|
+
if (layerInfo.subLayerInfos === undefined)
|
|
133
|
+
layerInfo.subLayerInfos = [];
|
|
134
|
+
layerInfo.subLayerInfos.push(subLayerInfo);
|
|
135
|
+
featureInfos.push(layerInfo);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.OgcApiFeaturesReader = OgcApiFeaturesReader;
|
|
139
|
+
//# sourceMappingURL=OgcApiFeaturesReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OgcApiFeaturesReader.js","sourceRoot":"","sources":["../../../src/OgcApiFeatures/OgcApiFeaturesReader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAG/F,4EAAyE;AAEzE,0DAA+F;AAE/F,oEAAiE;AAcjE,gBAAgB;AAChB,MAAa,oBAAqB,SAAQ,qCAAiB;IAGzD;QACE,K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AM,eAAe,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;YACtD,MAAM,OAAO,GAAoB,EAAC,UAAU,EAAE,EAAE,EAAC,CAAC;YAElD,IAAI,eAAe,CAAC,UAAU,EAAE;gBAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC;oBACnE,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;aACvD;YAED,IAAI,UAAU,IAAI,IAAI,CAAC,YAAY,EAAE;gBACnC,MAAM,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,QAAe,CAAC,CAAC;gBAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;gBAClD,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAyB,EAAE,EAAE;oBAC9D,OAAO,EAAC,OAAO,EAAC,CAAC;gBACnB,CAAC,CAAC,CAAC;aACJ;YACD,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACrC;QAED,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS;YACvC,SAAS,CAAC,aAAa,GAAG,EAAE,CAAC;QAC/B,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE3C,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;CAEF;AAnJD,oDAmJC","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\r\nimport { Transform } from \"@itwin/core-geometry\";\r\nimport { GeoJSONGeometryReader } from \"../GeoJSON/GeoJSONGeometryReader\";\r\nimport * as Geojson from \"geojson\";\r\nimport { PrimitiveValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\r\nimport { FeatureInfoReader } from \"../Feature/FeatureInfoReader\";\r\nimport { FeatureAttributeDrivenSymbology, FeatureGeometryRenderer, GraphicPrimitive, GraphicsGeometryRenderer, MapLayerFeature, MapLayerFeatureAttribute, MapLayerFeatureInfo, MapSubLayerFeatureInfo } from \"@itwin/core-frontend\";\r\n\r\n/** @internal */\r\nexport type OgcFeaturePropertyType = \"string\" | \"number\" | \"integer\" | \"datetime\" | \"geometry\" | \"boolean\";\r\n\r\n/** @internal */\r\nexport interface ReadOgcApiFeaturesInfoOptions {\r\n collection: Geojson.FeatureCollection;\r\n layerSettings: ImageMapLayerSettings;\r\n queryables?: any;\r\n geomRenderer?: GraphicsGeometryRenderer;\r\n}\r\n\r\n/** @internal */\r\nexport class OgcApiFeaturesReader extends FeatureInfoReader {\r\n public transform: Transform | undefined;\r\n\r\n public constructor() {\r\n super();\r\n }\r\n\r\n private applySymbologyAttributes(attrSymbology: FeatureAttributeDrivenSymbology, feature: any) {\r\n if (attrSymbology && feature) {\r\n const symbolFields = attrSymbology.rendererFields;\r\n if (symbolFields && symbolFields.length > 0 && feature.properties) {\r\n const featureAttr: {[key: string]: any} = {};\r\n for (const [attrKey, attrValue] of Object.entries(feature.properties))\r\n if (symbolFields.includes(attrKey)) {\r\n featureAttr[attrKey] = attrValue;\r\n }\r\n attrSymbology.setActiveFeatureAttributes(featureAttr);\r\n }\r\n }\r\n }\r\n\r\n public async readAndRender(data: Geojson.FeatureCollection, renderer: FeatureGeometryRenderer) {\r\n const responseObj = data;\r\n if (responseObj.type === \"FeatureCollection\") {\r\n\r\n const geomReader = new GeoJSONGeometryReader(renderer);\r\n\r\n for (const feature of responseObj.features) {\r\n // Each feature has potentially a different geometry type, so we need to inform the geometry renderer\r\n if (renderer.hasSymbologyRenderer()) {\r\n renderer.symbolRenderer.activeGeometryType = feature.geometry.type;\r\n // Read attributes if needed (attribute driven symbology)\r\n if (renderer.symbolRenderer.isAttributeDriven()) {\r\n this.applySymbologyAttributes(renderer.symbolRenderer, feature);\r\n }\r\n }\r\n\r\n await geomReader.readGeometry(feature.geometry);\r\n }\r\n }\r\n }\r\n\r\n public async readFeatureInfo(opts: ReadOgcApiFeaturesInfoOptions, featureInfos: MapLayerFeatureInfo[]) {\r\n if (!Array.isArray(opts.collection.features))\r\n return;\r\n\r\n const layerInfo: MapLayerFeatureInfo = { layerName: opts.layerSettings.name };\r\n\r\n // Create a signature index for every field name / type.\r\n let fieldsType: { [key: string]: OgcFeaturePropertyType } | undefined;\r\n if (Array.isArray(opts.queryables?.properties)) {\r\n fieldsType = {};\r\n for (const fieldInfo of opts.queryables) {\r\n fieldsType[fieldInfo.name] = fieldInfo.type;\r\n }\r\n }\r\n\r\n const getStandardTypeName = (fieldType: OgcFeaturePropertyType) => {\r\n switch (fieldType) {\r\n case \"number\":\r\n return StandardTypeNames.Double;\r\n case \"integer\":\r\n return StandardTypeNames.Integer;\r\n case \"boolean\":\r\n return StandardTypeNames.Boolean;\r\n case \"datetime\":\r\n return StandardTypeNames.DateTime;\r\n default:\r\n return StandardTypeNames.String;\r\n }\r\n };\r\n\r\n const getRecordInfo = (fieldName: string, value: any): MapLayerFeatureAttribute => {\r\n let typename = StandardTypeNames.String;\r\n const propertyValue: PrimitiveValue = {valueFormat: PropertyValueFormat.Primitive};\r\n\r\n if (value === null) {\r\n value = undefined;\r\n }\r\n\r\n const strValue = `${value}`;\r\n if (fieldsType) {\r\n const fieldType = fieldsType[fieldName];\r\n switch (fieldType) {\r\n case \"integer\":\r\n propertyValue.value = value as number;\r\n break;\r\n case \"number\":\r\n propertyValue.value = this.toFixedWithoutPadding(value);\r\n break;\r\n case \"datetime\":\r\n propertyValue.value = new Date(value);\r\n break;\r\n default:\r\n if (value !== undefined)\r\n propertyValue.value = strValue;\r\n break;\r\n }\r\n typename = getStandardTypeName(fieldType);\r\n propertyValue.displayValue = this.getDisplayValue(typename, propertyValue.value);\r\n } else {\r\n // Queryables are optional with OGC Features, in this case everything is string.\r\n propertyValue.value = strValue;\r\n propertyValue.displayValue = strValue;\r\n }\r\n\r\n return {value: propertyValue, property: { name: fieldName, displayLabel: fieldName, typename }};\r\n };\r\n\r\n let geomReader: GeoJSONGeometryReader|undefined;\r\n if (opts.geomRenderer) {\r\n geomReader = new GeoJSONGeometryReader(opts.geomRenderer);\r\n }\r\n\r\n // Each feature response represent a single sub-layer, no need to check for existing entry.\r\n const subLayerInfo: MapSubLayerFeatureInfo = {\r\n subLayerName: opts.layerSettings.name,\r\n displayFieldName: opts.layerSettings.name,\r\n features: [],\r\n };\r\n\r\n // Read all features attributes / geometries\r\n for (const responseFeature of opts.collection.features) {\r\n const feature: MapLayerFeature = {attributes: []};\r\n\r\n if (responseFeature.properties) {\r\n for (const [key, value] of Object.entries(responseFeature.properties))\r\n feature.attributes?.push(getRecordInfo(key, value));\r\n }\r\n\r\n if (geomReader && opts.geomRenderer) {\r\n await geomReader.readGeometry(responseFeature.geometry as any);\r\n const graphics = opts.geomRenderer.moveGraphics();\r\n feature.geometries = graphics.map((graphic: GraphicPrimitive) => {\r\n return {graphic};\r\n });\r\n }\r\n subLayerInfo.features.push(feature);\r\n }\r\n\r\n if (layerInfo.subLayerInfos === undefined)\r\n layerInfo.subLayerInfos = [];\r\n layerInfo.subLayerInfos.push(subLayerInfo);\r\n\r\n featureInfos.push(layerInfo);\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapLayersFormats.d.ts","sourceRoot":"","sources":["../../src/mapLayersFormats.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"mapLayersFormats.d.ts","sourceRoot":"","sources":["../../src/mapLayersFormats.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,MAAM,CAAC,UAAU,CAAsB;IAC/C,OAAc,YAAY,EAAE,YAAY,CAAC;IAEzC;;;OAGG;WACiB,UAAU,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB9E,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;CAEF"}
|
|
@@ -12,6 +12,7 @@ const core_bentley_1 = require("@itwin/core-bentley");
|
|
|
12
12
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
13
13
|
const ArcGisFeatureFormat_1 = require("./ArcGisFeature/ArcGisFeatureFormat");
|
|
14
14
|
const MapFeatureInfoTool_1 = require("./Tools/MapFeatureInfoTool");
|
|
15
|
+
const OgcApiFeaturesFormat_1 = require("./OgcApiFeatures/OgcApiFeaturesFormat");
|
|
15
16
|
/** The primary API for the `@itwin/map-layers-formats` package. It allows the package's features to be [[initialize]]d.
|
|
16
17
|
* @beta
|
|
17
18
|
*/
|
|
@@ -22,8 +23,10 @@ class MapLayersFormats {
|
|
|
22
23
|
*/
|
|
23
24
|
static async initialize(config) {
|
|
24
25
|
(0, core_bentley_1.assert)(core_frontend_1.IModelApp.initialized, "MapLayersFormats.initialize must be called after IModelApp.startup and before IModelApp.shutdown");
|
|
25
|
-
if (core_frontend_1.IModelApp.initialized)
|
|
26
|
+
if (core_frontend_1.IModelApp.initialized) {
|
|
26
27
|
core_frontend_1.IModelApp.mapLayerFormatRegistry.register(ArcGisFeatureFormat_1.ArcGisFeatureMapLayerFormat);
|
|
28
|
+
core_frontend_1.IModelApp.mapLayerFormatRegistry.register(OgcApiFeaturesFormat_1.OgcApiFeaturesMapLayerFormat);
|
|
29
|
+
}
|
|
27
30
|
// register namespace containing localized strings for this package
|
|
28
31
|
MapLayersFormats.localization = config?.localization ?? core_frontend_1.IModelApp.localization;
|
|
29
32
|
await MapLayersFormats.localization.registerNamespace(MapLayersFormats.localizationNamespace);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapLayersFormats.js","sourceRoot":"","sources":["../../src/mapLayersFormats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,sDAA6C;AAC7C,wDAAiD;AACjD,6EAAkF;AAClF,mEAAgE;
|
|
1
|
+
{"version":3,"file":"mapLayersFormats.js","sourceRoot":"","sources":["../../src/mapLayersFormats.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,sDAA6C;AAC7C,wDAAiD;AACjD,6EAAkF;AAClF,mEAAgE;AAEhE,gFAAqF;AASrF;;GAEG;AACH,MAAa,gBAAgB;IAK3B;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAA+B;QAC5D,IAAA,qBAAM,EAAC,yBAAS,CAAC,WAAW,EAAE,kGAAkG,CAAC,CAAC;QAClI,IAAI,yBAAS,CAAC,WAAW,EAAE;YACzB,yBAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,iDAA2B,CAAC,CAAC;YACvE,yBAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,mDAA4B,CAAC,CAAC;SACzE;QAED,mEAAmE;QACnE,gBAAgB,CAAC,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,yBAAS,CAAC,YAAY,CAAC;QAC/E,MAAM,gBAAgB,CAAC,YAAY,CAAC,iBAAiB,CACnD,gBAAgB,CAAC,qBAAqB,CACvC,CAAC;QAEF,uCAAkB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IACtE,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,gBAAgB,CAAC,UAAU,CAAC;IACrC,CAAC;;AA1Bc,2BAAU,GAAG,kBAAkB,CAAC;AAFpC,4CAAgB","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\r\n/** @packageDocumentation\r\n * @module MapLayersFormats\r\n */\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { ArcGisFeatureMapLayerFormat } from \"./ArcGisFeature/ArcGisFeatureFormat\";\r\nimport { MapFeatureInfoTool } from \"./Tools/MapFeatureInfoTool\";\r\nimport { Localization } from \"@itwin/core-common\";\r\nimport { OgcApiFeaturesMapLayerFormat } from \"./OgcApiFeatures/OgcApiFeaturesFormat\";\r\n\r\n/** Configuration options.\r\n * @beta\r\n */\r\nexport interface MapLayersFormatsConfig {\r\n localization?: Localization;\r\n}\r\n\r\n/** The primary API for the `@itwin/map-layers-formats` package. It allows the package's features to be [[initialize]]d.\r\n * @beta\r\n */\r\nexport class MapLayersFormats {\r\n\r\n private static _defaultNs = \"mapLayersFormats\";\r\n public static localization: Localization;\r\n\r\n /** Registers the [MapLayerFormat]($frontend)s provided by this package for use with [IModelApp]($frontend).\r\n * Typically, an application will call `MapLayersFormats.initialize` immediately after [IModelApp.startup]($frontend).\r\n * This function has no effect if called **before** [IModelApp.startup]($frontend) or **after** [IModelApp.shutdown]($frontend).\r\n */\r\n public static async initialize(config?: MapLayersFormatsConfig): Promise<void> {\r\n assert(IModelApp.initialized, \"MapLayersFormats.initialize must be called after IModelApp.startup and before IModelApp.shutdown\");\r\n if (IModelApp.initialized) {\r\n IModelApp.mapLayerFormatRegistry.register(ArcGisFeatureMapLayerFormat);\r\n IModelApp.mapLayerFormatRegistry.register(OgcApiFeaturesMapLayerFormat);\r\n }\r\n\r\n // register namespace containing localized strings for this package\r\n MapLayersFormats.localization = config?.localization ?? IModelApp.localization;\r\n await MapLayersFormats.localization.registerNamespace(\r\n MapLayersFormats.localizationNamespace,\r\n );\r\n\r\n MapFeatureInfoTool.register(MapLayersFormats.localizationNamespace);\r\n }\r\n\r\n /** The internationalization service namespace. */\r\n public static get localizationNamespace(): string {\r\n return MapLayersFormats._defaultNs;\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Cartographic, ImageMapLayerSettings, ImageSource } from "@itwin/core-common";
|
|
2
2
|
import { Transform } from "@itwin/core-geometry";
|
|
3
3
|
import { ArcGISImageryProvider, HitDetail, ImageryMapTileTree, MapFeatureInfoOptions, MapLayerFeatureInfo, QuadId } from "@itwin/core-frontend";
|
|
4
|
-
import { ArcGisExtent, ArcGisFeatureFormat,
|
|
5
|
-
import { EsriPMS, EsriSFS, EsriSLS } from "./EsriSymbology";
|
|
4
|
+
import { ArcGisExtent, ArcGisFeatureFormat, ArcGisFeatureResultType, ArcGisGeometry } from "./ArcGisFeatureQuery";
|
|
5
|
+
import { EsriPMS, EsriSFS, EsriSLS, EsriSLSProps, EsriSymbol } from "./EsriSymbology";
|
|
6
|
+
import { FeatureDefaultSymbology } from "../Feature/FeatureSymbology";
|
|
6
7
|
/**
|
|
7
8
|
* @internal
|
|
8
9
|
*/
|
|
@@ -10,6 +11,17 @@ interface ArcGisFeatureUrl {
|
|
|
10
11
|
url: string;
|
|
11
12
|
envelope?: ArcGisExtent;
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare class DefaultArcGiSymbology implements FeatureDefaultSymbology {
|
|
18
|
+
static readonly defaultPMS: EsriPMS;
|
|
19
|
+
static readonly defaultSLSProps: EsriSLSProps;
|
|
20
|
+
static readonly defaultSLS: EsriSLS;
|
|
21
|
+
static readonly defaultSFS: EsriSFS;
|
|
22
|
+
initialize(): Promise<void>;
|
|
23
|
+
getSymbology(geomType: string): EsriSymbol;
|
|
24
|
+
}
|
|
13
25
|
/** Provide tiles from a ESRI ArcGIS Feature service
|
|
14
26
|
* @internal
|
|
15
27
|
*/
|
|
@@ -25,17 +37,14 @@ export declare class ArcGisFeatureProvider extends ArcGISImageryProvider {
|
|
|
25
37
|
private _minDepthFromLod;
|
|
26
38
|
private _defaultSymbol;
|
|
27
39
|
private _renderer;
|
|
40
|
+
private _symbologyRenderer;
|
|
28
41
|
private static readonly _nbSubTiles;
|
|
29
42
|
serviceJson: any;
|
|
30
|
-
private static readonly defaultPMS;
|
|
31
|
-
private static readonly defaultSLS;
|
|
32
|
-
private static readonly defaultSFS;
|
|
33
43
|
get minimumZoomLevel(): number;
|
|
34
44
|
get maximumZoomLevel(): number;
|
|
35
45
|
private static _extentCache;
|
|
36
46
|
constructor(settings: ImageMapLayerSettings);
|
|
37
47
|
initialize(): Promise<void>;
|
|
38
|
-
static getDefaultSymbology(geomType: ArcGisFeatureGeometryType): EsriSFS | EsriSLS | EsriPMS | undefined;
|
|
39
48
|
private fetchLayerExtent;
|
|
40
49
|
private setCartoRangeFromExtentJson;
|
|
41
50
|
protected getLayerMetadata(layerId: number): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGisFeatureProvider.d.ts","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisFeatureProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAAkC,MAAM,oBAAoB,CAAC;AAEtH,OAAO,EAA8B,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,
|
|
1
|
+
{"version":3,"file":"ArcGisFeatureProvider.d.ts","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisFeatureProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAAkC,MAAM,oBAAoB,CAAC;AAEtH,OAAO,EAA8B,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAmB,qBAAqB,EAAmE,SAAS,EAAE,kBAAkB,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AAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CA8GjH"}
|
|
@@ -6,15 +6,61 @@ var _a;
|
|
|
6
6
|
import { ImageSource, ImageSourceFormat, ServerError } from "@itwin/core-common";
|
|
7
7
|
import { base64StringToUint8Array, IModelStatus, Logger } from "@itwin/core-bentley";
|
|
8
8
|
import { Matrix4d, Point3d, Range2d } from "@itwin/core-geometry";
|
|
9
|
-
import { ArcGisErrorCode,
|
|
10
|
-
import { ArcGisSymbologyRenderer } from "./ArcGisSymbologyRenderer";
|
|
9
|
+
import { ArcGisErrorCode, ArcGISImageryProvider, ArcGisUtilities, FeatureGraphicsRenderer, MapCartoRectangle, MapLayerImageryProviderStatus, setRequestTimeout } from "@itwin/core-frontend";
|
|
11
10
|
import { ArcGisFeatureQuery } from "./ArcGisFeatureQuery";
|
|
12
11
|
import { ArcGisPbfFeatureReader } from "./ArcGisPbfFeatureReader";
|
|
13
12
|
import { ArcGisJsonFeatureReader } from "./ArcGisJsonFeatureReader";
|
|
14
13
|
import { ArcGisFeatureResponse } from "./ArcGisFeatureResponse";
|
|
15
|
-
import { ArcGisCanvasRenderer } from "./ArcGisCanvasRenderer";
|
|
16
14
|
import { EsriPMS, EsriRenderer, EsriSFS, EsriSLS } from "./EsriSymbology";
|
|
15
|
+
import { FeatureCanvasRenderer } from "../Feature/FeatureCanvasRenderer";
|
|
16
|
+
import { ArcGisSymbologyCanvasRenderer } from "./ArcGisSymbologyRenderer";
|
|
17
17
|
const loggerCategory = "MapLayersFormats.ArcGISFeature";
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
class DefaultArcGiSymbology {
|
|
22
|
+
async initialize() {
|
|
23
|
+
// Marker image need to be loaded upfront;
|
|
24
|
+
await DefaultArcGiSymbology.defaultPMS.loadImage();
|
|
25
|
+
}
|
|
26
|
+
getSymbology(geomType) {
|
|
27
|
+
if (geomType === "esriGeometryPoint" || geomType === "esriGeometryMultipoint") {
|
|
28
|
+
return DefaultArcGiSymbology.defaultPMS;
|
|
29
|
+
}
|
|
30
|
+
else if (geomType === "esriGeometryLine" || geomType === "esriGeometryPolyline") {
|
|
31
|
+
return DefaultArcGiSymbology.defaultSLS;
|
|
32
|
+
}
|
|
33
|
+
else if (geomType === "esriGeometryPolygon") {
|
|
34
|
+
return DefaultArcGiSymbology.defaultSFS;
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Could not get default symbology for geometry type: '${geomType}'`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
_a = DefaultArcGiSymbology;
|
|
40
|
+
DefaultArcGiSymbology.defaultPMS = EsriPMS.fromJSON({
|
|
41
|
+
type: "esriPMS",
|
|
42
|
+
url: "",
|
|
43
|
+
contentType: "image/png",
|
|
44
|
+
imageData: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAmBJREFUOE+Nk01IVFEUx//n3jfvOZOaJkMtiiJ7o9RG3LgoqKhFSFJBTS1ahFBBi0ijfJXCIyQr+hBbSIsoW7iQoKKFCw2CkAI3tZAgy8Ei+xhoTCbnje/NPfHGnA816KzuPR+/c8/HJRQJE7o+VUhym0DcCOYGgBQEXjOLlyqo+nHanCkMoaL4rslKjZwOQLT4ek3Mmz3FACFNLB67ut6M1nWphbg8wI6VyJK5KEH0EQFVJRKbwzokAW++p/ErraAYSQK3u47bC3vLnA+ZB9i2gHF0oyQMCfCGNaUa+vauxs71wWz2V18cnBj8gQ8J1/eeBnHUa4sMFQDGdGno+4gwEAoQzjVUon3rqlx1KY9x7+0MWobjAPg3QJ2eZV4tAEyFNCN5FkSXyw2B3j1hRGvLcgBXMV5MptA4MOXr0gT0u5bZnAf0jBsyiSgJPAxqhON1K3FlRxUMvwFAtv7u0Wl0jvwEmJNEuOhakTt5wKEBifr6Oo14BIBRpgt07w6jcVMIngKGY7NofR5HwlF+zDcpsC193vyYB/innvHywCzdZfAR/+onX1segBTAxHzzfPE7/8yzzIPLjJE1LTixHZx5CtCK4gXLzovBiDPUsYxVM7gUkB3nWKlm6DYEnQGzXARxCOK+a1WfKtQXb6LNAvr7iCboCUA1Ocdsdv5KLPe7F6pH/w3wLbc+BwOuc5IZ1wEE/jonQbjptZn24tKKX7BgvR2r0NKZRwDvAqCI+Z30VJPTURv7P4A9psuQcYAUPwAoReBLrmX2Lmls7i8sZ7kWLwuoxA1FVJGxzMPLufi6P2r+2xFbOUjGAAAAAElFTkSuQmCC",
|
|
45
|
+
width: 16,
|
|
46
|
+
height: 16,
|
|
47
|
+
xoffset: -8,
|
|
48
|
+
yoffset: -16,
|
|
49
|
+
});
|
|
50
|
+
DefaultArcGiSymbology.defaultSLSProps = {
|
|
51
|
+
type: "esriSLS",
|
|
52
|
+
color: [0, 0, 255, 255],
|
|
53
|
+
width: 1,
|
|
54
|
+
style: "esriSLSSolid",
|
|
55
|
+
};
|
|
56
|
+
DefaultArcGiSymbology.defaultSLS = EsriSLS.fromJSON(_a.defaultSLSProps);
|
|
57
|
+
DefaultArcGiSymbology.defaultSFS = EsriSFS.fromJSON({
|
|
58
|
+
type: "esriSFS",
|
|
59
|
+
color: [0, 0, 255, 100],
|
|
60
|
+
style: "esriSFSSolid",
|
|
61
|
+
outline: _a.defaultSLSProps,
|
|
62
|
+
});
|
|
63
|
+
export { DefaultArcGiSymbology };
|
|
18
64
|
/** Provide tiles from a ESRI ArcGIS Feature service
|
|
19
65
|
* @internal
|
|
20
66
|
*/
|
|
@@ -31,6 +77,7 @@ class ArcGisFeatureProvider extends ArcGISImageryProvider {
|
|
|
31
77
|
this._outSR = 102100;
|
|
32
78
|
this._maxDepthFromLod = 0;
|
|
33
79
|
this._minDepthFromLod = 0;
|
|
80
|
+
this._defaultSymbol = new DefaultArcGiSymbology();
|
|
34
81
|
}
|
|
35
82
|
async initialize() {
|
|
36
83
|
const metadata = await this.getServiceJson();
|
|
@@ -163,14 +210,6 @@ class ArcGisFeatureProvider extends ArcGISImageryProvider {
|
|
|
163
210
|
this._minDepthFromLod = scales.minLod;
|
|
164
211
|
// 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)
|
|
165
212
|
this._maxDepthFromLod = (scales.maxLod ? scales.maxLod : this.defaultMaximumZoomLevel);
|
|
166
|
-
this._defaultSymbol = ArcGisFeatureProvider.getDefaultSymbology(this._layerMetadata?.geometryType);
|
|
167
|
-
if (!this._defaultSymbol) {
|
|
168
|
-
Logger.logError(loggerCategory, "Could not determine default symbology: geometry type not supported");
|
|
169
|
-
throw new Error("Could not determine default symbology: geometry type not supported");
|
|
170
|
-
}
|
|
171
|
-
if (this._defaultSymbol.type === "esriPMS") {
|
|
172
|
-
await this._defaultSymbol.loadImage();
|
|
173
|
-
}
|
|
174
213
|
try {
|
|
175
214
|
this._renderer = EsriRenderer.fromJSON(this._layerMetadata?.drawingInfo?.renderer);
|
|
176
215
|
await this._renderer.initialize();
|
|
@@ -178,20 +217,11 @@ class ArcGisFeatureProvider extends ArcGISImageryProvider {
|
|
|
178
217
|
catch (e) {
|
|
179
218
|
Logger.logError(loggerCategory, `Could not initialize symbology renderer for '${this._settings.name}': ${e}`);
|
|
180
219
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
else if (geomType === "esriGeometryLine" || geomType === "esriGeometryPolyline") {
|
|
188
|
-
return EsriSLS.fromJSON(ArcGisFeatureProvider.defaultSLS);
|
|
189
|
-
}
|
|
190
|
-
else if (geomType === "esriGeometryPolygon") {
|
|
191
|
-
return EsriSFS.fromJSON(ArcGisFeatureProvider.defaultSFS);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return undefined;
|
|
220
|
+
// Sanity check: make sure we got default symbology for this geometry type
|
|
221
|
+
// if not, it will throw
|
|
222
|
+
this._defaultSymbol.getSymbology(this._layerMetadata?.geometryType);
|
|
223
|
+
await this._defaultSymbol.initialize(); // images must be loaded upfront
|
|
224
|
+
this._symbologyRenderer = ArcGisSymbologyCanvasRenderer.create(this._renderer, this._defaultSymbol, this._layerMetadata?.geometryType);
|
|
195
225
|
}
|
|
196
226
|
async fetchLayerExtent() {
|
|
197
227
|
let extentJson;
|
|
@@ -356,7 +386,7 @@ class ArcGisFeatureProvider extends ArcGISImageryProvider {
|
|
|
356
386
|
return;
|
|
357
387
|
}
|
|
358
388
|
const featureReader = new ArcGisJsonFeatureReader(this._settings, this._layerMetadata);
|
|
359
|
-
const renderer = new
|
|
389
|
+
const renderer = new FeatureGraphicsRenderer({ viewport: hit.viewport, crs: "webMercator" });
|
|
360
390
|
await featureReader.readFeatureInfo(responseData, featureInfos, renderer);
|
|
361
391
|
}
|
|
362
392
|
catch (e) {
|
|
@@ -429,8 +459,11 @@ class ArcGisFeatureProvider extends ArcGISImageryProvider {
|
|
|
429
459
|
}
|
|
430
460
|
}
|
|
431
461
|
// Create the renderer
|
|
432
|
-
|
|
433
|
-
|
|
462
|
+
if (!this._symbologyRenderer) {
|
|
463
|
+
Logger.logError(loggerCategory, `Unable to load tile: symbology renderer not aailable.`);
|
|
464
|
+
return undefined;
|
|
465
|
+
}
|
|
466
|
+
const renderer = new FeatureCanvasRenderer(ctx, this._symbologyRenderer, transfo);
|
|
434
467
|
const featureReader = this.format === "PBF" ? new ArcGisPbfFeatureReader(this._settings, this._layerMetadata) : new ArcGisJsonFeatureReader(this._settings, this._layerMetadata);
|
|
435
468
|
const getSubEnvelopes = (envelope) => {
|
|
436
469
|
const dx = (envelope.xmax - envelope.xmin) * 0.5;
|
|
@@ -506,30 +539,7 @@ class ArcGisFeatureProvider extends ArcGISImageryProvider {
|
|
|
506
539
|
return undefined;
|
|
507
540
|
}
|
|
508
541
|
}
|
|
509
|
-
_a = ArcGisFeatureProvider;
|
|
510
542
|
ArcGisFeatureProvider._nbSubTiles = 2; // Number of subtiles for a single axis
|
|
511
|
-
ArcGisFeatureProvider.defaultPMS = {
|
|
512
|
-
type: "esriPMS",
|
|
513
|
-
url: "",
|
|
514
|
-
contentType: "image/png",
|
|
515
|
-
imageData: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAmBJREFUOE+Nk01IVFEUx//n3jfvOZOaJkMtiiJ7o9RG3LgoqKhFSFJBTS1ahFBBi0ijfJXCIyQr+hBbSIsoW7iQoKKFCw2CkAI3tZAgy8Ei+xhoTCbnje/NPfHGnA816KzuPR+/c8/HJRQJE7o+VUhym0DcCOYGgBQEXjOLlyqo+nHanCkMoaL4rslKjZwOQLT4ek3Mmz3FACFNLB67ut6M1nWphbg8wI6VyJK5KEH0EQFVJRKbwzokAW++p/ErraAYSQK3u47bC3vLnA+ZB9i2gHF0oyQMCfCGNaUa+vauxs71wWz2V18cnBj8gQ8J1/eeBnHUa4sMFQDGdGno+4gwEAoQzjVUon3rqlx1KY9x7+0MWobjAPg3QJ2eZV4tAEyFNCN5FkSXyw2B3j1hRGvLcgBXMV5MptA4MOXr0gT0u5bZnAf0jBsyiSgJPAxqhON1K3FlRxUMvwFAtv7u0Wl0jvwEmJNEuOhakTt5wKEBifr6Oo14BIBRpgt07w6jcVMIngKGY7NofR5HwlF+zDcpsC193vyYB/innvHywCzdZfAR/+onX1segBTAxHzzfPE7/8yzzIPLjJE1LTixHZx5CtCK4gXLzovBiDPUsYxVM7gUkB3nWKlm6DYEnQGzXARxCOK+a1WfKtQXb6LNAvr7iCboCUA1Ocdsdv5KLPe7F6pH/w3wLbc+BwOuc5IZ1wEE/jonQbjptZn24tKKX7BgvR2r0NKZRwDvAqCI+Z30VJPTURv7P4A9psuQcYAUPwAoReBLrmX2Lmls7i8sZ7kWLwuoxA1FVJGxzMPLufi6P2r+2xFbOUjGAAAAAElFTkSuQmCC",
|
|
516
|
-
width: 16,
|
|
517
|
-
height: 16,
|
|
518
|
-
xoffset: -8,
|
|
519
|
-
yoffset: -16,
|
|
520
|
-
};
|
|
521
|
-
ArcGisFeatureProvider.defaultSLS = {
|
|
522
|
-
type: "esriSLS",
|
|
523
|
-
color: [0, 0, 0, 255],
|
|
524
|
-
width: 1,
|
|
525
|
-
style: "esriSLSSolid",
|
|
526
|
-
};
|
|
527
|
-
ArcGisFeatureProvider.defaultSFS = {
|
|
528
|
-
type: "esriSFS",
|
|
529
|
-
color: [0, 0, 255, 255],
|
|
530
|
-
style: "esriSFSSolid",
|
|
531
|
-
outline: _a.defaultSLS,
|
|
532
|
-
};
|
|
533
543
|
ArcGisFeatureProvider._extentCache = new Map();
|
|
534
544
|
export { ArcGisFeatureProvider };
|
|
535
545
|
//# sourceMappingURL=ArcGisFeatureProvider.js.map
|