@anov/3d-ability 0.0.139 → 0.0.141

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 (265) hide show
  1. package/dist/business/Animation/motion/index.js +35 -56
  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 +146 -187
  5. package/dist/business/Area/Fence/FenceBase.js.map +1 -1
  6. package/dist/business/Area/Fence/fence_base_01.js +120 -112
  7. package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
  8. package/dist/business/Area/Fence/fence_feeting_01.js +218 -130
  9. package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
  10. package/dist/business/Area/Fence/fence_roll_01.js +140 -130
  11. package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
  12. package/dist/business/Area/FillArea/FillAreaBase.js +87 -126
  13. package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
  14. package/dist/business/Area/FillArea/fillArea_face_01.js +72 -98
  15. package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
  16. package/dist/business/Area/FillArea/fillArea_line_01.js +66 -94
  17. package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
  18. package/dist/business/Area/index.js +267 -483
  19. package/dist/business/Area/index.js.map +1 -1
  20. package/dist/business/Area/tool.js +14 -26
  21. package/dist/business/Area/tool.js.map +1 -1
  22. package/dist/business/Base/ObjectLayer.js +21 -46
  23. package/dist/business/Base/ObjectLayer.js.map +1 -1
  24. package/dist/business/Batch/index.js +189 -234
  25. package/dist/business/Batch/index.js.map +1 -1
  26. package/dist/business/Box/index.js +52 -81
  27. package/dist/business/Box/index.js.map +1 -1
  28. package/dist/business/Cylinder/index.js +51 -79
  29. package/dist/business/Cylinder/index.js.map +1 -1
  30. package/dist/business/Flyline/bubble/CircleBubble.js +1 -9
  31. package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
  32. package/dist/business/Flyline/bubble/index.js +7 -21
  33. package/dist/business/Flyline/bubble/index.js.map +1 -1
  34. package/dist/business/Flyline/index.js +96 -162
  35. package/dist/business/Flyline/index.js.map +1 -1
  36. package/dist/business/Flyline/line/ArcLine.js +208 -291
  37. package/dist/business/Flyline/line/ArcLine.js.map +1 -1
  38. package/dist/business/Flyline/line/index.js +8 -22
  39. package/dist/business/Flyline/line/index.js.map +1 -1
  40. package/dist/business/HeatMap/HeatMap.js +380 -467
  41. package/dist/business/HeatMap/HeatMap.js.map +1 -1
  42. package/dist/business/HeatMap/core.js +405 -525
  43. package/dist/business/HeatMap/core.js.map +1 -1
  44. package/dist/business/HeatMap/shader.js +69 -3
  45. package/dist/business/HeatMap/shader.js.map +1 -1
  46. package/dist/business/InfoPanel/index.js +201 -242
  47. package/dist/business/InfoPanel/index.js.map +1 -1
  48. package/dist/business/Line/index.js +55 -88
  49. package/dist/business/Line/index.js.map +1 -1
  50. package/dist/business/Mark/KeyframeAnimation.js +145 -176
  51. package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
  52. package/dist/business/Mark/index.js +196 -294
  53. package/dist/business/Mark/index.js.map +1 -1
  54. package/dist/business/Mark/shader/tanhao.js +36 -3
  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 +377 -551
  58. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
  59. package/dist/business/MaterialSwitch/inject.js +92 -58
  60. package/dist/business/MaterialSwitch/inject.js.map +1 -1
  61. package/dist/business/MaterialSwitch/shader/finalFade.js +74 -2
  62. package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
  63. package/dist/business/MaterialSwitch/shader/ground.js +95 -16
  64. package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
  65. package/dist/business/MaterialSwitch/shader/groundBase64.js +9 -3
  66. package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
  67. package/dist/business/MaterialSwitch/shader/realFade.js +48 -9
  68. package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
  69. package/dist/business/Plane/index.js +51 -78
  70. package/dist/business/Plane/index.js.map +1 -1
  71. package/dist/business/Poi/index.d.ts +5 -0
  72. package/dist/business/Poi/index.js +256 -295
  73. package/dist/business/Poi/index.js.map +1 -1
  74. package/dist/business/Poi/link/Cylinder.js +56 -89
  75. package/dist/business/Poi/link/Cylinder.js.map +1 -1
  76. package/dist/business/Poi/link/Pyramid.js +104 -165
  77. package/dist/business/Poi/link/Pyramid.js.map +1 -1
  78. package/dist/business/Poi/link/index.d.ts +1 -1
  79. package/dist/business/Poi/link/index.js +54 -114
  80. package/dist/business/Poi/link/index.js.map +1 -1
  81. package/dist/business/Poi/panel/index.d.ts +124 -0
  82. package/dist/business/Poi/panel/index.js +474 -0
  83. package/dist/business/Poi/panel/index.js.map +1 -0
  84. package/dist/business/Poi/panel/interfaces.d.ts +67 -0
  85. package/dist/business/Poi/panel/interfaces.js +2 -0
  86. package/dist/business/Poi/panel/interfaces.js.map +1 -0
  87. package/dist/business/Poi/panel/utils.d.ts +72 -0
  88. package/dist/business/Poi/panel/utils.js +126 -0
  89. package/dist/business/Poi/panel/utils.js.map +1 -0
  90. package/dist/business/Poi/particle/DoubleCircle.js +71 -107
  91. package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
  92. package/dist/business/Poi/particle/DynamicCircle.js +75 -111
  93. package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
  94. package/dist/business/Poi/particle/SingleCircle.js +62 -98
  95. package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
  96. package/dist/business/Poi/particle/index.js +49 -117
  97. package/dist/business/Poi/particle/index.js.map +1 -1
  98. package/dist/business/Poi/shader/circle.js +31 -3
  99. package/dist/business/Poi/shader/circle.js.map +1 -1
  100. package/dist/business/Poi/shader/cylinder.js +37 -3
  101. package/dist/business/Poi/shader/cylinder.js.map +1 -1
  102. package/dist/business/Poi/shader/doubleCircle.js +55 -3
  103. package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
  104. package/dist/business/Poi/shader/dynamicCircle.js +67 -3
  105. package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
  106. package/dist/business/Poi/title/Border.js +7 -27
  107. package/dist/business/Poi/title/Border.js.map +1 -1
  108. package/dist/business/Poi/title/Ellipse.js +7 -27
  109. package/dist/business/Poi/title/Ellipse.js.map +1 -1
  110. package/dist/business/Poi/title/index.js +208 -292
  111. package/dist/business/Poi/title/index.js.map +1 -1
  112. package/dist/business/Poi/tools.js +22 -19
  113. package/dist/business/Poi/tools.js.map +1 -1
  114. package/dist/business/Poi/types.d.ts +3 -0
  115. package/dist/business/Poi/types.js.map +1 -1
  116. package/dist/business/Sphere/index.js +47 -72
  117. package/dist/business/Sphere/index.js.map +1 -1
  118. package/dist/business/Spline/index.js +190 -245
  119. package/dist/business/Spline/index.js.map +1 -1
  120. package/dist/business/SplitBuilding/index.js +327 -536
  121. package/dist/business/SplitBuilding/index.js.map +1 -1
  122. package/dist/business/SplitBuilding/type.js +2 -2
  123. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +218 -275
  124. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
  125. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +132 -177
  126. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
  127. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +51 -1
  128. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
  129. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +6 -1
  130. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
  131. package/dist/business/TrafficComponents/base.js +32 -55
  132. package/dist/business/TrafficComponents/base.js.map +1 -1
  133. package/dist/business/TrafficComponents/utils.js +25 -24
  134. package/dist/business/TrafficComponents/utils.js.map +1 -1
  135. package/dist/business/Utils/Curve.js +40 -56
  136. package/dist/business/Utils/Curve.js.map +1 -1
  137. package/dist/business/Utils/constant.js +1 -1
  138. package/dist/business/Utils/constant.js.map +1 -1
  139. package/dist/business/Utils/defineProps.js +13 -14
  140. package/dist/business/Utils/defineProps.js.map +1 -1
  141. package/dist/business/Utils/round-curve.js +127 -153
  142. package/dist/business/Utils/round-curve.js.map +1 -1
  143. package/dist/business/VideoPanel/index.js +258 -319
  144. package/dist/business/VideoPanel/index.js.map +1 -1
  145. package/dist/business/Water/index.js +78 -108
  146. package/dist/business/Water/index.js.map +1 -1
  147. package/dist/business/Water/types.js +1 -1
  148. package/dist/business/Water/types.js.map +1 -1
  149. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +383 -449
  150. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
  151. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +107 -142
  152. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
  153. package/dist/core/Controls/FirstViewControl/index.js +84 -96
  154. package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
  155. package/dist/core/Controls/ThirdViewControl/action/input.js +77 -98
  156. package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
  157. package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
  158. package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
  159. package/dist/core/Controls/ThirdViewControl/index.js +19 -28
  160. package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
  161. package/dist/core/Controls/ThirdViewControl/player/animation.js +126 -155
  162. package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
  163. package/dist/core/Controls/ThirdViewControl/player/camera.js +47 -63
  164. package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
  165. package/dist/core/Controls/ThirdViewControl/player/control.js +39 -49
  166. package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
  167. package/dist/core/Controls/ThirdViewControl/player.js +66 -91
  168. package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
  169. package/dist/core/Controls/base.js +14 -30
  170. package/dist/core/Controls/base.js.map +1 -1
  171. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +92 -131
  172. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
  173. package/dist/core/Debug/PerformanceInfo/Performance.js +22 -47
  174. package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
  175. package/dist/core/Light/PointLight/PointLightExt.js +4 -21
  176. package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
  177. package/dist/core/Material/FinirMaterial/FinirMaterial.js +37 -57
  178. package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
  179. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +116 -153
  180. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
  181. package/dist/core/Material/PristineGridMaterial/shader/fragment.js +95 -1
  182. package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
  183. package/dist/core/Material/PristineGridMaterial/shader/vertex.js +26 -1
  184. package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
  185. package/dist/core/Material/SurfaceMaterial/index.js +76 -172
  186. package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
  187. package/dist/core/Material/decorators.js +6 -11
  188. package/dist/core/Material/decorators.js.map +1 -1
  189. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +16 -12
  190. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
  191. package/dist/core/PostEffects/addBrightnessContrastPass.js +17 -13
  192. package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
  193. package/dist/core/PostEffects/bloomPass.js +17 -10
  194. package/dist/core/PostEffects/bloomPass.js.map +1 -1
  195. package/dist/core/PostEffects/bloomSelect.js +60 -43
  196. package/dist/core/PostEffects/bloomSelect.js.map +1 -1
  197. package/dist/core/PostEffects/colorifyPass.js +17 -13
  198. package/dist/core/PostEffects/colorifyPass.js.map +1 -1
  199. package/dist/core/PostEffects/index.js +28 -22
  200. package/dist/core/PostEffects/index.js.map +1 -1
  201. package/dist/core/PostEffects/outlinePass.js +37 -50
  202. package/dist/core/PostEffects/outlinePass.js.map +1 -1
  203. package/dist/core/PostEffects/postprocessing.js +14 -12
  204. package/dist/core/PostEffects/postprocessing.js.map +1 -1
  205. package/dist/core/PostEffects/saoPass.js +15 -10
  206. package/dist/core/PostEffects/saoPass.js.map +1 -1
  207. package/dist/core/PostEffects/shader/colorify.js +22 -3
  208. package/dist/core/PostEffects/shader/colorify.js.map +1 -1
  209. package/dist/core/PostEffects/shader/gammaCorrectionShader.js +27 -3
  210. package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
  211. package/dist/core/PostEffects/shader/mapping.js +66 -3
  212. package/dist/core/PostEffects/shader/mapping.js.map +1 -1
  213. package/dist/core/PostEffects/shader/thermalMaging.js +28 -3
  214. package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
  215. package/dist/core/SceneEffect/grow/grow.js +85 -101
  216. package/dist/core/SceneEffect/grow/grow.js.map +1 -1
  217. package/dist/core/SceneEffect/grow/style_down.js +60 -77
  218. package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
  219. package/dist/core/SceneEffect/grow/style_up.js +64 -81
  220. package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
  221. package/dist/core/SceneEffect/grow/type.js +2 -2
  222. package/dist/core/SceneEffect/grow/type.js.map +1 -1
  223. package/dist/core/WeatherSystem/DynamicWeatherSystem.js +51 -76
  224. package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
  225. package/dist/core/WeatherSystem/hdr/index.js +69 -105
  226. package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
  227. package/dist/core/WeatherSystem/index.js +77 -124
  228. package/dist/core/WeatherSystem/index.js.map +1 -1
  229. package/dist/core/WeatherSystem/objects/fog/index.js +52 -80
  230. package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
  231. package/dist/core/WeatherSystem/objects/rain/index.js +72 -84
  232. package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
  233. package/dist/core/WeatherSystem/objects/rain/lineRain.js +88 -118
  234. package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
  235. package/dist/core/WeatherSystem/objects/rain/plane.js +116 -146
  236. package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
  237. package/dist/core/WeatherSystem/objects/rain/point.js +100 -148
  238. package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
  239. package/dist/core/WeatherSystem/objects/sky/cloud.js +71 -104
  240. package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
  241. package/dist/core/WeatherSystem/objects/sky/index.js +66 -84
  242. package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
  243. package/dist/core/WeatherSystem/objects/sky/outline.js +25 -45
  244. package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
  245. package/dist/core/WeatherSystem/shaders/cloud.js +74 -3
  246. package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
  247. package/dist/core/WeatherSystem/shaders/fog.js +103 -3
  248. package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
  249. package/dist/core/WeatherSystem/shaders/rain.js +206 -7
  250. package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
  251. package/dist/core/WeatherSystem/shaders/sky.js +87 -3
  252. package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
  253. package/dist/core/WeatherSystem/sky/index.js +104 -135
  254. package/dist/core/WeatherSystem/sky/index.js.map +1 -1
  255. package/dist/core/WeatherSystem/utils/constant.js +44 -38
  256. package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
  257. package/dist/core/WeatherSystem/utils/math.js +18 -25
  258. package/dist/core/WeatherSystem/utils/math.js.map +1 -1
  259. package/dist/core/WeatherSystem/utils/type.js +1 -1
  260. package/dist/core/WeatherSystem/utils/type.js.map +1 -1
  261. package/dist/core/WeatherSystem/weather/index.js +96 -141
  262. package/dist/core/WeatherSystem/weather/index.js.map +1 -1
  263. package/dist/utils/index.js +1 -1
  264. package/dist/utils/index.js.map +1 -1
  265. package/package.json +3 -3
@@ -1,32 +1,13 @@
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); }
2
1
  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; }
3
2
  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); }
22
3
  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; }
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); }
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); }
25
6
  import { CanvasTexture, DoubleSide, Mesh, NearestFilter, Object3D, PlaneGeometry, ShaderMaterial, Vector2, use } from '@anov/3d-core';
26
7
  import h from 'anov-heat-map';
27
8
  import Supercluster from 'supercluster';
28
9
  import { heightFragmentShader, heightVertexShader } from "./shader";
29
- var defaultGradient = {
10
+ const defaultGradient = {
30
11
  0.25: 'rgb(0,0,255)',
31
12
  0.55: 'rgb(0,255,0)',
32
13
  0.85: 'yellow',
@@ -36,475 +17,407 @@ var defaultGradient = {
36
17
  /**
37
18
  * 区域热力图
38
19
  */
39
- var HeatMap = /*#__PURE__*/function (_Object3D) {
40
- _inherits(HeatMap, _Object3D);
41
- var _super = _createSuper(HeatMap);
42
- function HeatMap(options) {
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) {
43
29
  var _options$radius, _options$height, _options$isPixel;
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;
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;
63
47
 
64
48
  // this.initSupercluster()
65
- return _this;
66
49
  }
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
- }
50
+ initSupercluster() {
51
+ this._supercluster = new Supercluster({
52
+ radius: 40,
53
+ minZoom: 1,
54
+ maxZoom: 16
55
+ });
56
+ }
88
57
 
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
- }
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
+ }
108
75
 
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
- }
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
+ }
123
88
 
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
- }
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
+ }
138
102
 
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
- }
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
+ }
183
136
 
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
- }
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
+ }
242
184
 
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;
256
- return {
257
- x: (maxX + minX) / 2,
258
- z: (maxZ + minZ) / 2
259
- };
260
- }
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
+ }
261
202
 
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
- });
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
281
219
  });
282
- }
220
+ });
221
+ }
283
222
 
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
- });
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;
239
+ 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
246
+ };
247
+ });
311
248
 
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)
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)
317
254
 
318
- return result;
319
- }
255
+ return result;
256
+ }
320
257
 
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;
337
- }
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
+ }
338
273
 
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;
353
- }
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
+ }
354
287
 
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;
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);
314
+ }
315
+ if (max <= 5000) {
316
+ const scale = (5000 - max) / 5000 * 5 + 1;
317
+ return Math.floor(maxRadius < 40 ? scale : 1);
396
318
  }
319
+ return 1;
320
+ }
397
321
 
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
- }
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
439
343
  },
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
- }
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
358
+ },
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
+ }
456
380
 
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();
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();
484
401
 
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);
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);
500
415
 
501
- // @ts-ignore
502
- (_this$_attachmentMesh = this._attachmentMesh) === null || _this$_attachmentMesh === void 0 || _this$_attachmentMesh.material.dispose();
503
- }
504
- return this;
416
+ // @ts-ignore
417
+ (_this$_attachmentMesh = this._attachmentMesh) === null || _this$_attachmentMesh === void 0 || _this$_attachmentMesh.material.dispose();
505
418
  }
506
- }]);
507
- return HeatMap;
508
- }(Object3D);
419
+ return this;
420
+ }
421
+ }
509
422
  export default HeatMap;
510
423
  //# sourceMappingURL=HeatMap.js.map