@vaadin/bundles 25.0.0-alpha3 → 25.0.0-alpha5

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 (192) hide show
  1. package/node_modules_ol_ImageCanvas_js.js +76 -83
  2. package/node_modules_ol_ImageCanvas_js.js.map +1 -1
  3. package/node_modules_ol_TileRange_js.js +128 -110
  4. package/node_modules_ol_TileRange_js.js.map +1 -1
  5. package/node_modules_ol_Tile_js.js +279 -0
  6. package/node_modules_ol_Tile_js.js.map +1 -0
  7. package/node_modules_ol_VectorRenderTile_js.js +428 -143
  8. package/node_modules_ol_VectorRenderTile_js.js.map +1 -1
  9. package/node_modules_ol_VectorTile_js.js +405 -119
  10. package/node_modules_ol_VectorTile_js.js.map +1 -1
  11. package/node_modules_ol_control_MousePosition_js.js +327 -0
  12. package/node_modules_ol_control_MousePosition_js.js.map +1 -0
  13. package/node_modules_ol_control_ZoomToExtent_js.js +118 -0
  14. package/node_modules_ol_control_ZoomToExtent_js.js.map +1 -0
  15. package/node_modules_ol_events_SnapEvent_js.js +79 -0
  16. package/node_modules_ol_events_SnapEvent_js.js.map +1 -0
  17. package/node_modules_ol_featureloader_js.js +205 -0
  18. package/node_modules_ol_featureloader_js.js.map +1 -0
  19. package/node_modules_ol_geom_Circle_js.js +300 -0
  20. package/node_modules_ol_geom_Circle_js.js.map +1 -0
  21. package/node_modules_ol_geom_GeometryCollection_js.js +369 -0
  22. package/node_modules_ol_geom_GeometryCollection_js.js.map +1 -0
  23. package/node_modules_ol_geom_MultiPoint_js.js +228 -0
  24. package/node_modules_ol_geom_MultiPoint_js.js.map +1 -0
  25. package/node_modules_ol_geom_flat_center_js.js +47 -0
  26. package/node_modules_ol_geom_flat_center_js.js.map +1 -0
  27. package/node_modules_ol_geom_flat_geodesic_js.js +123 -88
  28. package/node_modules_ol_geom_flat_geodesic_js.js.map +1 -1
  29. package/node_modules_ol_geom_flat_interpolate_js.js +230 -0
  30. package/node_modules_ol_geom_flat_interpolate_js.js.map +1 -0
  31. package/node_modules_ol_geom_flat_length_js-_375a0.js +58 -0
  32. package/node_modules_ol_geom_flat_length_js-_375a0.js.map +1 -0
  33. package/node_modules_ol_geom_flat_length_js-_375a1.js +58 -0
  34. package/node_modules_ol_geom_flat_length_js-_375a1.js.map +1 -0
  35. package/node_modules_ol_geom_flat_length_js-_375a2.js +58 -0
  36. package/node_modules_ol_geom_flat_length_js-_375a2.js.map +1 -0
  37. package/node_modules_ol_geom_flat_length_js-_375a3.js +58 -0
  38. package/node_modules_ol_geom_flat_length_js-_375a3.js.map +1 -0
  39. package/node_modules_ol_geom_flat_length_js-_375a4.js +58 -0
  40. package/node_modules_ol_geom_flat_length_js-_375a4.js.map +1 -0
  41. package/node_modules_ol_geom_flat_linechunk_js.js +76 -0
  42. package/node_modules_ol_geom_flat_linechunk_js.js.map +1 -0
  43. package/node_modules_ol_geom_flat_straightchunk_js.js +68 -0
  44. package/node_modules_ol_geom_flat_straightchunk_js.js.map +1 -0
  45. package/node_modules_ol_geom_flat_textpath_js.js +178 -0
  46. package/node_modules_ol_geom_flat_textpath_js.js.map +1 -0
  47. package/node_modules_ol_interaction_DblClickDragZoom_js.js +285 -0
  48. package/node_modules_ol_interaction_DblClickDragZoom_js.js.map +1 -0
  49. package/node_modules_ol_interaction_DragAndDrop_js.js +351 -0
  50. package/node_modules_ol_interaction_DragAndDrop_js.js.map +1 -0
  51. package/node_modules_ol_interaction_DragRotateAndZoom_js.js +159 -0
  52. package/node_modules_ol_interaction_DragRotateAndZoom_js.js.map +1 -0
  53. package/node_modules_ol_layer_Vector_js-_49290.js +110 -0
  54. package/node_modules_ol_layer_Vector_js-_49290.js.map +1 -0
  55. package/node_modules_ol_layer_Vector_js-_49291.js +110 -0
  56. package/node_modules_ol_layer_Vector_js-_49291.js.map +1 -0
  57. package/node_modules_ol_layer_Vector_js-_49292.js +110 -0
  58. package/node_modules_ol_layer_Vector_js-_49292.js.map +1 -0
  59. package/node_modules_ol_layer_Vector_js-_49293.js +110 -0
  60. package/node_modules_ol_layer_Vector_js-_49293.js.map +1 -0
  61. package/node_modules_ol_loadingstrategy_js.js +95 -0
  62. package/node_modules_ol_loadingstrategy_js.js.map +1 -0
  63. package/node_modules_ol_render_VectorContext_js-_3ad60.js +144 -0
  64. package/node_modules_ol_render_VectorContext_js-_3ad60.js.map +1 -0
  65. package/node_modules_ol_render_VectorContext_js-_3ad61.js +144 -0
  66. package/node_modules_ol_render_VectorContext_js-_3ad61.js.map +1 -0
  67. package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js +372 -0
  68. package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js.map +1 -0
  69. package/node_modules_ol_render_canvas_ImageBuilder_js.js +318 -0
  70. package/node_modules_ol_render_canvas_ImageBuilder_js.js.map +1 -0
  71. package/node_modules_ol_render_canvas_Instruction_js.js +66 -0
  72. package/node_modules_ol_render_canvas_Instruction_js.js.map +1 -0
  73. package/node_modules_ol_render_canvas_LineStringBuilder_js.js +187 -0
  74. package/node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -0
  75. package/node_modules_ol_render_canvas_PolygonBuilder_js.js +276 -0
  76. package/node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
  77. package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js +156 -0
  78. package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js.map +1 -0
  79. package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js +156 -0
  80. package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js.map +1 -0
  81. package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js +301 -0
  82. package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js.map +1 -0
  83. package/node_modules_ol_renderer_Layer_js.js +219 -0
  84. package/node_modules_ol_renderer_Layer_js.js.map +1 -0
  85. package/node_modules_ol_source_Source_js.js +256 -0
  86. package/node_modules_ol_source_Source_js.js.map +1 -0
  87. package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js +318 -0
  88. package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js.map +1 -0
  89. package/node_modules_ol_source_VectorEventType_js.js +80 -0
  90. package/node_modules_ol_source_VectorEventType_js.js.map +1 -0
  91. package/node_modules_ol_structs_RBush_js.js +242 -0
  92. package/node_modules_ol_structs_RBush_js.js.map +1 -0
  93. package/node_modules_ol_style_js.js +2 -1
  94. package/node_modules_ol_style_js.js.map +1 -1
  95. package/node_modules_rbush_rbush_min_js.js +16 -0
  96. package/node_modules_rbush_rbush_min_js.js.map +1 -0
  97. package/package.json +142 -146
  98. package/vaadin-bundle.json +2447 -2352
  99. package/vaadin.js +52246 -63791
  100. package/vaadin.js.map +1 -1
  101. package/vendors-node_modules_dompurify_dist_purify_es_mjs.js +1364 -0
  102. package/vendors-node_modules_dompurify_dist_purify_es_mjs.js.map +1 -0
  103. package/vendors-node_modules_dompurify_dist_purify_js.js +26 -21
  104. package/vendors-node_modules_dompurify_dist_purify_js.js.map +1 -1
  105. package/vendors-node_modules_marked_lib_marked_esm_js.js +2205 -0
  106. package/vendors-node_modules_marked_lib_marked_esm_js.js.map +1 -0
  107. package/vendors-node_modules_marked_lib_marked_umd_js.js +2164 -2556
  108. package/vendors-node_modules_marked_lib_marked_umd_js.js.map +1 -1
  109. package/vendors-node_modules_ol_Feature_js.js +360 -0
  110. package/vendors-node_modules_ol_Feature_js.js.map +1 -0
  111. package/vendors-node_modules_ol_Geolocation_js.js +352 -293
  112. package/vendors-node_modules_ol_Geolocation_js.js.map +1 -1
  113. package/vendors-node_modules_ol_ImageTile_js.js +494 -0
  114. package/vendors-node_modules_ol_ImageTile_js.js.map +1 -0
  115. package/vendors-node_modules_ol_Overlay_js.js +606 -0
  116. package/vendors-node_modules_ol_Overlay_js.js.map +1 -0
  117. package/vendors-node_modules_ol_control_FullScreen_js.js +417 -0
  118. package/vendors-node_modules_ol_control_FullScreen_js.js.map +1 -0
  119. package/vendors-node_modules_ol_control_OverviewMap_js.js +711 -0
  120. package/vendors-node_modules_ol_control_OverviewMap_js.js.map +1 -0
  121. package/vendors-node_modules_ol_control_ScaleLine_js.js +509 -0
  122. package/vendors-node_modules_ol_control_ScaleLine_js.js.map +1 -0
  123. package/vendors-node_modules_ol_control_ZoomSlider_js.js +418 -0
  124. package/vendors-node_modules_ol_control_ZoomSlider_js.js.map +1 -0
  125. package/vendors-node_modules_ol_control_js.js +490 -0
  126. package/vendors-node_modules_ol_control_js.js.map +1 -0
  127. package/vendors-node_modules_ol_geom_LineString_js.js +574 -0
  128. package/vendors-node_modules_ol_geom_LineString_js.js.map +1 -0
  129. package/vendors-node_modules_ol_geom_MultiLineString_js.js +405 -0
  130. package/vendors-node_modules_ol_geom_MultiLineString_js.js.map +1 -0
  131. package/vendors-node_modules_ol_geom_MultiPolygon_js.js +773 -0
  132. package/vendors-node_modules_ol_geom_MultiPolygon_js.js.map +1 -0
  133. package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js +769 -0
  134. package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js.map +1 -0
  135. package/vendors-node_modules_ol_index_js.js +526 -675
  136. package/vendors-node_modules_ol_index_js.js.map +1 -1
  137. package/vendors-node_modules_ol_interaction_Draw_js.js +2777 -0
  138. package/vendors-node_modules_ol_interaction_Draw_js.js.map +1 -0
  139. package/vendors-node_modules_ol_interaction_Extent_js.js +586 -0
  140. package/vendors-node_modules_ol_interaction_Extent_js.js.map +1 -0
  141. package/vendors-node_modules_ol_interaction_Link_js.js +489 -0
  142. package/vendors-node_modules_ol_interaction_Link_js.js.map +1 -0
  143. package/vendors-node_modules_ol_interaction_Modify_js.js +1841 -0
  144. package/vendors-node_modules_ol_interaction_Modify_js.js.map +1 -0
  145. package/vendors-node_modules_ol_interaction_Select_js.js +623 -0
  146. package/vendors-node_modules_ol_interaction_Select_js.js.map +1 -0
  147. package/vendors-node_modules_ol_interaction_Snap_js.js +982 -0
  148. package/vendors-node_modules_ol_interaction_Snap_js.js.map +1 -0
  149. package/vendors-node_modules_ol_interaction_Translate_js.js +466 -0
  150. package/vendors-node_modules_ol_interaction_Translate_js.js.map +1 -0
  151. package/vendors-node_modules_ol_interaction_js.js +872 -0
  152. package/vendors-node_modules_ol_interaction_js.js.map +1 -0
  153. package/vendors-node_modules_ol_layer_Graticule_js.js +1374 -989
  154. package/vendors-node_modules_ol_layer_Graticule_js.js.map +1 -1
  155. package/vendors-node_modules_ol_render_Feature_js.js +546 -0
  156. package/vendors-node_modules_ol_render_Feature_js.js.map +1 -0
  157. package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js +897 -0
  158. package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -0
  159. package/vendors-node_modules_ol_render_canvas_Builder_js.js +907 -0
  160. package/vendors-node_modules_ol_render_canvas_Builder_js.js.map +1 -0
  161. package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js +539 -0
  162. package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -0
  163. package/vendors-node_modules_ol_render_canvas_Executor_js.js +1715 -0
  164. package/vendors-node_modules_ol_render_canvas_Executor_js.js.map +1 -0
  165. package/vendors-node_modules_ol_render_canvas_Immediate_js.js +1208 -0
  166. package/vendors-node_modules_ol_render_canvas_Immediate_js.js.map +1 -0
  167. package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js +825 -0
  168. package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -0
  169. package/vendors-node_modules_ol_renderer_canvas_Layer_js.js +654 -0
  170. package/vendors-node_modules_ol_renderer_canvas_Layer_js.js.map +1 -0
  171. package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js +1044 -0
  172. package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -0
  173. package/vendors-node_modules_ol_renderer_vector_js.js +460 -0
  174. package/vendors-node_modules_ol_renderer_vector_js.js.map +1 -0
  175. package/vendors-node_modules_ol_source_Vector_js.js +2091 -0
  176. package/vendors-node_modules_ol_source_Vector_js.js.map +1 -0
  177. package/node_modules_ol_ImageTile_js.js +0 -177
  178. package/node_modules_ol_ImageTile_js.js.map +0 -1
  179. package/node_modules_ol_render_js.js +0 -131
  180. package/node_modules_ol_render_js.js.map +0 -1
  181. package/node_modules_ol_structs_LRUCache_js.js +0 -275
  182. package/node_modules_ol_structs_LRUCache_js.js.map +0 -1
  183. package/node_modules_ol_tilecoord_js.js +0 -115
  184. package/node_modules_ol_tilecoord_js.js.map +0 -1
  185. package/vendors-node_modules_ol_TileCache_js.js +0 -461
  186. package/vendors-node_modules_ol_TileCache_js.js.map +0 -1
  187. package/vendors-node_modules_ol_Tile_js.js +0 -330
  188. package/vendors-node_modules_ol_Tile_js.js.map +0 -1
  189. package/vendors-node_modules_ol_style_Text_js.js +0 -509
  190. package/vendors-node_modules_ol_style_Text_js.js.map +0 -1
  191. package/vendors-node_modules_rbush_index_js.js +0 -531
  192. package/vendors-node_modules_rbush_index_js.js.map +0 -1
@@ -0,0 +1,1208 @@
1
+ (self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["vendors-node_modules_ol_render_canvas_Immediate_js"],{
2
+
3
+ /***/ "./node_modules/ol/render/canvas/Immediate.js":
4
+ /*!****************************************************!*\
5
+ !*** ./node_modules/ol/render/canvas/Immediate.js ***!
6
+ \****************************************************/
7
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
8
+
9
+ __webpack_require__.r(__webpack_exports__);
10
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
12
+ /* harmony export */ });
13
+ /* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
14
+ /* harmony import */ var _colorlike_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../colorlike.js */ "./node_modules/ol/colorlike.js");
15
+ /* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
16
+ /* harmony import */ var _geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../geom/SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
17
+ /* harmony import */ var _geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../geom/flat/transform.js */ "./node_modules/ol/geom/flat/transform.js");
18
+ /* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math.js */ "./node_modules/ol/math.js");
19
+ /* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
20
+ /* harmony import */ var _VectorContext_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../VectorContext.js */ "./node_modules/ol/render/VectorContext.js");
21
+ /* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/ol/render/canvas.js");
22
+ /**
23
+ * @module ol/render/canvas/Immediate
24
+ */
25
+ // FIXME test, especially polygons with holes and multipolygons
26
+ // FIXME need to handle large thick features (where pixel size matters)
27
+ // FIXME add offset and end to ol/geom/flat/transform~transform2D?
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ /**
40
+ * @classdesc
41
+ * A concrete subclass of {@link module:ol/render/VectorContext~VectorContext} that implements
42
+ * direct rendering of features and geometries to an HTML5 Canvas context.
43
+ * Instances of this class are created internally by the library and
44
+ * provided to application code as vectorContext member of the
45
+ * {@link module:ol/render/Event~RenderEvent} object associated with postcompose, precompose and
46
+ * render events emitted by layers and maps.
47
+ */
48
+ class CanvasImmediateRenderer extends _VectorContext_js__WEBPACK_IMPORTED_MODULE_0__["default"] {
49
+ /**
50
+ * @param {CanvasRenderingContext2D} context Context.
51
+ * @param {number} pixelRatio Pixel ratio.
52
+ * @param {import("../../extent.js").Extent} extent Extent.
53
+ * @param {import("../../transform.js").Transform} transform Transform.
54
+ * @param {number} viewRotation View rotation.
55
+ * @param {number} [squaredTolerance] Optional squared tolerance for simplification.
56
+ * @param {import("../../proj.js").TransformFunction} [userTransform] Transform from user to view projection.
57
+ */
58
+ constructor(
59
+ context,
60
+ pixelRatio,
61
+ extent,
62
+ transform,
63
+ viewRotation,
64
+ squaredTolerance,
65
+ userTransform,
66
+ ) {
67
+ super();
68
+
69
+ /**
70
+ * @private
71
+ * @type {CanvasRenderingContext2D}
72
+ */
73
+ this.context_ = context;
74
+
75
+ /**
76
+ * @private
77
+ * @type {number}
78
+ */
79
+ this.pixelRatio_ = pixelRatio;
80
+
81
+ /**
82
+ * @private
83
+ * @type {import("../../extent.js").Extent}
84
+ */
85
+ this.extent_ = extent;
86
+
87
+ /**
88
+ * @private
89
+ * @type {import("../../transform.js").Transform}
90
+ */
91
+ this.transform_ = transform;
92
+
93
+ /**
94
+ * @private
95
+ * @type {number}
96
+ */
97
+ this.transformRotation_ = transform
98
+ ? (0,_math_js__WEBPACK_IMPORTED_MODULE_1__.toFixed)(Math.atan2(transform[1], transform[0]), 10)
99
+ : 0;
100
+
101
+ /**
102
+ * @private
103
+ * @type {number}
104
+ */
105
+ this.viewRotation_ = viewRotation;
106
+
107
+ /**
108
+ * @private
109
+ * @type {number}
110
+ */
111
+ this.squaredTolerance_ = squaredTolerance;
112
+
113
+ /**
114
+ * @private
115
+ * @type {import("../../proj.js").TransformFunction}
116
+ */
117
+ this.userTransform_ = userTransform;
118
+
119
+ /**
120
+ * @private
121
+ * @type {?import("../canvas.js").FillState}
122
+ */
123
+ this.contextFillState_ = null;
124
+
125
+ /**
126
+ * @private
127
+ * @type {?import("../canvas.js").StrokeState}
128
+ */
129
+ this.contextStrokeState_ = null;
130
+
131
+ /**
132
+ * @private
133
+ * @type {?import("../canvas.js").TextState}
134
+ */
135
+ this.contextTextState_ = null;
136
+
137
+ /**
138
+ * @private
139
+ * @type {?import("../canvas.js").FillState}
140
+ */
141
+ this.fillState_ = null;
142
+
143
+ /**
144
+ * @private
145
+ * @type {?import("../canvas.js").StrokeState}
146
+ */
147
+ this.strokeState_ = null;
148
+
149
+ /**
150
+ * @private
151
+ * @type {import('../../DataTile.js').ImageLike}
152
+ */
153
+ this.image_ = null;
154
+
155
+ /**
156
+ * @private
157
+ * @type {number}
158
+ */
159
+ this.imageAnchorX_ = 0;
160
+
161
+ /**
162
+ * @private
163
+ * @type {number}
164
+ */
165
+ this.imageAnchorY_ = 0;
166
+
167
+ /**
168
+ * @private
169
+ * @type {number}
170
+ */
171
+ this.imageHeight_ = 0;
172
+
173
+ /**
174
+ * @private
175
+ * @type {number}
176
+ */
177
+ this.imageOpacity_ = 0;
178
+
179
+ /**
180
+ * @private
181
+ * @type {number}
182
+ */
183
+ this.imageOriginX_ = 0;
184
+
185
+ /**
186
+ * @private
187
+ * @type {number}
188
+ */
189
+ this.imageOriginY_ = 0;
190
+
191
+ /**
192
+ * @private
193
+ * @type {boolean}
194
+ */
195
+ this.imageRotateWithView_ = false;
196
+
197
+ /**
198
+ * @private
199
+ * @type {number}
200
+ */
201
+ this.imageRotation_ = 0;
202
+
203
+ /**
204
+ * @private
205
+ * @type {import("../../size.js").Size}
206
+ */
207
+ this.imageScale_ = [0, 0];
208
+
209
+ /**
210
+ * @private
211
+ * @type {number}
212
+ */
213
+ this.imageWidth_ = 0;
214
+
215
+ /**
216
+ * @private
217
+ * @type {string}
218
+ */
219
+ this.text_ = '';
220
+
221
+ /**
222
+ * @private
223
+ * @type {number}
224
+ */
225
+ this.textOffsetX_ = 0;
226
+
227
+ /**
228
+ * @private
229
+ * @type {number}
230
+ */
231
+ this.textOffsetY_ = 0;
232
+
233
+ /**
234
+ * @private
235
+ * @type {boolean}
236
+ */
237
+ this.textRotateWithView_ = false;
238
+
239
+ /**
240
+ * @private
241
+ * @type {number}
242
+ */
243
+ this.textRotation_ = 0;
244
+
245
+ /**
246
+ * @private
247
+ * @type {import("../../size.js").Size}
248
+ */
249
+ this.textScale_ = [0, 0];
250
+
251
+ /**
252
+ * @private
253
+ * @type {?import("../canvas.js").FillState}
254
+ */
255
+ this.textFillState_ = null;
256
+
257
+ /**
258
+ * @private
259
+ * @type {?import("../canvas.js").StrokeState}
260
+ */
261
+ this.textStrokeState_ = null;
262
+
263
+ /**
264
+ * @private
265
+ * @type {?import("../canvas.js").TextState}
266
+ */
267
+ this.textState_ = null;
268
+
269
+ /**
270
+ * @private
271
+ * @type {Array<number>}
272
+ */
273
+ this.pixelCoordinates_ = [];
274
+
275
+ /**
276
+ * @private
277
+ * @type {import("../../transform.js").Transform}
278
+ */
279
+ this.tmpLocalTransform_ = (0,_transform_js__WEBPACK_IMPORTED_MODULE_2__.create)();
280
+ }
281
+
282
+ /**
283
+ * @param {Array<number>} flatCoordinates Flat coordinates.
284
+ * @param {number} offset Offset.
285
+ * @param {number} end End.
286
+ * @param {number} stride Stride.
287
+ * @private
288
+ */
289
+ drawImages_(flatCoordinates, offset, end, stride) {
290
+ if (!this.image_) {
291
+ return;
292
+ }
293
+ const pixelCoordinates = (0,_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_3__.transform2D)(
294
+ flatCoordinates,
295
+ offset,
296
+ end,
297
+ stride,
298
+ this.transform_,
299
+ this.pixelCoordinates_,
300
+ );
301
+ const context = this.context_;
302
+ const localTransform = this.tmpLocalTransform_;
303
+ const alpha = context.globalAlpha;
304
+ if (this.imageOpacity_ != 1) {
305
+ context.globalAlpha = alpha * this.imageOpacity_;
306
+ }
307
+ let rotation = this.imageRotation_;
308
+ if (this.transformRotation_ === 0) {
309
+ rotation -= this.viewRotation_;
310
+ }
311
+ if (this.imageRotateWithView_) {
312
+ rotation += this.viewRotation_;
313
+ }
314
+ for (let i = 0, ii = pixelCoordinates.length; i < ii; i += 2) {
315
+ const x = pixelCoordinates[i] - this.imageAnchorX_;
316
+ const y = pixelCoordinates[i + 1] - this.imageAnchorY_;
317
+ if (
318
+ rotation !== 0 ||
319
+ this.imageScale_[0] != 1 ||
320
+ this.imageScale_[1] != 1
321
+ ) {
322
+ const centerX = x + this.imageAnchorX_;
323
+ const centerY = y + this.imageAnchorY_;
324
+ (0,_transform_js__WEBPACK_IMPORTED_MODULE_2__.compose)(
325
+ localTransform,
326
+ centerX,
327
+ centerY,
328
+ 1,
329
+ 1,
330
+ rotation,
331
+ -centerX,
332
+ -centerY,
333
+ );
334
+ context.save();
335
+ context.transform.apply(context, localTransform);
336
+ context.translate(centerX, centerY);
337
+ context.scale(this.imageScale_[0], this.imageScale_[1]);
338
+ context.drawImage(
339
+ this.image_,
340
+ this.imageOriginX_,
341
+ this.imageOriginY_,
342
+ this.imageWidth_,
343
+ this.imageHeight_,
344
+ -this.imageAnchorX_,
345
+ -this.imageAnchorY_,
346
+ this.imageWidth_,
347
+ this.imageHeight_,
348
+ );
349
+ context.restore();
350
+ } else {
351
+ context.drawImage(
352
+ this.image_,
353
+ this.imageOriginX_,
354
+ this.imageOriginY_,
355
+ this.imageWidth_,
356
+ this.imageHeight_,
357
+ x,
358
+ y,
359
+ this.imageWidth_,
360
+ this.imageHeight_,
361
+ );
362
+ }
363
+ }
364
+ if (this.imageOpacity_ != 1) {
365
+ context.globalAlpha = alpha;
366
+ }
367
+ }
368
+
369
+ /**
370
+ * @param {Array<number>} flatCoordinates Flat coordinates.
371
+ * @param {number} offset Offset.
372
+ * @param {number} end End.
373
+ * @param {number} stride Stride.
374
+ * @private
375
+ */
376
+ drawText_(flatCoordinates, offset, end, stride) {
377
+ if (!this.textState_ || this.text_ === '') {
378
+ return;
379
+ }
380
+ if (this.textFillState_) {
381
+ this.setContextFillState_(this.textFillState_);
382
+ }
383
+ if (this.textStrokeState_) {
384
+ this.setContextStrokeState_(this.textStrokeState_);
385
+ }
386
+ this.setContextTextState_(this.textState_);
387
+ const pixelCoordinates = (0,_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_3__.transform2D)(
388
+ flatCoordinates,
389
+ offset,
390
+ end,
391
+ stride,
392
+ this.transform_,
393
+ this.pixelCoordinates_,
394
+ );
395
+ const context = this.context_;
396
+ let rotation = this.textRotation_;
397
+ if (this.transformRotation_ === 0) {
398
+ rotation -= this.viewRotation_;
399
+ }
400
+ if (this.textRotateWithView_) {
401
+ rotation += this.viewRotation_;
402
+ }
403
+ for (; offset < end; offset += stride) {
404
+ const x = pixelCoordinates[offset] + this.textOffsetX_;
405
+ const y = pixelCoordinates[offset + 1] + this.textOffsetY_;
406
+ if (
407
+ rotation !== 0 ||
408
+ this.textScale_[0] != 1 ||
409
+ this.textScale_[1] != 1
410
+ ) {
411
+ context.save();
412
+ context.translate(x - this.textOffsetX_, y - this.textOffsetY_);
413
+ context.rotate(rotation);
414
+ context.translate(this.textOffsetX_, this.textOffsetY_);
415
+ context.scale(this.textScale_[0], this.textScale_[1]);
416
+ if (this.textStrokeState_) {
417
+ context.strokeText(this.text_, 0, 0);
418
+ }
419
+ if (this.textFillState_) {
420
+ context.fillText(this.text_, 0, 0);
421
+ }
422
+ context.restore();
423
+ } else {
424
+ if (this.textStrokeState_) {
425
+ context.strokeText(this.text_, x, y);
426
+ }
427
+ if (this.textFillState_) {
428
+ context.fillText(this.text_, x, y);
429
+ }
430
+ }
431
+ }
432
+ }
433
+
434
+ /**
435
+ * @param {Array<number>} flatCoordinates Flat coordinates.
436
+ * @param {number} offset Offset.
437
+ * @param {number} end End.
438
+ * @param {number} stride Stride.
439
+ * @param {boolean} close Close.
440
+ * @private
441
+ * @return {number} end End.
442
+ */
443
+ moveToLineTo_(flatCoordinates, offset, end, stride, close) {
444
+ const context = this.context_;
445
+ const pixelCoordinates = (0,_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_3__.transform2D)(
446
+ flatCoordinates,
447
+ offset,
448
+ end,
449
+ stride,
450
+ this.transform_,
451
+ this.pixelCoordinates_,
452
+ );
453
+ context.moveTo(pixelCoordinates[0], pixelCoordinates[1]);
454
+ let length = pixelCoordinates.length;
455
+ if (close) {
456
+ length -= 2;
457
+ }
458
+ for (let i = 2; i < length; i += 2) {
459
+ context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]);
460
+ }
461
+ if (close) {
462
+ context.closePath();
463
+ }
464
+ return end;
465
+ }
466
+
467
+ /**
468
+ * @param {Array<number>} flatCoordinates Flat coordinates.
469
+ * @param {number} offset Offset.
470
+ * @param {Array<number>} ends Ends.
471
+ * @param {number} stride Stride.
472
+ * @private
473
+ * @return {number} End.
474
+ */
475
+ drawRings_(flatCoordinates, offset, ends, stride) {
476
+ for (let i = 0, ii = ends.length; i < ii; ++i) {
477
+ offset = this.moveToLineTo_(
478
+ flatCoordinates,
479
+ offset,
480
+ ends[i],
481
+ stride,
482
+ true,
483
+ );
484
+ }
485
+ return offset;
486
+ }
487
+
488
+ /**
489
+ * Render a circle geometry into the canvas. Rendering is immediate and uses
490
+ * the current fill and stroke styles.
491
+ *
492
+ * @param {import("../../geom/Circle.js").default} geometry Circle geometry.
493
+ * @api
494
+ * @override
495
+ */
496
+ drawCircle(geometry) {
497
+ if (this.squaredTolerance_) {
498
+ geometry = /** @type {import("../../geom/Circle.js").default} */ (
499
+ geometry.simplifyTransformed(
500
+ this.squaredTolerance_,
501
+ this.userTransform_,
502
+ )
503
+ );
504
+ }
505
+ if (!(0,_extent_js__WEBPACK_IMPORTED_MODULE_4__.intersects)(this.extent_, geometry.getExtent())) {
506
+ return;
507
+ }
508
+ if (this.fillState_ || this.strokeState_) {
509
+ if (this.fillState_) {
510
+ this.setContextFillState_(this.fillState_);
511
+ }
512
+ if (this.strokeState_) {
513
+ this.setContextStrokeState_(this.strokeState_);
514
+ }
515
+ const pixelCoordinates = (0,_geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_5__.transformGeom2D)(
516
+ geometry,
517
+ this.transform_,
518
+ this.pixelCoordinates_,
519
+ );
520
+ const dx = pixelCoordinates[2] - pixelCoordinates[0];
521
+ const dy = pixelCoordinates[3] - pixelCoordinates[1];
522
+ const radius = Math.sqrt(dx * dx + dy * dy);
523
+ const context = this.context_;
524
+ context.beginPath();
525
+ context.arc(
526
+ pixelCoordinates[0],
527
+ pixelCoordinates[1],
528
+ radius,
529
+ 0,
530
+ 2 * Math.PI,
531
+ );
532
+ if (this.fillState_) {
533
+ context.fill();
534
+ }
535
+ if (this.strokeState_) {
536
+ context.stroke();
537
+ }
538
+ }
539
+ if (this.text_ !== '') {
540
+ this.drawText_(geometry.getCenter(), 0, 2, 2);
541
+ }
542
+ }
543
+
544
+ /**
545
+ * Set the rendering style. Note that since this is an immediate rendering API,
546
+ * any `zIndex` on the provided style will be ignored.
547
+ *
548
+ * @param {import("../../style/Style.js").default} style The rendering style.
549
+ * @api
550
+ * @override
551
+ */
552
+ setStyle(style) {
553
+ this.setFillStrokeStyle(style.getFill(), style.getStroke());
554
+ this.setImageStyle(style.getImage());
555
+ this.setTextStyle(style.getText());
556
+ }
557
+
558
+ /**
559
+ * @param {import("../../transform.js").Transform} transform Transform.
560
+ */
561
+ setTransform(transform) {
562
+ this.transform_ = transform;
563
+ }
564
+
565
+ /**
566
+ * Render a geometry into the canvas. Call
567
+ * {@link module:ol/render/canvas/Immediate~CanvasImmediateRenderer#setStyle renderer.setStyle()} first to set the rendering style.
568
+ *
569
+ * @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
570
+ * @api
571
+ * @override
572
+ */
573
+ drawGeometry(geometry) {
574
+ const type = geometry.getType();
575
+ switch (type) {
576
+ case 'Point':
577
+ this.drawPoint(
578
+ /** @type {import("../../geom/Point.js").default} */ (geometry),
579
+ );
580
+ break;
581
+ case 'LineString':
582
+ this.drawLineString(
583
+ /** @type {import("../../geom/LineString.js").default} */ (geometry),
584
+ );
585
+ break;
586
+ case 'Polygon':
587
+ this.drawPolygon(
588
+ /** @type {import("../../geom/Polygon.js").default} */ (geometry),
589
+ );
590
+ break;
591
+ case 'MultiPoint':
592
+ this.drawMultiPoint(
593
+ /** @type {import("../../geom/MultiPoint.js").default} */ (geometry),
594
+ );
595
+ break;
596
+ case 'MultiLineString':
597
+ this.drawMultiLineString(
598
+ /** @type {import("../../geom/MultiLineString.js").default} */ (
599
+ geometry
600
+ ),
601
+ );
602
+ break;
603
+ case 'MultiPolygon':
604
+ this.drawMultiPolygon(
605
+ /** @type {import("../../geom/MultiPolygon.js").default} */ (
606
+ geometry
607
+ ),
608
+ );
609
+ break;
610
+ case 'GeometryCollection':
611
+ this.drawGeometryCollection(
612
+ /** @type {import("../../geom/GeometryCollection.js").default} */ (
613
+ geometry
614
+ ),
615
+ );
616
+ break;
617
+ case 'Circle':
618
+ this.drawCircle(
619
+ /** @type {import("../../geom/Circle.js").default} */ (geometry),
620
+ );
621
+ break;
622
+ default:
623
+ }
624
+ }
625
+
626
+ /**
627
+ * Render a feature into the canvas. Note that any `zIndex` on the provided
628
+ * style will be ignored - features are rendered immediately in the order that
629
+ * this method is called. If you need `zIndex` support, you should be using an
630
+ * {@link module:ol/layer/Vector~VectorLayer} instead.
631
+ *
632
+ * @param {import("../../Feature.js").default} feature Feature.
633
+ * @param {import("../../style/Style.js").default} style Style.
634
+ * @api
635
+ * @override
636
+ */
637
+ drawFeature(feature, style) {
638
+ const geometry = style.getGeometryFunction()(feature);
639
+ if (!geometry) {
640
+ return;
641
+ }
642
+ this.setStyle(style);
643
+ this.drawGeometry(geometry);
644
+ }
645
+
646
+ /**
647
+ * Render a GeometryCollection to the canvas. Rendering is immediate and
648
+ * uses the current styles appropriate for each geometry in the collection.
649
+ *
650
+ * @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
651
+ * @override
652
+ */
653
+ drawGeometryCollection(geometry) {
654
+ const geometries = geometry.getGeometriesArray();
655
+ for (let i = 0, ii = geometries.length; i < ii; ++i) {
656
+ this.drawGeometry(geometries[i]);
657
+ }
658
+ }
659
+
660
+ /**
661
+ * Render a Point geometry into the canvas. Rendering is immediate and uses
662
+ * the current style.
663
+ *
664
+ * @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
665
+ * @override
666
+ */
667
+ drawPoint(geometry) {
668
+ if (this.squaredTolerance_) {
669
+ geometry = /** @type {import("../../geom/Point.js").default} */ (
670
+ geometry.simplifyTransformed(
671
+ this.squaredTolerance_,
672
+ this.userTransform_,
673
+ )
674
+ );
675
+ }
676
+ const flatCoordinates = geometry.getFlatCoordinates();
677
+ const stride = geometry.getStride();
678
+ if (this.image_) {
679
+ this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
680
+ }
681
+ if (this.text_ !== '') {
682
+ this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);
683
+ }
684
+ }
685
+
686
+ /**
687
+ * Render a MultiPoint geometry into the canvas. Rendering is immediate and
688
+ * uses the current style.
689
+ *
690
+ * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
691
+ * @override
692
+ */
693
+ drawMultiPoint(geometry) {
694
+ if (this.squaredTolerance_) {
695
+ geometry = /** @type {import("../../geom/MultiPoint.js").default} */ (
696
+ geometry.simplifyTransformed(
697
+ this.squaredTolerance_,
698
+ this.userTransform_,
699
+ )
700
+ );
701
+ }
702
+ const flatCoordinates = geometry.getFlatCoordinates();
703
+ const stride = geometry.getStride();
704
+ if (this.image_) {
705
+ this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
706
+ }
707
+ if (this.text_ !== '') {
708
+ this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);
709
+ }
710
+ }
711
+
712
+ /**
713
+ * Render a LineString into the canvas. Rendering is immediate and uses
714
+ * the current style.
715
+ *
716
+ * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
717
+ * @override
718
+ */
719
+ drawLineString(geometry) {
720
+ if (this.squaredTolerance_) {
721
+ geometry = /** @type {import("../../geom/LineString.js").default} */ (
722
+ geometry.simplifyTransformed(
723
+ this.squaredTolerance_,
724
+ this.userTransform_,
725
+ )
726
+ );
727
+ }
728
+ if (!(0,_extent_js__WEBPACK_IMPORTED_MODULE_4__.intersects)(this.extent_, geometry.getExtent())) {
729
+ return;
730
+ }
731
+ if (this.strokeState_) {
732
+ this.setContextStrokeState_(this.strokeState_);
733
+ const context = this.context_;
734
+ const flatCoordinates = geometry.getFlatCoordinates();
735
+ context.beginPath();
736
+ this.moveToLineTo_(
737
+ flatCoordinates,
738
+ 0,
739
+ flatCoordinates.length,
740
+ geometry.getStride(),
741
+ false,
742
+ );
743
+ context.stroke();
744
+ }
745
+ if (this.text_ !== '') {
746
+ const flatMidpoint = geometry.getFlatMidpoint();
747
+ this.drawText_(flatMidpoint, 0, 2, 2);
748
+ }
749
+ }
750
+
751
+ /**
752
+ * Render a MultiLineString geometry into the canvas. Rendering is immediate
753
+ * and uses the current style.
754
+ *
755
+ * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
756
+ * @override
757
+ */
758
+ drawMultiLineString(geometry) {
759
+ if (this.squaredTolerance_) {
760
+ geometry =
761
+ /** @type {import("../../geom/MultiLineString.js").default} */ (
762
+ geometry.simplifyTransformed(
763
+ this.squaredTolerance_,
764
+ this.userTransform_,
765
+ )
766
+ );
767
+ }
768
+ const geometryExtent = geometry.getExtent();
769
+ if (!(0,_extent_js__WEBPACK_IMPORTED_MODULE_4__.intersects)(this.extent_, geometryExtent)) {
770
+ return;
771
+ }
772
+ if (this.strokeState_) {
773
+ this.setContextStrokeState_(this.strokeState_);
774
+ const context = this.context_;
775
+ const flatCoordinates = geometry.getFlatCoordinates();
776
+ let offset = 0;
777
+ const ends = /** @type {Array<number>} */ (geometry.getEnds());
778
+ const stride = geometry.getStride();
779
+ context.beginPath();
780
+ for (let i = 0, ii = ends.length; i < ii; ++i) {
781
+ offset = this.moveToLineTo_(
782
+ flatCoordinates,
783
+ offset,
784
+ ends[i],
785
+ stride,
786
+ false,
787
+ );
788
+ }
789
+ context.stroke();
790
+ }
791
+ if (this.text_ !== '') {
792
+ const flatMidpoints = geometry.getFlatMidpoints();
793
+ this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2);
794
+ }
795
+ }
796
+
797
+ /**
798
+ * Render a Polygon geometry into the canvas. Rendering is immediate and uses
799
+ * the current style.
800
+ *
801
+ * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
802
+ * @override
803
+ */
804
+ drawPolygon(geometry) {
805
+ if (this.squaredTolerance_) {
806
+ geometry = /** @type {import("../../geom/Polygon.js").default} */ (
807
+ geometry.simplifyTransformed(
808
+ this.squaredTolerance_,
809
+ this.userTransform_,
810
+ )
811
+ );
812
+ }
813
+ if (!(0,_extent_js__WEBPACK_IMPORTED_MODULE_4__.intersects)(this.extent_, geometry.getExtent())) {
814
+ return;
815
+ }
816
+ if (this.strokeState_ || this.fillState_) {
817
+ if (this.fillState_) {
818
+ this.setContextFillState_(this.fillState_);
819
+ }
820
+ if (this.strokeState_) {
821
+ this.setContextStrokeState_(this.strokeState_);
822
+ }
823
+ const context = this.context_;
824
+ context.beginPath();
825
+ this.drawRings_(
826
+ geometry.getOrientedFlatCoordinates(),
827
+ 0,
828
+ /** @type {Array<number>} */ (geometry.getEnds()),
829
+ geometry.getStride(),
830
+ );
831
+ if (this.fillState_) {
832
+ context.fill();
833
+ }
834
+ if (this.strokeState_) {
835
+ context.stroke();
836
+ }
837
+ }
838
+ if (this.text_ !== '') {
839
+ const flatInteriorPoint = geometry.getFlatInteriorPoint();
840
+ this.drawText_(flatInteriorPoint, 0, 2, 2);
841
+ }
842
+ }
843
+
844
+ /**
845
+ * Render MultiPolygon geometry into the canvas. Rendering is immediate and
846
+ * uses the current style.
847
+ * @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
848
+ * @override
849
+ */
850
+ drawMultiPolygon(geometry) {
851
+ if (this.squaredTolerance_) {
852
+ geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (
853
+ geometry.simplifyTransformed(
854
+ this.squaredTolerance_,
855
+ this.userTransform_,
856
+ )
857
+ );
858
+ }
859
+ if (!(0,_extent_js__WEBPACK_IMPORTED_MODULE_4__.intersects)(this.extent_, geometry.getExtent())) {
860
+ return;
861
+ }
862
+ if (this.strokeState_ || this.fillState_) {
863
+ if (this.fillState_) {
864
+ this.setContextFillState_(this.fillState_);
865
+ }
866
+ if (this.strokeState_) {
867
+ this.setContextStrokeState_(this.strokeState_);
868
+ }
869
+ const context = this.context_;
870
+ const flatCoordinates = geometry.getOrientedFlatCoordinates();
871
+ let offset = 0;
872
+ const endss = geometry.getEndss();
873
+ const stride = geometry.getStride();
874
+ context.beginPath();
875
+ for (let i = 0, ii = endss.length; i < ii; ++i) {
876
+ const ends = endss[i];
877
+ offset = this.drawRings_(flatCoordinates, offset, ends, stride);
878
+ }
879
+ if (this.fillState_) {
880
+ context.fill();
881
+ }
882
+ if (this.strokeState_) {
883
+ context.stroke();
884
+ }
885
+ }
886
+ if (this.text_ !== '') {
887
+ const flatInteriorPoints = geometry.getFlatInteriorPoints();
888
+ this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2);
889
+ }
890
+ }
891
+
892
+ /**
893
+ * @param {import("../canvas.js").FillState} fillState Fill state.
894
+ * @private
895
+ */
896
+ setContextFillState_(fillState) {
897
+ const context = this.context_;
898
+ const contextFillState = this.contextFillState_;
899
+ if (!contextFillState) {
900
+ context.fillStyle = fillState.fillStyle;
901
+ this.contextFillState_ = {
902
+ fillStyle: fillState.fillStyle,
903
+ };
904
+ } else {
905
+ if (contextFillState.fillStyle != fillState.fillStyle) {
906
+ contextFillState.fillStyle = fillState.fillStyle;
907
+ context.fillStyle = fillState.fillStyle;
908
+ }
909
+ }
910
+ }
911
+
912
+ /**
913
+ * @param {import("../canvas.js").StrokeState} strokeState Stroke state.
914
+ * @private
915
+ */
916
+ setContextStrokeState_(strokeState) {
917
+ const context = this.context_;
918
+ const contextStrokeState = this.contextStrokeState_;
919
+ if (!contextStrokeState) {
920
+ context.lineCap = strokeState.lineCap;
921
+ context.setLineDash(strokeState.lineDash);
922
+ context.lineDashOffset = strokeState.lineDashOffset;
923
+ context.lineJoin = strokeState.lineJoin;
924
+ context.lineWidth = strokeState.lineWidth;
925
+ context.miterLimit = strokeState.miterLimit;
926
+ context.strokeStyle = strokeState.strokeStyle;
927
+ this.contextStrokeState_ = {
928
+ lineCap: strokeState.lineCap,
929
+ lineDash: strokeState.lineDash,
930
+ lineDashOffset: strokeState.lineDashOffset,
931
+ lineJoin: strokeState.lineJoin,
932
+ lineWidth: strokeState.lineWidth,
933
+ miterLimit: strokeState.miterLimit,
934
+ strokeStyle: strokeState.strokeStyle,
935
+ };
936
+ } else {
937
+ if (contextStrokeState.lineCap != strokeState.lineCap) {
938
+ contextStrokeState.lineCap = strokeState.lineCap;
939
+ context.lineCap = strokeState.lineCap;
940
+ }
941
+ if (!(0,_array_js__WEBPACK_IMPORTED_MODULE_6__.equals)(contextStrokeState.lineDash, strokeState.lineDash)) {
942
+ context.setLineDash(
943
+ (contextStrokeState.lineDash = strokeState.lineDash),
944
+ );
945
+ }
946
+ if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {
947
+ contextStrokeState.lineDashOffset = strokeState.lineDashOffset;
948
+ context.lineDashOffset = strokeState.lineDashOffset;
949
+ }
950
+ if (contextStrokeState.lineJoin != strokeState.lineJoin) {
951
+ contextStrokeState.lineJoin = strokeState.lineJoin;
952
+ context.lineJoin = strokeState.lineJoin;
953
+ }
954
+ if (contextStrokeState.lineWidth != strokeState.lineWidth) {
955
+ contextStrokeState.lineWidth = strokeState.lineWidth;
956
+ context.lineWidth = strokeState.lineWidth;
957
+ }
958
+ if (contextStrokeState.miterLimit != strokeState.miterLimit) {
959
+ contextStrokeState.miterLimit = strokeState.miterLimit;
960
+ context.miterLimit = strokeState.miterLimit;
961
+ }
962
+ if (contextStrokeState.strokeStyle != strokeState.strokeStyle) {
963
+ contextStrokeState.strokeStyle = strokeState.strokeStyle;
964
+ context.strokeStyle = strokeState.strokeStyle;
965
+ }
966
+ }
967
+ }
968
+
969
+ /**
970
+ * @param {import("../canvas.js").TextState} textState Text state.
971
+ * @private
972
+ */
973
+ setContextTextState_(textState) {
974
+ const context = this.context_;
975
+ const contextTextState = this.contextTextState_;
976
+ const textAlign = textState.textAlign
977
+ ? textState.textAlign
978
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultTextAlign;
979
+ if (!contextTextState) {
980
+ context.font = textState.font;
981
+ context.textAlign = textAlign;
982
+ context.textBaseline = textState.textBaseline;
983
+ this.contextTextState_ = {
984
+ font: textState.font,
985
+ textAlign: textAlign,
986
+ textBaseline: textState.textBaseline,
987
+ };
988
+ } else {
989
+ if (contextTextState.font != textState.font) {
990
+ contextTextState.font = textState.font;
991
+ context.font = textState.font;
992
+ }
993
+ if (contextTextState.textAlign != textAlign) {
994
+ contextTextState.textAlign = textAlign;
995
+ context.textAlign = textAlign;
996
+ }
997
+ if (contextTextState.textBaseline != textState.textBaseline) {
998
+ contextTextState.textBaseline = textState.textBaseline;
999
+ context.textBaseline = textState.textBaseline;
1000
+ }
1001
+ }
1002
+ }
1003
+
1004
+ /**
1005
+ * Set the fill and stroke style for subsequent draw operations. To clear
1006
+ * either fill or stroke styles, pass null for the appropriate parameter.
1007
+ *
1008
+ * @param {import("../../style/Fill.js").default} fillStyle Fill style.
1009
+ * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
1010
+ * @override
1011
+ */
1012
+ setFillStrokeStyle(fillStyle, strokeStyle) {
1013
+ if (!fillStyle) {
1014
+ this.fillState_ = null;
1015
+ } else {
1016
+ const fillStyleColor = fillStyle.getColor();
1017
+ this.fillState_ = {
1018
+ fillStyle: (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_8__.asColorLike)(
1019
+ fillStyleColor ? fillStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultFillStyle,
1020
+ ),
1021
+ };
1022
+ }
1023
+ if (!strokeStyle) {
1024
+ this.strokeState_ = null;
1025
+ } else {
1026
+ const strokeStyleColor = strokeStyle.getColor();
1027
+ const strokeStyleLineCap = strokeStyle.getLineCap();
1028
+ const strokeStyleLineDash = strokeStyle.getLineDash();
1029
+ const strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
1030
+ const strokeStyleLineJoin = strokeStyle.getLineJoin();
1031
+ const strokeStyleWidth = strokeStyle.getWidth();
1032
+ const strokeStyleMiterLimit = strokeStyle.getMiterLimit();
1033
+ const lineDash = strokeStyleLineDash
1034
+ ? strokeStyleLineDash
1035
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineDash;
1036
+ this.strokeState_ = {
1037
+ lineCap:
1038
+ strokeStyleLineCap !== undefined
1039
+ ? strokeStyleLineCap
1040
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineCap,
1041
+ lineDash:
1042
+ this.pixelRatio_ === 1
1043
+ ? lineDash
1044
+ : lineDash.map((n) => n * this.pixelRatio_),
1045
+ lineDashOffset:
1046
+ (strokeStyleLineDashOffset
1047
+ ? strokeStyleLineDashOffset
1048
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineDashOffset) * this.pixelRatio_,
1049
+ lineJoin:
1050
+ strokeStyleLineJoin !== undefined
1051
+ ? strokeStyleLineJoin
1052
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineJoin,
1053
+ lineWidth:
1054
+ (strokeStyleWidth !== undefined
1055
+ ? strokeStyleWidth
1056
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineWidth) * this.pixelRatio_,
1057
+ miterLimit:
1058
+ strokeStyleMiterLimit !== undefined
1059
+ ? strokeStyleMiterLimit
1060
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultMiterLimit,
1061
+ strokeStyle: (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_8__.asColorLike)(
1062
+ strokeStyleColor ? strokeStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultStrokeStyle,
1063
+ ),
1064
+ };
1065
+ }
1066
+ }
1067
+
1068
+ /**
1069
+ * Set the image style for subsequent draw operations. Pass null to remove
1070
+ * the image style.
1071
+ *
1072
+ * @param {import("../../style/Image.js").default} imageStyle Image style.
1073
+ * @override
1074
+ */
1075
+ setImageStyle(imageStyle) {
1076
+ let imageSize;
1077
+ if (!imageStyle || !(imageSize = imageStyle.getSize())) {
1078
+ this.image_ = null;
1079
+ return;
1080
+ }
1081
+ const imagePixelRatio = imageStyle.getPixelRatio(this.pixelRatio_);
1082
+ const imageAnchor = imageStyle.getAnchor();
1083
+ const imageOrigin = imageStyle.getOrigin();
1084
+ this.image_ = imageStyle.getImage(this.pixelRatio_);
1085
+ this.imageAnchorX_ = imageAnchor[0] * imagePixelRatio;
1086
+ this.imageAnchorY_ = imageAnchor[1] * imagePixelRatio;
1087
+ this.imageHeight_ = imageSize[1] * imagePixelRatio;
1088
+ this.imageOpacity_ = imageStyle.getOpacity();
1089
+ this.imageOriginX_ = imageOrigin[0];
1090
+ this.imageOriginY_ = imageOrigin[1];
1091
+ this.imageRotateWithView_ = imageStyle.getRotateWithView();
1092
+ this.imageRotation_ = imageStyle.getRotation();
1093
+ const imageScale = imageStyle.getScaleArray();
1094
+ this.imageScale_ = [
1095
+ (imageScale[0] * this.pixelRatio_) / imagePixelRatio,
1096
+ (imageScale[1] * this.pixelRatio_) / imagePixelRatio,
1097
+ ];
1098
+ this.imageWidth_ = imageSize[0] * imagePixelRatio;
1099
+ }
1100
+
1101
+ /**
1102
+ * Set the text style for subsequent draw operations. Pass null to
1103
+ * remove the text style.
1104
+ *
1105
+ * @param {import("../../style/Text.js").default} textStyle Text style.
1106
+ * @override
1107
+ */
1108
+ setTextStyle(textStyle) {
1109
+ if (!textStyle) {
1110
+ this.text_ = '';
1111
+ } else {
1112
+ const textFillStyle = textStyle.getFill();
1113
+ if (!textFillStyle) {
1114
+ this.textFillState_ = null;
1115
+ } else {
1116
+ const textFillStyleColor = textFillStyle.getColor();
1117
+ this.textFillState_ = {
1118
+ fillStyle: (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_8__.asColorLike)(
1119
+ textFillStyleColor ? textFillStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultFillStyle,
1120
+ ),
1121
+ };
1122
+ }
1123
+ const textStrokeStyle = textStyle.getStroke();
1124
+ if (!textStrokeStyle) {
1125
+ this.textStrokeState_ = null;
1126
+ } else {
1127
+ const textStrokeStyleColor = textStrokeStyle.getColor();
1128
+ const textStrokeStyleLineCap = textStrokeStyle.getLineCap();
1129
+ const textStrokeStyleLineDash = textStrokeStyle.getLineDash();
1130
+ const textStrokeStyleLineDashOffset =
1131
+ textStrokeStyle.getLineDashOffset();
1132
+ const textStrokeStyleLineJoin = textStrokeStyle.getLineJoin();
1133
+ const textStrokeStyleWidth = textStrokeStyle.getWidth();
1134
+ const textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();
1135
+ this.textStrokeState_ = {
1136
+ lineCap:
1137
+ textStrokeStyleLineCap !== undefined
1138
+ ? textStrokeStyleLineCap
1139
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineCap,
1140
+ lineDash: textStrokeStyleLineDash
1141
+ ? textStrokeStyleLineDash
1142
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineDash,
1143
+ lineDashOffset: textStrokeStyleLineDashOffset
1144
+ ? textStrokeStyleLineDashOffset
1145
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineDashOffset,
1146
+ lineJoin:
1147
+ textStrokeStyleLineJoin !== undefined
1148
+ ? textStrokeStyleLineJoin
1149
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineJoin,
1150
+ lineWidth:
1151
+ textStrokeStyleWidth !== undefined
1152
+ ? textStrokeStyleWidth
1153
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultLineWidth,
1154
+ miterLimit:
1155
+ textStrokeStyleMiterLimit !== undefined
1156
+ ? textStrokeStyleMiterLimit
1157
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultMiterLimit,
1158
+ strokeStyle: (0,_colorlike_js__WEBPACK_IMPORTED_MODULE_8__.asColorLike)(
1159
+ textStrokeStyleColor ? textStrokeStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultStrokeStyle,
1160
+ ),
1161
+ };
1162
+ }
1163
+ const textFont = textStyle.getFont();
1164
+ const textOffsetX = textStyle.getOffsetX();
1165
+ const textOffsetY = textStyle.getOffsetY();
1166
+ const textRotateWithView = textStyle.getRotateWithView();
1167
+ const textRotation = textStyle.getRotation();
1168
+ const textScale = textStyle.getScaleArray();
1169
+ const textText = textStyle.getText();
1170
+ const textTextAlign = textStyle.getTextAlign();
1171
+ const textTextBaseline = textStyle.getTextBaseline();
1172
+ this.textState_ = {
1173
+ font: textFont !== undefined ? textFont : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultFont,
1174
+ textAlign:
1175
+ textTextAlign !== undefined ? textTextAlign : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultTextAlign,
1176
+ textBaseline:
1177
+ textTextBaseline !== undefined
1178
+ ? textTextBaseline
1179
+ : _canvas_js__WEBPACK_IMPORTED_MODULE_7__.defaultTextBaseline,
1180
+ };
1181
+ this.text_ =
1182
+ textText !== undefined
1183
+ ? Array.isArray(textText)
1184
+ ? textText.reduce((acc, t, i) => (acc += i % 2 ? ' ' : t), '')
1185
+ : textText
1186
+ : '';
1187
+ this.textOffsetX_ =
1188
+ textOffsetX !== undefined ? this.pixelRatio_ * textOffsetX : 0;
1189
+ this.textOffsetY_ =
1190
+ textOffsetY !== undefined ? this.pixelRatio_ * textOffsetY : 0;
1191
+ this.textRotateWithView_ =
1192
+ textRotateWithView !== undefined ? textRotateWithView : false;
1193
+ this.textRotation_ = textRotation !== undefined ? textRotation : 0;
1194
+ this.textScale_ = [
1195
+ this.pixelRatio_ * textScale[0],
1196
+ this.pixelRatio_ * textScale[1],
1197
+ ];
1198
+ }
1199
+ }
1200
+ }
1201
+
1202
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CanvasImmediateRenderer);
1203
+
1204
+
1205
+ /***/ })
1206
+
1207
+ }])
1208
+ //# sourceMappingURL=vendors-node_modules_ol_render_canvas_Immediate_js.js.map