@anov/3d-ability 0.0.142 → 0.0.143

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 (256) hide show
  1. package/dist/business/Animation/motion/index.js +56 -35
  2. package/dist/business/Animation/motion/index.js.map +1 -1
  3. package/dist/business/Animation/type.js +2 -2
  4. package/dist/business/Area/Fence/FenceBase.js +187 -146
  5. package/dist/business/Area/Fence/FenceBase.js.map +1 -1
  6. package/dist/business/Area/Fence/fence_base_01.js +112 -120
  7. package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
  8. package/dist/business/Area/Fence/fence_feeting_01.js +130 -218
  9. package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
  10. package/dist/business/Area/Fence/fence_roll_01.js +130 -140
  11. package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
  12. package/dist/business/Area/FillArea/FillAreaBase.js +126 -87
  13. package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
  14. package/dist/business/Area/FillArea/fillArea_face_01.js +98 -72
  15. package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
  16. package/dist/business/Area/FillArea/fillArea_line_01.js +94 -66
  17. package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
  18. package/dist/business/Area/index.js +483 -267
  19. package/dist/business/Area/index.js.map +1 -1
  20. package/dist/business/Area/tool.js +26 -14
  21. package/dist/business/Area/tool.js.map +1 -1
  22. package/dist/business/Base/ObjectLayer.js +46 -21
  23. package/dist/business/Base/ObjectLayer.js.map +1 -1
  24. package/dist/business/Batch/index.js +234 -189
  25. package/dist/business/Batch/index.js.map +1 -1
  26. package/dist/business/Box/index.js +81 -52
  27. package/dist/business/Box/index.js.map +1 -1
  28. package/dist/business/Cylinder/index.js +79 -51
  29. package/dist/business/Cylinder/index.js.map +1 -1
  30. package/dist/business/Flyline/bubble/CircleBubble.js +9 -1
  31. package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
  32. package/dist/business/Flyline/bubble/index.js +21 -7
  33. package/dist/business/Flyline/bubble/index.js.map +1 -1
  34. package/dist/business/Flyline/index.js +162 -96
  35. package/dist/business/Flyline/index.js.map +1 -1
  36. package/dist/business/Flyline/line/ArcLine.js +291 -208
  37. package/dist/business/Flyline/line/ArcLine.js.map +1 -1
  38. package/dist/business/Flyline/line/index.js +22 -8
  39. package/dist/business/Flyline/line/index.js.map +1 -1
  40. package/dist/business/HeatMap/HeatMap.js +467 -380
  41. package/dist/business/HeatMap/HeatMap.js.map +1 -1
  42. package/dist/business/HeatMap/core.js +525 -405
  43. package/dist/business/HeatMap/core.js.map +1 -1
  44. package/dist/business/HeatMap/shader.js +3 -69
  45. package/dist/business/HeatMap/shader.js.map +1 -1
  46. package/dist/business/InfoPanel/index.js +242 -201
  47. package/dist/business/InfoPanel/index.js.map +1 -1
  48. package/dist/business/Line/index.js +88 -55
  49. package/dist/business/Line/index.js.map +1 -1
  50. package/dist/business/Mark/KeyframeAnimation.js +176 -145
  51. package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
  52. package/dist/business/Mark/index.js +294 -196
  53. package/dist/business/Mark/index.js.map +1 -1
  54. package/dist/business/Mark/shader/tanhao.js +3 -36
  55. package/dist/business/Mark/shader/tanhao.js.map +1 -1
  56. package/dist/business/Mark/type.js +1 -1
  57. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +551 -377
  58. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
  59. package/dist/business/MaterialSwitch/inject.js +58 -92
  60. package/dist/business/MaterialSwitch/inject.js.map +1 -1
  61. package/dist/business/MaterialSwitch/shader/finalFade.js +2 -74
  62. package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
  63. package/dist/business/MaterialSwitch/shader/ground.js +16 -95
  64. package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
  65. package/dist/business/MaterialSwitch/shader/groundBase64.js +3 -9
  66. package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
  67. package/dist/business/MaterialSwitch/shader/realFade.js +9 -48
  68. package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
  69. package/dist/business/Plane/index.js +78 -51
  70. package/dist/business/Plane/index.js.map +1 -1
  71. package/dist/business/Poi/index.js +336 -248
  72. package/dist/business/Poi/index.js.map +1 -1
  73. package/dist/business/Poi/link/Cylinder.js +89 -56
  74. package/dist/business/Poi/link/Cylinder.js.map +1 -1
  75. package/dist/business/Poi/link/Pyramid.js +165 -104
  76. package/dist/business/Poi/link/Pyramid.js.map +1 -1
  77. package/dist/business/Poi/link/index.js +114 -54
  78. package/dist/business/Poi/link/index.js.map +1 -1
  79. package/dist/business/Poi/panel/index.js +373 -315
  80. package/dist/business/Poi/panel/index.js.map +1 -1
  81. package/dist/business/Poi/panel/utils.js +10 -5
  82. package/dist/business/Poi/panel/utils.js.map +1 -1
  83. package/dist/business/Poi/particle/DoubleCircle.js +107 -71
  84. package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
  85. package/dist/business/Poi/particle/DynamicCircle.js +111 -75
  86. package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
  87. package/dist/business/Poi/particle/SingleCircle.js +98 -62
  88. package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
  89. package/dist/business/Poi/particle/index.js +117 -49
  90. package/dist/business/Poi/particle/index.js.map +1 -1
  91. package/dist/business/Poi/shader/circle.js +3 -31
  92. package/dist/business/Poi/shader/circle.js.map +1 -1
  93. package/dist/business/Poi/shader/cylinder.js +3 -37
  94. package/dist/business/Poi/shader/cylinder.js.map +1 -1
  95. package/dist/business/Poi/shader/doubleCircle.js +3 -55
  96. package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
  97. package/dist/business/Poi/shader/dynamicCircle.js +3 -67
  98. package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
  99. package/dist/business/Poi/title/Border.js +27 -7
  100. package/dist/business/Poi/title/Border.js.map +1 -1
  101. package/dist/business/Poi/title/Ellipse.js +27 -7
  102. package/dist/business/Poi/title/Ellipse.js.map +1 -1
  103. package/dist/business/Poi/title/index.js +292 -208
  104. package/dist/business/Poi/title/index.js.map +1 -1
  105. package/dist/business/Poi/tools.js +17 -18
  106. package/dist/business/Poi/tools.js.map +1 -1
  107. package/dist/business/Sphere/index.js +72 -47
  108. package/dist/business/Sphere/index.js.map +1 -1
  109. package/dist/business/Spline/index.js +245 -190
  110. package/dist/business/Spline/index.js.map +1 -1
  111. package/dist/business/SplitBuilding/index.js +536 -327
  112. package/dist/business/SplitBuilding/index.js.map +1 -1
  113. package/dist/business/SplitBuilding/type.js +2 -2
  114. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +275 -218
  115. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
  116. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +177 -132
  117. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
  118. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +1 -51
  119. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
  120. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +1 -6
  121. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
  122. package/dist/business/TrafficComponents/base.js +55 -32
  123. package/dist/business/TrafficComponents/base.js.map +1 -1
  124. package/dist/business/TrafficComponents/utils.js +24 -25
  125. package/dist/business/TrafficComponents/utils.js.map +1 -1
  126. package/dist/business/Utils/Curve.js +56 -40
  127. package/dist/business/Utils/Curve.js.map +1 -1
  128. package/dist/business/Utils/constant.js +1 -1
  129. package/dist/business/Utils/constant.js.map +1 -1
  130. package/dist/business/Utils/defineProps.js +14 -13
  131. package/dist/business/Utils/defineProps.js.map +1 -1
  132. package/dist/business/Utils/round-curve.js +153 -127
  133. package/dist/business/Utils/round-curve.js.map +1 -1
  134. package/dist/business/VideoPanel/index.js +319 -258
  135. package/dist/business/VideoPanel/index.js.map +1 -1
  136. package/dist/business/Water/index.js +108 -78
  137. package/dist/business/Water/index.js.map +1 -1
  138. package/dist/business/Water/types.js +1 -1
  139. package/dist/business/Water/types.js.map +1 -1
  140. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +449 -383
  141. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
  142. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +142 -107
  143. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
  144. package/dist/core/Controls/FirstViewControl/index.js +96 -84
  145. package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
  146. package/dist/core/Controls/ThirdViewControl/action/input.js +98 -77
  147. package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
  148. package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
  149. package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
  150. package/dist/core/Controls/ThirdViewControl/index.js +28 -19
  151. package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
  152. package/dist/core/Controls/ThirdViewControl/player/animation.js +155 -126
  153. package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
  154. package/dist/core/Controls/ThirdViewControl/player/camera.js +63 -47
  155. package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
  156. package/dist/core/Controls/ThirdViewControl/player/control.js +49 -39
  157. package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
  158. package/dist/core/Controls/ThirdViewControl/player.js +91 -66
  159. package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
  160. package/dist/core/Controls/base.js +30 -14
  161. package/dist/core/Controls/base.js.map +1 -1
  162. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +131 -92
  163. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
  164. package/dist/core/Debug/PerformanceInfo/Performance.js +47 -22
  165. package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
  166. package/dist/core/Light/PointLight/PointLightExt.js +21 -4
  167. package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
  168. package/dist/core/Material/FinirMaterial/FinirMaterial.js +57 -37
  169. package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
  170. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +153 -116
  171. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
  172. package/dist/core/Material/PristineGridMaterial/shader/fragment.js +1 -95
  173. package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
  174. package/dist/core/Material/PristineGridMaterial/shader/vertex.js +1 -26
  175. package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
  176. package/dist/core/Material/SurfaceMaterial/index.js +172 -76
  177. package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
  178. package/dist/core/Material/decorators.js +11 -6
  179. package/dist/core/Material/decorators.js.map +1 -1
  180. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +12 -16
  181. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
  182. package/dist/core/PostEffects/addBrightnessContrastPass.js +13 -17
  183. package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
  184. package/dist/core/PostEffects/bloomPass.js +10 -17
  185. package/dist/core/PostEffects/bloomPass.js.map +1 -1
  186. package/dist/core/PostEffects/bloomSelect.js +43 -60
  187. package/dist/core/PostEffects/bloomSelect.js.map +1 -1
  188. package/dist/core/PostEffects/colorifyPass.js +13 -17
  189. package/dist/core/PostEffects/colorifyPass.js.map +1 -1
  190. package/dist/core/PostEffects/index.js +22 -28
  191. package/dist/core/PostEffects/index.js.map +1 -1
  192. package/dist/core/PostEffects/outlinePass.js +50 -37
  193. package/dist/core/PostEffects/outlinePass.js.map +1 -1
  194. package/dist/core/PostEffects/postprocessing.js +12 -14
  195. package/dist/core/PostEffects/postprocessing.js.map +1 -1
  196. package/dist/core/PostEffects/saoPass.js +10 -15
  197. package/dist/core/PostEffects/saoPass.js.map +1 -1
  198. package/dist/core/PostEffects/shader/colorify.js +3 -22
  199. package/dist/core/PostEffects/shader/colorify.js.map +1 -1
  200. package/dist/core/PostEffects/shader/gammaCorrectionShader.js +3 -27
  201. package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
  202. package/dist/core/PostEffects/shader/mapping.js +3 -66
  203. package/dist/core/PostEffects/shader/mapping.js.map +1 -1
  204. package/dist/core/PostEffects/shader/thermalMaging.js +3 -28
  205. package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
  206. package/dist/core/SceneEffect/grow/grow.js +101 -85
  207. package/dist/core/SceneEffect/grow/grow.js.map +1 -1
  208. package/dist/core/SceneEffect/grow/style_down.js +77 -60
  209. package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
  210. package/dist/core/SceneEffect/grow/style_up.js +81 -64
  211. package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
  212. package/dist/core/SceneEffect/grow/type.js +2 -2
  213. package/dist/core/SceneEffect/grow/type.js.map +1 -1
  214. package/dist/core/WeatherSystem/DynamicWeatherSystem.js +76 -51
  215. package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
  216. package/dist/core/WeatherSystem/hdr/index.js +105 -69
  217. package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
  218. package/dist/core/WeatherSystem/index.js +124 -77
  219. package/dist/core/WeatherSystem/index.js.map +1 -1
  220. package/dist/core/WeatherSystem/objects/fog/index.js +80 -52
  221. package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
  222. package/dist/core/WeatherSystem/objects/rain/index.js +84 -72
  223. package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
  224. package/dist/core/WeatherSystem/objects/rain/lineRain.js +118 -88
  225. package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
  226. package/dist/core/WeatherSystem/objects/rain/plane.js +146 -116
  227. package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
  228. package/dist/core/WeatherSystem/objects/rain/point.js +148 -100
  229. package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
  230. package/dist/core/WeatherSystem/objects/sky/cloud.js +104 -71
  231. package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
  232. package/dist/core/WeatherSystem/objects/sky/index.js +84 -66
  233. package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
  234. package/dist/core/WeatherSystem/objects/sky/outline.js +45 -25
  235. package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
  236. package/dist/core/WeatherSystem/shaders/cloud.js +3 -74
  237. package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
  238. package/dist/core/WeatherSystem/shaders/fog.js +3 -103
  239. package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
  240. package/dist/core/WeatherSystem/shaders/rain.js +7 -206
  241. package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
  242. package/dist/core/WeatherSystem/shaders/sky.js +3 -87
  243. package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
  244. package/dist/core/WeatherSystem/sky/index.js +135 -104
  245. package/dist/core/WeatherSystem/sky/index.js.map +1 -1
  246. package/dist/core/WeatherSystem/utils/constant.js +38 -44
  247. package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
  248. package/dist/core/WeatherSystem/utils/math.js +25 -18
  249. package/dist/core/WeatherSystem/utils/math.js.map +1 -1
  250. package/dist/core/WeatherSystem/utils/type.js +1 -1
  251. package/dist/core/WeatherSystem/utils/type.js.map +1 -1
  252. package/dist/core/WeatherSystem/weather/index.js +141 -96
  253. package/dist/core/WeatherSystem/weather/index.js.map +1 -1
  254. package/dist/utils/index.js +1 -1
  255. package/dist/utils/index.js.map +1 -1
  256. package/package.json +3 -3
@@ -1,13 +1,32 @@
1
+ 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); }
1
2
  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; }
2
3
  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; }
4
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ 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); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
14
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
15
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
16
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
17
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
18
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
19
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
3
22
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
5
- 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); }
23
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
24
+ 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); }
6
25
  import { CanvasTexture, DoubleSide, Mesh, NearestFilter, Object3D, PlaneGeometry, ShaderMaterial, Vector2, use } from '@anov/3d-core';
7
26
  import h from 'anov-heat-map';
8
27
  import Supercluster from 'supercluster';
9
28
  import { heightFragmentShader, heightVertexShader } from "./shader";
10
- const defaultGradient = {
29
+ var defaultGradient = {
11
30
  0.25: 'rgb(0,0,255)',
12
31
  0.55: 'rgb(0,255,0)',
13
32
  0.85: 'yellow',
@@ -17,407 +36,475 @@ const defaultGradient = {
17
36
  /**
18
37
  * 区域热力图
19
38
  */
20
-
21
- class HeatMap extends Object3D {
22
- get defaultMax() {
23
- return Math.max(...this.data.map(item => item.value));
24
- }
25
- get url() {
26
- return this._url;
27
- }
28
- constructor(options) {
39
+ var HeatMap = /*#__PURE__*/function (_Object3D) {
40
+ _inherits(HeatMap, _Object3D);
41
+ var _super = _createSuper(HeatMap);
42
+ function HeatMap(options) {
29
43
  var _options$radius, _options$height, _options$isPixel;
30
- super();
31
- _defineProperty(this, "data", []);
32
- _defineProperty(this, "_height", void 0);
33
- _defineProperty(this, "_radius", void 0);
34
- _defineProperty(this, "_heatmap", void 0);
35
- _defineProperty(this, "_url", void 0);
36
- _defineProperty(this, "_colorMap", void 0);
37
- _defineProperty(this, "_isPixel", void 0);
38
- _defineProperty(this, "_canvasBox", void 0);
39
- _defineProperty(this, "_attachmentMesh", void 0);
40
- _defineProperty(this, "_supercluster", void 0);
41
- _defineProperty(this, "_range", void 0);
42
- this._colorMap = options.colorMap || defaultGradient;
43
- this._radius = (_options$radius = options.radius) !== null && _options$radius !== void 0 ? _options$radius : 40;
44
- this._height = (_options$height = options.height) !== null && _options$height !== void 0 ? _options$height : 70;
45
- this._isPixel = (_options$isPixel = options.isPixel) !== null && _options$isPixel !== void 0 ? _options$isPixel : false;
46
- this._range = options.range;
44
+ var _this;
45
+ _classCallCheck(this, HeatMap);
46
+ _this = _super.call(this);
47
+ _defineProperty(_assertThisInitialized(_this), "data", []);
48
+ _defineProperty(_assertThisInitialized(_this), "_height", void 0);
49
+ _defineProperty(_assertThisInitialized(_this), "_radius", void 0);
50
+ _defineProperty(_assertThisInitialized(_this), "_heatmap", void 0);
51
+ _defineProperty(_assertThisInitialized(_this), "_url", void 0);
52
+ _defineProperty(_assertThisInitialized(_this), "_colorMap", void 0);
53
+ _defineProperty(_assertThisInitialized(_this), "_isPixel", void 0);
54
+ _defineProperty(_assertThisInitialized(_this), "_canvasBox", void 0);
55
+ _defineProperty(_assertThisInitialized(_this), "_attachmentMesh", void 0);
56
+ _defineProperty(_assertThisInitialized(_this), "_supercluster", void 0);
57
+ _defineProperty(_assertThisInitialized(_this), "_range", void 0);
58
+ _this._colorMap = options.colorMap || defaultGradient;
59
+ _this._radius = (_options$radius = options.radius) !== null && _options$radius !== void 0 ? _options$radius : 40;
60
+ _this._height = (_options$height = options.height) !== null && _options$height !== void 0 ? _options$height : 70;
61
+ _this._isPixel = (_options$isPixel = options.isPixel) !== null && _options$isPixel !== void 0 ? _options$isPixel : false;
62
+ _this._range = options.range;
47
63
 
48
64
  // this.initSupercluster()
65
+ return _this;
49
66
  }
50
- initSupercluster() {
51
- this._supercluster = new Supercluster({
52
- radius: 40,
53
- minZoom: 1,
54
- maxZoom: 16
55
- });
56
- }
57
-
58
- /**
59
- * set supercluster data
60
- */
61
- setSuperclusterData() {
62
- const featuresPoints = this.data.map(item => {
63
- return {
64
- type: 'Feature',
65
- properties: {},
66
- geometry: {
67
- type: 'Point',
68
- coordinates: [item.x, item.z]
69
- }
70
- };
71
- });
72
- console.log('正在加载点数据到supercluster:', featuresPoints.length);
73
- this._supercluster.load(featuresPoints);
74
- }
75
-
76
- /**
77
- * get zoom level
78
- * @param camera
79
- * @returns
80
- */
81
- getZoomLevel(camera) {
82
- const minZoom = 10;
83
- const maxZoom = 16;
84
- const minHeight = 10;
85
- const maxHeight = 1000;
86
- return Math.max(minZoom, Math.min(maxZoom, (maxHeight - camera.position.y) / (maxHeight - minHeight) * (maxZoom - minZoom) + minZoom));
87
- }
67
+ _createClass(HeatMap, [{
68
+ key: "defaultMax",
69
+ get: function get() {
70
+ return Math.max.apply(Math, _toConsumableArray(this.data.map(function (item) {
71
+ return item.value;
72
+ })));
73
+ }
74
+ }, {
75
+ key: "url",
76
+ get: function get() {
77
+ return this._url;
78
+ }
79
+ }, {
80
+ key: "initSupercluster",
81
+ value: function initSupercluster() {
82
+ this._supercluster = new Supercluster({
83
+ radius: 40,
84
+ minZoom: 1,
85
+ maxZoom: 16
86
+ });
87
+ }
88
88
 
89
- /**
90
- * get supercluster data
91
- * @returns
92
- */
93
- getSuperclusterData() {
94
- const {
95
- max
96
- } = this.calDataMaxMin();
97
- const zoom = this.getZoomLevel(use.useScene().camera);
98
- const clusters = this._supercluster.getClusters([-max, -max, max, max], zoom);
99
- console.log('当前缩放级别:', zoom, '输入点数量:', this.data.length, '聚类后点数量:', clusters.length);
100
- return clusters;
101
- }
89
+ /**
90
+ * set supercluster data
91
+ */
92
+ }, {
93
+ key: "setSuperclusterData",
94
+ value: function setSuperclusterData() {
95
+ var featuresPoints = this.data.map(function (item) {
96
+ return {
97
+ type: 'Feature',
98
+ properties: {},
99
+ geometry: {
100
+ type: 'Point',
101
+ coordinates: [item.x, item.z]
102
+ }
103
+ };
104
+ });
105
+ console.log('正在加载点数据到supercluster:', featuresPoints.length);
106
+ this._supercluster.load(featuresPoints);
107
+ }
102
108
 
103
- /**
104
- * calculate data max and min
105
- * @returns
106
- */
107
- calDataMaxMin() {
108
- const maxX = Math.max(...this.data.map(item => item.x));
109
- const minX = Math.min(...this.data.map(item => item.x));
110
- const maxZ = Math.max(...this.data.map(item => item.z));
111
- const minZ = Math.min(...this.data.map(item => item.z));
112
- const max = Math.max(Math.abs(Math.ceil(maxX)), Math.abs(Math.ceil(minX)), Math.abs(Math.ceil(maxZ)), Math.abs(Math.ceil(minZ)), 60);
113
- const maxRadius = Math.max(...this.data.map(item => {
114
- var _item$radius;
115
- return (_item$radius = item.radius) !== null && _item$radius !== void 0 ? _item$radius : this._radius;
116
- }), this._radius);
117
- const width = max * 2;
118
- const height = max * 2;
119
- const realShowWidth = maxX - minX;
120
- const realShowHeight = maxZ - minZ;
121
- const realShowMax = Math.max(Math.ceil(realShowWidth), Math.ceil(realShowHeight), 60);
122
- return {
123
- width,
124
- height,
125
- max,
126
- minX,
127
- minZ,
128
- maxX,
129
- maxZ,
130
- realShowMax,
131
- realShowWidth,
132
- realShowHeight,
133
- maxRadius
134
- };
135
- }
109
+ /**
110
+ * get zoom level
111
+ * @param camera
112
+ * @returns
113
+ */
114
+ }, {
115
+ key: "getZoomLevel",
116
+ value: function getZoomLevel(camera) {
117
+ var minZoom = 10;
118
+ var maxZoom = 16;
119
+ var minHeight = 10;
120
+ var maxHeight = 1000;
121
+ return Math.max(minZoom, Math.min(maxZoom, (maxHeight - camera.position.y) / (maxHeight - minHeight) * (maxZoom - minZoom) + minZoom));
122
+ }
136
123
 
137
- /**
138
- * generateAsitePoints
139
- * @param data
140
- */
141
- generateAsitePoints(data) {
142
- const maxX = Math.max(...data.map(item => item.x));
143
- const minX = Math.min(...data.map(item => item.x));
144
- const maxZ = Math.max(...data.map(item => item.z));
145
- const minZ = Math.min(...data.map(item => item.z));
146
- const maxRadius = 2 * Math.max(...data.map(item => {
147
- var _item$radius2;
148
- return (_item$radius2 = item.radius) !== null && _item$radius2 !== void 0 ? _item$radius2 : this._radius;
149
- }), this._radius);
150
- const boundaryPoints = [{
151
- x: minX - maxRadius,
152
- z: minZ - maxRadius,
153
- value: 0,
154
- y: 0,
155
- isBoundary: true,
156
- radius: 0.001
157
- }, {
158
- x: maxX + maxRadius,
159
- z: minZ - maxRadius,
160
- value: 0,
161
- y: 0,
162
- isBoundary: true,
163
- radius: 0.001
164
- }, {
165
- x: minX - maxRadius,
166
- z: maxZ + maxRadius,
167
- value: 0,
168
- y: 0,
169
- isBoundary: true,
170
- radius: 0.001
171
- }, {
172
- x: maxX + maxRadius,
173
- z: maxZ + maxRadius,
174
- value: 0,
175
- y: 0,
176
- isBoundary: true,
177
- radius: 0.001
178
- }];
179
- return {
180
- boundaryPoints,
181
- maxRadius
182
- };
183
- }
124
+ /**
125
+ * get supercluster data
126
+ * @returns
127
+ */
128
+ }, {
129
+ key: "getSuperclusterData",
130
+ value: function getSuperclusterData() {
131
+ var _this$calDataMaxMin = this.calDataMaxMin(),
132
+ max = _this$calDataMaxMin.max;
133
+ var zoom = this.getZoomLevel(use.useScene().camera);
134
+ var clusters = this._supercluster.getClusters([-max, -max, max, max], zoom);
135
+ console.log('当前缩放级别:', zoom, '输入点数量:', this.data.length, '聚类后点数量:', clusters.length);
136
+ return clusters;
137
+ }
184
138
 
185
- /**
186
- * generate new origin
187
- * @returns
188
- */
189
- get newOrigin() {
190
- // need to consider one point and multiple points
191
- const {
192
- minX,
193
- minZ,
194
- maxX,
195
- maxZ
196
- } = this.calDataMaxMin();
197
- return {
198
- x: (maxX + minX) / 2,
199
- z: (maxZ + minZ) / 2
200
- };
201
- }
139
+ /**
140
+ * calculate data max and min
141
+ * @returns
142
+ */
143
+ }, {
144
+ key: "calDataMaxMin",
145
+ value: function calDataMaxMin() {
146
+ var _this2 = this;
147
+ var maxX = Math.max.apply(Math, _toConsumableArray(this.data.map(function (item) {
148
+ return item.x;
149
+ })));
150
+ var minX = Math.min.apply(Math, _toConsumableArray(this.data.map(function (item) {
151
+ return item.x;
152
+ })));
153
+ var maxZ = Math.max.apply(Math, _toConsumableArray(this.data.map(function (item) {
154
+ return item.z;
155
+ })));
156
+ var minZ = Math.min.apply(Math, _toConsumableArray(this.data.map(function (item) {
157
+ return item.z;
158
+ })));
159
+ var max = Math.max(Math.abs(Math.ceil(maxX)), Math.abs(Math.ceil(minX)), Math.abs(Math.ceil(maxZ)), Math.abs(Math.ceil(minZ)), 60);
160
+ var maxRadius = Math.max.apply(Math, _toConsumableArray(this.data.map(function (item) {
161
+ var _item$radius;
162
+ return (_item$radius = item.radius) !== null && _item$radius !== void 0 ? _item$radius : _this2._radius;
163
+ })).concat([this._radius]));
164
+ var width = max * 2;
165
+ var height = max * 2;
166
+ var realShowWidth = maxX - minX;
167
+ var realShowHeight = maxZ - minZ;
168
+ var realShowMax = Math.max(Math.ceil(realShowWidth), Math.ceil(realShowHeight), 60);
169
+ return {
170
+ width: width,
171
+ height: height,
172
+ max: max,
173
+ minX: minX,
174
+ minZ: minZ,
175
+ maxX: maxX,
176
+ maxZ: maxZ,
177
+ realShowMax: realShowMax,
178
+ realShowWidth: realShowWidth,
179
+ realShowHeight: realShowHeight,
180
+ maxRadius: maxRadius
181
+ };
182
+ }
202
183
 
203
- /**
204
- * coordinate 3D transformation
205
- * @param data
206
- * @returns
207
- */
208
- coordinate3DTransformation(data) {
209
- const {
210
- x,
211
- z
212
- } = this.newOrigin;
213
- return data.map(item => {
214
- var _item$radius3;
215
- return _objectSpread(_objectSpread({}, item), {}, {
216
- x: item.x - x,
217
- z: item.z - z,
218
- radius: (_item$radius3 = item.radius) !== null && _item$radius3 !== void 0 ? _item$radius3 : this._radius
219
- });
220
- });
221
- }
184
+ /**
185
+ * generateAsitePoints
186
+ * @param data
187
+ */
188
+ }, {
189
+ key: "generateAsitePoints",
190
+ value: function generateAsitePoints(data) {
191
+ var _this3 = this;
192
+ var maxX = Math.max.apply(Math, _toConsumableArray(data.map(function (item) {
193
+ return item.x;
194
+ })));
195
+ var minX = Math.min.apply(Math, _toConsumableArray(data.map(function (item) {
196
+ return item.x;
197
+ })));
198
+ var maxZ = Math.max.apply(Math, _toConsumableArray(data.map(function (item) {
199
+ return item.z;
200
+ })));
201
+ var minZ = Math.min.apply(Math, _toConsumableArray(data.map(function (item) {
202
+ return item.z;
203
+ })));
204
+ var maxRadius = 2 * Math.max.apply(Math, _toConsumableArray(data.map(function (item) {
205
+ var _item$radius2;
206
+ return (_item$radius2 = item.radius) !== null && _item$radius2 !== void 0 ? _item$radius2 : _this3._radius;
207
+ })).concat([this._radius]));
208
+ var boundaryPoints = [{
209
+ x: minX - maxRadius,
210
+ z: minZ - maxRadius,
211
+ value: 0,
212
+ y: 0,
213
+ isBoundary: true,
214
+ radius: 0.001
215
+ }, {
216
+ x: maxX + maxRadius,
217
+ z: minZ - maxRadius,
218
+ value: 0,
219
+ y: 0,
220
+ isBoundary: true,
221
+ radius: 0.001
222
+ }, {
223
+ x: minX - maxRadius,
224
+ z: maxZ + maxRadius,
225
+ value: 0,
226
+ y: 0,
227
+ isBoundary: true,
228
+ radius: 0.001
229
+ }, {
230
+ x: maxX + maxRadius,
231
+ z: maxZ + maxRadius,
232
+ value: 0,
233
+ y: 0,
234
+ isBoundary: true,
235
+ radius: 0.001
236
+ }];
237
+ return {
238
+ boundaryPoints: boundaryPoints,
239
+ maxRadius: maxRadius
240
+ };
241
+ }
222
242
 
223
- /**
224
- * coordinate transformation, to canvas coordinate
225
- * @param data
226
- * @returns
227
- */
228
- coordinateTransformation(data) {
229
- const hanldeData = this.coordinate3DTransformation(data);
230
- const {
231
- width,
232
- height,
233
- realShowWidth,
234
- realShowHeight
235
- } = this.calDataMaxMin();
236
- const resolutionScale = this.calResolutionScale();
237
- const result = hanldeData.map(item => {
238
- var _item$radius4;
243
+ /**
244
+ * generate new origin
245
+ * @returns
246
+ */
247
+ }, {
248
+ key: "newOrigin",
249
+ get: function get() {
250
+ // need to consider one point and multiple points
251
+ var _this$calDataMaxMin2 = this.calDataMaxMin(),
252
+ minX = _this$calDataMaxMin2.minX,
253
+ minZ = _this$calDataMaxMin2.minZ,
254
+ maxX = _this$calDataMaxMin2.maxX,
255
+ maxZ = _this$calDataMaxMin2.maxZ;
239
256
  return {
240
- x: Math.floor((item.x - -realShowWidth / 2) / (realShowWidth / 2 - -realShowWidth / 2) * width) * resolutionScale,
241
- y: Math.floor((item.z - -realShowHeight / 2) / (realShowHeight / 2 - -realShowHeight / 2) * height) * resolutionScale,
242
- value: item.value,
243
- radius: ((_item$radius4 = item.radius) !== null && _item$radius4 !== void 0 ? _item$radius4 : this._radius) * resolutionScale * 2,
244
- // @ts-ignore
245
- isBoundary: item === null || item === void 0 ? void 0 : item.isBoundary
257
+ x: (maxX + minX) / 2,
258
+ z: (maxZ + minZ) / 2
246
259
  };
247
- });
260
+ }
248
261
 
249
- // console.log('原始', data, realShowWidth, realShowHeight)
250
- // console.log('newOrigin', this.newOrigin)
251
- // console.log('hanldeData', hanldeData)
252
- // console.log('结果', result)
253
- // console.log('resolutionScale', resolutionScale, realShowWidth, realShowHeight, realShowWidth * resolutionScale, realShowHeight * resolutionScale)
262
+ /**
263
+ * coordinate 3D transformation
264
+ * @param data
265
+ * @returns
266
+ */
267
+ }, {
268
+ key: "coordinate3DTransformation",
269
+ value: function coordinate3DTransformation(data) {
270
+ var _this4 = this;
271
+ var _this$newOrigin = this.newOrigin,
272
+ x = _this$newOrigin.x,
273
+ z = _this$newOrigin.z;
274
+ return data.map(function (item) {
275
+ var _item$radius3;
276
+ return _objectSpread(_objectSpread({}, item), {}, {
277
+ x: item.x - x,
278
+ z: item.z - z,
279
+ radius: (_item$radius3 = item.radius) !== null && _item$radius3 !== void 0 ? _item$radius3 : _this4._radius
280
+ });
281
+ });
282
+ }
254
283
 
255
- return result;
256
- }
284
+ /**
285
+ * coordinate transformation, to canvas coordinate
286
+ * @param data
287
+ * @returns
288
+ */
289
+ }, {
290
+ key: "coordinateTransformation",
291
+ value: function coordinateTransformation(data) {
292
+ var _this5 = this;
293
+ var hanldeData = this.coordinate3DTransformation(data);
294
+ var _this$calDataMaxMin3 = this.calDataMaxMin(),
295
+ width = _this$calDataMaxMin3.width,
296
+ height = _this$calDataMaxMin3.height,
297
+ realShowWidth = _this$calDataMaxMin3.realShowWidth,
298
+ realShowHeight = _this$calDataMaxMin3.realShowHeight;
299
+ var resolutionScale = this.calResolutionScale();
300
+ var result = hanldeData.map(function (item) {
301
+ var _item$radius4;
302
+ return {
303
+ x: Math.floor((item.x - -realShowWidth / 2) / (realShowWidth / 2 - -realShowWidth / 2) * width) * resolutionScale,
304
+ y: Math.floor((item.z - -realShowHeight / 2) / (realShowHeight / 2 - -realShowHeight / 2) * height) * resolutionScale,
305
+ value: item.value,
306
+ radius: ((_item$radius4 = item.radius) !== null && _item$radius4 !== void 0 ? _item$radius4 : _this5._radius) * resolutionScale * 2,
307
+ // @ts-ignore
308
+ isBoundary: item === null || item === void 0 ? void 0 : item.isBoundary
309
+ };
310
+ });
257
311
 
258
- /**
259
- * generate heatmap texture
260
- * @param canvasBox
261
- * @returns
262
- */
263
- createHeatmapTool() {
264
- const heatmap = h.create({
265
- container: this._canvasBox,
266
- radius: this._radius,
267
- gradient: this._colorMap,
268
- maxOpacity: 1,
269
- minOpacity: 0
270
- });
271
- return heatmap;
272
- }
312
+ // console.log('原始', data, realShowWidth, realShowHeight)
313
+ // console.log('newOrigin', this.newOrigin)
314
+ // console.log('hanldeData', hanldeData)
315
+ // console.log('结果', result)
316
+ // console.log('resolutionScale', resolutionScale, realShowWidth, realShowHeight, realShowWidth * resolutionScale, realShowHeight * resolutionScale)
273
317
 
274
- /**
275
- * create heatmap container canvas
276
- * @returns
277
- */
278
- createCanvas(width, height) {
279
- const canvasBox = document.createElement('div');
280
- canvasBox.style.width = `${width}px`;
281
- canvasBox.style.height = `${height}px`;
282
- canvasBox.style.top = '0';
283
- canvasBox.style.right = '0';
284
- use.useScene().domElement.parentElement.appendChild(canvasBox);
285
- return canvasBox;
286
- }
318
+ return result;
319
+ }
287
320
 
288
- /**
289
- * calculate resolution scale
290
- * @param width
291
- * @returns
292
- */
293
- calResolutionScale() {
294
- const hanldeData = this.coordinate3DTransformation(this.data);
295
- const {
296
- width,
297
- height,
298
- realShowWidth,
299
- realShowHeight
300
- } = this.calDataMaxMin();
301
- const result = hanldeData.map(item => ({
302
- x: Math.floor((item.x - -realShowWidth / 2) / (realShowWidth / 2 - -realShowWidth / 2) * width),
303
- y: Math.floor((item.z - -realShowHeight / 2) / (realShowHeight / 2 - -realShowHeight / 2) * height),
304
- value: item.value,
305
- radius: item.radius * 2
306
- }));
307
- const maxRadius = Math.max(...result.map(item => item.radius));
308
- const maxX = Math.max(...result.map(item => item.x));
309
- const maxY = Math.max(...result.map(item => item.y));
310
- const max = Math.max(maxX, maxY);
311
- if (max <= 1000) {
312
- const scale = (1000 - max) / 1000 * 15 + 1;
313
- return Math.floor(maxRadius < 40 ? scale : 1);
321
+ /**
322
+ * generate heatmap texture
323
+ * @param canvasBox
324
+ * @returns
325
+ */
326
+ }, {
327
+ key: "createHeatmapTool",
328
+ value: function createHeatmapTool() {
329
+ var heatmap = h.create({
330
+ container: this._canvasBox,
331
+ radius: this._radius,
332
+ gradient: this._colorMap,
333
+ maxOpacity: 1,
334
+ minOpacity: 0
335
+ });
336
+ return heatmap;
314
337
  }
315
- if (max <= 5000) {
316
- const scale = (5000 - max) / 5000 * 5 + 1;
317
- return Math.floor(maxRadius < 40 ? scale : 1);
338
+
339
+ /**
340
+ * create heatmap container canvas
341
+ * @returns
342
+ */
343
+ }, {
344
+ key: "createCanvas",
345
+ value: function createCanvas(width, height) {
346
+ var canvasBox = document.createElement('div');
347
+ canvasBox.style.width = "".concat(width, "px");
348
+ canvasBox.style.height = "".concat(height, "px");
349
+ canvasBox.style.top = '0';
350
+ canvasBox.style.right = '0';
351
+ use.useScene().domElement.parentElement.appendChild(canvasBox);
352
+ return canvasBox;
318
353
  }
319
- return 1;
320
- }
321
354
 
322
- /**
323
- * create attachment mesh
324
- */
325
- createAttachmentMesh() {
326
- if (this._attachmentMesh) this.remove(this._attachmentMesh);
327
- const {
328
- realShowMax,
329
- max,
330
- realShowWidth,
331
- realShowHeight
332
- } = this.calDataMaxMin();
333
- const canvas = this._heatmap._renderer.canvas;
334
- const texture = new CanvasTexture(canvas);
335
- texture.minFilter = NearestFilter;
336
- texture.magFilter = NearestFilter;
337
- this._url = canvas.toDataURL('image/png');
338
- const threshold = 0.3 / 1000 * realShowMax;
339
- const shaderMaterial = new ShaderMaterial({
340
- uniforms: {
341
- map: {
342
- value: texture
343
- },
344
- granularity: {
345
- value: realShowMax / 3 < 300 ? 300 : realShowMax / 3
346
- },
347
- threshold: {
348
- value: threshold > 0.6 ? 0.6 : threshold < 0.25 ? 0.25 : threshold
349
- },
350
- uOpacity: {
351
- value: 2.0
352
- },
353
- uHeight: {
354
- value: this._height
355
- },
356
- isPixel: {
357
- value: this._isPixel
355
+ /**
356
+ * calculate resolution scale
357
+ * @param width
358
+ * @returns
359
+ */
360
+ }, {
361
+ key: "calResolutionScale",
362
+ value: function calResolutionScale() {
363
+ var hanldeData = this.coordinate3DTransformation(this.data);
364
+ var _this$calDataMaxMin4 = this.calDataMaxMin(),
365
+ width = _this$calDataMaxMin4.width,
366
+ height = _this$calDataMaxMin4.height,
367
+ realShowWidth = _this$calDataMaxMin4.realShowWidth,
368
+ realShowHeight = _this$calDataMaxMin4.realShowHeight;
369
+ var result = hanldeData.map(function (item) {
370
+ return {
371
+ x: Math.floor((item.x - -realShowWidth / 2) / (realShowWidth / 2 - -realShowWidth / 2) * width),
372
+ y: Math.floor((item.z - -realShowHeight / 2) / (realShowHeight / 2 - -realShowHeight / 2) * height),
373
+ value: item.value,
374
+ radius: item.radius * 2
375
+ };
376
+ });
377
+ var maxRadius = Math.max.apply(Math, _toConsumableArray(result.map(function (item) {
378
+ return item.radius;
379
+ })));
380
+ var maxX = Math.max.apply(Math, _toConsumableArray(result.map(function (item) {
381
+ return item.x;
382
+ })));
383
+ var maxY = Math.max.apply(Math, _toConsumableArray(result.map(function (item) {
384
+ return item.y;
385
+ })));
386
+ var max = Math.max(maxX, maxY);
387
+ if (max <= 1000) {
388
+ var scale = (1000 - max) / 1000 * 15 + 1;
389
+ return Math.floor(maxRadius < 40 ? scale : 1);
390
+ }
391
+ if (max <= 5000) {
392
+ var _scale = (5000 - max) / 5000 * 5 + 1;
393
+ return Math.floor(maxRadius < 40 ? _scale : 1);
394
+ }
395
+ return 1;
396
+ }
397
+
398
+ /**
399
+ * create attachment mesh
400
+ */
401
+ }, {
402
+ key: "createAttachmentMesh",
403
+ value: function createAttachmentMesh() {
404
+ if (this._attachmentMesh) this.remove(this._attachmentMesh);
405
+ var _this$calDataMaxMin5 = this.calDataMaxMin(),
406
+ realShowMax = _this$calDataMaxMin5.realShowMax,
407
+ max = _this$calDataMaxMin5.max,
408
+ realShowWidth = _this$calDataMaxMin5.realShowWidth,
409
+ realShowHeight = _this$calDataMaxMin5.realShowHeight;
410
+ var canvas = this._heatmap._renderer.canvas;
411
+ var texture = new CanvasTexture(canvas);
412
+ texture.minFilter = NearestFilter;
413
+ texture.magFilter = NearestFilter;
414
+ this._url = canvas.toDataURL('image/png');
415
+ var threshold = 0.3 / 1000 * realShowMax;
416
+ var shaderMaterial = new ShaderMaterial({
417
+ uniforms: {
418
+ map: {
419
+ value: texture
420
+ },
421
+ granularity: {
422
+ value: realShowMax / 3 < 300 ? 300 : realShowMax / 3
423
+ },
424
+ threshold: {
425
+ value: threshold > 0.6 ? 0.6 : threshold < 0.25 ? 0.25 : threshold
426
+ },
427
+ uOpacity: {
428
+ value: 2.0
429
+ },
430
+ uHeight: {
431
+ value: this._height
432
+ },
433
+ isPixel: {
434
+ value: this._isPixel
435
+ },
436
+ uRange: {
437
+ value: new Vector2(-max, max)
438
+ }
358
439
  },
359
- uRange: {
360
- value: new Vector2(-max, max)
361
- }
362
- },
363
- vertexShader: heightVertexShader,
364
- fragmentShader: heightFragmentShader,
365
- transparent: true,
366
- side: DoubleSide,
367
- depthTest: false
368
- });
369
- const mesh = new Mesh(new PlaneGeometry(realShowWidth, realShowHeight, 500, 500), shaderMaterial);
370
- const {
371
- x,
372
- z
373
- } = this.newOrigin;
374
- mesh.rotation.x = -Math.PI / 2;
375
- mesh.position.set(x, 0, z);
376
- mesh.renderOrder = 1000;
377
- this._attachmentMesh = mesh;
378
- this.add(mesh);
379
- }
440
+ vertexShader: heightVertexShader,
441
+ fragmentShader: heightFragmentShader,
442
+ transparent: true,
443
+ side: DoubleSide,
444
+ depthTest: false
445
+ });
446
+ var mesh = new Mesh(new PlaneGeometry(realShowWidth, realShowHeight, 500, 500), shaderMaterial);
447
+ var _this$newOrigin2 = this.newOrigin,
448
+ x = _this$newOrigin2.x,
449
+ z = _this$newOrigin2.z;
450
+ mesh.rotation.x = -Math.PI / 2;
451
+ mesh.position.set(x, 0, z);
452
+ mesh.renderOrder = 1000;
453
+ this._attachmentMesh = mesh;
454
+ this.add(mesh);
455
+ }
380
456
 
381
- /**
382
- * set heatmap data
383
- * @param data
384
- */
385
- setData(data) {
386
- var _this$_range$max, _this$_range, _this$_range$min, _this$_range2;
387
- const {
388
- boundaryPoints
389
- } = this.generateAsitePoints(data);
390
- this.data = [...boundaryPoints, ...data];
391
- const heatmapData = this.coordinateTransformation(this.data);
392
- this._canvasBox && use.useScene().domElement.parentElement.removeChild(this._canvasBox);
393
- this._canvasBox = this.createCanvas(Math.max(...heatmapData.map(item => item.x)), Math.max(...heatmapData.map(item => item.y)));
394
- this._heatmap = this.createHeatmapTool();
395
- this._heatmap.setData({
396
- data: heatmapData.filter(item => !item.isBoundary),
397
- max: (_this$_range$max = (_this$_range = this._range) === null || _this$_range === void 0 ? void 0 : _this$_range.max) !== null && _this$_range$max !== void 0 ? _this$_range$max : this.defaultMax,
398
- min: (_this$_range$min = (_this$_range2 = this._range) === null || _this$_range2 === void 0 ? void 0 : _this$_range2.min) !== null && _this$_range$min !== void 0 ? _this$_range$min : 0
399
- });
400
- this.createAttachmentMesh();
457
+ /**
458
+ * set heatmap data
459
+ * @param data
460
+ */
461
+ }, {
462
+ key: "setData",
463
+ value: function setData(data) {
464
+ var _this$_range$max, _this$_range, _this$_range$min, _this$_range2;
465
+ var _this$generateAsitePo = this.generateAsitePoints(data),
466
+ boundaryPoints = _this$generateAsitePo.boundaryPoints;
467
+ this.data = [].concat(_toConsumableArray(boundaryPoints), _toConsumableArray(data));
468
+ var heatmapData = this.coordinateTransformation(this.data);
469
+ this._canvasBox && use.useScene().domElement.parentElement.removeChild(this._canvasBox);
470
+ this._canvasBox = this.createCanvas(Math.max.apply(Math, _toConsumableArray(heatmapData.map(function (item) {
471
+ return item.x;
472
+ }))), Math.max.apply(Math, _toConsumableArray(heatmapData.map(function (item) {
473
+ return item.y;
474
+ }))));
475
+ this._heatmap = this.createHeatmapTool();
476
+ this._heatmap.setData({
477
+ data: heatmapData.filter(function (item) {
478
+ return !item.isBoundary;
479
+ }),
480
+ max: (_this$_range$max = (_this$_range = this._range) === null || _this$_range === void 0 ? void 0 : _this$_range.max) !== null && _this$_range$max !== void 0 ? _this$_range$max : this.defaultMax,
481
+ min: (_this$_range$min = (_this$_range2 = this._range) === null || _this$_range2 === void 0 ? void 0 : _this$_range2.min) !== null && _this$_range$min !== void 0 ? _this$_range$min : 0
482
+ });
483
+ this.createAttachmentMesh();
401
484
 
402
- // 聚类暂时不实现
403
- // this.setSuperclusterData()
404
- // use.useScene().orbitControls.addEventListener('change', () => {
405
- // const clusters = this.getSuperclusterData()
406
- // console.log(clusters)
407
- // })
408
- }
409
- removeFromParent() {
410
- super.removeFromParent();
411
- // todo: 升级three.js后,父对象变化,会触发此函数,重组内部引起关系
412
- if (this.parent) {
413
- var _this$_attachmentMesh;
414
- use.useScene().domElement.parentElement.removeChild(this._canvasBox);
485
+ // 聚类暂时不实现
486
+ // this.setSuperclusterData()
487
+ // use.useScene().orbitControls.addEventListener('change', () => {
488
+ // const clusters = this.getSuperclusterData()
489
+ // console.log(clusters)
490
+ // })
491
+ }
492
+ }, {
493
+ key: "removeFromParent",
494
+ value: function removeFromParent() {
495
+ _get(_getPrototypeOf(HeatMap.prototype), "removeFromParent", this).call(this);
496
+ // todo: 升级three.js后,父对象变化,会触发此函数,重组内部引起关系
497
+ if (this.parent) {
498
+ var _this$_attachmentMesh;
499
+ use.useScene().domElement.parentElement.removeChild(this._canvasBox);
415
500
 
416
- // @ts-ignore
417
- (_this$_attachmentMesh = this._attachmentMesh) === null || _this$_attachmentMesh === void 0 || _this$_attachmentMesh.material.dispose();
501
+ // @ts-ignore
502
+ (_this$_attachmentMesh = this._attachmentMesh) === null || _this$_attachmentMesh === void 0 || _this$_attachmentMesh.material.dispose();
503
+ }
504
+ return this;
418
505
  }
419
- return this;
420
- }
421
- }
506
+ }]);
507
+ return HeatMap;
508
+ }(Object3D);
422
509
  export default HeatMap;
423
510
  //# sourceMappingURL=HeatMap.js.map