@progress/kendo-charts 1.22.0 → 1.23.0-dev.202201170838

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 (59) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/dist/cdn/js/kendo-charts.js +1 -1
  4. package/dist/cdn/main.js +1 -1
  5. package/dist/es/common/keys.js +25 -0
  6. package/dist/es/common.js +1 -0
  7. package/dist/es/drawing-utils.js +27 -3
  8. package/dist/es/main.js +1 -0
  9. package/dist/es/map/attribution.js +158 -0
  10. package/dist/es/map/crs.js +277 -0
  11. package/dist/es/map/datums.js +16 -0
  12. package/dist/es/map/extent.js +129 -0
  13. package/dist/es/map/layers/bubble.js +185 -0
  14. package/dist/es/map/layers/layer.js +140 -0
  15. package/dist/es/map/layers/marker.js +347 -0
  16. package/dist/es/map/layers/shape.js +389 -0
  17. package/dist/es/map/layers/tile.js +491 -0
  18. package/dist/es/map/location.js +201 -0
  19. package/dist/es/map/map.js +945 -0
  20. package/dist/es/map/navigator.js +175 -0
  21. package/dist/es/map/scroller/draggable.js +454 -0
  22. package/dist/es/map/scroller/fx.js +119 -0
  23. package/dist/es/map/scroller/observable.js +175 -0
  24. package/dist/es/map/scroller/scroller.js +746 -0
  25. package/dist/es/map/scroller/user-events.js +713 -0
  26. package/dist/es/map/utils.js +450 -0
  27. package/dist/es/map/zoom.js +139 -0
  28. package/dist/es/map.js +1 -0
  29. package/dist/es/services/map-service.js +15 -0
  30. package/dist/es2015/common/keys.js +25 -0
  31. package/dist/es2015/common.js +1 -0
  32. package/dist/es2015/drawing-utils.js +43 -3
  33. package/dist/es2015/main.js +1 -0
  34. package/dist/es2015/map/attribution.js +148 -0
  35. package/dist/es2015/map/crs.js +233 -0
  36. package/dist/es2015/map/datums.js +16 -0
  37. package/dist/es2015/map/extent.js +115 -0
  38. package/dist/es2015/map/layers/bubble.js +167 -0
  39. package/dist/es2015/map/layers/layer.js +134 -0
  40. package/dist/es2015/map/layers/marker.js +327 -0
  41. package/dist/es2015/map/layers/shape.js +369 -0
  42. package/dist/es2015/map/layers/tile.js +465 -0
  43. package/dist/es2015/map/location.js +193 -0
  44. package/dist/es2015/map/map.js +915 -0
  45. package/dist/es2015/map/navigator.js +170 -0
  46. package/dist/es2015/map/scroller/draggable.js +418 -0
  47. package/dist/es2015/map/scroller/fx.js +112 -0
  48. package/dist/es2015/map/scroller/observable.js +165 -0
  49. package/dist/es2015/map/scroller/scroller.js +716 -0
  50. package/dist/es2015/map/scroller/user-events.js +695 -0
  51. package/dist/es2015/map/utils.js +450 -0
  52. package/dist/es2015/map/zoom.js +134 -0
  53. package/dist/es2015/map.js +1 -0
  54. package/dist/es2015/services/map-service.js +15 -0
  55. package/dist/npm/main.d.ts +1 -0
  56. package/dist/npm/main.js +6218 -342
  57. package/dist/npm/map.d.ts +4 -0
  58. package/dist/systemjs/kendo-charts.js +1 -1
  59. package/package.json +1 -1
@@ -0,0 +1,389 @@
1
+ import {
2
+ geometry as g,
3
+ drawing as d
4
+ } from '@progress/kendo-drawing';
5
+
6
+ import {
7
+ Class,
8
+ defined,
9
+ last,
10
+ setDefaultOptions
11
+ } from '../../common';
12
+
13
+ import {
14
+ proxy
15
+ } from '../utils';
16
+
17
+ import {
18
+ Layer
19
+ } from './layer';
20
+
21
+ import {
22
+ Movable
23
+ } from '../scroller/draggable';
24
+
25
+ import {
26
+ Location
27
+ } from '../location';
28
+
29
+ var Group = d.Group;
30
+
31
+ export var ShapeLayer = (function (Layer) {
32
+ function ShapeLayer(map, options) {
33
+ Layer.call(this, map, options);
34
+
35
+ this._pan = proxy(this._pan, this);
36
+
37
+ this.surface = d.Surface.create(this.element, {
38
+ width: map.scrollElement.clientWidth,
39
+ height: map.scrollElement.clientHeight
40
+ });
41
+
42
+ this._initRoot();
43
+ this.movable = new Movable(this.surface.element);
44
+ this._markers = [];
45
+
46
+ this._click = this._handler('shapeClick');
47
+ this.surface.bind('click', this._click);
48
+ this._mouseenter = this._handler('shapeMouseEnter');
49
+ this.surface.bind('mouseenter', this._mouseenter);
50
+ this._mouseleave = this._handler('shapeMouseLeave');
51
+ this.surface.bind('mouseleave', this._mouseleave);
52
+ }
53
+
54
+ if ( Layer ) ShapeLayer.__proto__ = Layer;
55
+ ShapeLayer.prototype = Object.create( Layer && Layer.prototype );
56
+ ShapeLayer.prototype.constructor = ShapeLayer;
57
+
58
+ ShapeLayer.prototype.destroy = function destroy () {
59
+ Layer.prototype.destroy.call(this);
60
+
61
+ this.surface.destroy();
62
+ };
63
+
64
+ ShapeLayer.prototype._reset = function _reset () {
65
+ Layer.prototype._reset.call(this);
66
+
67
+ this._translateSurface();
68
+
69
+ this._data = this._readData();
70
+
71
+ if (this._hasData()) {
72
+ this._load(this._data);
73
+ }
74
+ };
75
+
76
+ ShapeLayer.prototype._initRoot = function _initRoot () {
77
+ this._root = new Group();
78
+ this.surface.draw(this._root);
79
+ };
80
+
81
+ ShapeLayer.prototype._beforeReset = function _beforeReset () {
82
+ this.surface.clear();
83
+ this._initRoot();
84
+ };
85
+
86
+ ShapeLayer.prototype._resize = function _resize () {
87
+ this.surface.size(this.map.size());
88
+ };
89
+
90
+ ShapeLayer.prototype._readData = function _readData () {
91
+ var data = Layer.prototype._readData.call(this);
92
+
93
+ if (data.type === "FeatureCollection") {
94
+ return data.features;
95
+ }
96
+
97
+ if (data.type === "GeometryCollection") {
98
+ return data.geometries;
99
+ }
100
+
101
+ return data;
102
+ };
103
+
104
+ ShapeLayer.prototype._load = function _load (data) {
105
+ var this$1 = this;
106
+
107
+ this._data = data;
108
+ this._clearMarkers();
109
+
110
+ if (!this._loader) {
111
+ this._loader = new GeoJsonLoader(this.map, this.options.style, this);
112
+ }
113
+
114
+ var container = new Group();
115
+
116
+ for (var i = 0; i < data.length; i++) {
117
+ var shape = this$1._loader.parse(data[i]);
118
+
119
+ if (shape) {
120
+ container.append(shape);
121
+ }
122
+ }
123
+
124
+ this._root.clear();
125
+ this._root.append(container);
126
+ };
127
+
128
+ ShapeLayer.prototype.shapeCreated = function shapeCreated (shape) {
129
+ var cancelled = false;
130
+
131
+ // the GeoJSON loader builds "Point" type as a circle
132
+ // use the circle shape type as and indicator for rendering a marker
133
+ // keep the behavior under a setting as this is supported by kendo jQuery Map
134
+ // but we opted out of this in blazor
135
+ if (shape instanceof d.Circle && this.map.options.renderPointsAsMarkers) {
136
+ cancelled = defined(this._createMarker(shape));
137
+ }
138
+
139
+ if (!cancelled) {
140
+ var args = {
141
+ layer: this,
142
+ shape: shape
143
+ };
144
+
145
+ cancelled = this.map.trigger('shapeCreated', args);
146
+ }
147
+
148
+ return cancelled;
149
+ };
150
+
151
+ ShapeLayer.prototype.featureCreated = function featureCreated (e) {
152
+ e.layer = this;
153
+ this.map.trigger('shapeFeatureCreated', e);
154
+ };
155
+
156
+ ShapeLayer.prototype._createMarker = function _createMarker (shape) {
157
+ var marker = this.map.markers.bind({
158
+ location: shape.location
159
+ }, shape.dataItem);
160
+
161
+ if (marker) {
162
+ this._markers.push(marker);
163
+ }
164
+
165
+ return marker;
166
+ };
167
+
168
+ ShapeLayer.prototype._clearMarkers = function _clearMarkers () {
169
+ var this$1 = this;
170
+
171
+ for (var i = 0; i < this._markers.length; i++) {
172
+ this$1.map.markers.remove(this$1._markers[i]);
173
+ }
174
+
175
+ this._markers = [];
176
+ };
177
+
178
+ ShapeLayer.prototype._pan = function _pan () {
179
+ if (!this._panning) {
180
+ this._panning = true;
181
+ this.surface.suspendTracking();
182
+ }
183
+ };
184
+
185
+ ShapeLayer.prototype._panEnd = function _panEnd (e) {
186
+ Layer.prototype._panEnd.call(this, e);
187
+ this._translateSurface();
188
+ this.surface.resumeTracking();
189
+ this._panning = false;
190
+ };
191
+
192
+ ShapeLayer.prototype._translateSurface = function _translateSurface () {
193
+ var map = this.map;
194
+ var nw = map.locationToView(map.extent().nw);
195
+
196
+ if (this.surface.translate) {
197
+ this.surface.translate(nw);
198
+ this.movable.moveTo({
199
+ x: nw.x,
200
+ y: nw.y
201
+ });
202
+ }
203
+ };
204
+
205
+ ShapeLayer.prototype._handler = function _handler (event) {
206
+ var layer = this;
207
+
208
+ return function(e) {
209
+ if (e.element) {
210
+ var args = {
211
+ layer: layer,
212
+ layerIndex: (layer.map.layers || []).indexOf(layer),
213
+ shape: e.element,
214
+ shapeIndex: (layer._data || []).indexOf(e.element.dataItem),
215
+ originalEvent: e.originalEvent
216
+ };
217
+
218
+ layer.map.trigger(event, args);
219
+ }
220
+ };
221
+ };
222
+
223
+ ShapeLayer.prototype._activate = function _activate () {
224
+ Layer.prototype._activate.call(this);
225
+ this._panHandler = proxy(this._pan, this);
226
+ this.map.bind('pan', this.panHandler);
227
+ };
228
+
229
+ ShapeLayer.prototype._deactivate = function _deactivate () {
230
+ Layer.prototype._deactivate.call(this);
231
+ this.map.unbind('pan', this._panHandler);
232
+ };
233
+
234
+ return ShapeLayer;
235
+ }(Layer));
236
+
237
+ setDefaultOptions(ShapeLayer, {
238
+ autoBind: true,
239
+ zIndex: 100
240
+ });
241
+
242
+ var GeoJsonLoader = (function (Class) {
243
+ function GeoJsonLoader(locator, defaultStyle, observer) {
244
+ Class.call(this);
245
+ this.observer = observer;
246
+ this.locator = locator;
247
+ this.style = defaultStyle;
248
+ }
249
+
250
+ if ( Class ) GeoJsonLoader.__proto__ = Class;
251
+ GeoJsonLoader.prototype = Object.create( Class && Class.prototype );
252
+ GeoJsonLoader.prototype.constructor = GeoJsonLoader;
253
+
254
+ GeoJsonLoader.prototype.parse = function parse (item) {
255
+ var root = new Group();
256
+ var unwrap = true;
257
+
258
+ if (item.type === 'Feature') {
259
+ unwrap = false;
260
+ this._loadGeometryTo(root, item.geometry, item);
261
+ this._featureCreated(root, item);
262
+ } else {
263
+ this._loadGeometryTo(root, item, item);
264
+ }
265
+
266
+ if (unwrap && root.children.length < 2) {
267
+ root = root.children[0];
268
+ }
269
+
270
+ return root;
271
+ };
272
+
273
+ GeoJsonLoader.prototype._shapeCreated = function _shapeCreated (shape) {
274
+ var cancelled = false;
275
+
276
+ if (this.observer && this.observer.shapeCreated) {
277
+ cancelled = this.observer.shapeCreated(shape);
278
+ }
279
+
280
+ return cancelled;
281
+ };
282
+
283
+ GeoJsonLoader.prototype._featureCreated = function _featureCreated (group, dataItem) {
284
+ if (this.observer && this.observer.featureCreated) {
285
+ this.observer.featureCreated({
286
+ group: group,
287
+ dataItem: dataItem,
288
+ properties: dataItem.properties
289
+ });
290
+ }
291
+ };
292
+
293
+ /* eslint-disable indent */
294
+ GeoJsonLoader.prototype._loadGeometryTo = function _loadGeometryTo (container, geometry, dataItem) {
295
+ var this$1 = this;
296
+
297
+ var coords = geometry.coordinates;
298
+ var i;
299
+ var path;
300
+
301
+ switch (geometry.type) {
302
+ case 'LineString':
303
+ path = this._loadPolygon(container, [coords], dataItem);
304
+ this._setLineFill(path);
305
+ break;
306
+ case 'MultiLineString':
307
+ for (i = 0; i < coords.length; i++) {
308
+ path = this$1._loadPolygon(container, [coords[i]], dataItem);
309
+ this$1._setLineFill(path);
310
+ }
311
+ break;
312
+ case 'Polygon':
313
+ this._loadPolygon(container, coords, dataItem);
314
+ break;
315
+ case 'MultiPolygon':
316
+ for (i = 0; i < coords.length; i++) {
317
+ this$1._loadPolygon(container, coords[i], dataItem);
318
+ }
319
+ break;
320
+ case 'Point':
321
+ this._loadPoint(container, coords, dataItem);
322
+ break;
323
+ case 'MultiPoint':
324
+ for (i = 0; i < coords.length; i++) {
325
+ this$1._loadPoint(container, coords[i], dataItem);
326
+ }
327
+ break;
328
+ default:
329
+ break;
330
+ }
331
+ };
332
+ /* eslint-disable indent */
333
+
334
+ GeoJsonLoader.prototype._setLineFill = function _setLineFill (path) {
335
+ var segments = path.segments;
336
+
337
+ if (segments.length < 4 || !segments[0].anchor().equals(last(segments).anchor())) {
338
+ path.options.fill = null;
339
+ }
340
+ };
341
+
342
+ GeoJsonLoader.prototype._loadShape = function _loadShape (container, shape) {
343
+ if (!this._shapeCreated(shape)) {
344
+ container.append(shape);
345
+ }
346
+
347
+ return shape;
348
+ };
349
+
350
+ GeoJsonLoader.prototype._loadPolygon = function _loadPolygon (container, rings, dataItem) {
351
+ var shape = this._buildPolygon(rings);
352
+ shape.dataItem = dataItem;
353
+ return this._loadShape(container, shape);
354
+ };
355
+
356
+ GeoJsonLoader.prototype._buildPolygon = function _buildPolygon (rings) {
357
+ var this$1 = this;
358
+
359
+ var type = rings.length > 1 ? d.MultiPath : d.Path;
360
+ var path = new type(this.style);
361
+
362
+ for (var i = 0; i < rings.length; i++) {
363
+ for (var j = 0; j < rings[i].length; j++) {
364
+ var point = this$1.locator.locationToView(Location.fromLngLat(rings[i][j]));
365
+ if (j === 0) {
366
+ path.moveTo(point.x, point.y);
367
+ } else {
368
+ path.lineTo(point.x, point.y);
369
+ }
370
+ }
371
+ }
372
+
373
+ return path;
374
+ };
375
+
376
+ GeoJsonLoader.prototype._loadPoint = function _loadPoint (container, coords, dataItem) {
377
+ var location = Location.fromLngLat(coords);
378
+ var point = this.locator.locationToView(location);
379
+ var circle = new g.Circle(point, 10);
380
+ var shape = new d.Circle(circle, this.style);
381
+
382
+ shape.dataItem = dataItem;
383
+ shape.location = location;
384
+
385
+ return this._loadShape(container, shape);
386
+ };
387
+
388
+ return GeoJsonLoader;
389
+ }(Class));