@itwin/map-layers-formats 5.0.0-dev.10 → 5.0.0-dev.102
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 +56 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js +3 -3
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts +4 -4
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +70 -67
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js +17 -0
- package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts +2 -2
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js +4 -2
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js +7 -4
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.d.ts +2 -2
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js +3 -2
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.d.ts +5 -5
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js +20 -20
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +3 -3
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +37 -32
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.d.ts +1 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.js +28 -7
- package/lib/cjs/ArcGisFeature/EsriSymbology.js.map +1 -1
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js +48 -72
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
- package/lib/cjs/Feature/FeatureCanvasRenderer.d.ts +2 -2
- package/lib/cjs/Feature/FeatureCanvasRenderer.d.ts.map +1 -1
- package/lib/cjs/Feature/FeatureCanvasRenderer.js +2 -0
- package/lib/cjs/Feature/FeatureCanvasRenderer.js.map +1 -1
- package/lib/cjs/Feature/FeatureInfoReader.js +20 -20
- package/lib/cjs/Feature/FeatureInfoReader.js.map +1 -1
- package/lib/cjs/Feature/RandomMapColor.js +10 -10
- package/lib/cjs/Feature/RandomMapColor.js.map +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometry.d.ts +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometry.d.ts.map +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometry.js.map +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.d.ts +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.d.ts.map +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.js +5 -4
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.js.map +1 -1
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.d.ts +36 -0
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.d.ts.map +1 -0
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.js +87 -0
- package/lib/cjs/GoogleMaps/GoogleMapDecorator.js.map +1 -0
- package/lib/cjs/GoogleMaps/GoogleMaps.d.ts +166 -0
- package/lib/cjs/GoogleMaps/GoogleMaps.d.ts.map +1 -0
- package/lib/cjs/GoogleMaps/GoogleMaps.js +56 -0
- package/lib/cjs/GoogleMaps/GoogleMaps.js.map +1 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.d.ts +10 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.d.ts.map +1 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.js +20 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryFormat.js.map +1 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.d.ts +25 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.d.ts.map +1 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.js +232 -0
- package/lib/cjs/GoogleMaps/GoogleMapsImageryProvider.js.map +1 -0
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.js +3 -3
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.d.ts +4 -4
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.d.ts.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.js +58 -51
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.d.ts +3 -3
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.d.ts.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.js +6 -5
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -1
- package/lib/cjs/Tools/GeometryTerrainDraper.d.ts +1 -1
- package/lib/cjs/Tools/GeometryTerrainDraper.d.ts.map +1 -1
- package/lib/cjs/Tools/GeometryTerrainDraper.js +13 -9
- package/lib/cjs/Tools/GeometryTerrainDraper.js.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoDecorator.d.ts +1 -1
- package/lib/cjs/Tools/MapFeatureInfoDecorator.d.ts.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoDecorator.js +60 -56
- package/lib/cjs/Tools/MapFeatureInfoDecorator.js.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoTool.d.ts +1 -1
- package/lib/cjs/Tools/MapFeatureInfoTool.d.ts.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoTool.js +16 -19
- package/lib/cjs/Tools/MapFeatureInfoTool.js.map +1 -1
- package/lib/cjs/internal/GoogleMapsUtils.d.ts +38 -0
- package/lib/cjs/internal/GoogleMapsUtils.d.ts.map +1 -0
- package/lib/cjs/internal/GoogleMapsUtils.js +104 -0
- package/lib/cjs/internal/GoogleMapsUtils.js.map +1 -0
- package/lib/cjs/map-layers-formats.d.ts +4 -3
- package/lib/cjs/map-layers-formats.d.ts.map +1 -1
- package/lib/cjs/map-layers-formats.js +4 -3
- package/lib/cjs/map-layers-formats.js.map +1 -1
- package/lib/cjs/mapLayersFormats.d.ts.map +1 -1
- package/lib/cjs/mapLayersFormats.js +10 -7
- package/lib/cjs/mapLayersFormats.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js +2 -2
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +4 -4
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +52 -49
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js +17 -0
- package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts +2 -2
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js +3 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js +5 -2
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.d.ts +2 -2
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js +2 -1
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.d.ts +5 -5
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js +2 -2
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +3 -3
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +37 -32
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.d.ts +1 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.js +27 -6
- package/lib/esm/ArcGisFeature/EsriSymbology.js.map +1 -1
- package/lib/esm/ArcGisFeature/esriPBuffer.gen.js +48 -72
- package/lib/esm/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
- package/lib/esm/Feature/FeatureCanvasRenderer.d.ts +2 -2
- package/lib/esm/Feature/FeatureCanvasRenderer.d.ts.map +1 -1
- package/lib/esm/Feature/FeatureCanvasRenderer.js +2 -0
- package/lib/esm/Feature/FeatureCanvasRenderer.js.map +1 -1
- package/lib/esm/Feature/FeatureInfoReader.js +20 -20
- package/lib/esm/Feature/FeatureInfoReader.js.map +1 -1
- package/lib/esm/Feature/RandomMapColor.js +10 -10
- package/lib/esm/Feature/RandomMapColor.js.map +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometry.d.ts +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometry.d.ts.map +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometry.js.map +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.d.ts +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.d.ts.map +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.js +2 -1
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.js.map +1 -1
- package/lib/esm/GoogleMaps/GoogleMapDecorator.d.ts +36 -0
- package/lib/esm/GoogleMaps/GoogleMapDecorator.d.ts.map +1 -0
- package/lib/esm/GoogleMaps/GoogleMapDecorator.js +82 -0
- package/lib/esm/GoogleMaps/GoogleMapDecorator.js.map +1 -0
- package/lib/esm/GoogleMaps/GoogleMaps.d.ts +166 -0
- package/lib/esm/GoogleMaps/GoogleMaps.d.ts.map +1 -0
- package/lib/esm/GoogleMaps/GoogleMaps.js +53 -0
- package/lib/esm/GoogleMaps/GoogleMaps.js.map +1 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryFormat.d.ts +10 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryFormat.d.ts.map +1 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryFormat.js +16 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryFormat.js.map +1 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryProvider.d.ts +25 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryProvider.d.ts.map +1 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryProvider.js +228 -0
- package/lib/esm/GoogleMaps/GoogleMapsImageryProvider.js.map +1 -0
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.js +2 -2
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.d.ts +4 -4
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.d.ts.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.js +49 -42
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.d.ts +3 -3
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.d.ts.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.js +3 -2
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -1
- package/lib/esm/Tools/GeometryTerrainDraper.d.ts +1 -1
- package/lib/esm/Tools/GeometryTerrainDraper.d.ts.map +1 -1
- package/lib/esm/Tools/GeometryTerrainDraper.js +11 -7
- package/lib/esm/Tools/GeometryTerrainDraper.js.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoDecorator.d.ts +1 -1
- package/lib/esm/Tools/MapFeatureInfoDecorator.d.ts.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoDecorator.js +58 -54
- package/lib/esm/Tools/MapFeatureInfoDecorator.js.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoTool.d.ts +1 -1
- package/lib/esm/Tools/MapFeatureInfoTool.d.ts.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoTool.js +16 -19
- package/lib/esm/Tools/MapFeatureInfoTool.js.map +1 -1
- package/lib/esm/internal/GoogleMapsUtils.d.ts +38 -0
- package/lib/esm/internal/GoogleMapsUtils.d.ts.map +1 -0
- package/lib/esm/internal/GoogleMapsUtils.js +101 -0
- package/lib/esm/internal/GoogleMapsUtils.js.map +1 -0
- package/lib/esm/map-layers-formats.d.ts +4 -3
- package/lib/esm/map-layers-formats.d.ts.map +1 -1
- package/lib/esm/map-layers-formats.js +4 -3
- package/lib/esm/map-layers-formats.js.map +1 -1
- package/lib/esm/mapLayersFormats.d.ts.map +1 -1
- package/lib/esm/mapLayersFormats.js +7 -4
- package/lib/esm/mapLayersFormats.js.map +1 -1
- package/lib/public/images/google_on_non_white.png +0 -0
- package/lib/public/images/google_on_non_white_hdpi.png +0 -0
- package/lib/public/images/google_on_white.png +0 -0
- package/lib/public/images/google_on_white_hdpi.png +0 -0
- package/package.json +31 -27
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.EsriClassBreaksRenderer = exports.EsriUniqueValueRenderer = exports.EsriSimpleRenderer = exports.EsriRenderer = exports.EsriClassBreaksValueInfo = exports.EsriUniqueValueInfo = exports.EsriSFS = exports.EsriSMS = exports.EsriPMS = exports.EsriSLS = exports.EsriSymbol = void 0;
|
|
8
8
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
9
9
|
const core_common_1 = require("@itwin/core-common");
|
|
10
|
-
const
|
|
10
|
+
const FeatureSymbology_js_1 = require("../Feature/FeatureSymbology.js");
|
|
11
11
|
/** Convert a channel array [r, g, b, a] to ColorDef
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
@@ -19,7 +19,7 @@ function colorFromArray(channels) {
|
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
/** @internal */
|
|
22
|
-
class EsriSymbol extends
|
|
22
|
+
class EsriSymbol extends FeatureSymbology_js_1.FeatureSymbology {
|
|
23
23
|
static fromJSON(props) {
|
|
24
24
|
if (props.type === "esriSFS") {
|
|
25
25
|
return EsriSFS.fromJSON(props);
|
|
@@ -39,6 +39,7 @@ class EsriSymbol extends FeatureSymbology_1.FeatureSymbology {
|
|
|
39
39
|
exports.EsriSymbol = EsriSymbol;
|
|
40
40
|
/** @internal */
|
|
41
41
|
class EsriSLS {
|
|
42
|
+
props;
|
|
42
43
|
get color() { return colorFromArray(this.props.color); }
|
|
43
44
|
get type() { return this.props.type; }
|
|
44
45
|
get width() { return this.props.width; }
|
|
@@ -53,6 +54,8 @@ class EsriSLS {
|
|
|
53
54
|
exports.EsriSLS = EsriSLS;
|
|
54
55
|
/** @internal */
|
|
55
56
|
class EsriPMS {
|
|
57
|
+
props;
|
|
58
|
+
_image;
|
|
56
59
|
get type() { return this.props.type; }
|
|
57
60
|
get url() { return this.props.url; }
|
|
58
61
|
get imageData() { return this.props.imageData; }
|
|
@@ -92,6 +95,8 @@ class EsriPMS {
|
|
|
92
95
|
exports.EsriPMS = EsriPMS;
|
|
93
96
|
/** @internal */
|
|
94
97
|
class EsriSMS {
|
|
98
|
+
props;
|
|
99
|
+
_outline;
|
|
95
100
|
get angle() { return this.props.angle; }
|
|
96
101
|
get color() { return colorFromArray(this.props.color); }
|
|
97
102
|
get outline() { return this._outline; }
|
|
@@ -112,6 +117,8 @@ class EsriSMS {
|
|
|
112
117
|
exports.EsriSMS = EsriSMS;
|
|
113
118
|
/** @internal */
|
|
114
119
|
class EsriSFS {
|
|
120
|
+
props;
|
|
121
|
+
_outline;
|
|
115
122
|
get color() { return colorFromArray(this.props.color); }
|
|
116
123
|
get type() { return this.props.type; }
|
|
117
124
|
get style() { return this.props.style; }
|
|
@@ -128,6 +135,10 @@ class EsriSFS {
|
|
|
128
135
|
exports.EsriSFS = EsriSFS;
|
|
129
136
|
/** @internal */
|
|
130
137
|
class EsriUniqueValueInfo {
|
|
138
|
+
value;
|
|
139
|
+
label;
|
|
140
|
+
description;
|
|
141
|
+
symbol;
|
|
131
142
|
constructor(json) {
|
|
132
143
|
this.value = json.value;
|
|
133
144
|
this.label = json.label;
|
|
@@ -141,6 +152,11 @@ class EsriUniqueValueInfo {
|
|
|
141
152
|
exports.EsriUniqueValueInfo = EsriUniqueValueInfo;
|
|
142
153
|
/** @internal */
|
|
143
154
|
class EsriClassBreaksValueInfo {
|
|
155
|
+
classMaxValue;
|
|
156
|
+
classMinValue;
|
|
157
|
+
label;
|
|
158
|
+
description;
|
|
159
|
+
symbol;
|
|
144
160
|
constructor(json) {
|
|
145
161
|
this.classMaxValue = json.classMaxValue;
|
|
146
162
|
this.classMinValue = json.classMinValue;
|
|
@@ -170,9 +186,10 @@ class EsriRenderer {
|
|
|
170
186
|
exports.EsriRenderer = EsriRenderer;
|
|
171
187
|
/** @internal */
|
|
172
188
|
class EsriSimpleRenderer extends EsriRenderer {
|
|
189
|
+
type = "simple";
|
|
190
|
+
symbol;
|
|
173
191
|
constructor(json) {
|
|
174
192
|
super();
|
|
175
|
-
this.type = "simple";
|
|
176
193
|
this.type = json.type;
|
|
177
194
|
this.symbol = EsriSymbol.fromJSON(json.symbol);
|
|
178
195
|
}
|
|
@@ -190,6 +207,10 @@ class EsriSimpleRenderer extends EsriRenderer {
|
|
|
190
207
|
exports.EsriSimpleRenderer = EsriSimpleRenderer;
|
|
191
208
|
/** @internal */
|
|
192
209
|
class EsriUniqueValueRenderer extends EsriRenderer {
|
|
210
|
+
_props;
|
|
211
|
+
type = "uniqueValue";
|
|
212
|
+
defaultSymbol;
|
|
213
|
+
uniqueValueInfos = [];
|
|
193
214
|
get fields() {
|
|
194
215
|
const fields = [];
|
|
195
216
|
if (this.field1)
|
|
@@ -205,8 +226,6 @@ class EsriUniqueValueRenderer extends EsriRenderer {
|
|
|
205
226
|
get field3() { return this._props.field3 ?? undefined; }
|
|
206
227
|
constructor(json) {
|
|
207
228
|
super();
|
|
208
|
-
this.type = "uniqueValue";
|
|
209
|
-
this.uniqueValueInfos = [];
|
|
210
229
|
if (json.defaultSymbol)
|
|
211
230
|
this.defaultSymbol = EsriSymbol.fromJSON(json.defaultSymbol);
|
|
212
231
|
for (const uvi of json.uniqueValueInfos) {
|
|
@@ -233,7 +252,11 @@ class EsriUniqueValueRenderer extends EsriRenderer {
|
|
|
233
252
|
exports.EsriUniqueValueRenderer = EsriUniqueValueRenderer;
|
|
234
253
|
/** @internal */
|
|
235
254
|
class EsriClassBreaksRenderer extends EsriRenderer {
|
|
255
|
+
_props;
|
|
256
|
+
type = "classBreaks";
|
|
257
|
+
defaultSymbol;
|
|
236
258
|
get classificationMethod() { return this._props.classificationMethod; }
|
|
259
|
+
classBreakInfos = [];
|
|
237
260
|
get fields() {
|
|
238
261
|
if (this.field)
|
|
239
262
|
return [this.field];
|
|
@@ -243,8 +266,6 @@ class EsriClassBreaksRenderer extends EsriRenderer {
|
|
|
243
266
|
get minValue() { return this._props.minValue ?? 0; }
|
|
244
267
|
constructor(json) {
|
|
245
268
|
super();
|
|
246
|
-
this.type = "classBreaks";
|
|
247
|
-
this.classBreakInfos = [];
|
|
248
269
|
if (json.defaultSymbol)
|
|
249
270
|
this.defaultSymbol = EsriSymbol.fromJSON(json.defaultSymbol);
|
|
250
271
|
for (const cbi of json.classBreakInfos) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EsriSymbology.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/EsriSymbology.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAA6C;AAC7C,oDAA8C;AAC9C,kEAA+D;AAE/D;;GAEG;AACH,SAAS,cAAc,CAAC,QAAmB;IACzC,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,0CAA0C;QAC1C,OAAO,sBAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG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C,QAAQ,CAAC,IAAI,CAAE,GAAG,CAAC,MAAkB,CAAC,SAAS,EAAE,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAEM,MAAM,CAAU,QAAQ,CAAC,IAAkC;QAChE,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF;AA7CD,0DA6CC","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 { assert } from \"@itwin/core-bentley\";\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { FeatureSymbology } from \"../Feature/FeatureSymbology\";\r\n\r\n/** Convert a channel array [r, g, b, a] to ColorDef\r\n * @internal\r\n */\r\nfunction colorFromArray(channels?: number[]) {\r\n if (channels && channels.length === 4) {\r\n // Alpha channel is reversed, 255 = opaque\r\n return ColorDef.from(channels[0], channels[1], channels[2], 255 - channels[3]);\r\n }\r\n return undefined;\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSymbolPropsType = \"esriSFS\" | \"esriPMS\" | \"esriSMS\" | \"esriSLS\" | \"esriSMS\" | \"esriTS\" | \"CIMSymbolReference\";\r\n\r\n/** @internal */\r\nexport interface EsriSymbolCommonProps {\r\n type: EsriSymbolPropsType;\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSymbolProps = EsriSLSProps | EsriPMSProps | EsriSFSProps | EsriSMSProps;\r\n\r\n/** @internal */\r\nexport abstract class EsriSymbol extends FeatureSymbology implements EsriSymbolCommonProps {\r\n public readonly abstract type: EsriSymbolPropsType;\r\n\r\n public static fromJSON(props: EsriSymbolProps) {\r\n if (props.type === \"esriSFS\") {\r\n return EsriSFS.fromJSON(props );\r\n } else if (props.type === \"esriSLS\") {\r\n return EsriSLS.fromJSON(props );\r\n } else if (props.type === \"esriPMS\") {\r\n return EsriPMS.fromJSON(props );\r\n } else if (props.type === \"esriSMS\") {\r\n return EsriSMS.fromJSON(props );\r\n }\r\n throw new Error(`Unknown ESRI symbology type}`);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSLSStyle = \"esriSLSDash\" | \"esriSLSDashDot\" | \"esriSLSDashDotDot\" | \"esriSLSDot\" | \"esriSLSLongDash\" | \"esriSLSLongDashDot\" |\r\n\"esriSLSNull\" | \"esriSLSShortDash\" | \"esriSLSShortDashDot\" | \"esriSLSShortDashDotDot\" | \"esriSLSShortDot\" | \"esriSLSSolid\";\r\n\r\n/** @internal */\r\nexport interface EsriSLSProps extends EsriSymbolCommonProps {\r\n color: number[];\r\n type: \"esriSLS\";\r\n width: number;\r\n style: EsriSLSStyle;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSLS implements EsriSymbolCommonProps {\r\n public readonly props: EsriSLSProps;\r\n\r\n public get color() { return colorFromArray(this.props.color); }\r\n public get type() { return this.props.type; }\r\n public get width() { return this.props.width; }\r\n public get style() { return this.props.style; }\r\n\r\n constructor(json: EsriSLSProps) {\r\n this.props = json;\r\n }\r\n\r\n public static fromJSON(json: EsriSLSProps) {\r\n return new EsriSLS(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriPMSProps extends EsriSymbolCommonProps {\r\n type: \"esriPMS\";\r\n url: string;\r\n imageData: string;\r\n contentType: string;\r\n width?: number;\r\n height?: number;\r\n xoffset?: number;\r\n yoffset?: number;\r\n angle?: number;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriPMS implements EsriSymbolCommonProps {\r\n public readonly props: EsriPMSProps;\r\n private _image: HTMLImageElement|undefined;\r\n\r\n public get type() { return this.props.type; }\r\n public get url() { return this.props.url; }\r\n public get imageData() { return this.props.imageData; }\r\n public get imageUrl() { return `data:${this.contentType};base64,${this.imageData}`; }\r\n public get image() {\r\n assert(this._image !== undefined);\r\n return this._image;\r\n }\r\n public get contentType() { return this.props.contentType; }\r\n public get width() { return this.props.width; }\r\n public get height() { return this.props.height; }\r\n public get xoffset() { return this.props.xoffset; }\r\n public get yoffset() { return this.props.yoffset; }\r\n public get angle() { return this.props.angle; }\r\n\r\n public async loadImage() {\r\n if (this._image === undefined) {\r\n this._image = new Image();\r\n\r\n return new Promise<void>((resolve, reject) => {\r\n if (this._image) {\r\n this._image.addEventListener(\"load\", () => {\r\n resolve();\r\n });\r\n this._image.src = this.imageUrl;\r\n } else\r\n reject(new Error(\"Failed to load image\"));\r\n });\r\n }\r\n }\r\n\r\n private constructor(json: EsriPMSProps) {\r\n this.props = json;\r\n }\r\n\r\n public static fromJSON(json: EsriPMSProps) {\r\n return new EsriPMS(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSMSStyleType = \"esriSMSCircle\" | \"esriSMSCross\" | \"esriSMSDiamond\" | \"esriSMSSquare\" | \"esriSMSTriangle\" | \"esriSMSX\";\r\n\r\n/** @internal */\r\nexport interface EsriSMSProps extends EsriSymbolCommonProps {\r\n angle?: number;\r\n color?: number[];\r\n outline?: EsriSLSProps;\r\n size: number;\r\n style: EsriSMSStyleType;\r\n type: \"esriSMS\";\r\n xoffset?: number;\r\n yoffset?: number;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSMS implements EsriSymbolCommonProps {\r\n public readonly props: EsriSMSProps;\r\n private _outline: EsriSLS | undefined;\r\n public get angle() { return this.props.angle; }\r\n public get color() { return colorFromArray(this.props.color); }\r\n public get outline() { return this._outline; }\r\n public get size() { return this.props.size; }\r\n public get style() { return this.props.style; }\r\n public get type() { return this.props.type; }\r\n public get xoffset() { return this.props.xoffset; }\r\n public get yoffset() { return this.props.yoffset; }\r\n\r\n private constructor(json: EsriSMSProps) {\r\n this.props = json;\r\n if (json.outline)\r\n this._outline = EsriSLS.fromJSON(json.outline);\r\n }\r\n\r\n public static fromJSON(json: EsriSMSProps) {\r\n return new EsriSMS(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSFSStyleProps = \"esriSFSBackwardDiagonal\" | \"esriSFSCross\" | \"esriSFSDiagonalCross\" | \"esriSFSForwardDiagonal\" | \"esriSFSHorizontal\" | \"esriSFSNull\" | \"esriSFSSolid\" | \"esriSFSVertical\";\r\n\r\n/** @internal */\r\nexport interface EsriSFSProps extends EsriSymbolCommonProps {\r\n color?: number[];\r\n type: \"esriSFS\";\r\n style: EsriSFSStyleProps;\r\n outline?: EsriSLSProps;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSFS implements EsriSymbolCommonProps {\r\n public readonly props: EsriSFSProps;\r\n private _outline: EsriSLS | undefined;\r\n\r\n public get color() { return colorFromArray(this.props.color); }\r\n public get type() { return this.props.type; }\r\n public get style() { return this.props.style; }\r\n public get outline() { return this._outline; }\r\n constructor(json: EsriSFSProps) {\r\n this.props = json;\r\n if (json.outline)\r\n this._outline = EsriSLS.fromJSON(json.outline);\r\n }\r\n\r\n public static fromJSON(json: EsriSFSProps): EsriSFS {\r\n return new EsriSFS(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriUniqueValueInfoProps {\r\n value: string;\r\n label?: string;\r\n description?: string;\r\n symbol: EsriSymbolProps;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriUniqueValueInfo {\r\n\r\n public readonly value: string;\r\n public readonly label: string|undefined;\r\n public readonly description: string|undefined;\r\n public readonly symbol: EsriSymbol;\r\n\r\n private constructor(json: EsriUniqueValueInfoProps) {\r\n this.value = json.value;\r\n this.label = json.label;\r\n this.description = json.description;\r\n this.symbol = EsriSymbol.fromJSON(json.symbol);\r\n }\r\n\r\n public static fromJSON(json: EsriUniqueValueInfoProps) {\r\n return new EsriUniqueValueInfo(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriClassBreaksInfoProps {\r\n classMaxValue: number;\r\n classMinValue?: number;\r\n label?: string;\r\n description?: string;\r\n symbol: EsriSymbolProps;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriClassBreaksValueInfo {\r\n\r\n public readonly classMaxValue: number;\r\n public readonly classMinValue?: number;\r\n public readonly label: string|undefined;\r\n public readonly description: string|undefined;\r\n public readonly symbol: EsriSymbol;\r\n\r\n private constructor(json: EsriClassBreaksInfoProps) {\r\n this.classMaxValue = json.classMaxValue;\r\n this.classMinValue = json.classMinValue;\r\n this.label = json.label;\r\n this.description = json.description;\r\n this.symbol = EsriSymbol.fromJSON(json.symbol);\r\n }\r\n\r\n public static fromJSON(json: EsriClassBreaksInfoProps) {\r\n return new EsriClassBreaksValueInfo(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriRendererBaseProps {\r\n type: EsriRendererType;\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriSimpleRendererProps extends EsriRendererBaseProps {\r\n symbol: EsriSymbolProps;\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriUniqueValueRendererProps extends EsriRendererBaseProps {\r\n field1?: string;\r\n field2?: string;\r\n field3?: string;\r\n defaultSymbol?: EsriSymbolProps;\r\n uniqueValueInfos: EsriUniqueValueInfoProps[];\r\n}\r\n\r\n/** @internal */\r\nexport type EsriClassificationMethodType = \"esriClassifyDefinedInterval\" | \"esriClassifyEqualInterval\" | \"esriClassifyManual\" | \"esriClassifyNaturalBreaks\" | \"esriClassifyQuantile\" | \"esriClassifyStandardDeviation\";\r\n\r\n/** @internal */\r\nexport interface EsriClassBreaksRendererProps extends EsriRendererBaseProps {\r\n field: string;\r\n minValue: number;\r\n defaultSymbol?: EsriSymbolProps;\r\n classificationMethod: EsriClassificationMethodType;\r\n classBreakInfos: EsriClassBreaksInfoProps[];\r\n}\r\n\r\n/** @internal */\r\nexport type EsriRendererType = \"simple\" | \"uniqueValue\" | \"classBreaks\";\r\n\r\n/** @internal */\r\nexport type EsriRendererProps = EsriSimpleRendererProps | EsriUniqueValueRendererProps | EsriClassBreaksRendererProps;\r\n\r\n/** @internal */\r\nexport abstract class EsriRenderer {\r\n public readonly abstract type: EsriRendererType;\r\n public abstract initialize(): Promise<void>;\r\n public get fields(): string[]|undefined {return undefined;}\r\n public static fromJSON(json: EsriRendererProps): EsriRenderer {\r\n if (json.type === \"simple\")\r\n return EsriSimpleRenderer.fromJSON(json as EsriSimpleRendererProps);\r\n else if (json.type === \"uniqueValue\")\r\n return EsriUniqueValueRenderer.fromJSON(json as EsriUniqueValueRendererProps);\r\n else if (json.type === \"classBreaks\")\r\n return EsriClassBreaksRenderer.fromJSON(json as EsriClassBreaksRendererProps);\r\n else\r\n throw Error(\"Unknown renderer type\");\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSimpleRenderer extends EsriRenderer {\r\n public readonly type: EsriRendererType = \"simple\";\r\n public readonly symbol: EsriSymbol;\r\n\r\n protected constructor(json: EsriSimpleRendererProps) {\r\n super();\r\n this.type = json.type;\r\n this.symbol = EsriSymbol.fromJSON(json.symbol);\r\n }\r\n public async initialize() {\r\n const promises: Promise<void>[] = [];\r\n if (this.symbol.type === \"esriPMS\") {\r\n promises.push((this.symbol as EsriPMS).loadImage());\r\n }\r\n await Promise.all(promises);\r\n }\r\n\r\n public static override fromJSON(json: EsriSimpleRendererProps) {\r\n return new EsriSimpleRenderer(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class EsriUniqueValueRenderer extends EsriRenderer {\r\n private _props: EsriUniqueValueRendererProps;\r\n public readonly type: EsriRendererType = \"uniqueValue\";\r\n public readonly defaultSymbol?: EsriSymbol;\r\n public readonly uniqueValueInfos: EsriUniqueValueInfo[] = [];\r\n\r\n public override get fields() {\r\n const fields: string[] = [];\r\n if (this.field1)\r\n fields.push(this.field1);\r\n if (this.field2)\r\n fields.push(this.field2);\r\n if (this.field3)\r\n fields.push(this.field3);\r\n\r\n return fields;\r\n }\r\n\r\n public get field1() { return this._props.field1 ?? undefined; }\r\n public get field2() { return this._props.field2 ?? undefined; }\r\n public get field3() { return this._props.field3 ?? undefined; }\r\n\r\n protected constructor(json: EsriUniqueValueRendererProps) {\r\n super();\r\n if (json.defaultSymbol)\r\n this.defaultSymbol = EsriSymbol.fromJSON(json.defaultSymbol);\r\n for (const uvi of json.uniqueValueInfos) {\r\n this.uniqueValueInfos.push(EsriUniqueValueInfo.fromJSON(uvi));\r\n }\r\n\r\n this._props = json;\r\n }\r\n\r\n public override async initialize() {\r\n const promises: Promise<void>[] = [];\r\n if (this.defaultSymbol?.type === \"esriPMS\") {\r\n promises.push((this.defaultSymbol as EsriPMS).loadImage());\r\n }\r\n for (const uvi of this.uniqueValueInfos) {\r\n if (uvi.symbol.type === \"esriPMS\") {\r\n promises.push((uvi.symbol as EsriPMS).loadImage());\r\n }\r\n }\r\n await Promise.all(promises);\r\n }\r\n\r\n public static override fromJSON(json: EsriUniqueValueRendererProps) {\r\n return new EsriUniqueValueRenderer(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class EsriClassBreaksRenderer extends EsriRenderer {\r\n private _props: EsriClassBreaksRendererProps;\r\n public readonly type: EsriRendererType = \"classBreaks\";\r\n public readonly defaultSymbol?: EsriSymbol;\r\n public get classificationMethod() {return this._props.classificationMethod;}\r\n public readonly classBreakInfos: EsriClassBreaksValueInfo[] = [];\r\n\r\n public override get fields() {\r\n if (this.field)\r\n return [this.field];\r\n\r\n return undefined;\r\n }\r\n\r\n public get field() { return this._props.field ?? undefined; }\r\n public get minValue() { return this._props.minValue ?? 0; }\r\n\r\n protected constructor(json: EsriClassBreaksRendererProps) {\r\n super();\r\n if (json.defaultSymbol)\r\n this.defaultSymbol = EsriSymbol.fromJSON(json.defaultSymbol);\r\n\r\n for (const cbi of json.classBreakInfos) {\r\n this.classBreakInfos.push(EsriClassBreaksValueInfo.fromJSON(cbi));\r\n }\r\n\r\n this._props = json;\r\n }\r\n\r\n public override async initialize() {\r\n const promises: Promise<void>[] = [];\r\n if (this.defaultSymbol?.type === \"esriPMS\") {\r\n promises.push((this.defaultSymbol as EsriPMS).loadImage());\r\n }\r\n for (const cbi of this.classBreakInfos) {\r\n if (cbi.symbol.type === \"esriPMS\") {\r\n promises.push((cbi.symbol as EsriPMS).loadImage());\r\n }\r\n }\r\n await Promise.all(promises);\r\n }\r\n\r\n public static override fromJSON(json: EsriClassBreaksRendererProps) {\r\n return new EsriClassBreaksRenderer(json);\r\n }\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"EsriSymbology.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/EsriSymbology.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAA6C;AAC7C,oDAA8C;AAC9C,wEAAkE;AAElE;;GAEG;AACH,SAAS,cAAc,CAAC,QAAmB;IACzC,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,0CAA0C;QAC1C,OAAO,sBAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAaD,gBAAgB;AAChB,MAAsB,UAAW,SAAQ,sCAAgB;IAGhD,MAAM,CAAC,QAAQ,CAAC,KAAsB;QAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAE,CAAC;QAClC,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAE,CAAC;QAClC,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAE,CAAC;QAClC,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO,OAA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BAAuB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF;AA7CD,0DA6CC","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 { assert } from \"@itwin/core-bentley\";\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { FeatureSymbology } from \"../Feature/FeatureSymbology.js\";\r\n\r\n/** Convert a channel array [r, g, b, a] to ColorDef\r\n * @internal\r\n */\r\nfunction colorFromArray(channels?: number[]) {\r\n if (channels && channels.length === 4) {\r\n // Alpha channel is reversed, 255 = opaque\r\n return ColorDef.from(channels[0], channels[1], channels[2], 255 - channels[3]);\r\n }\r\n return undefined;\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSymbolPropsType = \"esriSFS\" | \"esriPMS\" | \"esriSMS\" | \"esriSLS\" | \"esriSMS\" | \"esriTS\" | \"CIMSymbolReference\";\r\n\r\n/** @internal */\r\nexport interface EsriSymbolCommonProps {\r\n type: EsriSymbolPropsType;\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSymbolProps = EsriSLSProps | EsriPMSProps | EsriSFSProps | EsriSMSProps;\r\n\r\n/** @internal */\r\nexport abstract class EsriSymbol extends FeatureSymbology implements EsriSymbolCommonProps {\r\n public readonly abstract type: EsriSymbolPropsType;\r\n\r\n public static fromJSON(props: EsriSymbolProps) {\r\n if (props.type === \"esriSFS\") {\r\n return EsriSFS.fromJSON(props );\r\n } else if (props.type === \"esriSLS\") {\r\n return EsriSLS.fromJSON(props );\r\n } else if (props.type === \"esriPMS\") {\r\n return EsriPMS.fromJSON(props );\r\n } else if (props.type === \"esriSMS\") {\r\n return EsriSMS.fromJSON(props );\r\n }\r\n throw new Error(`Unknown ESRI symbology type}`);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSLSStyle = \"esriSLSDash\" | \"esriSLSDashDot\" | \"esriSLSDashDotDot\" | \"esriSLSDot\" | \"esriSLSLongDash\" | \"esriSLSLongDashDot\" |\r\n\"esriSLSNull\" | \"esriSLSShortDash\" | \"esriSLSShortDashDot\" | \"esriSLSShortDashDotDot\" | \"esriSLSShortDot\" | \"esriSLSSolid\";\r\n\r\n/** @internal */\r\nexport interface EsriSLSProps extends EsriSymbolCommonProps {\r\n color: number[];\r\n type: \"esriSLS\";\r\n width: number;\r\n style: EsriSLSStyle;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSLS implements EsriSymbolCommonProps {\r\n public readonly props: EsriSLSProps;\r\n\r\n public get color() { return colorFromArray(this.props.color); }\r\n public get type() { return this.props.type; }\r\n public get width() { return this.props.width; }\r\n public get style() { return this.props.style; }\r\n\r\n constructor(json: EsriSLSProps) {\r\n this.props = json;\r\n }\r\n\r\n public static fromJSON(json: EsriSLSProps) {\r\n return new EsriSLS(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriPMSProps extends EsriSymbolCommonProps {\r\n type: \"esriPMS\";\r\n url: string;\r\n imageData: string;\r\n contentType: string;\r\n width?: number;\r\n height?: number;\r\n xoffset?: number;\r\n yoffset?: number;\r\n angle?: number;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriPMS implements EsriSymbolCommonProps {\r\n public readonly props: EsriPMSProps;\r\n private _image: HTMLImageElement|undefined;\r\n\r\n public get type() { return this.props.type; }\r\n public get url() { return this.props.url; }\r\n public get imageData() { return this.props.imageData; }\r\n public get imageUrl() { return `data:${this.contentType};base64,${this.imageData}`; }\r\n public get image() {\r\n assert(this._image !== undefined);\r\n return this._image;\r\n }\r\n public get contentType() { return this.props.contentType; }\r\n public get width() { return this.props.width; }\r\n public get height() { return this.props.height; }\r\n public get xoffset() { return this.props.xoffset; }\r\n public get yoffset() { return this.props.yoffset; }\r\n public get angle() { return this.props.angle; }\r\n\r\n public async loadImage() {\r\n if (this._image === undefined) {\r\n this._image = new Image();\r\n\r\n return new Promise<void>((resolve, reject) => {\r\n if (this._image) {\r\n this._image.addEventListener(\"load\", () => {\r\n resolve();\r\n });\r\n this._image.src = this.imageUrl;\r\n } else\r\n reject(new Error(\"Failed to load image\"));\r\n });\r\n }\r\n }\r\n\r\n private constructor(json: EsriPMSProps) {\r\n this.props = json;\r\n }\r\n\r\n public static fromJSON(json: EsriPMSProps) {\r\n return new EsriPMS(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSMSStyleType = \"esriSMSCircle\" | \"esriSMSCross\" | \"esriSMSDiamond\" | \"esriSMSSquare\" | \"esriSMSTriangle\" | \"esriSMSX\";\r\n\r\n/** @internal */\r\nexport interface EsriSMSProps extends EsriSymbolCommonProps {\r\n angle?: number;\r\n color?: number[];\r\n outline?: EsriSLSProps;\r\n size: number;\r\n style: EsriSMSStyleType;\r\n type: \"esriSMS\";\r\n xoffset?: number;\r\n yoffset?: number;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSMS implements EsriSymbolCommonProps {\r\n public readonly props: EsriSMSProps;\r\n private _outline: EsriSLS | undefined;\r\n public get angle() { return this.props.angle; }\r\n public get color() { return colorFromArray(this.props.color); }\r\n public get outline() { return this._outline; }\r\n public get size() { return this.props.size; }\r\n public get style() { return this.props.style; }\r\n public get type() { return this.props.type; }\r\n public get xoffset() { return this.props.xoffset; }\r\n public get yoffset() { return this.props.yoffset; }\r\n\r\n private constructor(json: EsriSMSProps) {\r\n this.props = json;\r\n if (json.outline)\r\n this._outline = EsriSLS.fromJSON(json.outline);\r\n }\r\n\r\n public static fromJSON(json: EsriSMSProps) {\r\n return new EsriSMS(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type EsriSFSStyleProps = \"esriSFSBackwardDiagonal\" | \"esriSFSCross\" | \"esriSFSDiagonalCross\" | \"esriSFSForwardDiagonal\" | \"esriSFSHorizontal\" | \"esriSFSNull\" | \"esriSFSSolid\" | \"esriSFSVertical\";\r\n\r\n/** @internal */\r\nexport interface EsriSFSProps extends EsriSymbolCommonProps {\r\n color?: number[];\r\n type: \"esriSFS\";\r\n style: EsriSFSStyleProps;\r\n outline?: EsriSLSProps;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSFS implements EsriSymbolCommonProps {\r\n public readonly props: EsriSFSProps;\r\n private _outline: EsriSLS | undefined;\r\n\r\n public get color() { return colorFromArray(this.props.color); }\r\n public get type() { return this.props.type; }\r\n public get style() { return this.props.style; }\r\n public get outline() { return this._outline; }\r\n constructor(json: EsriSFSProps) {\r\n this.props = json;\r\n if (json.outline)\r\n this._outline = EsriSLS.fromJSON(json.outline);\r\n }\r\n\r\n public static fromJSON(json: EsriSFSProps): EsriSFS {\r\n return new EsriSFS(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriUniqueValueInfoProps {\r\n value: string;\r\n label?: string;\r\n description?: string;\r\n symbol: EsriSymbolProps;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriUniqueValueInfo {\r\n\r\n public readonly value: string;\r\n public readonly label: string|undefined;\r\n public readonly description: string|undefined;\r\n public readonly symbol: EsriSymbol;\r\n\r\n private constructor(json: EsriUniqueValueInfoProps) {\r\n this.value = json.value;\r\n this.label = json.label;\r\n this.description = json.description;\r\n this.symbol = EsriSymbol.fromJSON(json.symbol);\r\n }\r\n\r\n public static fromJSON(json: EsriUniqueValueInfoProps) {\r\n return new EsriUniqueValueInfo(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriClassBreaksInfoProps {\r\n classMaxValue: number;\r\n classMinValue?: number;\r\n label?: string;\r\n description?: string;\r\n symbol: EsriSymbolProps;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriClassBreaksValueInfo {\r\n\r\n public readonly classMaxValue: number;\r\n public readonly classMinValue?: number;\r\n public readonly label: string|undefined;\r\n public readonly description: string|undefined;\r\n public readonly symbol: EsriSymbol;\r\n\r\n private constructor(json: EsriClassBreaksInfoProps) {\r\n this.classMaxValue = json.classMaxValue;\r\n this.classMinValue = json.classMinValue;\r\n this.label = json.label;\r\n this.description = json.description;\r\n this.symbol = EsriSymbol.fromJSON(json.symbol);\r\n }\r\n\r\n public static fromJSON(json: EsriClassBreaksInfoProps) {\r\n return new EsriClassBreaksValueInfo(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriRendererBaseProps {\r\n type: EsriRendererType;\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriSimpleRendererProps extends EsriRendererBaseProps {\r\n symbol: EsriSymbolProps;\r\n}\r\n\r\n/** @internal */\r\nexport interface EsriUniqueValueRendererProps extends EsriRendererBaseProps {\r\n field1?: string;\r\n field2?: string;\r\n field3?: string;\r\n defaultSymbol?: EsriSymbolProps;\r\n uniqueValueInfos: EsriUniqueValueInfoProps[];\r\n}\r\n\r\n/** @internal */\r\nexport type EsriClassificationMethodType = \"esriClassifyDefinedInterval\" | \"esriClassifyEqualInterval\" | \"esriClassifyManual\" | \"esriClassifyNaturalBreaks\" | \"esriClassifyQuantile\" | \"esriClassifyStandardDeviation\";\r\n\r\n/** @internal */\r\nexport interface EsriClassBreaksRendererProps extends EsriRendererBaseProps {\r\n field: string;\r\n minValue: number;\r\n defaultSymbol?: EsriSymbolProps;\r\n classificationMethod: EsriClassificationMethodType;\r\n classBreakInfos: EsriClassBreaksInfoProps[];\r\n}\r\n\r\n/** @internal */\r\nexport type EsriRendererType = \"simple\" | \"uniqueValue\" | \"classBreaks\";\r\n\r\n/** @internal */\r\nexport type EsriRendererProps = EsriSimpleRendererProps | EsriUniqueValueRendererProps | EsriClassBreaksRendererProps;\r\n\r\n/** @internal */\r\nexport abstract class EsriRenderer {\r\n public readonly abstract type: EsriRendererType;\r\n public abstract initialize(): Promise<void>;\r\n public get fields(): string[]|undefined {return undefined;}\r\n public static fromJSON(json: EsriRendererProps): EsriRenderer {\r\n if (json.type === \"simple\")\r\n return EsriSimpleRenderer.fromJSON(json as EsriSimpleRendererProps);\r\n else if (json.type === \"uniqueValue\")\r\n return EsriUniqueValueRenderer.fromJSON(json as EsriUniqueValueRendererProps);\r\n else if (json.type === \"classBreaks\")\r\n return EsriClassBreaksRenderer.fromJSON(json as EsriClassBreaksRendererProps);\r\n else\r\n throw Error(\"Unknown renderer type\");\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSimpleRenderer extends EsriRenderer {\r\n public readonly type: EsriRendererType = \"simple\";\r\n public readonly symbol: EsriSymbol;\r\n\r\n protected constructor(json: EsriSimpleRendererProps) {\r\n super();\r\n this.type = json.type;\r\n this.symbol = EsriSymbol.fromJSON(json.symbol);\r\n }\r\n public async initialize() {\r\n const promises: Promise<void>[] = [];\r\n if (this.symbol.type === \"esriPMS\") {\r\n promises.push((this.symbol as EsriPMS).loadImage());\r\n }\r\n await Promise.all(promises);\r\n }\r\n\r\n public static override fromJSON(json: EsriSimpleRendererProps) {\r\n return new EsriSimpleRenderer(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class EsriUniqueValueRenderer extends EsriRenderer {\r\n private _props: EsriUniqueValueRendererProps;\r\n public readonly type: EsriRendererType = \"uniqueValue\";\r\n public readonly defaultSymbol?: EsriSymbol;\r\n public readonly uniqueValueInfos: EsriUniqueValueInfo[] = [];\r\n\r\n public override get fields() {\r\n const fields: string[] = [];\r\n if (this.field1)\r\n fields.push(this.field1);\r\n if (this.field2)\r\n fields.push(this.field2);\r\n if (this.field3)\r\n fields.push(this.field3);\r\n\r\n return fields;\r\n }\r\n\r\n public get field1() { return this._props.field1 ?? undefined; }\r\n public get field2() { return this._props.field2 ?? undefined; }\r\n public get field3() { return this._props.field3 ?? undefined; }\r\n\r\n protected constructor(json: EsriUniqueValueRendererProps) {\r\n super();\r\n if (json.defaultSymbol)\r\n this.defaultSymbol = EsriSymbol.fromJSON(json.defaultSymbol);\r\n for (const uvi of json.uniqueValueInfos) {\r\n this.uniqueValueInfos.push(EsriUniqueValueInfo.fromJSON(uvi));\r\n }\r\n\r\n this._props = json;\r\n }\r\n\r\n public override async initialize() {\r\n const promises: Promise<void>[] = [];\r\n if (this.defaultSymbol?.type === \"esriPMS\") {\r\n promises.push((this.defaultSymbol as EsriPMS).loadImage());\r\n }\r\n for (const uvi of this.uniqueValueInfos) {\r\n if (uvi.symbol.type === \"esriPMS\") {\r\n promises.push((uvi.symbol as EsriPMS).loadImage());\r\n }\r\n }\r\n await Promise.all(promises);\r\n }\r\n\r\n public static override fromJSON(json: EsriUniqueValueRendererProps) {\r\n return new EsriUniqueValueRenderer(json);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class EsriClassBreaksRenderer extends EsriRenderer {\r\n private _props: EsriClassBreaksRendererProps;\r\n public readonly type: EsriRendererType = \"classBreaks\";\r\n public readonly defaultSymbol?: EsriSymbol;\r\n public get classificationMethod() {return this._props.classificationMethod;}\r\n public readonly classBreakInfos: EsriClassBreaksValueInfo[] = [];\r\n\r\n public override get fields() {\r\n if (this.field)\r\n return [this.field];\r\n\r\n return undefined;\r\n }\r\n\r\n public get field() { return this._props.field ?? undefined; }\r\n public get minValue() { return this._props.minValue ?? 0; }\r\n\r\n protected constructor(json: EsriClassBreaksRendererProps) {\r\n super();\r\n if (json.defaultSymbol)\r\n this.defaultSymbol = EsriSymbol.fromJSON(json.defaultSymbol);\r\n\r\n for (const cbi of json.classBreakInfos) {\r\n this.classBreakInfos.push(EsriClassBreaksValueInfo.fromJSON(cbi));\r\n }\r\n\r\n this._props = json;\r\n }\r\n\r\n public override async initialize() {\r\n const promises: Promise<void>[] = [];\r\n if (this.defaultSymbol?.type === \"esriPMS\") {\r\n promises.push((this.defaultSymbol as EsriPMS).loadImage());\r\n }\r\n for (const cbi of this.classBreakInfos) {\r\n if (cbi.symbol.type === \"esriPMS\") {\r\n promises.push((cbi.symbol as EsriPMS).loadImage());\r\n }\r\n }\r\n await Promise.all(promises);\r\n }\r\n\r\n public static override fromJSON(json: EsriClassBreaksRendererProps) {\r\n return new EsriClassBreaksRenderer(json);\r\n }\r\n}\r\n\r\n"]}
|