@vtx/ol-map 1.0.165 → 1.0.167

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.
@@ -0,0 +1,438 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _layer = require("ol/layer");
8
+ var _source = require("ol/source");
9
+ var _Style = _interopRequireDefault(require("ol/style/Style"));
10
+ var _Stroke = _interopRequireDefault(require("ol/style/Stroke"));
11
+ var _transform = require("ol/transform");
12
+ var _createFeatureCollection = require("../feature-layer/createFeatureCollection");
13
+ var _sampleArrowsAlongLine = require("./sampleArrowsAlongLine");
14
+ var _arrow = _interopRequireDefault(require("../assets/arrow.png"));
15
+ var _excluded = ["data", "features", "key", "name", "map", "lineStyle", "arrowStyle", "flowSpeed", "flowCycleSeconds", "minZoomForFlow", "maxArrowsPerLine", "zIndex", "show", "layerControl", "legend"];
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
17
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
18
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
21
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
22
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
23
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
24
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
25
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
26
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
27
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
28
+ var defaultLineStroke = {
29
+ color: 'rgba(36, 145, 252, 0.95)',
30
+ width: 3
31
+ };
32
+
33
+ /**
34
+ * 未配置 flowCycleSeconds 时:周期(秒) = BASE_CYCLE_SEC / flowSpeed,flowSpeed 越大越快。
35
+ */
36
+ var DEFAULT_BASE_CYCLE_SEC = 6;
37
+ var DEFAULT_FLOW_SPEED = 1;
38
+
39
+ /** 流动刷新间隔(ms),整图 render 上限约 1000/此值 fps;略大更省性能 */
40
+ var DEFAULT_FLOW_RENDER_MS = 33;
41
+
42
+ /** 未传 src 时与 PathLineLayer 共用 arrow.png;src 为 null / '' 则仅用 Canvas 描边箭头 */
43
+ function resolveArrowBitmapSrc(arrowStyle) {
44
+ if (!arrowStyle) {
45
+ return _arrow["default"];
46
+ }
47
+ var s = arrowStyle.src;
48
+ if (s === null || s === '') {
49
+ return null;
50
+ }
51
+ if (s === undefined) {
52
+ return _arrow["default"];
53
+ }
54
+ return s;
55
+ }
56
+
57
+ /** Canvas 描边「>」形,圆角端点与连接,形态对齐 components/assets/arrow.png */
58
+ function drawChevronArrow(ctx, color, headLen, headWidth, lineW, strokeWidthOpt) {
59
+ var strokeW = strokeWidthOpt != null ? strokeWidthOpt : lineW >= 1.5 ? lineW : Math.max(2.25, headWidth * 0.52);
60
+ var tipX = headLen * 0.88;
61
+ var backX = -headLen * 0.38;
62
+ var wingY = headWidth * 0.52;
63
+ ctx.strokeStyle = color;
64
+ ctx.lineWidth = strokeW;
65
+ ctx.lineCap = 'round';
66
+ ctx.lineJoin = 'round';
67
+ ctx.beginPath();
68
+ ctx.moveTo(backX, -wingY);
69
+ ctx.lineTo(tipX, 0);
70
+ ctx.lineTo(backX, wingY);
71
+ ctx.stroke();
72
+ }
73
+
74
+ /**
75
+ * 轨迹箭头流动图层(组合模式,对齐 FlyLineLayer):
76
+ * 内部为标准 ol VectorLayer,避免「继承 VectorLayer」在部分环境下与 OL 渲染路径不一致;
77
+ * OL 在 replay 为空时会跳过 postRender,普通矢量线图层与 FlyLine 一致可稳定触发 postrender。
78
+ */
79
+ var ArrowFlowLayer = exports["default"] = /*#__PURE__*/function () {
80
+ function ArrowFlowLayer(options) {
81
+ var _ref, _arrowStyle$spacingPx;
82
+ _classCallCheck(this, ArrowFlowLayer);
83
+ var data = options.data,
84
+ features = options.features,
85
+ key = options.key,
86
+ name = options.name,
87
+ map = options.map,
88
+ _options$lineStyle = options.lineStyle,
89
+ lineStyle = _options$lineStyle === void 0 ? {} : _options$lineStyle,
90
+ _options$arrowStyle = options.arrowStyle,
91
+ arrowStyle = _options$arrowStyle === void 0 ? {} : _options$arrowStyle,
92
+ flowSpeedOption = options.flowSpeed,
93
+ flowCycleSecondsOption = options.flowCycleSeconds,
94
+ minZoomForFlowOption = options.minZoomForFlow,
95
+ _options$maxArrowsPer = options.maxArrowsPerLine,
96
+ maxArrowsPerLine = _options$maxArrowsPer === void 0 ? 500 : _options$maxArrowsPer,
97
+ zIndex = options.zIndex,
98
+ _options$show = options.show,
99
+ show = _options$show === void 0 ? true : _options$show,
100
+ _options$layerControl = options.layerControl,
101
+ layerControl = _options$layerControl === void 0 ? true : _options$layerControl,
102
+ legend = options.legend,
103
+ rest = _objectWithoutProperties(options, _excluded);
104
+ var source = new _source.Vector(features ? {
105
+ features: features
106
+ } : {});
107
+ this.vectorLayer = new _layer.Vector(_objectSpread(_objectSpread({}, rest), {}, {
108
+ source: source,
109
+ style: new _Style["default"]({
110
+ stroke: new _Stroke["default"](_objectSpread(_objectSpread({}, defaultLineStroke), lineStyle))
111
+ }),
112
+ zIndex: zIndex,
113
+ updateWhileAnimating: true,
114
+ updateWhileInteracting: true
115
+ }));
116
+ this.vectorLayer.key = key;
117
+ this.vectorLayer.name = name;
118
+ this.vectorLayer.layerControl = layerControl;
119
+ this.vectorLayer.legend = legend;
120
+ this.vectorLayer.show = show;
121
+ this.key = key;
122
+ this.name = name;
123
+ this.map = map;
124
+ this.layerControl = layerControl;
125
+ this.legend = legend;
126
+ this.show = show;
127
+ this._lineStyleOptions = lineStyle;
128
+ this._arrowStyle = arrowStyle;
129
+ this.maxArrowsPerLine = maxArrowsPerLine;
130
+ this.spacingPx = (_ref = (_arrowStyle$spacingPx = arrowStyle.spacingPx) !== null && _arrowStyle$spacingPx !== void 0 ? _arrowStyle$spacingPx : arrowStyle.spacing) !== null && _ref !== void 0 ? _ref : 80;
131
+ this.flowSpeed = arrowStyle.flowSpeed != null ? arrowStyle.flowSpeed : flowSpeedOption != null ? flowSpeedOption : DEFAULT_FLOW_SPEED;
132
+ this._flowPerfOrigin = null;
133
+ this.flowCycleSeconds = arrowStyle.flowCycleSeconds != null ? arrowStyle.flowCycleSeconds : flowCycleSecondsOption != null ? flowCycleSecondsOption : null;
134
+ this.flowRenderMinIntervalMs = arrowStyle.flowRenderMinIntervalMs != null ? arrowStyle.flowRenderMinIntervalMs : DEFAULT_FLOW_RENDER_MS;
135
+ this.minZoomForFlow = arrowStyle.minZoomForFlow != null ? arrowStyle.minZoomForFlow : minZoomForFlowOption != null ? minZoomForFlowOption : null;
136
+ this._flowDriverId = null;
137
+ this._onViewResolutionChange = this._syncFlowDriverToZoom.bind(this);
138
+ if (this.map) {
139
+ var view = this.map.getView();
140
+ if (view) {
141
+ view.on('change:resolution', this._onViewResolutionChange);
142
+ }
143
+ }
144
+ this._arrowImage = null;
145
+ this._arrowImageSrc = null;
146
+ this._onPostRender = this.onPostRender.bind(this);
147
+ this.vectorLayer.on('postrender', this._onPostRender);
148
+ this._loadArrowImageFromStyle(arrowStyle);
149
+ if (data) {
150
+ this.loadData(data);
151
+ }
152
+ this.vectorLayer.setVisible(show);
153
+ this._syncFlowDriverToZoom();
154
+ }
155
+
156
+ /** 当前缩放是否达到展示流动箭头的层级(未配置阈值则始终为 true) */
157
+ return _createClass(ArrowFlowLayer, [{
158
+ key: "_flowZoomSufficient",
159
+ value: function _flowZoomSufficient() {
160
+ if (this.minZoomForFlow == null) {
161
+ return true;
162
+ }
163
+ var view = this.map && this.map.getView();
164
+ if (!view) {
165
+ return true;
166
+ }
167
+ var z = view.getZoom();
168
+ if (z == null || Number.isNaN(z)) {
169
+ return true;
170
+ }
171
+ return z >= this.minZoomForFlow;
172
+ }
173
+ }, {
174
+ key: "_shouldRunFlowDriver",
175
+ value: function _shouldRunFlowDriver() {
176
+ return this.show && this.vectorLayer.getVisible() && this._flowZoomSufficient();
177
+ }
178
+ }, {
179
+ key: "_syncFlowDriverToZoom",
180
+ value: function _syncFlowDriverToZoom() {
181
+ if (this._shouldRunFlowDriver()) {
182
+ this._startFlowDriver();
183
+ } else {
184
+ this._stopFlowDriver();
185
+ if (this.map && this.show && this.vectorLayer.getVisible()) {
186
+ this.map.render();
187
+ }
188
+ }
189
+ }
190
+ }, {
191
+ key: "_startFlowDriver",
192
+ value: function _startFlowDriver() {
193
+ var _this = this;
194
+ if (this._flowDriverId != null || !this.map) {
195
+ return;
196
+ }
197
+ if (!this._shouldRunFlowDriver()) {
198
+ return;
199
+ }
200
+ if (this.vectorLayer.getVisible()) {
201
+ this.map.render();
202
+ }
203
+ this._flowDriverId = setInterval(function () {
204
+ if (!_this._shouldRunFlowDriver()) {
205
+ _this._stopFlowDriver();
206
+ if (_this.map && _this.show && _this.vectorLayer.getVisible()) {
207
+ _this.map.render();
208
+ }
209
+ return;
210
+ }
211
+ _this.map.render();
212
+ }, this.flowRenderMinIntervalMs);
213
+ }
214
+ }, {
215
+ key: "_stopFlowDriver",
216
+ value: function _stopFlowDriver() {
217
+ if (this._flowDriverId != null) {
218
+ clearInterval(this._flowDriverId);
219
+ this._flowDriverId = null;
220
+ }
221
+ }
222
+ }, {
223
+ key: "_restartFlowDriver",
224
+ value: function _restartFlowDriver() {
225
+ this._stopFlowDriver();
226
+ this._syncFlowDriverToZoom();
227
+ }
228
+ }, {
229
+ key: "getSource",
230
+ value: function getSource() {
231
+ return this.vectorLayer.getSource();
232
+ }
233
+ }, {
234
+ key: "setVisible",
235
+ value: function setVisible(value) {
236
+ this.vectorLayer.setVisible(value);
237
+ }
238
+ }, {
239
+ key: "getVisible",
240
+ value: function getVisible() {
241
+ return this.vectorLayer.getVisible();
242
+ }
243
+ }, {
244
+ key: "_loadArrowImageFromStyle",
245
+ value: function _loadArrowImageFromStyle(arrowStyle) {
246
+ var _this2 = this;
247
+ var src = resolveArrowBitmapSrc(arrowStyle || {});
248
+ if (!src) {
249
+ this._arrowImage = null;
250
+ this._arrowImageSrc = null;
251
+ return;
252
+ }
253
+ if (src === this._arrowImageSrc) {
254
+ return;
255
+ }
256
+ this._arrowImageSrc = src;
257
+ this._arrowImage = null;
258
+ var img = new Image();
259
+ img.crossOrigin = 'anonymous';
260
+ img.onload = function () {
261
+ _this2._arrowImage = img;
262
+ if (_this2.map) {
263
+ _this2.map.render();
264
+ }
265
+ };
266
+ img.onerror = function () {
267
+ _this2._arrowImage = null;
268
+ };
269
+ img.src = src;
270
+ }
271
+ }, {
272
+ key: "setShow",
273
+ value: function setShow(value) {
274
+ this.show = value;
275
+ this.vectorLayer.show = value;
276
+ this.vectorLayer.setVisible(value);
277
+ if (!value) {
278
+ this._flowPerfOrigin = null;
279
+ this._stopFlowDriver();
280
+ } else {
281
+ this._syncFlowDriverToZoom();
282
+ }
283
+ }
284
+ }, {
285
+ key: "setLineStyle",
286
+ value: function setLineStyle(lineStyle) {
287
+ this._lineStyleOptions = lineStyle || {};
288
+ this.vectorLayer.setStyle(new _Style["default"]({
289
+ stroke: new _Stroke["default"](_objectSpread(_objectSpread({}, defaultLineStroke), this._lineStyleOptions))
290
+ }));
291
+ }
292
+ }, {
293
+ key: "setArrowStyle",
294
+ value: function setArrowStyle(arrowStyle) {
295
+ this._arrowStyle = arrowStyle || {};
296
+ if (arrowStyle) {
297
+ if (arrowStyle.spacingPx != null || arrowStyle.spacing != null) {
298
+ var _ref2, _arrowStyle$spacingPx2;
299
+ this.spacingPx = (_ref2 = (_arrowStyle$spacingPx2 = arrowStyle.spacingPx) !== null && _arrowStyle$spacingPx2 !== void 0 ? _arrowStyle$spacingPx2 : arrowStyle.spacing) !== null && _ref2 !== void 0 ? _ref2 : this.spacingPx;
300
+ }
301
+ if (arrowStyle.flowSpeed != null) {
302
+ this.flowSpeed = arrowStyle.flowSpeed;
303
+ }
304
+ if (arrowStyle.flowCycleSeconds !== undefined) {
305
+ this.flowCycleSeconds = arrowStyle.flowCycleSeconds;
306
+ }
307
+ if (arrowStyle.flowRenderMinIntervalMs != null) {
308
+ this.flowRenderMinIntervalMs = arrowStyle.flowRenderMinIntervalMs;
309
+ this._restartFlowDriver();
310
+ }
311
+ if (arrowStyle.minZoomForFlow !== undefined) {
312
+ this.minZoomForFlow = arrowStyle.minZoomForFlow;
313
+ this._syncFlowDriverToZoom();
314
+ }
315
+ }
316
+ this._loadArrowImageFromStyle(arrowStyle || {});
317
+ }
318
+ }, {
319
+ key: "loadData",
320
+ value: function loadData(data) {
321
+ this.getSource().clear();
322
+ var fs = (0, _createFeatureCollection.createGeoJson)(data);
323
+ if (fs && fs.length) {
324
+ this.getSource().addFeatures(fs);
325
+ }
326
+ }
327
+ }, {
328
+ key: "loadFeatures",
329
+ value: function loadFeatures(featureList) {
330
+ this.getSource().clear();
331
+ if (featureList && featureList.length) {
332
+ this.getSource().addFeatures(featureList);
333
+ }
334
+ }
335
+ }, {
336
+ key: "onPostRender",
337
+ value: function onPostRender(event) {
338
+ var _as$headLength, _as$headWidth, _as$lineWidth;
339
+ var ctx = event.context;
340
+ if (!ctx || typeof ctx.save !== 'function') {
341
+ return;
342
+ }
343
+ if (!this.vectorLayer.getVisible()) {
344
+ return;
345
+ }
346
+ if (!this._flowZoomSufficient()) {
347
+ return;
348
+ }
349
+ var frameState = event.frameState;
350
+ if (!frameState || !frameState.viewState) {
351
+ return;
352
+ }
353
+ var resolution = frameState.viewState.resolution;
354
+ var extent = frameState.extent;
355
+ var stepWorld = this.spacingPx * resolution;
356
+ if (stepWorld <= 0) {
357
+ return;
358
+ }
359
+ if (this._flowPerfOrigin == null) {
360
+ this._flowPerfOrigin = performance.now();
361
+ }
362
+ var elapsedMs = performance.now() - this._flowPerfOrigin;
363
+ var cycleSec;
364
+ if (this.flowCycleSeconds != null && this.flowCycleSeconds > 0) {
365
+ cycleSec = this.flowCycleSeconds;
366
+ } else {
367
+ cycleSec = DEFAULT_BASE_CYCLE_SEC / Math.max(0.05, this.flowSpeed);
368
+ }
369
+ var phase = elapsedMs / 1000 % cycleSec / cycleSec * stepWorld;
370
+ var transform = (0, _transform.multiply)(event.inversePixelTransform.slice(), frameState.coordinateToPixelTransform.slice());
371
+ var as = this._arrowStyle || {};
372
+ var color = as.color || '#ffffff';
373
+ var headLen = (_as$headLength = as.headLength) !== null && _as$headLength !== void 0 ? _as$headLength : 10;
374
+ var headWidth = (_as$headWidth = as.headWidth) !== null && _as$headWidth !== void 0 ? _as$headWidth : 7;
375
+ var lineW = (_as$lineWidth = as.lineWidth) !== null && _as$lineWidth !== void 0 ? _as$lineWidth : 1;
376
+ var strokeWidth = as.strokeWidth;
377
+ var opacity = as.opacity != null ? as.opacity : 1;
378
+ var bitmapSrc = resolveArrowBitmapSrc(as);
379
+ var imgScale = as.scale != null ? as.scale : 1;
380
+ var imgWidth = as.imgWidth;
381
+ var imgHeight = as.imgHeight;
382
+ ctx.save();
383
+ ctx.globalAlpha = opacity;
384
+ var features = this.getSource().getFeatures();
385
+ for (var fi = 0; fi < features.length; fi++) {
386
+ var geom = features[fi].getGeometry();
387
+ var lines = (0, _sampleArrowsAlongLine.flattenLineStrings)(geom);
388
+ for (var li = 0; li < lines.length; li++) {
389
+ var line = lines[li];
390
+ var samples = (0, _sampleArrowsAlongLine.sampleArrowsForLineString)(line, extent, {
391
+ stepWorld: stepWorld,
392
+ phase: phase,
393
+ maxArrows: this.maxArrowsPerLine
394
+ });
395
+ for (var si = 0; si < samples.length; si++) {
396
+ var s = samples[si];
397
+ var angle = (0, _sampleArrowsAlongLine.getPixelAngle)(transform, s.c0, s.c1);
398
+ var pt = s.coord.slice();
399
+ (0, _transform.apply)(transform, pt);
400
+ var x = pt[0];
401
+ var y = pt[1];
402
+ if (bitmapSrc && this._arrowImage && this._arrowImage.complete) {
403
+ var w = (imgWidth || this._arrowImage.width) * imgScale;
404
+ var h = (imgHeight || this._arrowImage.height) * imgScale;
405
+ ctx.save();
406
+ ctx.translate(x, y);
407
+ ctx.rotate(angle);
408
+ ctx.drawImage(this._arrowImage, -w / 2, -h / 2, w, h);
409
+ ctx.restore();
410
+ } else if (!bitmapSrc) {
411
+ ctx.save();
412
+ ctx.translate(x, y);
413
+ ctx.rotate(angle);
414
+ drawChevronArrow(ctx, color, headLen, headWidth, lineW, strokeWidth);
415
+ ctx.restore();
416
+ }
417
+ }
418
+ }
419
+ }
420
+ ctx.restore();
421
+ // 不在此处 map.render():会与定时器叠加重绘整图。由 _startFlowDriver 按 flowRenderMinIntervalMs 触发 render。
422
+ }
423
+ }, {
424
+ key: "destroy",
425
+ value: function destroy() {
426
+ this._stopFlowDriver();
427
+ this._flowPerfOrigin = null;
428
+ if (this.map) {
429
+ var view = this.map.getView();
430
+ if (view) {
431
+ view.un('change:resolution', this._onViewResolutionChange);
432
+ }
433
+ }
434
+ this.vectorLayer.un('postrender', this._onPostRender);
435
+ }
436
+ }]);
437
+ }();
438
+ //# sourceMappingURL=ArrowFlowLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrowFlowLayer.js","names":["_layer","require","_source","_Style","_interopRequireDefault","_Stroke","_transform","_createFeatureCollection","_sampleArrowsAlongLine","_arrow","_excluded","e","__esModule","_typeof","o","Symbol","iterator","constructor","prototype","ownKeys","r","t","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_classCallCheck","a","TypeError","_defineProperties","key","_createClass","_toPrimitive","toPrimitive","String","Number","defaultLineStroke","color","width","DEFAULT_BASE_CYCLE_SEC","DEFAULT_FLOW_SPEED","DEFAULT_FLOW_RENDER_MS","resolveArrowBitmapSrc","arrowStyle","defaultArrowSrc","s","src","undefined","drawChevronArrow","ctx","headLen","headWidth","lineW","strokeWidthOpt","strokeW","Math","max","tipX","backX","wingY","strokeStyle","lineWidth","lineCap","lineJoin","beginPath","moveTo","lineTo","stroke","ArrowFlowLayer","exports","options","_ref","_arrowStyle$spacingPx","data","features","name","map","_options$lineStyle","lineStyle","_options$arrowStyle","flowSpeedOption","flowSpeed","flowCycleSecondsOption","flowCycleSeconds","minZoomForFlowOption","minZoomForFlow","_options$maxArrowsPer","maxArrowsPerLine","zIndex","_options$show","show","_options$layerControl","layerControl","legend","rest","source","VectorSource","vectorLayer","VectorLayer","style","Style","Stroke","updateWhileAnimating","updateWhileInteracting","_lineStyleOptions","_arrowStyle","spacingPx","spacing","_flowPerfOrigin","flowRenderMinIntervalMs","_flowDriverId","_onViewResolutionChange","_syncFlowDriverToZoom","bind","view","getView","on","_arrowImage","_arrowImageSrc","_onPostRender","onPostRender","_loadArrowImageFromStyle","loadData","setVisible","_flowZoomSufficient","z","getZoom","isNaN","_shouldRunFlowDriver","getVisible","_startFlowDriver","_stopFlowDriver","render","_this","setInterval","clearInterval","_restartFlowDriver","getSource","_this2","img","Image","crossOrigin","onload","onerror","setShow","setLineStyle","setStyle","setArrowStyle","_ref2","_arrowStyle$spacingPx2","clear","fs","createGeoJson","addFeatures","loadFeatures","featureList","event","_as$headLength","_as$headWidth","_as$lineWidth","context","save","frameState","viewState","resolution","extent","stepWorld","performance","now","elapsedMs","cycleSec","phase","transform","multiply","inversePixelTransform","slice","coordinateToPixelTransform","as","headLength","strokeWidth","opacity","bitmapSrc","imgScale","scale","imgWidth","imgHeight","globalAlpha","getFeatures","fi","geom","getGeometry","lines","flattenLineStrings","li","line","samples","sampleArrowsForLineString","maxArrows","si","angle","getPixelAngle","c0","c1","pt","coord","x","y","complete","w","h","height","translate","rotate","drawImage","restore","destroy","un"],"sources":["arrow-flow-layer/ArrowFlowLayer.js"],"sourcesContent":["import { Vector as VectorLayer } from 'ol/layer';\nimport { Vector as VectorSource } from 'ol/source';\nimport Style from 'ol/style/Style';\nimport Stroke from 'ol/style/Stroke';\nimport { multiply, apply } from 'ol/transform';\nimport { createGeoJson } from '../feature-layer/createFeatureCollection';\nimport {\n flattenLineStrings,\n sampleArrowsForLineString,\n getPixelAngle,\n} from './sampleArrowsAlongLine';\nimport defaultArrowSrc from '../assets/arrow.png';\n\nconst defaultLineStroke = {\n color: 'rgba(36, 145, 252, 0.95)',\n width: 3,\n};\n\n/**\n * 未配置 flowCycleSeconds 时:周期(秒) = BASE_CYCLE_SEC / flowSpeed,flowSpeed 越大越快。\n */\nconst DEFAULT_BASE_CYCLE_SEC = 6;\n\nconst DEFAULT_FLOW_SPEED = 1;\n\n/** 流动刷新间隔(ms),整图 render 上限约 1000/此值 fps;略大更省性能 */\nconst DEFAULT_FLOW_RENDER_MS = 33;\n\n/** 未传 src 时与 PathLineLayer 共用 arrow.png;src 为 null / '' 则仅用 Canvas 描边箭头 */\nfunction resolveArrowBitmapSrc(arrowStyle) {\n if (!arrowStyle) {\n return defaultArrowSrc;\n }\n const s = arrowStyle.src;\n if (s === null || s === '') {\n return null;\n }\n if (s === undefined) {\n return defaultArrowSrc;\n }\n return s;\n}\n\n/** Canvas 描边「>」形,圆角端点与连接,形态对齐 components/assets/arrow.png */\nfunction drawChevronArrow(ctx, color, headLen, headWidth, lineW, strokeWidthOpt) {\n const strokeW =\n strokeWidthOpt != null\n ? strokeWidthOpt\n : lineW >= 1.5\n ? lineW\n : Math.max(2.25, headWidth * 0.52);\n const tipX = headLen * 0.88;\n const backX = -headLen * 0.38;\n const wingY = headWidth * 0.52;\n ctx.strokeStyle = color;\n ctx.lineWidth = strokeW;\n ctx.lineCap = 'round';\n ctx.lineJoin = 'round';\n ctx.beginPath();\n ctx.moveTo(backX, -wingY);\n ctx.lineTo(tipX, 0);\n ctx.lineTo(backX, wingY);\n ctx.stroke();\n}\n\n/**\n * 轨迹箭头流动图层(组合模式,对齐 FlyLineLayer):\n * 内部为标准 ol VectorLayer,避免「继承 VectorLayer」在部分环境下与 OL 渲染路径不一致;\n * OL 在 replay 为空时会跳过 postRender,普通矢量线图层与 FlyLine 一致可稳定触发 postrender。\n */\nexport default class ArrowFlowLayer {\n constructor(options) {\n const {\n data,\n features,\n key,\n name,\n map,\n lineStyle = {},\n arrowStyle = {},\n flowSpeed: flowSpeedOption,\n flowCycleSeconds: flowCycleSecondsOption,\n minZoomForFlow: minZoomForFlowOption,\n maxArrowsPerLine = 500,\n zIndex,\n show = true,\n layerControl = true,\n legend,\n ...rest\n } = options;\n\n const source = new VectorSource(features ? { features } : {});\n\n this.vectorLayer = new VectorLayer({\n ...rest,\n source,\n style: new Style({\n stroke: new Stroke({\n ...defaultLineStroke,\n ...lineStyle,\n }),\n }),\n zIndex,\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n this.vectorLayer.key = key;\n this.vectorLayer.name = name;\n this.vectorLayer.layerControl = layerControl;\n this.vectorLayer.legend = legend;\n this.vectorLayer.show = show;\n\n this.key = key;\n this.name = name;\n this.map = map;\n this.layerControl = layerControl;\n this.legend = legend;\n this.show = show;\n\n this._lineStyleOptions = lineStyle;\n this._arrowStyle = arrowStyle;\n this.maxArrowsPerLine = maxArrowsPerLine;\n this.spacingPx = arrowStyle.spacingPx ?? arrowStyle.spacing ?? 80;\n this.flowSpeed =\n arrowStyle.flowSpeed != null\n ? arrowStyle.flowSpeed\n : flowSpeedOption != null\n ? flowSpeedOption\n : DEFAULT_FLOW_SPEED;\n\n this._flowPerfOrigin = null;\n\n this.flowCycleSeconds =\n arrowStyle.flowCycleSeconds != null\n ? arrowStyle.flowCycleSeconds\n : flowCycleSecondsOption != null\n ? flowCycleSecondsOption\n : null;\n\n this.flowRenderMinIntervalMs =\n arrowStyle.flowRenderMinIntervalMs != null\n ? arrowStyle.flowRenderMinIntervalMs\n : DEFAULT_FLOW_RENDER_MS;\n\n this.minZoomForFlow =\n arrowStyle.minZoomForFlow != null\n ? arrowStyle.minZoomForFlow\n : minZoomForFlowOption != null\n ? minZoomForFlowOption\n : null;\n\n this._flowDriverId = null;\n\n this._onViewResolutionChange = this._syncFlowDriverToZoom.bind(this);\n if (this.map) {\n const view = this.map.getView();\n if (view) {\n view.on('change:resolution', this._onViewResolutionChange);\n }\n }\n\n this._arrowImage = null;\n this._arrowImageSrc = null;\n\n this._onPostRender = this.onPostRender.bind(this);\n this.vectorLayer.on('postrender', this._onPostRender);\n\n this._loadArrowImageFromStyle(arrowStyle);\n\n if (data) {\n this.loadData(data);\n }\n this.vectorLayer.setVisible(show);\n this._syncFlowDriverToZoom();\n }\n\n /** 当前缩放是否达到展示流动箭头的层级(未配置阈值则始终为 true) */\n _flowZoomSufficient() {\n if (this.minZoomForFlow == null) {\n return true;\n }\n const view = this.map && this.map.getView();\n if (!view) {\n return true;\n }\n const z = view.getZoom();\n if (z == null || Number.isNaN(z)) {\n return true;\n }\n return z >= this.minZoomForFlow;\n }\n\n _shouldRunFlowDriver() {\n return (\n this.show &&\n this.vectorLayer.getVisible() &&\n this._flowZoomSufficient()\n );\n }\n\n _syncFlowDriverToZoom() {\n if (this._shouldRunFlowDriver()) {\n this._startFlowDriver();\n } else {\n this._stopFlowDriver();\n if (this.map && this.show && this.vectorLayer.getVisible()) {\n this.map.render();\n }\n }\n }\n\n _startFlowDriver() {\n if (this._flowDriverId != null || !this.map) {\n return;\n }\n if (!this._shouldRunFlowDriver()) {\n return;\n }\n if (this.vectorLayer.getVisible()) {\n this.map.render();\n }\n this._flowDriverId = setInterval(() => {\n if (!this._shouldRunFlowDriver()) {\n this._stopFlowDriver();\n if (this.map && this.show && this.vectorLayer.getVisible()) {\n this.map.render();\n }\n return;\n }\n this.map.render();\n }, this.flowRenderMinIntervalMs);\n }\n\n _stopFlowDriver() {\n if (this._flowDriverId != null) {\n clearInterval(this._flowDriverId);\n this._flowDriverId = null;\n }\n }\n\n _restartFlowDriver() {\n this._stopFlowDriver();\n this._syncFlowDriverToZoom();\n }\n\n getSource() {\n return this.vectorLayer.getSource();\n }\n\n setVisible(value) {\n this.vectorLayer.setVisible(value);\n }\n\n getVisible() {\n return this.vectorLayer.getVisible();\n }\n\n _loadArrowImageFromStyle(arrowStyle) {\n const src = resolveArrowBitmapSrc(arrowStyle || {});\n if (!src) {\n this._arrowImage = null;\n this._arrowImageSrc = null;\n return;\n }\n if (src === this._arrowImageSrc) {\n return;\n }\n this._arrowImageSrc = src;\n this._arrowImage = null;\n const img = new Image();\n img.crossOrigin = 'anonymous';\n img.onload = () => {\n this._arrowImage = img;\n if (this.map) {\n this.map.render();\n }\n };\n img.onerror = () => {\n this._arrowImage = null;\n };\n img.src = src;\n }\n\n setShow(value) {\n this.show = value;\n this.vectorLayer.show = value;\n this.vectorLayer.setVisible(value);\n if (!value) {\n this._flowPerfOrigin = null;\n this._stopFlowDriver();\n } else {\n this._syncFlowDriverToZoom();\n }\n }\n\n setLineStyle(lineStyle) {\n this._lineStyleOptions = lineStyle || {};\n this.vectorLayer.setStyle(\n new Style({\n stroke: new Stroke({\n ...defaultLineStroke,\n ...this._lineStyleOptions,\n }),\n }),\n );\n }\n\n setArrowStyle(arrowStyle) {\n this._arrowStyle = arrowStyle || {};\n if (arrowStyle) {\n if (arrowStyle.spacingPx != null || arrowStyle.spacing != null) {\n this.spacingPx = arrowStyle.spacingPx ?? arrowStyle.spacing ?? this.spacingPx;\n }\n if (arrowStyle.flowSpeed != null) {\n this.flowSpeed = arrowStyle.flowSpeed;\n }\n if (arrowStyle.flowCycleSeconds !== undefined) {\n this.flowCycleSeconds = arrowStyle.flowCycleSeconds;\n }\n if (arrowStyle.flowRenderMinIntervalMs != null) {\n this.flowRenderMinIntervalMs = arrowStyle.flowRenderMinIntervalMs;\n this._restartFlowDriver();\n }\n if (arrowStyle.minZoomForFlow !== undefined) {\n this.minZoomForFlow = arrowStyle.minZoomForFlow;\n this._syncFlowDriverToZoom();\n }\n }\n this._loadArrowImageFromStyle(arrowStyle || {});\n }\n\n loadData(data) {\n this.getSource().clear();\n const fs = createGeoJson(data);\n if (fs && fs.length) {\n this.getSource().addFeatures(fs);\n }\n }\n\n loadFeatures(featureList) {\n this.getSource().clear();\n if (featureList && featureList.length) {\n this.getSource().addFeatures(featureList);\n }\n }\n\n onPostRender(event) {\n const ctx = event.context;\n if (!ctx || typeof ctx.save !== 'function') {\n return;\n }\n if (!this.vectorLayer.getVisible()) {\n return;\n }\n if (!this._flowZoomSufficient()) {\n return;\n }\n\n const frameState = event.frameState;\n if (!frameState || !frameState.viewState) {\n return;\n }\n\n const resolution = frameState.viewState.resolution;\n const extent = frameState.extent;\n const stepWorld = this.spacingPx * resolution;\n if (stepWorld <= 0) {\n return;\n }\n\n if (this._flowPerfOrigin == null) {\n this._flowPerfOrigin = performance.now();\n }\n const elapsedMs = performance.now() - this._flowPerfOrigin;\n let cycleSec;\n if (this.flowCycleSeconds != null && this.flowCycleSeconds > 0) {\n cycleSec = this.flowCycleSeconds;\n } else {\n cycleSec = DEFAULT_BASE_CYCLE_SEC / Math.max(0.05, this.flowSpeed);\n }\n const phase = (((elapsedMs / 1000) % cycleSec) / cycleSec) * stepWorld;\n\n const transform = multiply(\n event.inversePixelTransform.slice(),\n frameState.coordinateToPixelTransform.slice(),\n );\n\n const as = this._arrowStyle || {};\n const color = as.color || '#ffffff';\n const headLen = as.headLength ?? 10;\n const headWidth = as.headWidth ?? 7;\n const lineW = as.lineWidth ?? 1;\n const strokeWidth = as.strokeWidth;\n const opacity = as.opacity != null ? as.opacity : 1;\n const bitmapSrc = resolveArrowBitmapSrc(as);\n const imgScale = as.scale != null ? as.scale : 1;\n const imgWidth = as.imgWidth;\n const imgHeight = as.imgHeight;\n\n ctx.save();\n ctx.globalAlpha = opacity;\n\n const features = this.getSource().getFeatures();\n for (let fi = 0; fi < features.length; fi++) {\n const geom = features[fi].getGeometry();\n const lines = flattenLineStrings(geom);\n for (let li = 0; li < lines.length; li++) {\n const line = lines[li];\n const samples = sampleArrowsForLineString(line, extent, {\n stepWorld,\n phase,\n maxArrows: this.maxArrowsPerLine,\n });\n for (let si = 0; si < samples.length; si++) {\n const s = samples[si];\n const angle = getPixelAngle(transform, s.c0, s.c1);\n const pt = s.coord.slice();\n apply(transform, pt);\n const x = pt[0];\n const y = pt[1];\n\n if (\n bitmapSrc &&\n this._arrowImage &&\n this._arrowImage.complete\n ) {\n const w = (imgWidth || this._arrowImage.width) * imgScale;\n const h = (imgHeight || this._arrowImage.height) * imgScale;\n ctx.save();\n ctx.translate(x, y);\n ctx.rotate(angle);\n ctx.drawImage(this._arrowImage, -w / 2, -h / 2, w, h);\n ctx.restore();\n } else if (!bitmapSrc) {\n ctx.save();\n ctx.translate(x, y);\n ctx.rotate(angle);\n drawChevronArrow(\n ctx,\n color,\n headLen,\n headWidth,\n lineW,\n strokeWidth,\n );\n ctx.restore();\n }\n }\n }\n }\n\n ctx.restore();\n // 不在此处 map.render():会与定时器叠加重绘整图。由 _startFlowDriver 按 flowRenderMinIntervalMs 触发 render。\n }\n\n destroy() {\n this._stopFlowDriver();\n this._flowPerfOrigin = null;\n if (this.map) {\n const view = this.map.getView();\n if (view) {\n view.un('change:resolution', this._onViewResolutionChange);\n }\n }\n this.vectorLayer.un('postrender', this._onPostRender);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,wBAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAL,sBAAA,CAAAH,OAAA;AAAkD,IAAAS,SAAA;AAAA,SAAAN,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAE,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CA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,EAAE,CAACC,CAAC,GAAG,CAAC,EAAED,CAAC,EAAEC,CAAC,CAAC;cACrDhK,GAAG,CAACqK,OAAO,CAAC,CAAC;YACjB,CAAC,MAAM,IAAI,CAACjC,SAAS,EAAE;cACnBpI,GAAG,CAACgH,IAAI,CAAC,CAAC;cACVhH,GAAG,CAACkK,SAAS,CAACN,CAAC,EAAEC,CAAC,CAAC;cACnB7J,GAAG,CAACmK,MAAM,CAACb,KAAK,CAAC;cACjBvJ,gBAAgB,CACZC,GAAG,EACHZ,KAAK,EACLa,OAAO,EACPC,SAAS,EACTC,KAAK,EACL+H,WACJ,CAAC;cACDlI,GAAG,CAACqK,OAAO,CAAC,CAAC;YACjB;UACJ;QACJ;MACJ;MAEArK,GAAG,CAACqK,OAAO,CAAC,CAAC;MACb;IACJ;EAAC;IAAAxL,GAAA;IAAAf,KAAA,EAED,SAAAwM,OAAOA,CAAA,EAAG;MACN,IAAI,CAACpF,eAAe,CAAC,CAAC;MACtB,IAAI,CAACvB,eAAe,GAAG,IAAI;MAC3B,IAAI,IAAI,CAAChC,GAAG,EAAE;QACV,IAAMsC,IAAI,GAAG,IAAI,CAACtC,GAAG,CAACuC,OAAO,CAAC,CAAC;QAC/B,IAAID,IAAI,EAAE;UACNA,IAAI,CAACsG,EAAE,CAAC,mBAAmB,EAAE,IAAI,CAACzG,uBAAuB,CAAC;QAC9D;MACJ;MACA,IAAI,CAACd,WAAW,CAACuH,EAAE,CAAC,YAAY,EAAE,IAAI,CAACjG,aAAa,CAAC;IACzD;EAAC;AAAA","ignoreList":[]}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = ArrowFlowLayerComponent;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _ArrowFlowLayer = _interopRequireDefault(require("./ArrowFlowLayer"));
10
+ var _ahooks = require("ahooks");
11
+ var _events = require("../events");
12
+ var _useProps2 = _interopRequireDefault(require("../use-props"));
13
+ var _provider = _interopRequireDefault(require("../provider"));
14
+ var _excluded = ["data", "features", "zIndex", "id", "_key", "name", "show", "legend", "lineStyle", "arrowStyle", "flowSpeed", "flowCycleSeconds", "minZoomForFlow", "maxArrowsPerLine", "layerControl", "children"];
15
+ /* eslint-disable react/prop-types */
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
17
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
18
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
19
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
21
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
22
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
23
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
24
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
27
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
28
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
29
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
30
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
31
+ function ArrowFlowLayerComponent(props) {
32
+ var data = props.data,
33
+ features = props.features,
34
+ zIndex = props.zIndex,
35
+ key = props.id,
36
+ _key = props._key,
37
+ name = props.name,
38
+ _props$show = props.show,
39
+ show = _props$show === void 0 ? true : _props$show,
40
+ legend = props.legend,
41
+ _props$lineStyle = props.lineStyle,
42
+ lineStyle = _props$lineStyle === void 0 ? {} : _props$lineStyle,
43
+ _props$arrowStyle = props.arrowStyle,
44
+ arrowStyle = _props$arrowStyle === void 0 ? {} : _props$arrowStyle,
45
+ flowSpeed = props.flowSpeed,
46
+ flowCycleSeconds = props.flowCycleSeconds,
47
+ minZoomForFlow = props.minZoomForFlow,
48
+ maxArrowsPerLine = props.maxArrowsPerLine,
49
+ _props$layerControl = props.layerControl,
50
+ layerControl = _props$layerControl === void 0 ? true : _props$layerControl,
51
+ children = props.children,
52
+ rest = _objectWithoutProperties(props, _excluded);
53
+ var mergedArrowStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, arrowStyle), flowSpeed != null && arrowStyle.flowSpeed == null ? {
54
+ flowSpeed: flowSpeed
55
+ } : {}), flowCycleSeconds != null && arrowStyle.flowCycleSeconds == null ? {
56
+ flowCycleSeconds: flowCycleSeconds
57
+ } : {}), minZoomForFlow != null && arrowStyle.minZoomForFlow == null ? {
58
+ minZoomForFlow: minZoomForFlow
59
+ } : {});
60
+ var _useState = (0, _react.useState)(false),
61
+ _useState2 = _slicedToArray(_useState, 2),
62
+ layerLoad = _useState2[0],
63
+ setLayerLoad = _useState2[1];
64
+ var _useProps = (0, _useProps2["default"])(),
65
+ map = _useProps.map,
66
+ groupLayer = _useProps.groupLayer;
67
+ var layerRef = (0, _react.useRef)();
68
+ (0, _react.useEffect)(function () {
69
+ var layer = new _ArrowFlowLayer["default"](_objectSpread({
70
+ data: data,
71
+ features: features,
72
+ zIndex: zIndex,
73
+ key: key || _key,
74
+ name: name,
75
+ show: show,
76
+ legend: legend,
77
+ map: map,
78
+ lineStyle: lineStyle,
79
+ arrowStyle: mergedArrowStyle,
80
+ flowSpeed: flowSpeed,
81
+ flowCycleSeconds: flowCycleSeconds,
82
+ minZoomForFlow: minZoomForFlow,
83
+ maxArrowsPerLine: maxArrowsPerLine,
84
+ layerControl: layerControl
85
+ }, rest));
86
+ (0, _events.registerEventLayer)(layer, props);
87
+ setLayerLoad(true);
88
+ if (groupLayer) {
89
+ groupLayer.addLayer(layer);
90
+ } else {
91
+ map.layers.addLayer(layer);
92
+ }
93
+ layerRef.current = layer;
94
+ return function () {
95
+ layer.destroy();
96
+ if (groupLayer) {
97
+ groupLayer.removeLayer(layer);
98
+ } else {
99
+ map.layers.removeLayer(layer);
100
+ }
101
+ };
102
+ }, []);
103
+ (0, _ahooks.useUpdateEffect)(function () {
104
+ if (layerRef.current && data) {
105
+ layerRef.current.loadData(data);
106
+ }
107
+ }, [data]);
108
+ (0, _ahooks.useUpdateEffect)(function () {
109
+ if (layerRef.current && features) {
110
+ layerRef.current.loadFeatures(features);
111
+ }
112
+ }, [features]);
113
+ (0, _ahooks.useUpdateEffect)(function () {
114
+ if (layerRef.current) {
115
+ layerRef.current.setShow(show);
116
+ }
117
+ }, [show]);
118
+ (0, _ahooks.useUpdateEffect)(function () {
119
+ if (layerRef.current && lineStyle) {
120
+ layerRef.current.setLineStyle(lineStyle);
121
+ }
122
+ }, [JSON.stringify(lineStyle)]);
123
+ (0, _ahooks.useUpdateEffect)(function () {
124
+ if (layerRef.current) {
125
+ layerRef.current.setArrowStyle(mergedArrowStyle);
126
+ }
127
+ }, [JSON.stringify(mergedArrowStyle)]);
128
+ (0, _ahooks.useUpdateEffect)(function () {
129
+ if (layerRef.current && maxArrowsPerLine != null) {
130
+ layerRef.current.maxArrowsPerLine = maxArrowsPerLine;
131
+ }
132
+ }, [maxArrowsPerLine]);
133
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, layerLoad && /*#__PURE__*/_react["default"].createElement(_provider["default"], {
134
+ value: {
135
+ map: map,
136
+ featureLayer: layerRef.current.vectorLayer
137
+ }
138
+ }, children));
139
+ }
140
+ //# sourceMappingURL=index.js.map