@itwin/map-layers-formats 4.0.0-dev.52 → 4.0.0-dev.55

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.
Files changed (148) hide show
  1. package/.rush/temp/operation/build_ci/state.json +1 -1
  2. package/.rush/temp/operation/cover/state.json +1 -1
  3. package/.rush/temp/operation/docs/state.json +1 -1
  4. package/.rush/temp/package-deps_build_ci.json +3 -3
  5. package/.rush/temp/package-deps_cover.json +3 -3
  6. package/.rush/temp/package-deps_docs.json +3 -3
  7. package/.rush/temp/shrinkwrap-deps.json +44 -51
  8. package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.d.ts +8 -8
  9. package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js +14 -14
  10. package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
  11. package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.d.ts +14 -14
  12. package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.js +132 -132
  13. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.d.ts +14 -14
  14. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.js +200 -200
  15. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts +44 -44
  16. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +421 -421
  17. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  18. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts +92 -92
  19. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts.map +1 -1
  20. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js +82 -82
  21. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts +17 -17
  22. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js +33 -33
  23. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.d.ts +32 -32
  24. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.js +142 -142
  25. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts +16 -16
  26. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts.map +1 -1
  27. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js +42 -42
  28. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +85 -85
  29. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
  30. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +189 -189
  31. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  32. package/lib/cjs/ArcGisFeature/esriPBuffer.gen.d.ts +1063 -1063
  33. package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js +2270 -2270
  34. package/lib/cjs/map-layers-formats.d.ts +8 -8
  35. package/lib/cjs/map-layers-formats.js +28 -24
  36. package/lib/cjs/map-layers-formats.js.map +1 -1
  37. package/lib/cjs/mapLayersFormats.d.ts +10 -10
  38. package/lib/cjs/mapLayersFormats.js +28 -28
  39. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +1 -1
  40. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +34 -34
  41. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +1 -1
  42. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.js +161 -161
  43. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +1 -1
  44. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.js +167 -167
  45. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +1 -1
  46. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js +679 -679
  47. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
  48. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +1 -1
  49. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.js +103 -103
  50. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +1 -1
  51. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +214 -214
  52. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +1 -1
  53. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.js +94 -94
  54. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +1 -1
  55. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +59 -59
  56. package/lib/cjs/test/ArcGisFeature/Mocks.d.ts +6 -6
  57. package/lib/cjs/test/ArcGisFeature/Mocks.js +18 -18
  58. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.d.ts +55 -55
  59. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js +419 -419
  60. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js.map +1 -1
  61. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +1042 -1042
  62. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js +426 -426
  63. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js.map +1 -1
  64. package/lib/cjs/test/coverage/.nyc_output/186e5c44-6980-4d7a-9c52-bb4c9af0ad82.json +1 -0
  65. package/lib/cjs/test/coverage/.nyc_output/processinfo/186e5c44-6980-4d7a-9c52-bb4c9af0ad82.json +1 -0
  66. package/lib/cjs/test/coverage/.nyc_output/processinfo/a4fe7565-9b86-4573-8375-3819c82246d8.json +1 -0
  67. package/lib/cjs/test/coverage/.nyc_output/processinfo/index.json +1 -1
  68. package/lib/cjs/test/coverage/cobertura-coverage.xml +39 -39
  69. package/lib/cjs/test/coverage/lcov-report/index.html +1 -1
  70. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureFormat.ts.html +1 -1
  71. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureJSON.ts.html +1 -1
  72. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeaturePBF.ts.html +1 -1
  73. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureProvider.ts.html +1 -1
  74. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureQuery.ts.html +1 -1
  75. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureReader.ts.html +1 -1
  76. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureRenderer.ts.html +1 -1
  77. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureResponse.ts.html +1 -1
  78. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisSymbologyRenderer.ts.html +1 -1
  79. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/index.html +1 -1
  80. package/lib/cjs/test/coverage/lcov-report/src/index.html +1 -1
  81. package/lib/cjs/test/coverage/lcov-report/src/map-layers-formats.ts.html +1 -1
  82. package/lib/cjs/test/coverage/lcov-report/src/mapLayersFormats.ts.html +1 -1
  83. package/lib/cjs/test/coverage/lcov.info +47 -47
  84. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  85. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.d.ts +8 -8
  86. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js +11 -10
  87. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
  88. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.d.ts +14 -14
  89. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.js +128 -128
  90. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.d.ts +14 -14
  91. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.js +196 -196
  92. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +44 -44
  93. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +418 -417
  94. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  95. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts +92 -92
  96. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts.map +1 -1
  97. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js +78 -78
  98. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts +17 -17
  99. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js +29 -29
  100. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.d.ts +32 -32
  101. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.js +138 -138
  102. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts +16 -16
  103. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts.map +1 -1
  104. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js +38 -38
  105. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +85 -85
  106. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
  107. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +183 -182
  108. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  109. package/lib/esm/ArcGisFeature/esriPBuffer.gen.d.ts +1063 -1063
  110. package/lib/esm/ArcGisFeature/esriPBuffer.gen.js +2267 -2267
  111. package/lib/esm/map-layers-formats.d.ts +8 -8
  112. package/lib/esm/map-layers-formats.js +12 -12
  113. package/lib/esm/mapLayersFormats.d.ts +10 -10
  114. package/lib/esm/mapLayersFormats.js +24 -24
  115. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +1 -1
  116. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +32 -32
  117. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +1 -1
  118. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.js +159 -159
  119. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +1 -1
  120. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.js +165 -165
  121. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +1 -1
  122. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js +677 -677
  123. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
  124. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +1 -1
  125. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.js +101 -101
  126. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +1 -1
  127. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +212 -212
  128. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +1 -1
  129. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.js +92 -92
  130. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +1 -1
  131. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +57 -57
  132. package/lib/esm/test/ArcGisFeature/Mocks.d.ts +6 -6
  133. package/lib/esm/test/ArcGisFeature/Mocks.js +15 -15
  134. package/lib/esm/test/ArcGisFeature/NewYorkDataset.d.ts +55 -55
  135. package/lib/esm/test/ArcGisFeature/NewYorkDataset.js +416 -415
  136. package/lib/esm/test/ArcGisFeature/NewYorkDataset.js.map +1 -1
  137. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +1042 -1042
  138. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js +423 -422
  139. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js.map +1 -1
  140. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  141. package/lib/test/junit_results.xml +52 -52
  142. package/map-layers-formats.build.log +2 -2
  143. package/package.json +13 -13
  144. package/src/test/ArcGisFeature/ArcGisFeatureProvider.test.ts +21 -21
  145. package/lib/cjs/test/coverage/.nyc_output/579ba75b-0cfc-4b77-82ad-4f939b76443a.json +0 -1
  146. package/lib/cjs/test/coverage/.nyc_output/processinfo/579ba75b-0cfc-4b77-82ad-4f939b76443a.json +0 -1
  147. package/lib/cjs/test/coverage/.nyc_output/processinfo/f0a37b08-29bc-49a6-a608-b82501dccee7.json +0 -1
  148. /package/lib/cjs/test/coverage/.nyc_output/{f0a37b08-29bc-49a6-a608-b82501dccee7.json → a4fe7565-9b86-4573-8375-3819c82246d8.json} +0 -0
@@ -1,86 +1,86 @@
1
- import { ColorDef } from "@itwin/core-common";
2
- import { ArcGisFeatureGeometryType } from "./ArcGisFeatureQuery";
3
- /** @internal */
4
- export declare type EsriSymbolType = "esriSFS" | "esriPMS" | "esriSLS" | "esriSMS" | "esriTS" | "CIMSymbolReference";
5
- interface EsriSymbol {
6
- type: EsriSymbolType;
7
- }
8
- /** @internal */
9
- export declare type EsriSLSStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSLongDash" | "esriSLSLongDashDot" | "esriSLSNull" | "esriSLSShortDash" | "esriSLSShortDashDot" | "esriSLSShortDashDotDot" | "esriSLSShortDot" | "esriSLSSolid";
10
- interface EsriSLSProps {
11
- color: number[];
12
- type: EsriSymbolType;
13
- width: number;
14
- style: EsriSLSStyle;
15
- }
16
- /** @internal */
17
- export declare class EsriSLS implements EsriSymbol {
18
- readonly props: EsriSLSProps;
19
- get color(): ColorDef | undefined;
20
- get type(): EsriSymbolType;
21
- get width(): number;
22
- get style(): EsriSLSStyle;
23
- constructor(json: EsriSLSProps);
24
- static fromJSON(json: EsriSLSProps): EsriSLS;
25
- }
26
- interface EsriPMSProps {
27
- type: EsriSymbolType;
28
- url: string;
29
- imageData: string;
30
- contentType: string;
31
- width?: number;
32
- height?: number;
33
- xoffset?: number;
34
- yoffset?: number;
35
- angle?: number;
36
- }
37
- /** @internal */
38
- export declare class EsriPMS implements EsriSymbol {
39
- readonly props: EsriPMSProps;
40
- private _image;
41
- get type(): EsriSymbolType;
42
- get url(): string;
43
- get imageData(): string;
44
- get imageUrl(): string;
45
- get image(): HTMLImageElement;
46
- get contentType(): string;
47
- get width(): number | undefined;
48
- get height(): number | undefined;
49
- get xoffset(): number | undefined;
50
- get yoffset(): number | undefined;
51
- get angle(): number | undefined;
52
- constructor(json: EsriPMSProps);
53
- static fromJSON(json: EsriPMSProps): EsriPMS;
54
- }
55
- /** @internal */
56
- export declare type EsriSFSStyleProps = "esriSFSBackwardDiagonal" | "esriSFSCross" | "esriSFSDiagonalCross" | "esriSFSForwardDiagonal" | "esriSFSHorizontal" | "esriSFSNull" | "esriSFSSolid" | "esriSFSVertical";
57
- interface EsriSFSProps {
58
- color?: number[];
59
- type: EsriSymbolType;
60
- style: EsriSFSStyleProps;
61
- outline?: EsriSLSProps;
62
- }
63
- /** @internal */
64
- export declare class EsriSFS implements EsriSymbol {
65
- readonly props: EsriSFSProps;
66
- private _outline;
67
- get color(): ColorDef | undefined;
68
- get type(): EsriSymbolType;
69
- get style(): EsriSFSStyleProps;
70
- get outline(): EsriSLS | undefined;
71
- constructor(json: EsriSFSProps);
72
- static fromJSON(json: EsriSFSProps): EsriSFS;
73
- }
74
- /** @internal */
75
- export declare class ArcGisSymbologyRenderer {
76
- private _symbol;
77
- private static readonly defaultPMS;
78
- private static readonly defaultSLS;
79
- private static readonly defaultSFS;
80
- constructor(geometryType: ArcGisFeatureGeometryType, rendererDefinition: any);
81
- applyFillStyle(context: CanvasRenderingContext2D): void;
82
- applyStrokeStyle(context: CanvasRenderingContext2D): void;
83
- drawPoint(context: CanvasRenderingContext2D, ptX: number, ptY: number): void;
84
- }
85
- export {};
1
+ import { ColorDef } from "@itwin/core-common";
2
+ import { ArcGisFeatureGeometryType } from "./ArcGisFeatureQuery";
3
+ /** @internal */
4
+ export type EsriSymbolType = "esriSFS" | "esriPMS" | "esriSLS" | "esriSMS" | "esriTS" | "CIMSymbolReference";
5
+ interface EsriSymbol {
6
+ type: EsriSymbolType;
7
+ }
8
+ /** @internal */
9
+ export type EsriSLSStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSLongDash" | "esriSLSLongDashDot" | "esriSLSNull" | "esriSLSShortDash" | "esriSLSShortDashDot" | "esriSLSShortDashDotDot" | "esriSLSShortDot" | "esriSLSSolid";
10
+ interface EsriSLSProps {
11
+ color: number[];
12
+ type: EsriSymbolType;
13
+ width: number;
14
+ style: EsriSLSStyle;
15
+ }
16
+ /** @internal */
17
+ export declare class EsriSLS implements EsriSymbol {
18
+ readonly props: EsriSLSProps;
19
+ get color(): ColorDef | undefined;
20
+ get type(): EsriSymbolType;
21
+ get width(): number;
22
+ get style(): EsriSLSStyle;
23
+ constructor(json: EsriSLSProps);
24
+ static fromJSON(json: EsriSLSProps): EsriSLS;
25
+ }
26
+ interface EsriPMSProps {
27
+ type: EsriSymbolType;
28
+ url: string;
29
+ imageData: string;
30
+ contentType: string;
31
+ width?: number;
32
+ height?: number;
33
+ xoffset?: number;
34
+ yoffset?: number;
35
+ angle?: number;
36
+ }
37
+ /** @internal */
38
+ export declare class EsriPMS implements EsriSymbol {
39
+ readonly props: EsriPMSProps;
40
+ private _image;
41
+ get type(): EsriSymbolType;
42
+ get url(): string;
43
+ get imageData(): string;
44
+ get imageUrl(): string;
45
+ get image(): HTMLImageElement;
46
+ get contentType(): string;
47
+ get width(): number | undefined;
48
+ get height(): number | undefined;
49
+ get xoffset(): number | undefined;
50
+ get yoffset(): number | undefined;
51
+ get angle(): number | undefined;
52
+ constructor(json: EsriPMSProps);
53
+ static fromJSON(json: EsriPMSProps): EsriPMS;
54
+ }
55
+ /** @internal */
56
+ export type EsriSFSStyleProps = "esriSFSBackwardDiagonal" | "esriSFSCross" | "esriSFSDiagonalCross" | "esriSFSForwardDiagonal" | "esriSFSHorizontal" | "esriSFSNull" | "esriSFSSolid" | "esriSFSVertical";
57
+ interface EsriSFSProps {
58
+ color?: number[];
59
+ type: EsriSymbolType;
60
+ style: EsriSFSStyleProps;
61
+ outline?: EsriSLSProps;
62
+ }
63
+ /** @internal */
64
+ export declare class EsriSFS implements EsriSymbol {
65
+ readonly props: EsriSFSProps;
66
+ private _outline;
67
+ get color(): ColorDef | undefined;
68
+ get type(): EsriSymbolType;
69
+ get style(): EsriSFSStyleProps;
70
+ get outline(): EsriSLS | undefined;
71
+ constructor(json: EsriSFSProps);
72
+ static fromJSON(json: EsriSFSProps): EsriSFS;
73
+ }
74
+ /** @internal */
75
+ export declare class ArcGisSymbologyRenderer {
76
+ private _symbol;
77
+ private static readonly defaultPMS;
78
+ private static readonly defaultSLS;
79
+ private static readonly defaultSFS;
80
+ constructor(geometryType: ArcGisFeatureGeometryType, rendererDefinition: any);
81
+ applyFillStyle(context: CanvasRenderingContext2D): void;
82
+ applyStrokeStyle(context: CanvasRenderingContext2D): void;
83
+ drawPoint(context: CanvasRenderingContext2D, ptX: number, ptY: number): void;
84
+ }
85
+ export {};
86
86
  //# sourceMappingURL=ArcGisSymbologyRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArcGisSymbologyRenderer.d.ts","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisSymbologyRenderer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAajE,gBAAgB;AAChB,oBAAY,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,CAAC;AAC7G,UAAU,UAAU;IAClB,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,gBAAgB;AAChB,oBAAY,YAAY,GAAG,aAAa,GAAG,gBAAgB,GAAG,mBAAmB,G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C,OAAO,CAAC,OAAO,CAAyB;IAExC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAShC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAKhC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAIhC;gBAEU,YAAY,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,GAAG;IAmCrE,cAAc,CAAC,OAAO,EAAE,wBAAwB;IAchD,gBAAgB,CAAC,OAAO,EAAE,wBAAwB;IAqBlD,SAAS,CAAC,OAAO,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CA0B7E"}
@@ -1,183 +1,184 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import { Logger } from "@itwin/core-bentley";
6
- import { ColorDef } from "@itwin/core-common";
7
- // Convert a channel array [r, g, b, a] to ColorDef
8
- function colorFromArray(channels) {
9
- if (channels && channels.length === 4) {
10
- // Alpha channel is reversed, 255 = opaque
11
- return ColorDef.from(channels[0], channels[1], channels[2], 255 - channels[3]);
12
- }
13
- return undefined;
14
- }
15
- const loggerCategory = "MapLayersFormats.ArcGISFeature";
16
- /** @internal */
17
- export class EsriSLS {
18
- constructor(json) {
19
- this.props = json;
20
- }
21
- get color() { return colorFromArray(this.props.color); }
22
- get type() { return this.props.type; }
23
- get width() { return this.props.width; }
24
- get style() { return this.props.style; }
25
- static fromJSON(json) {
26
- return new EsriSLS(json);
27
- }
28
- }
29
- /** @internal */
30
- export class EsriPMS {
31
- constructor(json) {
32
- this.props = json;
33
- this._image = new Image();
34
- this._image.src = this.imageUrl;
35
- }
36
- get type() { return this.props.type; }
37
- get url() { return this.props.url; }
38
- get imageData() { return this.props.imageData; }
39
- get imageUrl() { return `data:${this.contentType};base64,${this.imageData}`; }
40
- get image() { return this._image; }
41
- get contentType() { return this.props.contentType; }
42
- get width() { return this.props.width; }
43
- get height() { return this.props.height; }
44
- get xoffset() { return this.props.xoffset; }
45
- get yoffset() { return this.props.yoffset; }
46
- get angle() { return this.props.angle; }
47
- static fromJSON(json) {
48
- return new EsriPMS(json);
49
- }
50
- }
51
- /** @internal */
52
- export class EsriSFS {
53
- constructor(json) {
54
- this.props = json;
55
- if (json.outline)
56
- this._outline = EsriSLS.fromJSON(json.outline);
57
- }
58
- get color() { return colorFromArray(this.props.color); }
59
- get type() { return this.props.type; }
60
- get style() { return this.props.style; }
61
- get outline() { return this._outline; }
62
- static fromJSON(json) {
63
- return new EsriSFS(json);
64
- }
65
- }
66
- /** @internal */
67
- export class ArcGisSymbologyRenderer {
68
- constructor(geometryType, rendererDefinition) {
69
- let symbol;
70
- if (rendererDefinition?.symbol !== undefined) {
71
- symbol = rendererDefinition.symbol;
72
- }
73
- else if (rendererDefinition?.defaultSymbol !== undefined) {
74
- symbol = rendererDefinition?.defaultSymbol;
75
- }
76
- if (symbol !== undefined) {
77
- if (symbol.type === "esriSFS") {
78
- this._symbol = EsriSFS.fromJSON(symbol);
79
- }
80
- else if (symbol.type === "esriSLS") {
81
- this._symbol = EsriSLS.fromJSON(symbol);
82
- }
83
- else if (symbol.type === "esriPMS") {
84
- this._symbol = EsriPMS.fromJSON(symbol);
85
- }
86
- }
87
- // If '_symbol' is still undefined at this point, that means we could not find
88
- // any symbology definition from the metadata, let's use some default symbology
89
- // so that we display at least something.
90
- if (this._symbol === undefined) {
91
- Logger.logWarning(loggerCategory, "Symbology definition not supported, using default symbology");
92
- if (geometryType === "esriGeometryPoint" || geometryType === "esriGeometryMultipoint") {
93
- this._symbol = EsriPMS.fromJSON(ArcGisSymbologyRenderer.defaultPMS);
94
- }
95
- else if (geometryType === "esriGeometryLine" || geometryType === "esriGeometryPolyline") {
96
- this._symbol = EsriSLS.fromJSON(ArcGisSymbologyRenderer.defaultSLS);
97
- }
98
- else if (geometryType === "esriGeometryPolygon") {
99
- this._symbol = EsriSFS.fromJSON(ArcGisSymbologyRenderer.defaultSFS);
100
- }
101
- else {
102
- Logger.logError(loggerCategory, "Could not determine default symbology: geometry type not supported");
103
- }
104
- }
105
- }
106
- applyFillStyle(context) {
107
- if (!context)
108
- return;
109
- if (this._symbol?.type === "esriSFS") {
110
- const sfs = this._symbol;
111
- if (sfs.style === "esriSFSSolid" && sfs.color) {
112
- context.fillStyle = sfs.color.toRgbaString();
113
- }
114
- else {
115
- context.fillStyle = ColorDef.from(200, 0, 0, 100).toRgbaString(); // default color is red?
116
- }
117
- }
118
- }
119
- applyStrokeStyle(context) {
120
- if (!context)
121
- return;
122
- let sls;
123
- if (this._symbol?.type === "esriSFS") {
124
- const sfs = this._symbol;
125
- if (sfs.outline && sfs.outline.style === "esriSLSSolid") {
126
- sls = sfs.outline;
127
- }
128
- }
129
- else if (this._symbol?.type === "esriSLS") {
130
- sls = this._symbol;
131
- }
132
- if (sls) {
133
- if (sls.color)
134
- context.strokeStyle = sls.color.toRgbaString();
135
- context.lineWidth = sls.width; // TODO: Should we scale this value here?
136
- }
137
- }
138
- drawPoint(context, ptX, ptY) {
139
- if (!context)
140
- return;
141
- if (this._symbol?.type === "esriPMS") {
142
- const pms = this._symbol;
143
- let xOffset = 0, yOffset = 0;
144
- if (pms.xoffset)
145
- xOffset = pms.xoffset;
146
- else if (pms.width)
147
- xOffset = pms.width * -0.5; // if no offset center in the middle
148
- if (pms.yoffset)
149
- yOffset = pms.yoffset;
150
- else if (pms.height)
151
- yOffset = pms.height * -0.5; // if no offset center in the middle
152
- if (pms.width && pms.height) {
153
- context.drawImage(pms.image, ptX + xOffset, ptY + yOffset, pms.width, pms.height);
154
- }
155
- else {
156
- context.drawImage(pms.image, ptX + xOffset, ptY + yOffset);
157
- }
158
- // TODO: marker rotation angle
159
- }
160
- }
161
- }
162
- ArcGisSymbologyRenderer.defaultPMS = {
163
- type: "esriPMS",
164
- url: "",
165
- contentType: "image/png",
166
- imageData: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAmBJREFUOE+Nk01IVFEUx//n3jfvOZOaJkMtiiJ7o9RG3LgoqKhFSFJBTS1ahFBBi0ijfJXCIyQr+hBbSIsoW7iQoKKFCw2CkAI3tZAgy8Ei+xhoTCbnje/NPfHGnA816KzuPR+/c8/HJRQJE7o+VUhym0DcCOYGgBQEXjOLlyqo+nHanCkMoaL4rslKjZwOQLT4ek3Mmz3FACFNLB67ut6M1nWphbg8wI6VyJK5KEH0EQFVJRKbwzokAW++p/ErraAYSQK3u47bC3vLnA+ZB9i2gHF0oyQMCfCGNaUa+vauxs71wWz2V18cnBj8gQ8J1/eeBnHUa4sMFQDGdGno+4gwEAoQzjVUon3rqlx1KY9x7+0MWobjAPg3QJ2eZV4tAEyFNCN5FkSXyw2B3j1hRGvLcgBXMV5MptA4MOXr0gT0u5bZnAf0jBsyiSgJPAxqhON1K3FlRxUMvwFAtv7u0Wl0jvwEmJNEuOhakTt5wKEBifr6Oo14BIBRpgt07w6jcVMIngKGY7NofR5HwlF+zDcpsC193vyYB/innvHywCzdZfAR/+onX1segBTAxHzzfPE7/8yzzIPLjJE1LTixHZx5CtCK4gXLzovBiDPUsYxVM7gUkB3nWKlm6DYEnQGzXARxCOK+a1WfKtQXb6LNAvr7iCboCUA1Ocdsdv5KLPe7F6pH/w3wLbc+BwOuc5IZ1wEE/jonQbjptZn24tKKX7BgvR2r0NKZRwDvAqCI+Z30VJPTURv7P4A9psuQcYAUPwAoReBLrmX2Lmls7i8sZ7kWLwuoxA1FVJGxzMPLufi6P2r+2xFbOUjGAAAAAElFTkSuQmCC",
167
- width: 16,
168
- height: 16,
169
- xoffset: -8,
170
- yoffset: -16,
171
- };
172
- ArcGisSymbologyRenderer.defaultSLS = {
173
- type: "esriSLS",
174
- color: [0, 0, 0, 255],
175
- width: 1,
176
- style: "esriSLSSolid",
177
- };
178
- ArcGisSymbologyRenderer.defaultSFS = {
179
- type: "esriSFS",
180
- color: [0, 0, 0, 255],
181
- style: "esriSFSSolid",
182
- };
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { Logger } from "@itwin/core-bentley";
6
+ import { ColorDef } from "@itwin/core-common";
7
+ // Convert a channel array [r, g, b, a] to ColorDef
8
+ function colorFromArray(channels) {
9
+ if (channels && channels.length === 4) {
10
+ // Alpha channel is reversed, 255 = opaque
11
+ return ColorDef.from(channels[0], channels[1], channels[2], 255 - channels[3]);
12
+ }
13
+ return undefined;
14
+ }
15
+ const loggerCategory = "MapLayersFormats.ArcGISFeature";
16
+ /** @internal */
17
+ export class EsriSLS {
18
+ get color() { return colorFromArray(this.props.color); }
19
+ get type() { return this.props.type; }
20
+ get width() { return this.props.width; }
21
+ get style() { return this.props.style; }
22
+ constructor(json) {
23
+ this.props = json;
24
+ }
25
+ static fromJSON(json) {
26
+ return new EsriSLS(json);
27
+ }
28
+ }
29
+ /** @internal */
30
+ export class EsriPMS {
31
+ get type() { return this.props.type; }
32
+ get url() { return this.props.url; }
33
+ get imageData() { return this.props.imageData; }
34
+ get imageUrl() { return `data:${this.contentType};base64,${this.imageData}`; }
35
+ get image() { return this._image; }
36
+ get contentType() { return this.props.contentType; }
37
+ get width() { return this.props.width; }
38
+ get height() { return this.props.height; }
39
+ get xoffset() { return this.props.xoffset; }
40
+ get yoffset() { return this.props.yoffset; }
41
+ get angle() { return this.props.angle; }
42
+ constructor(json) {
43
+ this.props = json;
44
+ this._image = new Image();
45
+ this._image.src = this.imageUrl;
46
+ }
47
+ static fromJSON(json) {
48
+ return new EsriPMS(json);
49
+ }
50
+ }
51
+ /** @internal */
52
+ export class EsriSFS {
53
+ get color() { return colorFromArray(this.props.color); }
54
+ get type() { return this.props.type; }
55
+ get style() { return this.props.style; }
56
+ get outline() { return this._outline; }
57
+ constructor(json) {
58
+ this.props = json;
59
+ if (json.outline)
60
+ this._outline = EsriSLS.fromJSON(json.outline);
61
+ }
62
+ static fromJSON(json) {
63
+ return new EsriSFS(json);
64
+ }
65
+ }
66
+ /** @internal */
67
+ class ArcGisSymbologyRenderer {
68
+ constructor(geometryType, rendererDefinition) {
69
+ let symbol;
70
+ if (rendererDefinition?.symbol !== undefined) {
71
+ symbol = rendererDefinition.symbol;
72
+ }
73
+ else if (rendererDefinition?.defaultSymbol !== undefined) {
74
+ symbol = rendererDefinition?.defaultSymbol;
75
+ }
76
+ if (symbol !== undefined) {
77
+ if (symbol.type === "esriSFS") {
78
+ this._symbol = EsriSFS.fromJSON(symbol);
79
+ }
80
+ else if (symbol.type === "esriSLS") {
81
+ this._symbol = EsriSLS.fromJSON(symbol);
82
+ }
83
+ else if (symbol.type === "esriPMS") {
84
+ this._symbol = EsriPMS.fromJSON(symbol);
85
+ }
86
+ }
87
+ // If '_symbol' is still undefined at this point, that means we could not find
88
+ // any symbology definition from the metadata, let's use some default symbology
89
+ // so that we display at least something.
90
+ if (this._symbol === undefined) {
91
+ Logger.logWarning(loggerCategory, "Symbology definition not supported, using default symbology");
92
+ if (geometryType === "esriGeometryPoint" || geometryType === "esriGeometryMultipoint") {
93
+ this._symbol = EsriPMS.fromJSON(ArcGisSymbologyRenderer.defaultPMS);
94
+ }
95
+ else if (geometryType === "esriGeometryLine" || geometryType === "esriGeometryPolyline") {
96
+ this._symbol = EsriSLS.fromJSON(ArcGisSymbologyRenderer.defaultSLS);
97
+ }
98
+ else if (geometryType === "esriGeometryPolygon") {
99
+ this._symbol = EsriSFS.fromJSON(ArcGisSymbologyRenderer.defaultSFS);
100
+ }
101
+ else {
102
+ Logger.logError(loggerCategory, "Could not determine default symbology: geometry type not supported");
103
+ }
104
+ }
105
+ }
106
+ applyFillStyle(context) {
107
+ if (!context)
108
+ return;
109
+ if (this._symbol?.type === "esriSFS") {
110
+ const sfs = this._symbol;
111
+ if (sfs.style === "esriSFSSolid" && sfs.color) {
112
+ context.fillStyle = sfs.color.toRgbaString();
113
+ }
114
+ else {
115
+ context.fillStyle = ColorDef.from(200, 0, 0, 100).toRgbaString(); // default color is red?
116
+ }
117
+ }
118
+ }
119
+ applyStrokeStyle(context) {
120
+ if (!context)
121
+ return;
122
+ let sls;
123
+ if (this._symbol?.type === "esriSFS") {
124
+ const sfs = this._symbol;
125
+ if (sfs.outline && sfs.outline.style === "esriSLSSolid") {
126
+ sls = sfs.outline;
127
+ }
128
+ }
129
+ else if (this._symbol?.type === "esriSLS") {
130
+ sls = this._symbol;
131
+ }
132
+ if (sls) {
133
+ if (sls.color)
134
+ context.strokeStyle = sls.color.toRgbaString();
135
+ context.lineWidth = sls.width; // TODO: Should we scale this value here?
136
+ }
137
+ }
138
+ drawPoint(context, ptX, ptY) {
139
+ if (!context)
140
+ return;
141
+ if (this._symbol?.type === "esriPMS") {
142
+ const pms = this._symbol;
143
+ let xOffset = 0, yOffset = 0;
144
+ if (pms.xoffset)
145
+ xOffset = pms.xoffset;
146
+ else if (pms.width)
147
+ xOffset = pms.width * -0.5; // if no offset center in the middle
148
+ if (pms.yoffset)
149
+ yOffset = pms.yoffset;
150
+ else if (pms.height)
151
+ yOffset = pms.height * -0.5; // if no offset center in the middle
152
+ if (pms.width && pms.height) {
153
+ context.drawImage(pms.image, ptX + xOffset, ptY + yOffset, pms.width, pms.height);
154
+ }
155
+ else {
156
+ context.drawImage(pms.image, ptX + xOffset, ptY + yOffset);
157
+ }
158
+ // TODO: marker rotation angle
159
+ }
160
+ }
161
+ }
162
+ ArcGisSymbologyRenderer.defaultPMS = {
163
+ type: "esriPMS",
164
+ url: "",
165
+ contentType: "image/png",
166
+ imageData: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAmBJREFUOE+Nk01IVFEUx//n3jfvOZOaJkMtiiJ7o9RG3LgoqKhFSFJBTS1ahFBBi0ijfJXCIyQr+hBbSIsoW7iQoKKFCw2CkAI3tZAgy8Ei+xhoTCbnje/NPfHGnA816KzuPR+/c8/HJRQJE7o+VUhym0DcCOYGgBQEXjOLlyqo+nHanCkMoaL4rslKjZwOQLT4ek3Mmz3FACFNLB67ut6M1nWphbg8wI6VyJK5KEH0EQFVJRKbwzokAW++p/ErraAYSQK3u47bC3vLnA+ZB9i2gHF0oyQMCfCGNaUa+vauxs71wWz2V18cnBj8gQ8J1/eeBnHUa4sMFQDGdGno+4gwEAoQzjVUon3rqlx1KY9x7+0MWobjAPg3QJ2eZV4tAEyFNCN5FkSXyw2B3j1hRGvLcgBXMV5MptA4MOXr0gT0u5bZnAf0jBsyiSgJPAxqhON1K3FlRxUMvwFAtv7u0Wl0jvwEmJNEuOhakTt5wKEBifr6Oo14BIBRpgt07w6jcVMIngKGY7NofR5HwlF+zDcpsC193vyYB/innvHywCzdZfAR/+onX1segBTAxHzzfPE7/8yzzIPLjJE1LTixHZx5CtCK4gXLzovBiDPUsYxVM7gUkB3nWKlm6DYEnQGzXARxCOK+a1WfKtQXb6LNAvr7iCboCUA1Ocdsdv5KLPe7F6pH/w3wLbc+BwOuc5IZ1wEE/jonQbjptZn24tKKX7BgvR2r0NKZRwDvAqCI+Z30VJPTURv7P4A9psuQcYAUPwAoReBLrmX2Lmls7i8sZ7kWLwuoxA1FVJGxzMPLufi6P2r+2xFbOUjGAAAAAElFTkSuQmCC",
167
+ width: 16,
168
+ height: 16,
169
+ xoffset: -8,
170
+ yoffset: -16,
171
+ };
172
+ ArcGisSymbologyRenderer.defaultSLS = {
173
+ type: "esriSLS",
174
+ color: [0, 0, 0, 255],
175
+ width: 1,
176
+ style: "esriSLSSolid",
177
+ };
178
+ ArcGisSymbologyRenderer.defaultSFS = {
179
+ type: "esriSFS",
180
+ color: [0, 0, 0, 255],
181
+ style: "esriSFSSolid",
182
+ };
183
+ export { ArcGisSymbologyRenderer };
183
184
  //# sourceMappingURL=ArcGisSymbologyRenderer.js.map
@@ -1 +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ACnB,IAAI,GAAG,CAAC,MAAM;gBACjB,OAAO,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,oCAAoC;YAEnE,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE;gBAC3B,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;aACnF;iBAAM;gBACL,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC;aAC5D;YAED,8BAA8B;SAC/B;IACH,CAAC;;AAvHuB,kCAAU,GAAiB;IACjD,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,EAAE;IACP,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,04BAA04B;IACr5B,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,CAAC,EAAE;CACb,CAAC;AAEsB,kCAAU,GAAiB;IACjD,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IACrB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,cAAc;CACtB,CAAC;AAEsB,kCAAU,GAAiB;IACjD,IAAI,EAAE,SAAS;IACf,KAAK,EAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IACtB,KAAK,EAAE,cAAc;CACtB,CAAC","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 { Logger } from \"@itwin/core-bentley\";\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { ArcGisFeatureGeometryType } from \"./ArcGisFeatureQuery\";\r\n\r\n// Convert a channel array [r, g, b, a] to ColorDef\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\nconst loggerCategory = \"MapLayersFormats.ArcGISFeature\";\r\n\r\n/** @internal */\r\nexport type EsriSymbolType = \"esriSFS\" | \"esriPMS\" | \"esriSLS\" | \"esriSMS\" | \"esriTS\" | \"CIMSymbolReference\";\r\ninterface EsriSymbol {\r\n type: EsriSymbolType;\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\ninterface EsriSLSProps {\r\n color: number[];\r\n type: EsriSymbolType;\r\n width: number;\r\n style: EsriSLSStyle;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSLS implements EsriSymbol {\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\ninterface EsriPMSProps {\r\n type: EsriSymbolType;\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 EsriSymbol {\r\n public readonly props: EsriPMSProps;\r\n private _image: HTMLImageElement;\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() { return this._image; }\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 constructor(json: EsriPMSProps) {\r\n this.props = json;\r\n this._image = new Image();\r\n this._image.src = this.imageUrl;\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 EsriSFSStyleProps = \"esriSFSBackwardDiagonal\" | \"esriSFSCross\" | \"esriSFSDiagonalCross\" | \"esriSFSForwardDiagonal\" | \"esriSFSHorizontal\" | \"esriSFSNull\" | \"esriSFSSolid\" | \"esriSFSVertical\";\r\ninterface EsriSFSProps {\r\n color?: number[];\r\n type: EsriSymbolType;\r\n style: EsriSFSStyleProps;\r\n outline?: EsriSLSProps;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSFS implements EsriSymbol {\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 class ArcGisSymbologyRenderer {\r\n private _symbol: EsriSymbol | undefined;\r\n\r\n private static readonly defaultPMS: EsriPMSProps = {\r\n type: \"esriPMS\",\r\n url: \"\",\r\n contentType: \"image/png\",\r\n imageData: \"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAmBJREFUOE+Nk01IVFEUx//n3jfvOZOaJkMtiiJ7o9RG3LgoqKhFSFJBTS1ahFBBi0ijfJXCIyQr+hBbSIsoW7iQoKKFCw2CkAI3tZAgy8Ei+xhoTCbnje/NPfHGnA816KzuPR+/c8/HJRQJE7o+VUhym0DcCOYGgBQEXjOLlyqo+nHanCkMoaL4rslKjZwOQLT4ek3Mmz3FACFNLB67ut6M1nWphbg8wI6VyJK5KEH0EQFVJRKbwzokAW++p/ErraAYSQK3u47bC3vLnA+ZB9i2gHF0oyQMCfCGNaUa+vauxs71wWz2V18cnBj8gQ8J1/eeBnHUa4sMFQDGdGno+4gwEAoQzjVUon3rqlx1KY9x7+0MWobjAPg3QJ2eZV4tAEyFNCN5FkSXyw2B3j1hRGvLcgBXMV5MptA4MOXr0gT0u5bZnAf0jBsyiSgJPAxqhON1K3FlRxUMvwFAtv7u0Wl0jvwEmJNEuOhakTt5wKEBifr6Oo14BIBRpgt07w6jcVMIngKGY7NofR5HwlF+zDcpsC193vyYB/innvHywCzdZfAR/+onX1segBTAxHzzfPE7/8yzzIPLjJE1LTixHZx5CtCK4gXLzovBiDPUsYxVM7gUkB3nWKlm6DYEnQGzXARxCOK+a1WfKtQXb6LNAvr7iCboCUA1Ocdsdv5KLPe7F6pH/w3wLbc+BwOuc5IZ1wEE/jonQbjptZn24tKKX7BgvR2r0NKZRwDvAqCI+Z30VJPTURv7P4A9psuQcYAUPwAoReBLrmX2Lmls7i8sZ7kWLwuoxA1FVJGxzMPLufi6P2r+2xFbOUjGAAAAAElFTkSuQmCC\",\r\n width: 16,\r\n height: 16,\r\n xoffset: -8,\r\n yoffset: -16,\r\n };\r\n\r\n private static readonly defaultSLS: EsriSLSProps = {\r\n type: \"esriSLS\",\r\n color: [0, 0, 0, 255],\r\n width: 1,\r\n style: \"esriSLSSolid\",\r\n };\r\n\r\n private static readonly defaultSFS: EsriSFSProps = {\r\n type: \"esriSFS\",\r\n color: [0, 0, 0, 255],\r\n style: \"esriSFSSolid\",\r\n };\r\n\r\n constructor(geometryType: ArcGisFeatureGeometryType, rendererDefinition: any) {\r\n let symbol;\r\n if (rendererDefinition?.symbol !== undefined) {\r\n symbol = rendererDefinition.symbol;\r\n } else if (rendererDefinition?.defaultSymbol !== undefined) {\r\n symbol = rendererDefinition?.defaultSymbol;\r\n }\r\n\r\n if (symbol !== undefined) {\r\n if (symbol.type === \"esriSFS\") {\r\n this._symbol = EsriSFS.fromJSON(symbol);\r\n } else if (symbol.type === \"esriSLS\") {\r\n this._symbol = EsriSLS.fromJSON(symbol);\r\n } else if (symbol.type === \"esriPMS\") {\r\n this._symbol = EsriPMS.fromJSON(symbol);\r\n }\r\n }\r\n\r\n // If '_symbol' is still undefined at this point, that means we could not find\r\n // any symbology definition from the metadata, let's use some default symbology\r\n // so that we display at least something.\r\n if (this._symbol === undefined) {\r\n Logger.logWarning(loggerCategory, \"Symbology definition not supported, using default symbology\");\r\n if (geometryType === \"esriGeometryPoint\" || geometryType === \"esriGeometryMultipoint\") {\r\n this._symbol = EsriPMS.fromJSON(ArcGisSymbologyRenderer.defaultPMS);\r\n } else if (geometryType === \"esriGeometryLine\" || geometryType === \"esriGeometryPolyline\") {\r\n this._symbol = EsriSLS.fromJSON(ArcGisSymbologyRenderer.defaultSLS);\r\n } else if (geometryType === \"esriGeometryPolygon\") {\r\n this._symbol = EsriSFS.fromJSON(ArcGisSymbologyRenderer.defaultSFS);\r\n } else {\r\n Logger.logError(loggerCategory, \"Could not determine default symbology: geometry type not supported\");\r\n }\r\n }\r\n }\r\n\r\n public applyFillStyle(context: CanvasRenderingContext2D) {\r\n if (!context)\r\n return;\r\n\r\n if (this._symbol?.type === \"esriSFS\") {\r\n const sfs = this._symbol as EsriSFS;\r\n if (sfs.style === \"esriSFSSolid\" && sfs.color) {\r\n context.fillStyle = sfs.color.toRgbaString();\r\n } else {\r\n context.fillStyle = ColorDef.from(200, 0, 0, 100).toRgbaString(); // default color is red?\r\n }\r\n }\r\n }\r\n\r\n public applyStrokeStyle(context: CanvasRenderingContext2D) {\r\n if (!context)\r\n return;\r\n\r\n let sls: EsriSLS | undefined;\r\n if (this._symbol?.type === \"esriSFS\") {\r\n const sfs = this._symbol as EsriSFS;\r\n if (sfs.outline && sfs.outline.style === \"esriSLSSolid\") {\r\n sls = sfs.outline;\r\n }\r\n } else if (this._symbol?.type === \"esriSLS\") {\r\n sls = this._symbol as EsriSLS;\r\n }\r\n\r\n if (sls) {\r\n if (sls.color)\r\n context.strokeStyle = sls.color.toRgbaString();\r\n context.lineWidth = sls.width; // TODO: Should we scale this value here?\r\n }\r\n }\r\n\r\n public drawPoint(context: CanvasRenderingContext2D, ptX: number, ptY: number) {\r\n if (!context)\r\n return;\r\n\r\n if (this._symbol?.type === \"esriPMS\") {\r\n const pms = this._symbol as EsriPMS;\r\n let xOffset = 0, yOffset = 0;\r\n if (pms.xoffset)\r\n xOffset = pms.xoffset;\r\n else if (pms.width)\r\n xOffset = pms.width * -0.5; // if no offset center in the middle\r\n\r\n if (pms.yoffset)\r\n yOffset = pms.yoffset;\r\n else if (pms.height)\r\n yOffset = pms.height * -0.5; // if no offset center in the middle\r\n\r\n if (pms.width && pms.height) {\r\n context.drawImage(pms.image, ptX + xOffset, ptY + yOffset, pms.width, pms.height);\r\n } else {\r\n context.drawImage(pms.image, ptX + xOffset, ptY + yOffset);\r\n }\r\n\r\n // TODO: marker rotation angle\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ArcGisSymbologyRenderer.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisSymbologyRenderer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,m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AAG,GAAG,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;aACnF;iBAAM;gBACL,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC;aAC5D;YAED,8BAA8B;SAC/B;IACH,CAAC;;AAvHuB,kCAAU,GAAiB;IACjD,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,EAAE;IACP,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,04BAA04B;IACr5B,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,CAAC,EAAE;CACb,CAAC;AAEsB,kCAAU,GAAiB;IACjD,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IACrB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,cAAc;CACtB,CAAC;AAEsB,kCAAU,GAAiB;IACjD,IAAI,EAAE,SAAS;IACf,KAAK,EAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IACtB,KAAK,EAAE,cAAc;CACtB,CAAC;SAzBS,uBAAuB","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 { Logger } from \"@itwin/core-bentley\";\r\nimport { ColorDef } from \"@itwin/core-common\";\r\nimport { ArcGisFeatureGeometryType } from \"./ArcGisFeatureQuery\";\r\n\r\n// Convert a channel array [r, g, b, a] to ColorDef\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\nconst loggerCategory = \"MapLayersFormats.ArcGISFeature\";\r\n\r\n/** @internal */\r\nexport type EsriSymbolType = \"esriSFS\" | \"esriPMS\" | \"esriSLS\" | \"esriSMS\" | \"esriTS\" | \"CIMSymbolReference\";\r\ninterface EsriSymbol {\r\n type: EsriSymbolType;\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\ninterface EsriSLSProps {\r\n color: number[];\r\n type: EsriSymbolType;\r\n width: number;\r\n style: EsriSLSStyle;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSLS implements EsriSymbol {\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\ninterface EsriPMSProps {\r\n type: EsriSymbolType;\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 EsriSymbol {\r\n public readonly props: EsriPMSProps;\r\n private _image: HTMLImageElement;\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() { return this._image; }\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 constructor(json: EsriPMSProps) {\r\n this.props = json;\r\n this._image = new Image();\r\n this._image.src = this.imageUrl;\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 EsriSFSStyleProps = \"esriSFSBackwardDiagonal\" | \"esriSFSCross\" | \"esriSFSDiagonalCross\" | \"esriSFSForwardDiagonal\" | \"esriSFSHorizontal\" | \"esriSFSNull\" | \"esriSFSSolid\" | \"esriSFSVertical\";\r\ninterface EsriSFSProps {\r\n color?: number[];\r\n type: EsriSymbolType;\r\n style: EsriSFSStyleProps;\r\n outline?: EsriSLSProps;\r\n}\r\n\r\n/** @internal */\r\nexport class EsriSFS implements EsriSymbol {\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 class ArcGisSymbologyRenderer {\r\n private _symbol: EsriSymbol | undefined;\r\n\r\n private static readonly defaultPMS: EsriPMSProps = {\r\n type: \"esriPMS\",\r\n url: \"\",\r\n contentType: \"image/png\",\r\n imageData: \"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAmBJREFUOE+Nk01IVFEUx//n3jfvOZOaJkMtiiJ7o9RG3LgoqKhFSFJBTS1ahFBBi0ijfJXCIyQr+hBbSIsoW7iQoKKFCw2CkAI3tZAgy8Ei+xhoTCbnje/NPfHGnA816KzuPR+/c8/HJRQJE7o+VUhym0DcCOYGgBQEXjOLlyqo+nHanCkMoaL4rslKjZwOQLT4ek3Mmz3FACFNLB67ut6M1nWphbg8wI6VyJK5KEH0EQFVJRKbwzokAW++p/ErraAYSQK3u47bC3vLnA+ZB9i2gHF0oyQMCfCGNaUa+vauxs71wWz2V18cnBj8gQ8J1/eeBnHUa4sMFQDGdGno+4gwEAoQzjVUon3rqlx1KY9x7+0MWobjAPg3QJ2eZV4tAEyFNCN5FkSXyw2B3j1hRGvLcgBXMV5MptA4MOXr0gT0u5bZnAf0jBsyiSgJPAxqhON1K3FlRxUMvwFAtv7u0Wl0jvwEmJNEuOhakTt5wKEBifr6Oo14BIBRpgt07w6jcVMIngKGY7NofR5HwlF+zDcpsC193vyYB/innvHywCzdZfAR/+onX1segBTAxHzzfPE7/8yzzIPLjJE1LTixHZx5CtCK4gXLzovBiDPUsYxVM7gUkB3nWKlm6DYEnQGzXARxCOK+a1WfKtQXb6LNAvr7iCboCUA1Ocdsdv5KLPe7F6pH/w3wLbc+BwOuc5IZ1wEE/jonQbjptZn24tKKX7BgvR2r0NKZRwDvAqCI+Z30VJPTURv7P4A9psuQcYAUPwAoReBLrmX2Lmls7i8sZ7kWLwuoxA1FVJGxzMPLufi6P2r+2xFbOUjGAAAAAElFTkSuQmCC\",\r\n width: 16,\r\n height: 16,\r\n xoffset: -8,\r\n yoffset: -16,\r\n };\r\n\r\n private static readonly defaultSLS: EsriSLSProps = {\r\n type: \"esriSLS\",\r\n color: [0, 0, 0, 255],\r\n width: 1,\r\n style: \"esriSLSSolid\",\r\n };\r\n\r\n private static readonly defaultSFS: EsriSFSProps = {\r\n type: \"esriSFS\",\r\n color: [0, 0, 0, 255],\r\n style: \"esriSFSSolid\",\r\n };\r\n\r\n constructor(geometryType: ArcGisFeatureGeometryType, rendererDefinition: any) {\r\n let symbol;\r\n if (rendererDefinition?.symbol !== undefined) {\r\n symbol = rendererDefinition.symbol;\r\n } else if (rendererDefinition?.defaultSymbol !== undefined) {\r\n symbol = rendererDefinition?.defaultSymbol;\r\n }\r\n\r\n if (symbol !== undefined) {\r\n if (symbol.type === \"esriSFS\") {\r\n this._symbol = EsriSFS.fromJSON(symbol);\r\n } else if (symbol.type === \"esriSLS\") {\r\n this._symbol = EsriSLS.fromJSON(symbol);\r\n } else if (symbol.type === \"esriPMS\") {\r\n this._symbol = EsriPMS.fromJSON(symbol);\r\n }\r\n }\r\n\r\n // If '_symbol' is still undefined at this point, that means we could not find\r\n // any symbology definition from the metadata, let's use some default symbology\r\n // so that we display at least something.\r\n if (this._symbol === undefined) {\r\n Logger.logWarning(loggerCategory, \"Symbology definition not supported, using default symbology\");\r\n if (geometryType === \"esriGeometryPoint\" || geometryType === \"esriGeometryMultipoint\") {\r\n this._symbol = EsriPMS.fromJSON(ArcGisSymbologyRenderer.defaultPMS);\r\n } else if (geometryType === \"esriGeometryLine\" || geometryType === \"esriGeometryPolyline\") {\r\n this._symbol = EsriSLS.fromJSON(ArcGisSymbologyRenderer.defaultSLS);\r\n } else if (geometryType === \"esriGeometryPolygon\") {\r\n this._symbol = EsriSFS.fromJSON(ArcGisSymbologyRenderer.defaultSFS);\r\n } else {\r\n Logger.logError(loggerCategory, \"Could not determine default symbology: geometry type not supported\");\r\n }\r\n }\r\n }\r\n\r\n public applyFillStyle(context: CanvasRenderingContext2D) {\r\n if (!context)\r\n return;\r\n\r\n if (this._symbol?.type === \"esriSFS\") {\r\n const sfs = this._symbol as EsriSFS;\r\n if (sfs.style === \"esriSFSSolid\" && sfs.color) {\r\n context.fillStyle = sfs.color.toRgbaString();\r\n } else {\r\n context.fillStyle = ColorDef.from(200, 0, 0, 100).toRgbaString(); // default color is red?\r\n }\r\n }\r\n }\r\n\r\n public applyStrokeStyle(context: CanvasRenderingContext2D) {\r\n if (!context)\r\n return;\r\n\r\n let sls: EsriSLS | undefined;\r\n if (this._symbol?.type === \"esriSFS\") {\r\n const sfs = this._symbol as EsriSFS;\r\n if (sfs.outline && sfs.outline.style === \"esriSLSSolid\") {\r\n sls = sfs.outline;\r\n }\r\n } else if (this._symbol?.type === \"esriSLS\") {\r\n sls = this._symbol as EsriSLS;\r\n }\r\n\r\n if (sls) {\r\n if (sls.color)\r\n context.strokeStyle = sls.color.toRgbaString();\r\n context.lineWidth = sls.width; // TODO: Should we scale this value here?\r\n }\r\n }\r\n\r\n public drawPoint(context: CanvasRenderingContext2D, ptX: number, ptY: number) {\r\n if (!context)\r\n return;\r\n\r\n if (this._symbol?.type === \"esriPMS\") {\r\n const pms = this._symbol as EsriPMS;\r\n let xOffset = 0, yOffset = 0;\r\n if (pms.xoffset)\r\n xOffset = pms.xoffset;\r\n else if (pms.width)\r\n xOffset = pms.width * -0.5; // if no offset center in the middle\r\n\r\n if (pms.yoffset)\r\n yOffset = pms.yoffset;\r\n else if (pms.height)\r\n yOffset = pms.height * -0.5; // if no offset center in the middle\r\n\r\n if (pms.width && pms.height) {\r\n context.drawImage(pms.image, ptX + xOffset, ptY + yOffset, pms.width, pms.height);\r\n } else {\r\n context.drawImage(pms.image, ptX + xOffset, ptY + yOffset);\r\n }\r\n\r\n // TODO: marker rotation angle\r\n }\r\n }\r\n}\r\n"]}