@itwin/map-layers-formats 4.6.0-dev.8 → 4.7.0-dev.0
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/CHANGELOG.md +13 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- 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 +64 -54
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.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/ArcGisFeatureResponse.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 +54 -48
- 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/ArcGisFeature/esriPBuffer.gen.js +1 -1
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.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 +35 -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/Tools/MapFeatureInfoDecorator.js.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoTool.js +1 -1
- package/lib/cjs/Tools/MapFeatureInfoTool.js.map +1 -1
- package/lib/cjs/mapLayersFormats.d.ts.map +1 -1
- package/lib/cjs/mapLayersFormats.js +5 -2
- package/lib/cjs/mapLayersFormats.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js +1 -2
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.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 +63 -55
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.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/ArcGisFeatureResponse.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 +52 -47
- 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/ArcGisFeature/esriPBuffer.gen.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 +31 -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 +25 -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 +90 -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 +472 -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/Tools/MapFeatureInfoDecorator.js.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoTool.js +1 -2
- package/lib/esm/Tools/MapFeatureInfoTool.js.map +1 -1
- package/lib/esm/mapLayersFormats.d.ts.map +1 -1
- package/lib/esm/mapLayersFormats.js +5 -3
- package/lib/esm/mapLayersFormats.js.map +1 -1
- package/package.json +18 -15
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImageMapLayerSettings } from "@itwin/core-common";
|
|
2
|
-
import {
|
|
2
|
+
import { FeatureGeometryRenderer, GraphicsGeometryRenderer, MapLayerFeatureInfo } from "@itwin/core-frontend";
|
|
3
3
|
import { Transform } from "@itwin/core-geometry";
|
|
4
4
|
import { ArcGisBaseFeatureReader } from "./ArcGisFeatureReader";
|
|
5
5
|
import { ArcGisResponseData } from "./ArcGisFeatureResponse";
|
|
@@ -8,7 +8,7 @@ export declare class ArcGisJsonFeatureReader extends ArcGisBaseFeatureReader {
|
|
|
8
8
|
transform: Transform | undefined;
|
|
9
9
|
constructor(settings: ImageMapLayerSettings, layerMetadata: any);
|
|
10
10
|
private applySymbologyAttributes;
|
|
11
|
-
readAndRender(response: ArcGisResponseData, renderer:
|
|
12
|
-
readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[], renderer?:
|
|
11
|
+
readAndRender(response: ArcGisResponseData, renderer: FeatureGeometryRenderer): Promise<void>;
|
|
12
|
+
readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[], renderer?: GraphicsGeometryRenderer): Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=ArcGisJsonFeatureReader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGisJsonFeatureReader.d.ts","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisJsonFeatureReader.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"ArcGisJsonFeatureReader.d.ts","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisJsonFeatureReader.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAA6D,uBAAuB,EAAE,wBAAwB,EAA6C,mBAAmB,EAAyB,MAAM,sBAAsB,CAAC;AAC3O,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAmB,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE9E,gBAAgB;AAChB,qBAAa,uBAAwB,SAAQ,uBAAuB;IAC3D,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;gBAErB,QAAQ,EAAE,qBAAqB,EAAE,aAAa,EAAE,GAAG;IAKtE,OAAO,CAAC,wBAAwB;IAcnB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,uBAAuB;IAgB7E,eAAe,CAAC,QAAQ,EAAE,kBAAkB,EAAE,YAAY,EAAE,mBAAmB,EAAE,EAAE,QAAQ,CAAC,EAAE,wBAAwB;CAoGpI"}
|
|
@@ -26,12 +26,11 @@ export class ArcGisJsonFeatureReader extends ArcGisBaseFeatureReader {
|
|
|
26
26
|
async readAndRender(response, renderer) {
|
|
27
27
|
const responseObj = response.data;
|
|
28
28
|
if (responseObj.geometryType) {
|
|
29
|
-
const attrSymbology = renderer.attributeSymbology;
|
|
30
29
|
const geomReader = new ArcGisGeometryReaderJSON(responseObj.geometryType, renderer, renderer.transform === undefined);
|
|
31
30
|
for (const feature of responseObj.features) {
|
|
32
|
-
if (
|
|
31
|
+
if (renderer.hasSymbologyRenderer() && renderer.symbolRenderer.isAttributeDriven()) {
|
|
33
32
|
// Read attributes if needed (attribute driven symbology)
|
|
34
|
-
this.applySymbologyAttributes(
|
|
33
|
+
this.applySymbologyAttributes(renderer.symbolRenderer, feature);
|
|
35
34
|
}
|
|
36
35
|
await geomReader.readGeometry(feature.geometry);
|
|
37
36
|
}
|
|
@@ -107,7 +106,7 @@ export class ArcGisJsonFeatureReader extends ArcGisBaseFeatureReader {
|
|
|
107
106
|
const feature = { attributes: [] };
|
|
108
107
|
for (const [key, value] of Object.entries(responseFeature.attributes))
|
|
109
108
|
feature.attributes?.push(getRecordInfo(key, value));
|
|
110
|
-
if (geomReader) {
|
|
109
|
+
if (geomReader && renderer) {
|
|
111
110
|
await geomReader.readGeometry(responseFeature.geometry);
|
|
112
111
|
const graphics = renderer.moveGraphics();
|
|
113
112
|
feature.geometries = graphics.map((graphic) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGisJsonFeatureReader.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisJsonFeatureReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAkB,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,OAAO,EAAkC,wBAAwB,EAAyI,MAAM,sBAAsB,CAAC;AAEvO,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,gBAAgB;AAChB,MAAM,OAAO,uBAAwB,SAAQ,uBAAuB;IAGlE,YAAmB,QAA+B,EAAE,aAAkB;QACpE,KAAK,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAEjC,CAAC;IAEO,wBAAwB,CAAC,aAA6C,EAAE,OAAY;QAC1F,IAAI,aAAa,IAAI,OAAO,EAAE;YAC5B,MAAM,YAAY,GAAG,aAAa,CAAC,cAAc,CAAC;YAClD,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE;gBACjE,MAAM,WAAW,GAAyB,EAAE,CAAC;gBAC7C,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;oBACnE,IAAI,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;wBAClC,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;qBAClC;gBACH,aAAa,CAAC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AC,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;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { PrimitiveValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\nimport { ArcGisAttributeDrivenSymbology, ArcGisGeometryReaderJSON, ArcGisGeometryRenderer, ArcGisGraphicsRenderer, MapLayerFeature, MapLayerFeatureAttribute, MapLayerFeatureInfo, MapSubLayerFeatureInfo} from \"@itwin/core-frontend\";\nimport { Transform } from \"@itwin/core-geometry\";\nimport { ArcGisBaseFeatureReader } from \"./ArcGisFeatureReader\";\nimport { ArcGisFieldType, ArcGisResponseData } from \"./ArcGisFeatureResponse\";\n\n/** @internal */\nexport class ArcGisJsonFeatureReader extends ArcGisBaseFeatureReader {\n public transform: Transform | undefined;\n\n public constructor(settings: ImageMapLayerSettings, layerMetadata: any) {\n super(settings, layerMetadata);\n\n }\n\n private applySymbologyAttributes(attrSymbology: ArcGisAttributeDrivenSymbology, feature: any) {\n if (attrSymbology && feature) {\n const symbolFields = attrSymbology.rendererFields;\n if (symbolFields && symbolFields.length > 0 && feature.attributes) {\n const featureAttr: {[key: string]: any} = {};\n for (const [attrKey, attrValue] of Object.entries(feature.attributes))\n if (symbolFields.includes(attrKey)) {\n featureAttr[attrKey] = attrValue;\n }\n attrSymbology.setActiveFeatureAttributes(featureAttr);\n }\n }\n }\n\n public async readAndRender(response: ArcGisResponseData, renderer: ArcGisGeometryRenderer) {\n const responseObj = response.data;\n if (responseObj.geometryType) {\n const attrSymbology = renderer.attributeSymbology;\n\n const geomReader = new ArcGisGeometryReaderJSON(responseObj.geometryType, renderer, renderer.transform === undefined);\n\n for (const feature of responseObj.features) {\n if (attrSymbology) {\n // Read attributes if needed (attribute driven symbology)\n this.applySymbologyAttributes(attrSymbology, feature);\n }\n\n await geomReader.readGeometry(feature.geometry);\n }\n }\n }\n\n public async readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[], renderer?: ArcGisGraphicsRenderer) {\n const responseObj = response.data;\n if (responseObj === undefined || !Array.isArray(responseObj.features))\n return;\n\n const layerInfo: MapLayerFeatureInfo = { layerName: this._settings.name };\n\n // Create a signature index for every field name / type.\n const fieldsType: { [key: string]: ArcGisFieldType } = {};\n for (const fieldInfo of responseObj.fields) {\n fieldsType[fieldInfo.name] = fieldInfo.type;\n }\n\n const getStandardTypeName = (fieldType: ArcGisFieldType) => {\n switch (fieldType) {\n case \"esriFieldTypeInteger\":\n case \"esriFieldTypeSmallInteger\":\n case \"esriFieldTypeOID\":\n return StandardTypeNames.Integer;\n case \"esriFieldTypeDouble\":\n return StandardTypeNames.Double;\n case \"esriFieldTypeSingle\":\n return StandardTypeNames.Float;\n case \"esriFieldTypeDate\":\n return StandardTypeNames.DateTime;\n default:\n return StandardTypeNames.String;\n }\n };\n\n const getRecordInfo = (fieldName: string, value: any): MapLayerFeatureAttribute => {\n const propertyValue: PrimitiveValue = {valueFormat: PropertyValueFormat.Primitive};\n\n if (value === null) {\n value = undefined;\n }\n\n const strValue = `${value}`;\n const fieldType = fieldsType[fieldName];\n switch (fieldType) {\n case \"esriFieldTypeInteger\":\n case \"esriFieldTypeSmallInteger\":\n case \"esriFieldTypeOID\":\n propertyValue.value = value as number;\n break;\n case \"esriFieldTypeDouble\":\n case \"esriFieldTypeSingle\":\n propertyValue.value = this.toFixedWithoutPadding(value);\n break;\n case \"esriFieldTypeDate\":\n propertyValue.value = new Date(value);\n break;\n default:\n if (value !== undefined)\n propertyValue.value = strValue;\n\n break;\n }\n\n const typename = getStandardTypeName(fieldType);\n propertyValue.displayValue = this.getDisplayValue(typename, propertyValue.value);\n\n return {value: propertyValue, property: { name: fieldName, displayLabel: fieldName, typename }};\n };\n\n let geomReader: ArcGisGeometryReaderJSON|undefined;\n if (renderer && responseObj?.geometryType) {\n geomReader = new ArcGisGeometryReaderJSON(responseObj.geometryType, renderer);\n }\n\n // Each feature response represent a single sub-layer, no need to check for existing entry.\n const subLayerInfo: MapSubLayerFeatureInfo = {\n subLayerName: this._layerMetadata.name,\n displayFieldName: this._layerMetadata.name,\n features: [],\n };\n\n // Read all features attributes / geometries\n for (const responseFeature of responseObj.features) {\n const feature: MapLayerFeature = {attributes: []};\n\n for (const [key, value] of Object.entries(responseFeature.attributes))\n feature.attributes?.push(getRecordInfo(key, value));\n\n if (geomReader) {\n await geomReader.readGeometry(responseFeature.geometry);\n const graphics = renderer!.moveGraphics();\n feature.geometries = graphics.map((graphic) => {\n return {graphic};\n });\n }\n subLayerInfo.features.push(feature);\n }\n\n if (layerInfo.subLayerInfos === undefined)\n layerInfo.subLayerInfos = [];\n layerInfo.subLayerInfos.push(subLayerInfo);\n\n featureInfos.push(layerInfo);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ArcGisJsonFeatureReader.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisJsonFeatureReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAkB,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAA6K,MAAM,sBAAsB,CAAC;AAE3O,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,gBAAgB;AAChB,MAAM,OAAO,uBAAwB,SAAQ,uBAAuB;IAGlE,YAAmB,QAA+B,EAAE,aAAkB;QACpE,KAAK,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAE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C;QAC5C,KAAK,MAAM,eAAe,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;YACnD,MAAM,OAAO,GAAoB,EAAC,UAAU,EAAE,EAAE,EAAC,CAAC;YAElD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC;gBACnE,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YAEtD,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;gBAC3B,MAAM,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;gBACxD,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC;gBACzC,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;oBAC5C,OAAO,EAAC,OAAO,EAAC,CAAC;gBACnB,CAAC,CAAC,CAAC;YACL,CAAC;YACD,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;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;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { PrimitiveValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\nimport { ArcGisGeometryReaderJSON, FeatureAttributeDrivenSymbology, FeatureGeometryRenderer, GraphicsGeometryRenderer, MapLayerFeature, MapLayerFeatureAttribute, MapLayerFeatureInfo, MapSubLayerFeatureInfo} from \"@itwin/core-frontend\";\nimport { Transform } from \"@itwin/core-geometry\";\nimport { ArcGisBaseFeatureReader } from \"./ArcGisFeatureReader\";\nimport { ArcGisFieldType, ArcGisResponseData } from \"./ArcGisFeatureResponse\";\n\n/** @internal */\nexport class ArcGisJsonFeatureReader extends ArcGisBaseFeatureReader {\n public transform: Transform | undefined;\n\n public constructor(settings: ImageMapLayerSettings, layerMetadata: any) {\n super(settings, layerMetadata);\n\n }\n\n private applySymbologyAttributes(attrSymbology: FeatureAttributeDrivenSymbology, feature: any) {\n if (attrSymbology && feature) {\n const symbolFields = attrSymbology.rendererFields;\n if (symbolFields && symbolFields.length > 0 && feature.attributes) {\n const featureAttr: {[key: string]: any} = {};\n for (const [attrKey, attrValue] of Object.entries(feature.attributes))\n if (symbolFields.includes(attrKey)) {\n featureAttr[attrKey] = attrValue;\n }\n attrSymbology.setActiveFeatureAttributes(featureAttr);\n }\n }\n }\n\n public async readAndRender(response: ArcGisResponseData, renderer: FeatureGeometryRenderer) {\n const responseObj = response.data;\n if (responseObj.geometryType) {\n const geomReader = new ArcGisGeometryReaderJSON(responseObj.geometryType, renderer, renderer.transform === undefined);\n\n for (const feature of responseObj.features) {\n if (renderer.hasSymbologyRenderer() && renderer.symbolRenderer.isAttributeDriven()) {\n // Read attributes if needed (attribute driven symbology)\n this.applySymbologyAttributes(renderer.symbolRenderer, feature);\n }\n\n await geomReader.readGeometry(feature.geometry);\n }\n }\n }\n\n public async readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[], renderer?: GraphicsGeometryRenderer) {\n const responseObj = response.data;\n if (responseObj === undefined || !Array.isArray(responseObj.features))\n return;\n\n const layerInfo: MapLayerFeatureInfo = { layerName: this._settings.name };\n\n // Create a signature index for every field name / type.\n const fieldsType: { [key: string]: ArcGisFieldType } = {};\n for (const fieldInfo of responseObj.fields) {\n fieldsType[fieldInfo.name] = fieldInfo.type;\n }\n\n const getStandardTypeName = (fieldType: ArcGisFieldType) => {\n switch (fieldType) {\n case \"esriFieldTypeInteger\":\n case \"esriFieldTypeSmallInteger\":\n case \"esriFieldTypeOID\":\n return StandardTypeNames.Integer;\n case \"esriFieldTypeDouble\":\n return StandardTypeNames.Double;\n case \"esriFieldTypeSingle\":\n return StandardTypeNames.Float;\n case \"esriFieldTypeDate\":\n return StandardTypeNames.DateTime;\n default:\n return StandardTypeNames.String;\n }\n };\n\n const getRecordInfo = (fieldName: string, value: any): MapLayerFeatureAttribute => {\n const propertyValue: PrimitiveValue = {valueFormat: PropertyValueFormat.Primitive};\n\n if (value === null) {\n value = undefined;\n }\n\n const strValue = `${value}`;\n const fieldType = fieldsType[fieldName];\n switch (fieldType) {\n case \"esriFieldTypeInteger\":\n case \"esriFieldTypeSmallInteger\":\n case \"esriFieldTypeOID\":\n propertyValue.value = value as number;\n break;\n case \"esriFieldTypeDouble\":\n case \"esriFieldTypeSingle\":\n propertyValue.value = this.toFixedWithoutPadding(value);\n break;\n case \"esriFieldTypeDate\":\n propertyValue.value = new Date(value);\n break;\n default:\n if (value !== undefined)\n propertyValue.value = strValue;\n\n break;\n }\n\n const typename = getStandardTypeName(fieldType);\n propertyValue.displayValue = this.getDisplayValue(typename, propertyValue.value);\n\n return {value: propertyValue, property: { name: fieldName, displayLabel: fieldName, typename }};\n };\n\n let geomReader: ArcGisGeometryReaderJSON|undefined;\n if (renderer && responseObj?.geometryType) {\n geomReader = new ArcGisGeometryReaderJSON(responseObj.geometryType, renderer);\n }\n\n // Each feature response represent a single sub-layer, no need to check for existing entry.\n const subLayerInfo: MapSubLayerFeatureInfo = {\n subLayerName: this._layerMetadata.name,\n displayFieldName: this._layerMetadata.name,\n features: [],\n };\n\n // Read all features attributes / geometries\n for (const responseFeature of responseObj.features) {\n const feature: MapLayerFeature = {attributes: []};\n\n for (const [key, value] of Object.entries(responseFeature.attributes))\n feature.attributes?.push(getRecordInfo(key, value));\n\n if (geomReader && renderer) {\n await geomReader.readGeometry(responseFeature.geometry);\n const graphics = renderer.moveGraphics();\n feature.geometries = graphics.map((graphic) => {\n return {graphic};\n });\n }\n subLayerInfo.features.push(feature);\n }\n\n if (layerInfo.subLayerInfos === undefined)\n layerInfo.subLayerInfos = [];\n layerInfo.subLayerInfos.push(subLayerInfo);\n\n featureInfos.push(layerInfo);\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { esriPBuffer } from "../ArcGisFeature/esriPBuffer.gen";
|
|
2
|
-
import {
|
|
2
|
+
import { FeatureGeometryRenderer, GraphicsGeometryRenderer, MapLayerFeatureAttribute, MapLayerFeatureInfo } from "@itwin/core-frontend";
|
|
3
3
|
import { ImageMapLayerSettings } from "@itwin/core-common";
|
|
4
4
|
import { ArcGisBaseFeatureReader } from "./ArcGisFeatureReader";
|
|
5
5
|
import { ArcGisResponseData } from "./ArcGisFeatureResponse";
|
|
@@ -14,9 +14,9 @@ export declare class ArcGisPbfFeatureReader extends ArcGisBaseFeatureReader {
|
|
|
14
14
|
static getArcGisFeatureGeometryType(geomType: esriPBuffer.FeatureCollectionPBuffer.GeometryType): ArcGisFeatureGeometryType;
|
|
15
15
|
private getNumericValue;
|
|
16
16
|
getFeatureAttribute(fieldInfo: PbfFieldInfo, attrValue: esriPBuffer.FeatureCollectionPBuffer.Value): MapLayerFeatureAttribute | undefined;
|
|
17
|
-
readAndRender(response: ArcGisResponseData, renderer:
|
|
17
|
+
readAndRender(response: ArcGisResponseData, renderer: FeatureGeometryRenderer): Promise<void>;
|
|
18
18
|
private applySymbologyAttributes;
|
|
19
|
-
readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[], renderer?:
|
|
19
|
+
readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[], renderer?: GraphicsGeometryRenderer): Promise<void>;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
22
22
|
//# sourceMappingURL=ArcGisPbfFeatureReader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGisPbfFeatureReader.d.ts","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisPbfFeatureReader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"ArcGisPbfFeatureReader.d.ts","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisPbfFeatureReader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAmC,uBAAuB,EAAE,wBAAwB,EAAmB,wBAAwB,EAAE,mBAAmB,EAAyB,MAAM,sBAAsB,CAAC;AAEjN,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAKjE,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC,wBAAwB,CAAC,SAAS,CAAC;CACtD;AAED,gBAAgB;AAChB,qBAAa,sBAAuB,SAAQ,uBAAuB;gBAC9C,QAAQ,EAAE,qBAAqB,EAAE,aAAa,EAAE,GAAG;WAIxD,4BAA4B,CAAC,QAAQ,EAAE,WAAW,CAAC,wBAAwB,CAAC,YAAY,GAAG,yBAAyB;IAiBlI,OAAO,CAAC,eAAe;IAiChB,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,wBAAwB,CAAC,KAAK,GAAG,wBAAwB,GAAC,SAAS;IA2DjI,aAAa,CAAC,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,uBAAuB;IAyC1F,OAAO,CAAC,wBAAwB;IA0BnB,eAAe,CAAC,QAAQ,EAAE,kBAAkB,EAAE,YAAY,EAAE,mBAAmB,EAAE,EAAE,QAAQ,CAAC,EAAE,wBAAwB;CAkEpI"}
|
|
@@ -136,7 +136,6 @@ export class ArcGisPbfFeatureReader extends ArcGisBaseFeatureReader {
|
|
|
136
136
|
const collection = response.data;
|
|
137
137
|
if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)
|
|
138
138
|
return;
|
|
139
|
-
const attrSymbology = renderer.attributeSymbology;
|
|
140
139
|
// Fields metadata is stored outside feature results, create dedicated array first
|
|
141
140
|
const fields = [];
|
|
142
141
|
for (const field of collection.queryResult.featureResult.fields)
|
|
@@ -147,9 +146,9 @@ export class ArcGisPbfFeatureReader extends ArcGisBaseFeatureReader {
|
|
|
147
146
|
for (const feature of collection.queryResult.featureResult.features) {
|
|
148
147
|
// Render geometries
|
|
149
148
|
if (renderer && feature?.has_geometry) {
|
|
150
|
-
if (
|
|
149
|
+
if (renderer.hasSymbologyRenderer() && renderer.symbolRenderer.isAttributeDriven()) {
|
|
151
150
|
// Read attributes if needed (attribute driven symbology)
|
|
152
|
-
this.applySymbologyAttributes(
|
|
151
|
+
this.applySymbologyAttributes(renderer.symbolRenderer, feature, fields);
|
|
153
152
|
}
|
|
154
153
|
if (geomType === esriGeometryType.esriGeometryTypePoint || geomType === esriGeometryType.esriGeometryTypeMultipoint) {
|
|
155
154
|
await renderer.renderPoint(feature.geometry.lengths, feature.geometry.coords, stride, relativeCoords);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGisPbfFeatureReader.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisPbfFeatureReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,OAAO,EAAkB,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE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MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;iBAClH;gBACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC;gBACzC,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;oBAC5C,OAAO,EAAC,OAAO,EAAC,CAAC;gBACnB,CAAC,CAAC,CAAC;aACJ;YAED,IAAI,QAAQ,GAAG,CAAC,CAAC;YACjB,KAAK,MAAM,SAAS,IAAI,eAAe,CAAC,UAAU,EAAE;gBAClD,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE;oBAC5B,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6DAA6D,CAAC,CAAC;oBAC/F,MAAM;iBACP;gBACD,uCAAuC;gBACvC,MAAM,IAAI,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;gBACnE,IAAI,IAAI,EAAE;oBACR,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;iBAChC;gBAED,QAAQ,EAAE,CAAC;aACZ;YACD,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACrC;QAED,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,EAAE;YACzC,SAAS,CAAC,aAAa,GAAG,EAAE,CAAC;SAC9B;QACD,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3C,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { esriPBuffer } from \"../ArcGisFeature/esriPBuffer.gen\";\nimport { ArcGisAttributeDrivenSymbology, ArcGisGeometryRenderer, ArcGisGraphicsRenderer, MapLayerFeature, MapLayerFeatureAttribute, MapLayerFeatureInfo, MapSubLayerFeatureInfo} from \"@itwin/core-frontend\";\nimport { PrimitiveValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\nimport { ArcGisBaseFeatureReader } from \"./ArcGisFeatureReader\";\nimport { ArcGisResponseData } from \"./ArcGisFeatureResponse\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { ArcGisFeatureGeometryType } from \"./ArcGisFeatureQuery\";\n\nconst esriGeometryType = esriPBuffer.FeatureCollectionPBuffer.GeometryType;\nconst loggerCategory = \"MapLayersFormats.ArcGISFeature\";\n\ninterface PbfFieldInfo {\n name: string;\n type: esriPBuffer.FeatureCollectionPBuffer.FieldType;\n}\n\n/** @internal */\nexport class ArcGisPbfFeatureReader extends ArcGisBaseFeatureReader {\n public constructor(settings: ImageMapLayerSettings, layerMetadata: any) {\n super(settings, layerMetadata);\n }\n\n public static getArcGisFeatureGeometryType(geomType: esriPBuffer.FeatureCollectionPBuffer.GeometryType): ArcGisFeatureGeometryType {\n switch (geomType) {\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipatch:\n return \"esriGeometryMultiPatch\";\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipoint:\n return \"esriGeometryMultipoint\";\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePoint:\n return \"esriGeometryPoint\";\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolygon:\n return \"esriGeometryPolygon\";\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolyline:\n return \"esriGeometryPolyline\";\n default:\n return \"esriGeometryNull\";\n }\n }\n\n private getNumericValue(attrValue: esriPBuffer.FeatureCollectionPBuffer.Value) {\n const propertyValue: PrimitiveValue = { valueFormat: PropertyValueFormat.Primitive };\n let typename = StandardTypeNames.Number;\n if (attrValue.has_double_value) {\n const value = this.toFixedWithoutPadding(attrValue.double_value);\n propertyValue.value = value;\n typename = StandardTypeNames.Double;\n } else if (attrValue.has_float_value) {\n const value = this.toFixedWithoutPadding(attrValue.float_value);\n propertyValue.value = value;\n typename = StandardTypeNames.Float;\n } else if (attrValue.has_int64_value) {\n propertyValue.value = attrValue.int64_value;\n typename = StandardTypeNames.Integer;\n } else if (attrValue.has_sint64_value) {\n propertyValue.value = attrValue.sint64_value;\n typename = StandardTypeNames.Integer;\n } else if (attrValue.has_sint_value) {\n propertyValue.value = attrValue.sint_value;\n typename = StandardTypeNames.Integer;\n } else if (attrValue.has_uint64_value) {\n propertyValue.value = attrValue.uint64_value;\n typename = StandardTypeNames.Integer;\n } else if (attrValue.has_uint_value) {\n propertyValue.value = attrValue.uint_value;\n typename = StandardTypeNames.Integer;\n } else {\n propertyValue.value = undefined;\n }\n\n return { propertyValue, typename };\n }\n\n public getFeatureAttribute(fieldInfo: PbfFieldInfo, attrValue: esriPBuffer.FeatureCollectionPBuffer.Value): MapLayerFeatureAttribute|undefined {\n let propertyValue: PrimitiveValue = { valueFormat: PropertyValueFormat.Primitive };\n\n let typename = StandardTypeNames.String;\n if (fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDouble\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeInteger\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeSmallInteger\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeOID\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeSingle\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDate\n ) {\n const value = this.getNumericValue(attrValue);\n if (value.propertyValue === undefined) {\n Logger.logError(loggerCategory, `Could not read numeric value for field ${fieldInfo.name}`);\n return undefined;\n }\n\n if (fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDate) {\n const test = (value.propertyValue.value as unknown) as number;\n propertyValue.value = new Date(test);\n typename = StandardTypeNames.DateTime;\n } else {\n typename = value.typename;\n propertyValue = value.propertyValue;\n }\n } else if (fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeString) {\n if (attrValue.has_string_value) {\n propertyValue.value = attrValue.string_value;\n typename = StandardTypeNames.String;\n }\n } else if (fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeGlobalID) {\n if (attrValue.has_string_value) {\n propertyValue.value = attrValue.string_value;\n typename = StandardTypeNames.String;\n } else {\n const value = this.getNumericValue(attrValue);\n if (value.propertyValue === undefined) {\n Logger.logError(loggerCategory, `Could not read GlobalId value for field ${fieldInfo.name}`);\n return undefined;\n }\n }\n } else if (attrValue.has_string_value) {\n // If we reach this case that probably mean we don't support the field type, simply try to output string value\n typename = StandardTypeNames.String;\n propertyValue.value = attrValue.string_value;\n } else if (attrValue.value_type === \"none\") {\n // Sometimes fields are just empty, use an empty string\n typename = StandardTypeNames.String;\n propertyValue.value = undefined;\n } else {\n Logger.logError(loggerCategory, `Could not read value for field ${fieldInfo.name}`);\n return undefined;\n }\n\n propertyValue.displayValue = this.getDisplayValue(typename, propertyValue.value);\n\n return {value: propertyValue, property: { name: fieldInfo.name, displayLabel: fieldInfo.name, typename } };\n }\n\n public async readAndRender(response: ArcGisResponseData, renderer: ArcGisGeometryRenderer) {\n if (!(response.data instanceof esriPBuffer.FeatureCollectionPBuffer)) {\n const msg = \"Response was not in PBF format\";\n Logger.logError(loggerCategory, msg);\n return;\n }\n\n const collection = response.data;\n if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)\n return;\n\n const attrSymbology = renderer.attributeSymbology;\n\n // Fields metadata is stored outside feature results, create dedicated array first\n const fields: PbfFieldInfo[] = [];\n for (const field of collection.queryResult.featureResult.fields)\n fields.push({name: field.name, type:field.fieldType});\n\n const geomType = collection.queryResult.featureResult.geometryType;\n const stride = (collection.queryResult.featureResult.hasM || collection.queryResult.featureResult.hasZ) ? 3 : 2;\n const relativeCoords = renderer.transform === undefined;\n for (const feature of collection.queryResult.featureResult.features) {\n\n // Render geometries\n if (renderer && feature?.has_geometry) {\n\n if (attrSymbology) {\n // Read attributes if needed (attribute driven symbology)\n this.applySymbologyAttributes(attrSymbology, feature, fields);\n }\n\n if (geomType === esriGeometryType.esriGeometryTypePoint || geomType === esriGeometryType.esriGeometryTypeMultipoint) {\n await renderer.renderPoint(feature.geometry.lengths, feature.geometry.coords, stride, relativeCoords);\n } else if (geomType === esriGeometryType.esriGeometryTypePolyline || geomType === esriGeometryType.esriGeometryTypePolygon) {\n const fill = (geomType === esriGeometryType.esriGeometryTypePolygon);\n await renderer.renderPath(feature.geometry.lengths, feature.geometry.coords, fill, stride, relativeCoords);\n }\n }\n\n }\n }\n\n private applySymbologyAttributes(attrSymbology: ArcGisAttributeDrivenSymbology, feature: esriPBuffer.FeatureCollectionPBuffer.Feature, fields: PbfFieldInfo[]) {\n if (attrSymbology) {\n const symbolFields = attrSymbology.rendererFields;\n if (symbolFields && symbolFields.length > 0 && feature.attributes) {\n let fieldIdx = 0;\n const featureAttr: {[key: string]: any} = {};\n for (const attrValue of feature.attributes) {\n if (fieldIdx > fields.length) {\n Logger.logError(loggerCategory, \"Error while read feature info data: fields metadata missing\");\n break;\n }\n const fieldInfo = fields[fieldIdx++];\n if (symbolFields.includes(fieldInfo.name)) {\n const attr = this.getFeatureAttribute(fieldInfo, attrValue);\n if (attr) {\n const primitiveValue = attr.value as PrimitiveValue;\n featureAttr[fieldInfo.name] = primitiveValue.value;\n }\n }\n\n }\n attrSymbology.setActiveFeatureAttributes(featureAttr);\n }\n }\n }\n\n public async readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[], renderer?: ArcGisGraphicsRenderer) {\n if (!(response.data instanceof esriPBuffer.FeatureCollectionPBuffer)) {\n\n Logger.logError(loggerCategory, \"Response was not in PBF format\");\n }\n\n const collection = response.data as esriPBuffer.FeatureCollectionPBuffer;\n if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)\n return;\n\n const layerInfo: MapLayerFeatureInfo = { layerName: this._settings.name, subLayerInfos: [] };\n\n // Fields metadata is stored outside feature results, create dedicated array first\n const fields: PbfFieldInfo[] = [];\n for (const field of collection.queryResult.featureResult.fields)\n fields.push({name: field.name, type:field.fieldType});\n\n const geomType = collection.queryResult.featureResult.geometryType;\n const stride = (collection.queryResult.featureResult.hasM || collection.queryResult.featureResult.hasZ) ? 3 : 2;\n\n const subLayerInfo: MapSubLayerFeatureInfo = {\n subLayerName: this._layerMetadata.name,\n displayFieldName: this._layerMetadata.name,\n features: [],\n };\n\n // Read feature values\n for (const featureResponse of collection.queryResult.featureResult.features) {\n const feature: MapLayerFeature = { attributes: []};\n\n if (renderer && featureResponse?.has_geometry) {\n if (geomType === esriGeometryType.esriGeometryTypePoint || geomType === esriGeometryType.esriGeometryTypeMultipoint) {\n await renderer.renderPoint(featureResponse.geometry.lengths, featureResponse.geometry.coords, stride, true);\n } else if (geomType === esriGeometryType.esriGeometryTypePolyline || geomType === esriGeometryType.esriGeometryTypePolygon) {\n const fill = (geomType === esriGeometryType.esriGeometryTypePolygon);\n await renderer.renderPath(featureResponse.geometry.lengths, featureResponse.geometry.coords, fill, stride, true);\n }\n const graphics = renderer.moveGraphics();\n feature.geometries = graphics.map((graphic) => {\n return {graphic};\n });\n }\n\n let fieldIdx = 0;\n for (const attrValue of featureResponse.attributes) {\n if (fieldIdx > fields.length) {\n Logger.logError(loggerCategory, \"Error while read feature info data: fields metadata missing\");\n break;\n }\n // Convert everything to string for now\n const attr = this.getFeatureAttribute(fields[fieldIdx], attrValue);\n if (attr) {\n feature.attributes?.push(attr);\n }\n\n fieldIdx++;\n }\n subLayerInfo.features.push(feature);\n }\n\n if (layerInfo.subLayerInfos === undefined) {\n layerInfo.subLayerInfos = [];\n }\n layerInfo.subLayerInfos.push(subLayerInfo);\n featureInfos.push(layerInfo);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ArcGisPbfFeatureReader.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisPbfFeatureReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D,OAAO,EAAkB,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,MAAM,gBAAgB,GAAG,WAAW,CAAC,wBAAwB,CAAC,YAAY,CAAC;AAC3E,MAAM,cAAc,GAAG,gCAAgC,CAAC;AAOxD,gBAAgB;AAChB,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IACjE,YAAmB,QAA+B,EAAE,aAAkB;QACpE,KAAK,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,4BAA4B,CAAC,QAA2D;QACpG,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,WAAW,CAAC,wBAAwB,CAAC,YAAY,CAAC,0BAA0B;gBAC/E,OAAO,wBAAwB,CAAC;YAClC,KAAK,WAAW,CAAC,wBAAwB,CAAC,YAAY,CAAC,0BAA0B;gBAC/E,OAAO,wBAAwB,CAAC;YAClC,KAAK,WAAW,CAAC,wBAAwB,CAAC,YAAY,CAAC,qBAAqB;gBAC1E,OAAO,mBAAmB,CAAC;YAC7B,KAAK,WAAW,CAAC,wBAAwB,CAAC,YAAY,CAAC,uBAAuB;gBAC5E,OAAO,qBAAqB,CAAC;YAC/B,KAAK,WAAW,CAAC,wBAAwB,CAAC,YAAY,CAAC,wBAAwB;gBAC7E,O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;gBACnD,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;oBAC7B,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6DAA6D,CAAC,CAAC;oBAC/F,MAAM;gBACR,CAAC;gBACD,uCAAuC;gBACvC,MAAM,IAAI,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;gBACnE,IAAI,IAAI,EAAE,CAAC;oBACT,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACjC,CAAC;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC;YACD,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAED,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;YAC1C,SAAS,CAAC,aAAa,GAAG,EAAE,CAAC;QAC/B,CAAC;QACD,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3C,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { esriPBuffer } from \"../ArcGisFeature/esriPBuffer.gen\";\nimport { FeatureAttributeDrivenSymbology, FeatureGeometryRenderer, GraphicsGeometryRenderer, MapLayerFeature, MapLayerFeatureAttribute, MapLayerFeatureInfo, MapSubLayerFeatureInfo} from \"@itwin/core-frontend\";\nimport { PrimitiveValue, PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\nimport { ArcGisBaseFeatureReader } from \"./ArcGisFeatureReader\";\nimport { ArcGisResponseData } from \"./ArcGisFeatureResponse\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { ArcGisFeatureGeometryType } from \"./ArcGisFeatureQuery\";\n\nconst esriGeometryType = esriPBuffer.FeatureCollectionPBuffer.GeometryType;\nconst loggerCategory = \"MapLayersFormats.ArcGISFeature\";\n\ninterface PbfFieldInfo {\n name: string;\n type: esriPBuffer.FeatureCollectionPBuffer.FieldType;\n}\n\n/** @internal */\nexport class ArcGisPbfFeatureReader extends ArcGisBaseFeatureReader {\n public constructor(settings: ImageMapLayerSettings, layerMetadata: any) {\n super(settings, layerMetadata);\n }\n\n public static getArcGisFeatureGeometryType(geomType: esriPBuffer.FeatureCollectionPBuffer.GeometryType): ArcGisFeatureGeometryType {\n switch (geomType) {\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipatch:\n return \"esriGeometryMultiPatch\";\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipoint:\n return \"esriGeometryMultipoint\";\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePoint:\n return \"esriGeometryPoint\";\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolygon:\n return \"esriGeometryPolygon\";\n case esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolyline:\n return \"esriGeometryPolyline\";\n default:\n return \"esriGeometryNull\";\n }\n }\n\n private getNumericValue(attrValue: esriPBuffer.FeatureCollectionPBuffer.Value) {\n const propertyValue: PrimitiveValue = { valueFormat: PropertyValueFormat.Primitive };\n let typename = StandardTypeNames.Number;\n if (attrValue.has_double_value) {\n const value = this.toFixedWithoutPadding(attrValue.double_value);\n propertyValue.value = value;\n typename = StandardTypeNames.Double;\n } else if (attrValue.has_float_value) {\n const value = this.toFixedWithoutPadding(attrValue.float_value);\n propertyValue.value = value;\n typename = StandardTypeNames.Float;\n } else if (attrValue.has_int64_value) {\n propertyValue.value = attrValue.int64_value;\n typename = StandardTypeNames.Integer;\n } else if (attrValue.has_sint64_value) {\n propertyValue.value = attrValue.sint64_value;\n typename = StandardTypeNames.Integer;\n } else if (attrValue.has_sint_value) {\n propertyValue.value = attrValue.sint_value;\n typename = StandardTypeNames.Integer;\n } else if (attrValue.has_uint64_value) {\n propertyValue.value = attrValue.uint64_value;\n typename = StandardTypeNames.Integer;\n } else if (attrValue.has_uint_value) {\n propertyValue.value = attrValue.uint_value;\n typename = StandardTypeNames.Integer;\n } else {\n propertyValue.value = undefined;\n }\n\n return { propertyValue, typename };\n }\n\n public getFeatureAttribute(fieldInfo: PbfFieldInfo, attrValue: esriPBuffer.FeatureCollectionPBuffer.Value): MapLayerFeatureAttribute|undefined {\n let propertyValue: PrimitiveValue = { valueFormat: PropertyValueFormat.Primitive };\n\n let typename = StandardTypeNames.String;\n if (fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDouble\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeInteger\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeSmallInteger\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeOID\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeSingle\n || fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDate\n ) {\n const value = this.getNumericValue(attrValue);\n if (value.propertyValue === undefined) {\n Logger.logError(loggerCategory, `Could not read numeric value for field ${fieldInfo.name}`);\n return undefined;\n }\n\n if (fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDate) {\n const test = (value.propertyValue.value as unknown) as number;\n propertyValue.value = new Date(test);\n typename = StandardTypeNames.DateTime;\n } else {\n typename = value.typename;\n propertyValue = value.propertyValue;\n }\n } else if (fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeString) {\n if (attrValue.has_string_value) {\n propertyValue.value = attrValue.string_value;\n typename = StandardTypeNames.String;\n }\n } else if (fieldInfo.type === esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeGlobalID) {\n if (attrValue.has_string_value) {\n propertyValue.value = attrValue.string_value;\n typename = StandardTypeNames.String;\n } else {\n const value = this.getNumericValue(attrValue);\n if (value.propertyValue === undefined) {\n Logger.logError(loggerCategory, `Could not read GlobalId value for field ${fieldInfo.name}`);\n return undefined;\n }\n }\n } else if (attrValue.has_string_value) {\n // If we reach this case that probably mean we don't support the field type, simply try to output string value\n typename = StandardTypeNames.String;\n propertyValue.value = attrValue.string_value;\n } else if (attrValue.value_type === \"none\") {\n // Sometimes fields are just empty, use an empty string\n typename = StandardTypeNames.String;\n propertyValue.value = undefined;\n } else {\n Logger.logError(loggerCategory, `Could not read value for field ${fieldInfo.name}`);\n return undefined;\n }\n\n propertyValue.displayValue = this.getDisplayValue(typename, propertyValue.value);\n\n return {value: propertyValue, property: { name: fieldInfo.name, displayLabel: fieldInfo.name, typename } };\n }\n\n public async readAndRender(response: ArcGisResponseData, renderer: FeatureGeometryRenderer) {\n if (!(response.data instanceof esriPBuffer.FeatureCollectionPBuffer)) {\n const msg = \"Response was not in PBF format\";\n Logger.logError(loggerCategory, msg);\n return;\n }\n\n const collection = response.data;\n if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)\n return;\n\n // Fields metadata is stored outside feature results, create dedicated array first\n const fields: PbfFieldInfo[] = [];\n for (const field of collection.queryResult.featureResult.fields)\n fields.push({name: field.name, type:field.fieldType});\n\n const geomType = collection.queryResult.featureResult.geometryType;\n\n const stride = (collection.queryResult.featureResult.hasM || collection.queryResult.featureResult.hasZ) ? 3 : 2;\n const relativeCoords = renderer.transform === undefined;\n for (const feature of collection.queryResult.featureResult.features) {\n\n // Render geometries\n if (renderer && feature?.has_geometry) {\n\n if (renderer.hasSymbologyRenderer() && renderer.symbolRenderer.isAttributeDriven()) {\n // Read attributes if needed (attribute driven symbology)\n this.applySymbologyAttributes(renderer.symbolRenderer, feature, fields);\n }\n\n if (geomType === esriGeometryType.esriGeometryTypePoint || geomType === esriGeometryType.esriGeometryTypeMultipoint) {\n await renderer.renderPoint(feature.geometry.lengths, feature.geometry.coords, stride, relativeCoords);\n } else if (geomType === esriGeometryType.esriGeometryTypePolyline || geomType === esriGeometryType.esriGeometryTypePolygon) {\n const fill = (geomType === esriGeometryType.esriGeometryTypePolygon);\n await renderer.renderPath(feature.geometry.lengths, feature.geometry.coords, fill, stride, relativeCoords);\n }\n }\n\n }\n }\n\n private applySymbologyAttributes(attrSymbology: FeatureAttributeDrivenSymbology, feature: esriPBuffer.FeatureCollectionPBuffer.Feature, fields: PbfFieldInfo[]) {\n if (attrSymbology) {\n const symbolFields = attrSymbology.rendererFields;\n if (symbolFields && symbolFields.length > 0 && feature.attributes) {\n let fieldIdx = 0;\n const featureAttr: {[key: string]: any} = {};\n for (const attrValue of feature.attributes) {\n if (fieldIdx > fields.length) {\n Logger.logError(loggerCategory, \"Error while read feature info data: fields metadata missing\");\n break;\n }\n const fieldInfo = fields[fieldIdx++];\n if (symbolFields.includes(fieldInfo.name)) {\n const attr = this.getFeatureAttribute(fieldInfo, attrValue);\n if (attr) {\n const primitiveValue = attr.value as PrimitiveValue;\n featureAttr[fieldInfo.name] = primitiveValue.value;\n }\n }\n\n }\n attrSymbology.setActiveFeatureAttributes(featureAttr);\n }\n }\n }\n\n public async readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[], renderer?: GraphicsGeometryRenderer) {\n if (!(response.data instanceof esriPBuffer.FeatureCollectionPBuffer)) {\n\n Logger.logError(loggerCategory, \"Response was not in PBF format\");\n }\n\n const collection = response.data as esriPBuffer.FeatureCollectionPBuffer;\n if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)\n return;\n\n const layerInfo: MapLayerFeatureInfo = { layerName: this._settings.name, subLayerInfos: [] };\n\n // Fields metadata is stored outside feature results, create dedicated array first\n const fields: PbfFieldInfo[] = [];\n for (const field of collection.queryResult.featureResult.fields)\n fields.push({name: field.name, type:field.fieldType});\n\n const geomType = collection.queryResult.featureResult.geometryType;\n const stride = (collection.queryResult.featureResult.hasM || collection.queryResult.featureResult.hasZ) ? 3 : 2;\n\n const subLayerInfo: MapSubLayerFeatureInfo = {\n subLayerName: this._layerMetadata.name,\n displayFieldName: this._layerMetadata.name,\n features: [],\n };\n\n // Read feature values\n for (const featureResponse of collection.queryResult.featureResult.features) {\n const feature: MapLayerFeature = { attributes: []};\n\n if (renderer && featureResponse?.has_geometry) {\n if (geomType === esriGeometryType.esriGeometryTypePoint || geomType === esriGeometryType.esriGeometryTypeMultipoint) {\n await renderer.renderPoint(featureResponse.geometry.lengths, featureResponse.geometry.coords, stride, true);\n } else if (geomType === esriGeometryType.esriGeometryTypePolyline || geomType === esriGeometryType.esriGeometryTypePolygon) {\n const fill = (geomType === esriGeometryType.esriGeometryTypePolygon);\n await renderer.renderPath(featureResponse.geometry.lengths, featureResponse.geometry.coords, fill, stride, true);\n }\n const graphics = renderer.moveGraphics();\n feature.geometries = graphics.map((graphic) => {\n return {graphic};\n });\n }\n\n let fieldIdx = 0;\n for (const attrValue of featureResponse.attributes) {\n if (fieldIdx > fields.length) {\n Logger.logError(loggerCategory, \"Error while read feature info data: fields metadata missing\");\n break;\n }\n // Convert everything to string for now\n const attr = this.getFeatureAttribute(fields[fieldIdx], attrValue);\n if (attr) {\n feature.attributes?.push(attr);\n }\n\n fieldIdx++;\n }\n subLayerInfo.features.push(feature);\n }\n\n if (layerInfo.subLayerInfos === undefined) {\n layerInfo.subLayerInfos = [];\n }\n layerInfo.subLayerInfos.push(subLayerInfo);\n featureInfos.push(layerInfo);\n }\n}\n"]}
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { EsriClassBreaksRenderer, EsriRenderer, EsriSMS, EsriSymbol, EsriUniqueValueRenderer } from "./EsriSymbology";
|
|
2
|
-
import {
|
|
2
|
+
import { FeatureAttributeDrivenSymbology, FeatureSymbologyRenderer } from "@itwin/core-frontend";
|
|
3
|
+
import { FeatureDefaultSymbology } from "../Feature/FeatureSymbology";
|
|
4
|
+
import { ArcGisFeatureGeometryType } from "./ArcGisFeatureQuery";
|
|
3
5
|
/** @internal */
|
|
4
6
|
export type ArcGisSymbologyRendererType = "simple" | "attributeDriven";
|
|
7
|
+
/** Feature Symbology renderer applicable to an HTML 2D Canvas
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface FeatureSymbologyCanvasRenderer extends FeatureSymbologyRenderer {
|
|
11
|
+
applyFillStyle(context: CanvasRenderingContext2D): void;
|
|
12
|
+
applyStrokeStyle(context: CanvasRenderingContext2D): void;
|
|
13
|
+
drawPoint(context: CanvasRenderingContext2D, ptX: number, ptY: number): void;
|
|
14
|
+
}
|
|
5
15
|
/** @internal */
|
|
6
|
-
export declare abstract class
|
|
7
|
-
abstract
|
|
16
|
+
export declare abstract class ArcGisSymbologyCanvasRenderer implements FeatureSymbologyCanvasRenderer {
|
|
17
|
+
abstract readonly renderer?: EsriRenderer;
|
|
18
|
+
abstract get symbol(): EsriSymbol;
|
|
19
|
+
abstract set symbol(symbol: EsriSymbol | undefined);
|
|
20
|
+
abstract get defaultSymbol(): EsriSymbol;
|
|
21
|
+
activeGeometryType: string;
|
|
22
|
+
abstract isAttributeDriven(): this is FeatureAttributeDrivenSymbology;
|
|
8
23
|
abstract applyFillStyle(context: CanvasRenderingContext2D): void;
|
|
9
24
|
abstract applyStrokeStyle(context: CanvasRenderingContext2D): void;
|
|
10
25
|
abstract drawPoint(context: CanvasRenderingContext2D, ptX: number, ptY: number): void;
|
|
11
|
-
static create(renderer: EsriRenderer | undefined, defaultSymbol:
|
|
26
|
+
static create(renderer: EsriRenderer | undefined, defaultSymbol: FeatureDefaultSymbology, geometryType?: ArcGisFeatureGeometryType): ArcGisSymbologyCanvasRenderer;
|
|
12
27
|
}
|
|
13
28
|
/** @internal */
|
|
14
29
|
export declare class ArcGisDashLineStyle {
|
|
@@ -37,15 +52,16 @@ export declare class ArcGisDashLineStyle {
|
|
|
37
52
|
};
|
|
38
53
|
}
|
|
39
54
|
/** @internal */
|
|
40
|
-
export declare class ArcGisSimpleSymbologyRenderer extends
|
|
41
|
-
|
|
55
|
+
export declare class ArcGisSimpleSymbologyRenderer extends ArcGisSymbologyCanvasRenderer {
|
|
56
|
+
protected _symbol: EsriSymbol | undefined;
|
|
57
|
+
protected _defaultSymbol: FeatureDefaultSymbology;
|
|
58
|
+
isAttributeDriven(): this is FeatureAttributeDrivenSymbology;
|
|
42
59
|
lineWidthScaleFactor: number;
|
|
43
60
|
get symbol(): EsriSymbol;
|
|
61
|
+
set symbol(symbol: EsriSymbol | undefined);
|
|
44
62
|
get defaultSymbol(): EsriSymbol;
|
|
45
|
-
protected _symbol: EsriSymbol;
|
|
46
|
-
protected _defaultSymbol: EsriSymbol;
|
|
47
63
|
readonly renderer?: EsriRenderer;
|
|
48
|
-
constructor(renderer: EsriRenderer | undefined, defaultSymbol:
|
|
64
|
+
constructor(renderer: EsriRenderer | undefined, defaultSymbol: FeatureDefaultSymbology, geometryType?: ArcGisFeatureGeometryType);
|
|
49
65
|
applyFillStyle(context: CanvasRenderingContext2D): void;
|
|
50
66
|
private getFillColor;
|
|
51
67
|
private applyLineDash;
|
|
@@ -61,27 +77,31 @@ export declare class ArcGisSimpleSymbologyRenderer extends ArcGisSymbologyRender
|
|
|
61
77
|
drawPoint(context: CanvasRenderingContext2D, ptX: number, ptY: number): void;
|
|
62
78
|
}
|
|
63
79
|
/** @internal */
|
|
64
|
-
export declare class ArcGisUniqueValueSymbologyRenderer extends ArcGisSimpleSymbologyRenderer implements
|
|
65
|
-
isAttributeDriven(): this is
|
|
80
|
+
export declare class ArcGisUniqueValueSymbologyRenderer extends ArcGisSimpleSymbologyRenderer implements FeatureAttributeDrivenSymbology {
|
|
81
|
+
isAttributeDriven(): this is FeatureAttributeDrivenSymbology;
|
|
66
82
|
protected _activeFeatureAttributes: {
|
|
67
83
|
[key: string]: any;
|
|
68
84
|
} | undefined;
|
|
69
85
|
protected uvRenderer: EsriUniqueValueRenderer;
|
|
86
|
+
private _defaultRenderSymbol;
|
|
87
|
+
get defaultSymbol(): EsriSymbol;
|
|
70
88
|
get rendererFields(): string[] | undefined;
|
|
71
|
-
constructor(renderer: EsriUniqueValueRenderer, defaultSymbol:
|
|
89
|
+
constructor(renderer: EsriUniqueValueRenderer, defaultSymbol: FeatureDefaultSymbology, geometryType?: ArcGisFeatureGeometryType);
|
|
72
90
|
setActiveFeatureAttributes(attributes: {
|
|
73
91
|
[key: string]: any;
|
|
74
92
|
}): void;
|
|
75
93
|
}
|
|
76
94
|
/** @internal */
|
|
77
|
-
export declare class ArcGisClassBreaksSymbologyRenderer extends ArcGisSimpleSymbologyRenderer implements
|
|
78
|
-
isAttributeDriven(): this is
|
|
95
|
+
export declare class ArcGisClassBreaksSymbologyRenderer extends ArcGisSimpleSymbologyRenderer implements FeatureAttributeDrivenSymbology {
|
|
96
|
+
isAttributeDriven(): this is FeatureAttributeDrivenSymbology;
|
|
79
97
|
protected _activeFeatureAttributes: {
|
|
80
98
|
[key: string]: any;
|
|
81
99
|
} | undefined;
|
|
82
100
|
protected cbRenderer: EsriClassBreaksRenderer;
|
|
101
|
+
private _defaultRenderSymbol;
|
|
102
|
+
get defaultSymbol(): EsriSymbol;
|
|
83
103
|
get rendererFields(): string[] | undefined;
|
|
84
|
-
constructor(renderer: EsriClassBreaksRenderer, defaultSymbol:
|
|
104
|
+
constructor(renderer: EsriClassBreaksRenderer, defaultSymbol: FeatureDefaultSymbology, geometryType?: ArcGisFeatureGeometryType);
|
|
85
105
|
setActiveFeatureAttributes(attributes: {
|
|
86
106
|
[key: string]: any;
|
|
87
107
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGisSymbologyRenderer.d.ts","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisSymbologyRenderer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE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,UAAU,EAAE,uBAAuB,CAAC;IAC9C,OAAO,CAAC,oBAAoB,CAAuB;IAEnD,IAAoB,aAAa,eAA6D;IAE9F,IAAW,cAAc,yBAKxB;gBAEkB,QAAQ,EAAE,uBAAuB,EAAE,aAAa,EAAE,uBAAuB,EAAE,YAAY,CAAC,EAAE,yBAAyB;IAO/H,0BAA0B,CAAC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;CAsCrE"}
|
|
@@ -8,21 +8,24 @@ import { Angle } from "@itwin/core-geometry";
|
|
|
8
8
|
/** @internal */
|
|
9
9
|
const loggerCategory = "MapLayersFormats.ArcGISFeature";
|
|
10
10
|
/** @internal */
|
|
11
|
-
export class
|
|
12
|
-
|
|
11
|
+
export class ArcGisSymbologyCanvasRenderer {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.activeGeometryType = "";
|
|
14
|
+
}
|
|
15
|
+
static create(renderer, defaultSymbol, geometryType) {
|
|
13
16
|
if (renderer?.type === "uniqueValue") {
|
|
14
|
-
return new ArcGisUniqueValueSymbologyRenderer(renderer, defaultSymbol);
|
|
17
|
+
return new ArcGisUniqueValueSymbologyRenderer(renderer, defaultSymbol, geometryType);
|
|
15
18
|
}
|
|
16
19
|
else if (renderer?.type === "classBreaks") {
|
|
17
|
-
return new ArcGisClassBreaksSymbologyRenderer(renderer, defaultSymbol);
|
|
20
|
+
return new ArcGisClassBreaksSymbologyRenderer(renderer, defaultSymbol, geometryType);
|
|
18
21
|
}
|
|
19
22
|
else {
|
|
20
|
-
return new ArcGisSimpleSymbologyRenderer(renderer, defaultSymbol);
|
|
23
|
+
return new ArcGisSimpleSymbologyRenderer(renderer, defaultSymbol, geometryType);
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
/** @internal */
|
|
25
|
-
class ArcGisDashLineStyle {
|
|
28
|
+
export class ArcGisDashLineStyle {
|
|
26
29
|
}
|
|
27
30
|
_a = ArcGisDashLineStyle;
|
|
28
31
|
// ESRI does not provide any values for their line style definition, those values have been
|
|
@@ -51,23 +54,24 @@ ArcGisDashLineStyle.dashValues = {
|
|
|
51
54
|
esriSLSShortDashDotDot: [_a._dashLineLength, _a._dashShortGapLength, _a._dotLineLength, _a._dashGapLength, _a._dotLineLength, _a._dashShortGapLength],
|
|
52
55
|
esriSLSShortDot: [_a._shortDotLineLength, _a._shortDotGapLength],
|
|
53
56
|
};
|
|
54
|
-
export { ArcGisDashLineStyle };
|
|
55
57
|
/** @internal */
|
|
56
|
-
export class ArcGisSimpleSymbologyRenderer extends
|
|
58
|
+
export class ArcGisSimpleSymbologyRenderer extends ArcGisSymbologyCanvasRenderer {
|
|
57
59
|
isAttributeDriven() { return false; }
|
|
58
|
-
get symbol() { return this._symbol; }
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
get symbol() { return (this._symbol ?? this.defaultSymbol); }
|
|
61
|
+
set symbol(symbol) { this._symbol = symbol; }
|
|
62
|
+
get defaultSymbol() { return this._defaultSymbol.getSymbology(this.activeGeometryType); }
|
|
63
|
+
constructor(renderer, defaultSymbol, geometryType) {
|
|
61
64
|
super();
|
|
62
65
|
this.lineWidthScaleFactor = 2; // This is value is empirical, this might need to be adjusted
|
|
63
66
|
this._defaultSymbol = defaultSymbol;
|
|
67
|
+
// ArcGIS service normally advertise upfront he geometry of all features. It's always possible to opt-out, but then
|
|
68
|
+
// you will have to set the activeGeometryType before rendering.
|
|
69
|
+
if (geometryType)
|
|
70
|
+
this.activeGeometryType = geometryType;
|
|
64
71
|
this.renderer = renderer;
|
|
65
72
|
if (this.renderer?.type === "simple") {
|
|
66
73
|
this._symbol = this.renderer.symbol;
|
|
67
74
|
}
|
|
68
|
-
else {
|
|
69
|
-
this._symbol = defaultSymbol;
|
|
70
|
-
}
|
|
71
75
|
}
|
|
72
76
|
applyFillStyle(context) {
|
|
73
77
|
if (!context)
|
|
@@ -81,15 +85,16 @@ export class ArcGisSimpleSymbologyRenderer extends ArcGisSymbologyRenderer {
|
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
87
|
getFillColor() {
|
|
88
|
+
const symbol = this.symbol;
|
|
84
89
|
let fillColor;
|
|
85
|
-
if (
|
|
86
|
-
const sfs =
|
|
90
|
+
if (symbol.type === "esriSFS") {
|
|
91
|
+
const sfs = symbol;
|
|
87
92
|
if (sfs.color) {
|
|
88
93
|
fillColor = sfs.color;
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
|
-
else if (
|
|
92
|
-
const sms =
|
|
96
|
+
else if (symbol.type === "esriSMS") {
|
|
97
|
+
const sms = symbol;
|
|
93
98
|
if (sms.color) {
|
|
94
99
|
fillColor = sms.color;
|
|
95
100
|
}
|
|
@@ -106,24 +111,25 @@ export class ArcGisSimpleSymbologyRenderer extends ArcGisSymbologyRenderer {
|
|
|
106
111
|
return;
|
|
107
112
|
// Stroke style can be from SFS's outline style or a SLS's color
|
|
108
113
|
let sls;
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
const symbol = this.symbol;
|
|
115
|
+
if (symbol.type === "esriSFS") {
|
|
116
|
+
const sfs = this.symbol;
|
|
111
117
|
if (sfs.outline) {
|
|
112
118
|
sls = sfs.outline;
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
|
-
else if (
|
|
116
|
-
sls = this.
|
|
121
|
+
else if (symbol.type === "esriSLS") {
|
|
122
|
+
sls = this.symbol;
|
|
117
123
|
}
|
|
118
|
-
else if (
|
|
119
|
-
const sms = this.
|
|
124
|
+
else if (symbol.type === "esriSMS") {
|
|
125
|
+
const sms = this.symbol;
|
|
120
126
|
if (sms.outline) {
|
|
121
127
|
sls = sms.outline;
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
if (sls) {
|
|
125
131
|
context.lineWidth = (sls.width > 0 ? sls.width : 1);
|
|
126
|
-
if (
|
|
132
|
+
if (symbol.type === "esriSLS")
|
|
127
133
|
context.lineWidth *= this.lineWidthScaleFactor;
|
|
128
134
|
if (sls.color) {
|
|
129
135
|
context.strokeStyle = sls.color.toRgbaString();
|
|
@@ -236,12 +242,15 @@ export class ArcGisSimpleSymbologyRenderer extends ArcGisSymbologyRenderer {
|
|
|
236
242
|
drawPoint(context, ptX, ptY) {
|
|
237
243
|
if (!context)
|
|
238
244
|
return;
|
|
239
|
-
|
|
240
|
-
|
|
245
|
+
const symbol = this.symbol;
|
|
246
|
+
if (symbol.type === "esriPMS") {
|
|
247
|
+
const pms = this.symbol;
|
|
241
248
|
const angleDegrees = pms.angle;
|
|
242
249
|
// We scale up a little a bit the size of symbol.
|
|
243
|
-
const width = pms.width === undefined ? pms.width : pms.width * 1.25;
|
|
244
|
-
const height = pms.height === undefined ? pms.height : pms.height * 1.25;
|
|
250
|
+
// const width = pms.width === undefined ? pms.width : pms.width * 1.25;
|
|
251
|
+
// const height = pms.height === undefined ? pms.height : pms.height * 1.25;
|
|
252
|
+
const width = pms.width;
|
|
253
|
+
const height = pms.height;
|
|
245
254
|
let xOffset = 0, yOffset = 0;
|
|
246
255
|
// Center the marker around the anchor point
|
|
247
256
|
if (width)
|
|
@@ -271,8 +280,8 @@ export class ArcGisSimpleSymbologyRenderer extends ArcGisSymbologyRenderer {
|
|
|
271
280
|
if (angleDegrees)
|
|
272
281
|
context.restore();
|
|
273
282
|
}
|
|
274
|
-
else if (
|
|
275
|
-
const sms = this.
|
|
283
|
+
else if (symbol.type === "esriSMS") {
|
|
284
|
+
const sms = this.symbol;
|
|
276
285
|
let xOffset = 0;
|
|
277
286
|
let yOffset = 0;
|
|
278
287
|
if (sms.xoffset)
|
|
@@ -286,19 +295,17 @@ export class ArcGisSimpleSymbologyRenderer extends ArcGisSymbologyRenderer {
|
|
|
286
295
|
/** @internal */
|
|
287
296
|
export class ArcGisUniqueValueSymbologyRenderer extends ArcGisSimpleSymbologyRenderer {
|
|
288
297
|
isAttributeDriven() { return true; }
|
|
298
|
+
get defaultSymbol() { return this._defaultRenderSymbol ?? super.defaultSymbol; }
|
|
289
299
|
get rendererFields() {
|
|
290
300
|
if (this.uvRenderer.field1)
|
|
291
301
|
return [this.uvRenderer.field1];
|
|
292
302
|
else
|
|
293
303
|
return undefined;
|
|
294
304
|
}
|
|
295
|
-
constructor(renderer, defaultSymbol) {
|
|
296
|
-
super(renderer, defaultSymbol);
|
|
305
|
+
constructor(renderer, defaultSymbol, geometryType) {
|
|
306
|
+
super(renderer, defaultSymbol, geometryType);
|
|
297
307
|
this.uvRenderer = this.renderer;
|
|
298
|
-
|
|
299
|
-
this._defaultSymbol = this.uvRenderer.defaultSymbol;
|
|
300
|
-
this._symbol = this.defaultSymbol;
|
|
301
|
-
}
|
|
308
|
+
this._defaultRenderSymbol = this.uvRenderer.defaultSymbol;
|
|
302
309
|
}
|
|
303
310
|
setActiveFeatureAttributes(attributes) {
|
|
304
311
|
this._activeFeatureAttributes = attributes;
|
|
@@ -311,7 +318,7 @@ export class ArcGisUniqueValueSymbologyRenderer extends ArcGisSimpleSymbologyRen
|
|
|
311
318
|
// Strangely, ArcGIS documentation says 'value' is a string,
|
|
312
319
|
// not too sure if a comparison on other types is possible, or its always forced to string properties?
|
|
313
320
|
if (uvi.value === queryValue.toString()) {
|
|
314
|
-
this.
|
|
321
|
+
this.symbol = uvi.symbol;
|
|
315
322
|
newSymbolApplied = true;
|
|
316
323
|
break;
|
|
317
324
|
}
|
|
@@ -321,26 +328,24 @@ export class ArcGisUniqueValueSymbologyRenderer extends ArcGisSimpleSymbologyRen
|
|
|
321
328
|
}
|
|
322
329
|
// Fallback to default symbology to make sure we render something
|
|
323
330
|
if (!newSymbolApplied) {
|
|
324
|
-
this.
|
|
331
|
+
this.symbol = undefined;
|
|
325
332
|
}
|
|
326
333
|
}
|
|
327
334
|
}
|
|
328
335
|
/** @internal */
|
|
329
336
|
export class ArcGisClassBreaksSymbologyRenderer extends ArcGisSimpleSymbologyRenderer {
|
|
330
337
|
isAttributeDriven() { return true; }
|
|
338
|
+
get defaultSymbol() { return this._defaultRenderSymbol ?? super.defaultSymbol; }
|
|
331
339
|
get rendererFields() {
|
|
332
340
|
if (this.cbRenderer)
|
|
333
341
|
return [this.cbRenderer.field];
|
|
334
342
|
else
|
|
335
343
|
return undefined;
|
|
336
344
|
}
|
|
337
|
-
constructor(renderer, defaultSymbol) {
|
|
338
|
-
super(renderer, defaultSymbol);
|
|
345
|
+
constructor(renderer, defaultSymbol, geometryType) {
|
|
346
|
+
super(renderer, defaultSymbol, geometryType);
|
|
339
347
|
this.cbRenderer = this.renderer;
|
|
340
|
-
|
|
341
|
-
this._defaultSymbol = this.cbRenderer.defaultSymbol;
|
|
342
|
-
this._symbol = this.defaultSymbol;
|
|
343
|
-
}
|
|
348
|
+
this._defaultRenderSymbol = this.cbRenderer.defaultSymbol;
|
|
344
349
|
}
|
|
345
350
|
setActiveFeatureAttributes(attributes) {
|
|
346
351
|
this._activeFeatureAttributes = attributes;
|
|
@@ -364,7 +369,7 @@ export class ArcGisClassBreaksSymbologyRenderer extends ArcGisSimpleSymbologyRen
|
|
|
364
369
|
}
|
|
365
370
|
if (queryValue >= currentMinValue
|
|
366
371
|
&& queryValue <= currentClass.classMaxValue) {
|
|
367
|
-
this.
|
|
372
|
+
this.symbol = currentClass.symbol;
|
|
368
373
|
return;
|
|
369
374
|
}
|
|
370
375
|
} while (++currentClassIdx < this.cbRenderer.classBreakInfos.length);
|
|
@@ -372,7 +377,7 @@ export class ArcGisClassBreaksSymbologyRenderer extends ArcGisSimpleSymbologyRen
|
|
|
372
377
|
}
|
|
373
378
|
// Fallback to default symbology to make sure we render something
|
|
374
379
|
if (!newSymbolApplied) {
|
|
375
|
-
this.
|
|
380
|
+
this.symbol = this.defaultSymbol;
|
|
376
381
|
}
|
|
377
382
|
}
|
|
378
383
|
}
|