@vtx/cs-map 1.0.10 → 1.0.12

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 (72) hide show
  1. package/lib/_util/generateRandomPosition.js +25 -0
  2. package/lib/_util/generateRandomPosition.js.map +1 -0
  3. package/lib/assets/water.png +0 -0
  4. package/lib/feature-layer/FeatureLayer.js +17 -17
  5. package/lib/feature-layer/FeatureLayer.js.map +1 -1
  6. package/lib/feature-layer/index.js +4 -4
  7. package/lib/feature-layer/index.js.map +1 -1
  8. package/lib/fly-line-layer/FlyLineLayer.js +212 -0
  9. package/lib/fly-line-layer/FlyLineLayer.js.map +1 -0
  10. package/lib/fly-line-layer/index.js +83 -0
  11. package/lib/fly-line-layer/index.js.map +1 -0
  12. package/lib/fly-line-layer/lineFlowMaterialProperty.js +90 -0
  13. package/lib/fly-line-layer/lineFlowMaterialProperty.js.map +1 -0
  14. package/lib/fly-line-layer/style/css.js +4 -0
  15. package/lib/fly-line-layer/style/css.js.map +1 -0
  16. package/lib/fly-line-layer/style/index.css +0 -0
  17. package/lib/fly-line-layer/style/index.js +4 -0
  18. package/lib/fly-line-layer/style/index.js.map +1 -0
  19. package/lib/fly-line-layer/style/index.less +0 -0
  20. package/lib/heatmap-layer/CesiumHeatmap.js +345 -0
  21. package/lib/heatmap-layer/CesiumHeatmap.js.map +1 -0
  22. package/lib/heatmap-layer/HeatmapLayer.js +158 -0
  23. package/lib/heatmap-layer/HeatmapLayer.js.map +1 -0
  24. package/lib/heatmap-layer/index.js +34 -0
  25. package/lib/heatmap-layer/index.js.map +1 -0
  26. package/lib/heatmap-layer/style/css.js +4 -0
  27. package/lib/heatmap-layer/style/css.js.map +1 -0
  28. package/lib/heatmap-layer/style/index.css +0 -0
  29. package/lib/heatmap-layer/style/index.js +4 -0
  30. package/lib/heatmap-layer/style/index.js.map +1 -0
  31. package/lib/heatmap-layer/style/index.less +0 -0
  32. package/lib/image-layer/ImageLayer.js +22 -22
  33. package/lib/image-layer/ImageLayer.js.map +1 -1
  34. package/lib/image-layer/index.js +6 -6
  35. package/lib/image-layer/index.js.map +1 -1
  36. package/lib/index.js +28 -0
  37. package/lib/index.js.map +1 -1
  38. package/lib/{tools/legend → legend}/index.js +71 -61
  39. package/lib/legend/index.js.map +1 -0
  40. package/lib/legend/style/css.js +8 -0
  41. package/lib/legend/style/css.js.map +1 -0
  42. package/lib/legend/style/index.css +57 -0
  43. package/lib/legend/style/index.js +8 -0
  44. package/lib/legend/style/index.js.map +1 -0
  45. package/lib/legend/style/index.less +59 -0
  46. package/lib/map/Layers.js +8 -8
  47. package/lib/map/Layers.js.map +1 -1
  48. package/lib/map/index.js +13 -0
  49. package/lib/map/index.js.map +1 -1
  50. package/lib/tools/index.js +1 -5
  51. package/lib/tools/index.js.map +1 -1
  52. package/lib/tools/layer/index.js +2 -2
  53. package/lib/tools/layer/index.js.map +1 -1
  54. package/lib/tools/style/index.css +1 -23
  55. package/lib/tools/style/index.less +1 -23
  56. package/lib/trail-polyline-layer/TrailPolylineLayer.js +11 -13
  57. package/lib/trail-polyline-layer/TrailPolylineLayer.js.map +1 -1
  58. package/lib/trail-polyline-layer/TrailPolylineMaterial.js.map +1 -0
  59. package/lib/water-surface-layer/WaterSurfaceLayer.js +87 -0
  60. package/lib/water-surface-layer/WaterSurfaceLayer.js.map +1 -0
  61. package/lib/water-surface-layer/index.js +28 -0
  62. package/lib/water-surface-layer/index.js.map +1 -0
  63. package/lib/water-surface-layer/style/css.js +4 -0
  64. package/lib/water-surface-layer/style/css.js.map +1 -0
  65. package/lib/water-surface-layer/style/index.css +0 -0
  66. package/lib/water-surface-layer/style/index.js +4 -0
  67. package/lib/water-surface-layer/style/index.js.map +1 -0
  68. package/lib/water-surface-layer/style/index.less +0 -0
  69. package/package.json +2 -1
  70. package/lib/material/TrailPolylineMaterial.js.map +0 -1
  71. package/lib/tools/legend/index.js.map +0 -1
  72. /package/lib/{material → trail-polyline-layer}/TrailPolylineMaterial.js +0 -0
@@ -0,0 +1,83 @@
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"] = _default;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _FlyLineLayer = _interopRequireDefault(require("./FlyLineLayer"));
10
+ var _ahooks = require("ahooks");
11
+ var _events = require("../events");
12
+ var _useProps2 = _interopRequireDefault(require("../_util/useProps"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ function _default(props) {
17
+ var data = props.data,
18
+ features = props.features,
19
+ url = props.url,
20
+ params = props.params,
21
+ zIndex = props.zIndex,
22
+ key = props.id,
23
+ _key = props._key,
24
+ name = props.name,
25
+ style = props.style,
26
+ labelField = props.labelField,
27
+ template = props.template,
28
+ _props$show = props.show,
29
+ show = _props$show === void 0 ? true : _props$show,
30
+ groupLayer = props.groupLayer,
31
+ legend = props.legend,
32
+ height = props.height,
33
+ color = props.color,
34
+ speed = props.speed;
35
+ var layerRef = (0, _react.useRef)();
36
+ var _useProps = (0, _useProps2["default"])(),
37
+ map = _useProps.map;
38
+ (0, _react.useEffect)(function () {
39
+ var layer = new _FlyLineLayer["default"]({
40
+ data: data,
41
+ features: features,
42
+ url: url,
43
+ params: params,
44
+ style: style,
45
+ zIndex: zIndex,
46
+ key: key || _key,
47
+ name: name,
48
+ labelField: labelField,
49
+ template: template,
50
+ show: show,
51
+ legend: legend,
52
+ height: height,
53
+ color: color,
54
+ speed: speed,
55
+ map: map,
56
+ groupLayer: groupLayer
57
+ });
58
+
59
+ // 注册事件
60
+ (0, _events.registerEventLayer)(layer, props);
61
+ if (groupLayer) {
62
+ groupLayer.addLayer(layer);
63
+ } else {
64
+ map.addLayer(layer);
65
+ }
66
+ layerRef.current = layer;
67
+ return function () {
68
+ if (groupLayer) {
69
+ groupLayer.removeLayer(layer);
70
+ } else {
71
+ map.removeLayer(layer);
72
+ }
73
+ };
74
+ }, []);
75
+ (0, _ahooks.useUpdateEffect)(function () {
76
+ layerRef.current.loadData(data);
77
+ }, [data]);
78
+ (0, _ahooks.useUpdateEffect)(function () {
79
+ layerRef.current.show = show;
80
+ }, [show]);
81
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null);
82
+ }
83
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_FlyLineLayer","_interopRequireDefault","_ahooks","_events","_useProps2","obj","__esModule","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_default","props","data","features","url","params","zIndex","id","_key","name","style","labelField","template","_props$show","show","groupLayer","legend","height","color","speed","layerRef","useRef","_useProps","useProps","map","useEffect","layer","FlyLineLayer","registerEventLayer","addLayer","current","removeLayer","useUpdateEffect","loadData","createElement","Fragment"],"sources":["fly-line-layer/index.js"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport FlyLineLayer from './FlyLineLayer';\nimport { useUpdateEffect } from 'ahooks';\nimport { registerEventLayer } from '../events';\nimport useProps from \"../_util/useProps\";\n\nexport default function(props) {\n const {\n data,\n features,\n url,\n params,\n zIndex,\n id: key,\n _key,\n name,\n style,\n labelField,\n template,\n show = true,\n groupLayer,\n legend,\n height,\n color,\n speed,\n } = props;\n const layerRef = useRef();\n const { map } = useProps();\n\n useEffect(() => {\n let layer = new FlyLineLayer({\n data,\n features,\n url,\n params,\n style,\n zIndex,\n key: key || _key,\n name,\n labelField,\n template,\n show,\n legend,\n height,\n color,\n speed,\n map,\n groupLayer\n });\n\n // 注册事件\n registerEventLayer(layer, props);\n\n\n if (groupLayer) {\n groupLayer.addLayer(layer);\n } else {\n map.addLayer(layer);\n }\n\n layerRef.current = layer;\n return () => {\n if (groupLayer) {\n groupLayer.removeLayer(layer);\n } else {\n map.removeLayer(layer);\n }\n };\n }, []);\n\n useUpdateEffect(() => {\n layerRef.current.loadData(data);\n }, [data]);\n\n useUpdateEffect(() => {\n layerRef.current.show = show;\n }, [show]);\n\n return (\n <></>\n );\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAH,sBAAA,CAAAF,OAAA;AAAyC,SAAAE,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,g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KAAK;MACLK,GAAG,EAAHA,GAAG;MACHT,UAAU,EAAVA;IACJ,CAAC,CAAC;;IAEF;IACA,IAAAa,0BAAkB,EAACF,KAAK,EAAEzB,KAAK,CAAC;IAGhC,IAAIc,UAAU,EAAE;MACZA,UAAU,CAACc,QAAQ,CAACH,KAAK,CAAC;IAC9B,CAAC,MAAM;MACHF,GAAG,CAACK,QAAQ,CAACH,KAAK,CAAC;IACvB;IAEAN,QAAQ,CAACU,OAAO,GAAGJ,KAAK;IACxB,OAAO,YAAM;MACT,IAAIX,UAAU,EAAE;QACZA,UAAU,CAACgB,WAAW,CAACL,KAAK,CAAC;MACjC,CAAC,MAAM;QACHF,GAAG,CAACO,WAAW,CAACL,KAAK,CAAC;MAC1B;IACJ,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,IAAAM,uBAAe,EAAC,YAAM;IAClBZ,QAAQ,CAACU,OAAO,CAACG,QAAQ,CAAC/B,IAAI,CAAC;EACnC,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAEV,IAAA8B,uBAAe,EAAC,YAAM;IAClBZ,QAAQ,CAACU,OAAO,CAAChB,IAAI,GAAGA,IAAI;EAChC,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAEV,oBACI5C,MAAA,YAAAgE,aAAA,CAAAhE,MAAA,YAAAiE,QAAA,MAAI,CAAC;AAEb"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var Cesium = _interopRequireWildcard(require("cesium"));
8
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
+ 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); }
11
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
13
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
+ var LineFlowMaterialProperty = /*#__PURE__*/function () {
17
+ function LineFlowMaterialProperty(options) {
18
+ _classCallCheck(this, LineFlowMaterialProperty);
19
+ this._definitionChanged = new Cesium.Event();
20
+ this._color = undefined;
21
+ this._speed = undefined;
22
+ this._percent = undefined;
23
+ this._gradient = undefined;
24
+ this.color = options.color;
25
+ this.speed = options.speed;
26
+ this.percent = options.percent;
27
+ this.gradient = options.gradient;
28
+ }
29
+ _createClass(LineFlowMaterialProperty, [{
30
+ key: "isConstant",
31
+ get: function get() {
32
+ return false;
33
+ }
34
+ }, {
35
+ key: "definitionChanged",
36
+ get: function get() {
37
+ return this._definitionChanged;
38
+ }
39
+ }, {
40
+ key: "getType",
41
+ value: function getType(time) {
42
+ return Cesium.Material.LineFlowMaterialType;
43
+ }
44
+ }, {
45
+ key: "getValue",
46
+ value: function getValue(time, result) {
47
+ if (!Cesium.defined(result)) {
48
+ result = {};
49
+ }
50
+ result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
51
+ result.speed = Cesium.Property.getValueOrDefault(this._speed, time, 5.0, result.speed);
52
+ result.percent = Cesium.Property.getValueOrDefault(this._percent, time, 0.1, result.percent);
53
+ result.gradient = Cesium.Property.getValueOrDefault(this._gradient, time, 0.01, result.gradient);
54
+ return result;
55
+ }
56
+ }, {
57
+ key: "equals",
58
+ value: function equals(other) {
59
+ return this === other || other instanceof LineFlowMaterialProperty && Cesium.Property.equals(this._color, other._color) && Cesium.Property.equals(this._speed, other._speed) && Cesium.Property.equals(this._percent, other._percent) && Cesium.Property.equals(this._gradient, other._gradient);
60
+ }
61
+ }]);
62
+ return LineFlowMaterialProperty;
63
+ }();
64
+ exports["default"] = LineFlowMaterialProperty;
65
+ Object.defineProperties(LineFlowMaterialProperty.prototype, {
66
+ color: Cesium.createPropertyDescriptor('color'),
67
+ speed: Cesium.createPropertyDescriptor('speed'),
68
+ percent: Cesium.createPropertyDescriptor('percent'),
69
+ gradient: Cesium.createPropertyDescriptor('gradient')
70
+ });
71
+ Cesium.LineFlowMaterialProperty = LineFlowMaterialProperty;
72
+ Cesium.Material.LineFlowMaterialProperty = 'LineFlowMaterialProperty';
73
+ Cesium.Material.LineFlowMaterialType = 'LineFlowMaterialType';
74
+ Cesium.Material.LineFlowMaterialSource = "\n uniform vec4 color;\n uniform float speed;\n uniform float percent;\n uniform float gradient;\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float t =fract(czm_frameNumber * speed / 1000.0);\n t *= (1.0 + percent);\n float alpha = smoothstep(t- percent, t, st.s) * step(-t, -st.s);\n alpha += gradient;\n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n }\n ";
75
+ Cesium.Material._materialCache.addMaterial(Cesium.Material.LineFlowMaterialType, {
76
+ fabric: {
77
+ type: Cesium.Material.LineFlowMaterialType,
78
+ uniforms: {
79
+ color: new Cesium.Color(1.0, 0.0, 0.0, 1.0),
80
+ speed: 10.0,
81
+ percent: 0.1,
82
+ gradient: 0.01
83
+ },
84
+ source: Cesium.Material.LineFlowMaterialSource
85
+ },
86
+ translucent: function translucent(material) {
87
+ return true;
88
+ }
89
+ });
90
+ //# sourceMappingURL=lineFlowMaterialProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineFlowMaterialProperty.js","names":["Cesium","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","o","Symbol","iterator","constructor","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","_toPropertyKey","_createClass","protoProps","staticProps","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","Number","LineFlowMaterialProperty","options","_definitionChanged","Event","_color","_speed","_percent","_gradient","color","speed","percent","gradient","value","getType","time","Material","LineFlowMaterialType","getValue","result","defined","Property","getValueOrDefault","Color","RED","equals","other","exports","defineProperties","createPropertyDescriptor","LineFlowMaterialSource","_materialCache","addMaterial","fabric","type","uniforms","source","translucent","material"],"sources":["fly-line-layer/lineFlowMaterialProperty.js"],"sourcesContent":["import * as Cesium from 'cesium';\n\nexport default class LineFlowMaterialProperty {\n constructor(options) {\n this._definitionChanged = new Cesium.Event();\n this._color = undefined;\n this._speed = undefined;\n this._percent = undefined;\n this._gradient = undefined;\n this.color = options.color;\n this.speed = options.speed;\n this.percent = options.percent;\n this.gradient = options.gradient;\n };\n\n get isConstant() {\n return false;\n }\n\n get definitionChanged() {\n return this._definitionChanged;\n }\n\n getType(time) {\n return Cesium.Material.LineFlowMaterialType;\n }\n\n getValue(time, result) {\n if (!Cesium.defined(result)) {\n result = {};\n }\n\n result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);\n result.speed = Cesium.Property.getValueOrDefault(this._speed, time, 5.0, result.speed);\n result.percent = Cesium.Property.getValueOrDefault(this._percent, time, 0.1, result.percent);\n result.gradient = Cesium.Property.getValueOrDefault(this._gradient, time, 0.01, result.gradient);\n return result\n }\n\n equals(other) {\n return (this === other ||\n (other instanceof LineFlowMaterialProperty &&\n Cesium.Property.equals(this._color, other._color) &&\n Cesium.Property.equals(this._speed, other._speed) &&\n Cesium.Property.equals(this._percent, other._percent) &&\n Cesium.Property.equals(this._gradient, other._gradient))\n )\n }\n}\n\nObject.defineProperties(LineFlowMaterialProperty.prototype, {\n color: Cesium.createPropertyDescriptor('color'),\n speed: Cesium.createPropertyDescriptor('speed'),\n percent: Cesium.createPropertyDescriptor('percent'),\n gradient: Cesium.createPropertyDescriptor('gradient'),\n})\n\nCesium.LineFlowMaterialProperty = LineFlowMaterialProperty;\nCesium.Material.LineFlowMaterialProperty = 'LineFlowMaterialProperty';\nCesium.Material.LineFlowMaterialType = 'LineFlowMaterialType';\nCesium.Material.LineFlowMaterialSource =\n `\n uniform vec4 color;\n uniform float speed;\n uniform float percent;\n uniform float gradient;\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float t =fract(czm_frameNumber * speed / 1000.0);\n t *= (1.0 + percent);\n float alpha = smoothstep(t- percent, t, st.s) * step(-t, -st.s);\n alpha += gradient;\n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n }\n `\n\nCesium.Material._materialCache.addMaterial(Cesium.Material.LineFlowMaterialType, {\n fabric: {\n type: Cesium.Material.LineFlowMaterialType,\n uniforms: {\n color: new Cesium.Color(1.0, 0.0, 0.0, 1.0),\n speed: 10.0,\n percent: 0.1,\n gradient: 0.01\n },\n source: Cesium.Material.LineFlowMaterialSource\n },\n translucent: function(material) {\n return true;\n }\n})\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAiC,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EA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AAM,CAAC8E,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;MAC3Cb,KAAK,EAAE,IAAI;MACXC,OAAO,EAAE,GAAG;MACZC,QAAQ,EAAE;IACd,CAAC;IACDwB,MAAM,EAAE3F,MAAM,CAACuE,QAAQ,CAACc;EAC5B,CAAC;EACDO,WAAW,EAAE,SAAAA,YAASC,QAAQ,EAAE;IAC5B,OAAO,IAAI;EACf;AACJ,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ require("./index.css");
4
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.js","names":["require"],"sources":["fly-line-layer/style/index.js"],"sourcesContent":["import './index.less';\n"],"mappings":";;AAAAA,OAAA"}
File without changes
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ require("./index.less");
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["require"],"sources":["fly-line-layer/style/index.js"],"sourcesContent":["import './index.less';\n"],"mappings":";;AAAAA,OAAA"}
File without changes
@@ -0,0 +1,345 @@
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
+ var Cesium = _interopRequireWildcard(require("cesium"));
5
+ var _heatmap = _interopRequireDefault(require("heatmap.js"));
6
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
7
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
8
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
9
+ /*
10
+ * CesiumHeatmap.js v0.1 | Cesium Heatmap Library
11
+ *
12
+ * Works with heatmap.js v2.0.0: http://www.patrick-wied.at/static/heatmapjs/
13
+ */
14
+
15
+ (function (window) {
16
+ 'use strict';
17
+
18
+ function define_CesiumHeatmap() {
19
+ var CesiumHeatmap = {
20
+ defaults: {
21
+ useEntitiesIfAvailable: true,
22
+ //whether to use entities if a Viewer is supplied or always use an ImageryProvider
23
+ minCanvasSize: 700,
24
+ // minimum size (in pixels) for the heatmap canvas
25
+ maxCanvasSize: 2000,
26
+ // maximum size (in pixels) for the heatmap canvas
27
+ radiusFactor: 60,
28
+ // data point size factor used if no radius is given (the greater of height and width divided by this number yields the used radius)
29
+ spacingFactor: 1.5,
30
+ // extra space around the borders (point radius multiplied by this number yields the spacing)
31
+ maxOpacity: 0.8,
32
+ // the maximum opacity used if not given in the heatmap options object
33
+ minOpacity: 0.1,
34
+ // the minimum opacity used if not given in the heatmap options object
35
+ blur: 0.85,
36
+ // the blur used if not given in the heatmap options object
37
+ gradient: {
38
+ // the gradient used if not given in the heatmap options object
39
+ '.3': 'blue',
40
+ '.65': 'yellow',
41
+ '.8': 'orange',
42
+ '.95': 'red'
43
+ }
44
+ }
45
+ };
46
+
47
+ /* Create a CesiumHeatmap instance
48
+ *
49
+ * cesium: the CesiumWidget or Viewer instance
50
+ * bb: the WGS84 bounding box like {north, east, south, west}
51
+ * options: a heatmap.js options object (see http://www.patrick-wied.at/static/heatmapjs/docs.html#h337-create)
52
+ */
53
+ CesiumHeatmap.create = function (cesium, bb, options) {
54
+ var instance = new CHInstance(cesium, bb, options);
55
+ return instance;
56
+ };
57
+ CesiumHeatmap._getContainer = function (width, height, id) {
58
+ var c = document.createElement("div");
59
+ if (id) {
60
+ c.setAttribute("id", id);
61
+ }
62
+ c.setAttribute("style", "width: " + width + "px; height: " + height + "px; margin: 0px; display: none;");
63
+ document.body.appendChild(c);
64
+ return c;
65
+ };
66
+ CesiumHeatmap._getImageryProvider = function (instance) {
67
+ //var n = (new Date()).getTime();
68
+ var d = instance._heatmap.getDataURL();
69
+ //console.log("Create data URL: " + ((new Date()).getTime() - n));
70
+
71
+ //var n = (new Date()).getTime();
72
+ var imgprov = new Cesium.SingleTileImageryProvider({
73
+ url: d,
74
+ rectangle: instance._rectangle
75
+ });
76
+ //console.log("Create imageryprovider: " + ((new Date()).getTime() - n));
77
+
78
+ imgprov._tilingScheme = new Cesium.WebMercatorTilingScheme({
79
+ rectangleSouthwestInMeters: new Cesium.Cartesian2(instance._mbounds.west, instance._mbounds.south),
80
+ rectangleNortheastInMeters: new Cesium.Cartesian2(instance._mbounds.east, instance._mbounds.north)
81
+ });
82
+ return imgprov;
83
+ };
84
+ CesiumHeatmap._getID = function (len) {
85
+ var text = "";
86
+ var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
87
+ for (var i = 0; i < (len ? len : 8); i++) text += possible.charAt(Math.floor(Math.random() * possible.length));
88
+ return text;
89
+ };
90
+ var WMP = new Cesium.WebMercatorProjection();
91
+
92
+ /* Convert a WGS84 location into a mercator location
93
+ *
94
+ * p: the WGS84 location like {x: lon, y: lat}
95
+ */
96
+ CesiumHeatmap.wgs84ToMercator = function (p) {
97
+ var mp = WMP.project(Cesium.Cartographic.fromDegrees(p.x, p.y));
98
+ return {
99
+ x: mp.x,
100
+ y: mp.y
101
+ };
102
+ };
103
+
104
+ /* Convert a WGS84 bounding box into a mercator bounding box
105
+ *
106
+ * bb: the WGS84 bounding box like {north, east, south, west}
107
+ */
108
+ CesiumHeatmap.wgs84ToMercatorBB = function (bb) {
109
+ var sw = WMP.project(Cesium.Cartographic.fromDegrees(bb.west, bb.south));
110
+ var ne = WMP.project(Cesium.Cartographic.fromDegrees(bb.east, bb.north));
111
+ return {
112
+ north: ne.y,
113
+ east: ne.x,
114
+ south: sw.y,
115
+ west: sw.x
116
+ };
117
+ };
118
+
119
+ /* Convert a mercator location into a WGS84 location
120
+ *
121
+ * p: the mercator lcation like {x, y}
122
+ */
123
+ CesiumHeatmap.mercatorToWgs84 = function (p) {
124
+ var wp = WMP.unproject(new Cesium.Cartesian3(p.x, p.y));
125
+ return {
126
+ x: wp.longitude,
127
+ y: wp.latitude
128
+ };
129
+ };
130
+
131
+ /* Convert a mercator bounding box into a WGS84 bounding box
132
+ *
133
+ * bb: the mercator bounding box like {north, east, south, west}
134
+ */
135
+ CesiumHeatmap.mercatorToWgs84BB = function (bb) {
136
+ var sw = WMP.unproject(new Cesium.Cartesian3(bb.west, bb.south));
137
+ var ne = WMP.unproject(new Cesium.Cartesian3(bb.east, bb.north));
138
+ return {
139
+ north: this.rad2deg(ne.latitude),
140
+ east: this.rad2deg(ne.longitude),
141
+ south: this.rad2deg(sw.latitude),
142
+ west: this.rad2deg(sw.longitude)
143
+ };
144
+ };
145
+
146
+ /* Convert degrees into radians
147
+ *
148
+ * d: the degrees to be converted to radians
149
+ */
150
+ CesiumHeatmap.deg2rad = function (d) {
151
+ var r = d * (Math.PI / 180.0);
152
+ return r;
153
+ };
154
+
155
+ /* Convert radians into degrees
156
+ *
157
+ * r: the radians to be converted to degrees
158
+ */
159
+ CesiumHeatmap.rad2deg = function (r) {
160
+ var d = r / (Math.PI / 180.0);
161
+ return d;
162
+ };
163
+ return CesiumHeatmap;
164
+ }
165
+ if (typeof CesiumHeatmap === 'undefined') {
166
+ window.CesiumHeatmap = define_CesiumHeatmap();
167
+ } else {
168
+ console.log("CesiumHeatmap already defined.");
169
+ }
170
+ })(window);
171
+
172
+ /* Initiate a CesiumHeatmap instance
173
+ *
174
+ * c: CesiumWidget instance
175
+ * bb: a WGS84 bounding box like {north, east, south, west}
176
+ * o: a heatmap.js options object (see http://www.patrick-wied.at/static/heatmapjs/docs.html#h337-create)
177
+ */
178
+ function CHInstance(c, bb, o) {
179
+ if (!bb) {
180
+ return null;
181
+ }
182
+ if (!o) {
183
+ o = {};
184
+ }
185
+ this._cesium = c;
186
+ this._options = o;
187
+ this._id = CesiumHeatmap._getID();
188
+ this._options.gradient = this._options.gradient ? this._options.gradient : CesiumHeatmap.defaults.gradient;
189
+ this._options.maxOpacity = this._options.maxOpacity ? this._options.maxOpacity : CesiumHeatmap.defaults.maxOpacity;
190
+ this._options.minOpacity = this._options.minOpacity ? this._options.minOpacity : CesiumHeatmap.defaults.minOpacity;
191
+ this._options.blur = this._options.blur ? this._options.blur : CesiumHeatmap.defaults.blur;
192
+ this._mbounds = CesiumHeatmap.wgs84ToMercatorBB(bb);
193
+ this._setWidthAndHeight(this._mbounds);
194
+ this._options.radius = Math.round(this._options.radius ? this._options.radius : this.width > this.height ? this.width / CesiumHeatmap.defaults.radiusFactor : this.height / CesiumHeatmap.defaults.radiusFactor);
195
+ this._spacing = this._options.radius * CesiumHeatmap.defaults.spacingFactor;
196
+ this._xoffset = this._mbounds.west;
197
+ this._yoffset = this._mbounds.south;
198
+ this.width = Math.round(this.width + this._spacing * 2);
199
+ this.height = Math.round(this.height + this._spacing * 2);
200
+ this._mbounds.west -= this._spacing * this._factor;
201
+ this._mbounds.east += this._spacing * this._factor;
202
+ this._mbounds.south -= this._spacing * this._factor;
203
+ this._mbounds.north += this._spacing * this._factor;
204
+ this.bounds = CesiumHeatmap.mercatorToWgs84BB(this._mbounds);
205
+ this._rectangle = Cesium.Rectangle.fromDegrees(this.bounds.west, this.bounds.south, this.bounds.east, this.bounds.north);
206
+ this._container = CesiumHeatmap._getContainer(this.width, this.height, this._id);
207
+ this._options.container = this._container;
208
+ this._heatmap = _heatmap["default"].create(this._options);
209
+ this._container.children[0].setAttribute("id", this._id + "-hm");
210
+ }
211
+
212
+ /* Convert a WGS84 location to the corresponding heatmap location
213
+ *
214
+ * p: a WGS84 location like {x:lon, y:lat}
215
+ */
216
+ CHInstance.prototype.wgs84PointToHeatmapPoint = function (p) {
217
+ return this.mercatorPointToHeatmapPoint(CesiumHeatmap.wgs84ToMercator(p));
218
+ };
219
+
220
+ /* Convert a mercator location to the corresponding heatmap location
221
+ *
222
+ * p: a WGS84 location like {x: lon, y:lat}
223
+ */
224
+ CHInstance.prototype.mercatorPointToHeatmapPoint = function (p) {
225
+ var pn = {};
226
+ pn.x = Math.round((p.x - this._xoffset) / this._factor + this._spacing);
227
+ pn.y = Math.round((p.y - this._yoffset) / this._factor + this._spacing);
228
+ pn.y = this.height - pn.y;
229
+ return pn;
230
+ };
231
+ CHInstance.prototype._setWidthAndHeight = function (mbb) {
232
+ this.width = mbb.east > 0 && mbb.west < 0 ? mbb.east + Math.abs(mbb.west) : Math.abs(mbb.east - mbb.west);
233
+ this.height = mbb.north > 0 && mbb.south < 0 ? mbb.north + Math.abs(mbb.south) : Math.abs(mbb.north - mbb.south);
234
+ this._factor = 1;
235
+ if (this.width > this.height && this.width > CesiumHeatmap.defaults.maxCanvasSize) {
236
+ this._factor = this.width / CesiumHeatmap.defaults.maxCanvasSize;
237
+ if (this.height / this._factor < CesiumHeatmap.defaults.minCanvasSize) {
238
+ this._factor = this.height / CesiumHeatmap.defaults.minCanvasSize;
239
+ }
240
+ } else if (this.height > this.width && this.height > CesiumHeatmap.defaults.maxCanvasSize) {
241
+ this._factor = this.height / CesiumHeatmap.defaults.maxCanvasSize;
242
+ if (this.width / this._factor < CesiumHeatmap.defaults.minCanvasSize) {
243
+ this._factor = this.width / CesiumHeatmap.defaults.minCanvasSize;
244
+ }
245
+ } else if (this.width < this.height && this.width < CesiumHeatmap.defaults.minCanvasSize) {
246
+ this._factor = this.width / CesiumHeatmap.defaults.minCanvasSize;
247
+ if (this.height / this._factor > CesiumHeatmap.defaults.maxCanvasSize) {
248
+ this._factor = this.height / CesiumHeatmap.defaults.maxCanvasSize;
249
+ }
250
+ } else if (this.height < this.width && this.height < CesiumHeatmap.defaults.minCanvasSize) {
251
+ this._factor = this.height / CesiumHeatmap.defaults.minCanvasSize;
252
+ if (this.width / this._factor > CesiumHeatmap.defaults.maxCanvasSize) {
253
+ this._factor = this.width / CesiumHeatmap.defaults.maxCanvasSize;
254
+ }
255
+ }
256
+ this.width = this.width / this._factor;
257
+ this.height = this.height / this._factor;
258
+ };
259
+
260
+ /* Set an array of heatmap locations
261
+ *
262
+ * min: the minimum allowed value for the data values
263
+ * max: the maximum allowed value for the data values
264
+ * data: an array of data points in heatmap coordinates and values like {x, y, value}
265
+ */
266
+ CHInstance.prototype.setData = function (min, max, data) {
267
+ if (data && data.length > 0 && min !== null && min !== false && max !== null && max !== false) {
268
+ this._heatmap.setData({
269
+ min: min,
270
+ max: max,
271
+ data: data
272
+ });
273
+ this.updateLayer();
274
+ return true;
275
+ }
276
+ return false;
277
+ };
278
+
279
+ /* Set an array of WGS84 locations
280
+ *
281
+ * min: the minimum allowed value for the data values
282
+ * max: the maximum allowed value for the data values
283
+ * data: an array of data points in WGS84 coordinates and values like { x:lon, y:lat, value }
284
+ */
285
+ CHInstance.prototype.setWGS84Data = function (min, max, data) {
286
+ if (data && data.length > 0 && min !== null && min !== false && max !== null && max !== false) {
287
+ var convdata = [];
288
+ for (var i = 0; i < data.length; i++) {
289
+ var gp = data[i];
290
+ var hp = this.wgs84PointToHeatmapPoint(gp);
291
+ if (gp.value || gp.value === 0) {
292
+ hp.value = gp.value;
293
+ }
294
+ convdata.push(hp);
295
+ }
296
+ return this.setData(min, max, convdata);
297
+ }
298
+ return false;
299
+ };
300
+
301
+ /* Set whether or not the heatmap is shown on the map
302
+ *
303
+ * s: true means the heatmap is shown, false means the heatmap is hidden
304
+ */
305
+ CHInstance.prototype.show = function (s) {
306
+ if (this._layer) {
307
+ this._layer.show = s;
308
+ }
309
+ };
310
+
311
+ /* Update/(re)draw the heatmap
312
+ */
313
+ CHInstance.prototype.updateLayer = function () {
314
+ // only works with a Viewer instance since the cesiumWidget
315
+ // instance doesn't contain an entities property
316
+ if (CesiumHeatmap.defaults.useEntitiesIfAvailable && this._cesium.entities) {
317
+ if (this._layer) {
318
+ this._cesium.entities.remove(this._layer);
319
+ }
320
+
321
+ // Work around issue with material rendering in Cesium
322
+ // provided by https://github.com/criis
323
+ var material = new Cesium.ImageMaterialProperty({
324
+ image: this._heatmap._renderer.canvas
325
+ });
326
+ if (Cesium.VERSION >= "1.21") {
327
+ material.transparent = true;
328
+ } else if (Cesium.VERSION >= "1.16") {
329
+ material.alpha = 0.99;
330
+ }
331
+ this._layer = this._cesium.entities.add({
332
+ show: true,
333
+ rectangle: {
334
+ coordinates: this._rectangle,
335
+ material: material
336
+ }
337
+ });
338
+ } else {
339
+ if (this._layer) {
340
+ this._cesium.scene.imageryLayers.remove(this._layer);
341
+ }
342
+ this._layer = this._cesium.scene.imageryLayers.addImageryProvider(CesiumHeatmap._getImageryProvider(this));
343
+ }
344
+ };
345
+ //# sourceMappingURL=CesiumHeatmap.js.map