@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.
- package/dist/business/Animation/motion/index.js +56 -35
- package/dist/business/Animation/motion/index.js.map +1 -1
- package/dist/business/Animation/type.js +2 -2
- package/dist/business/Area/Fence/FenceBase.js +187 -146
- package/dist/business/Area/Fence/FenceBase.js.map +1 -1
- package/dist/business/Area/Fence/fence_base_01.js +112 -120
- package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_feeting_01.js +130 -218
- package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_roll_01.js +130 -140
- package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
- package/dist/business/Area/FillArea/FillAreaBase.js +126 -87
- package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_face_01.js +98 -72
- package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_line_01.js +94 -66
- package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
- package/dist/business/Area/index.js +483 -267
- package/dist/business/Area/index.js.map +1 -1
- package/dist/business/Area/tool.js +26 -14
- package/dist/business/Area/tool.js.map +1 -1
- package/dist/business/Base/ObjectLayer.js +46 -21
- package/dist/business/Base/ObjectLayer.js.map +1 -1
- package/dist/business/Batch/index.js +234 -189
- package/dist/business/Batch/index.js.map +1 -1
- package/dist/business/Box/index.js +81 -52
- package/dist/business/Box/index.js.map +1 -1
- package/dist/business/Cylinder/index.js +79 -51
- package/dist/business/Cylinder/index.js.map +1 -1
- package/dist/business/Flyline/bubble/CircleBubble.js +9 -1
- package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
- package/dist/business/Flyline/bubble/index.js +21 -7
- package/dist/business/Flyline/bubble/index.js.map +1 -1
- package/dist/business/Flyline/index.js +162 -96
- package/dist/business/Flyline/index.js.map +1 -1
- package/dist/business/Flyline/line/ArcLine.js +291 -208
- package/dist/business/Flyline/line/ArcLine.js.map +1 -1
- package/dist/business/Flyline/line/index.js +22 -8
- package/dist/business/Flyline/line/index.js.map +1 -1
- package/dist/business/HeatMap/HeatMap.js +467 -380
- package/dist/business/HeatMap/HeatMap.js.map +1 -1
- package/dist/business/HeatMap/core.js +525 -405
- package/dist/business/HeatMap/core.js.map +1 -1
- package/dist/business/HeatMap/shader.js +3 -69
- package/dist/business/HeatMap/shader.js.map +1 -1
- package/dist/business/InfoPanel/index.js +242 -201
- package/dist/business/InfoPanel/index.js.map +1 -1
- package/dist/business/Line/index.js +88 -55
- package/dist/business/Line/index.js.map +1 -1
- package/dist/business/Mark/KeyframeAnimation.js +176 -145
- package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
- package/dist/business/Mark/index.js +294 -196
- package/dist/business/Mark/index.js.map +1 -1
- package/dist/business/Mark/shader/tanhao.js +3 -36
- package/dist/business/Mark/shader/tanhao.js.map +1 -1
- package/dist/business/Mark/type.js +1 -1
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +551 -377
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
- package/dist/business/MaterialSwitch/inject.js +58 -92
- package/dist/business/MaterialSwitch/inject.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/finalFade.js +2 -74
- package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/ground.js +16 -95
- package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/groundBase64.js +3 -9
- package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/realFade.js +9 -48
- package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
- package/dist/business/Plane/index.js +78 -51
- package/dist/business/Plane/index.js.map +1 -1
- package/dist/business/Poi/index.js +336 -248
- package/dist/business/Poi/index.js.map +1 -1
- package/dist/business/Poi/link/Cylinder.js +89 -56
- package/dist/business/Poi/link/Cylinder.js.map +1 -1
- package/dist/business/Poi/link/Pyramid.js +165 -104
- package/dist/business/Poi/link/Pyramid.js.map +1 -1
- package/dist/business/Poi/link/index.js +114 -54
- package/dist/business/Poi/link/index.js.map +1 -1
- package/dist/business/Poi/panel/index.js +373 -315
- package/dist/business/Poi/panel/index.js.map +1 -1
- package/dist/business/Poi/panel/utils.js +10 -5
- package/dist/business/Poi/panel/utils.js.map +1 -1
- package/dist/business/Poi/particle/DoubleCircle.js +107 -71
- package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
- package/dist/business/Poi/particle/DynamicCircle.js +111 -75
- package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
- package/dist/business/Poi/particle/SingleCircle.js +98 -62
- package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
- package/dist/business/Poi/particle/index.js +117 -49
- package/dist/business/Poi/particle/index.js.map +1 -1
- package/dist/business/Poi/shader/circle.js +3 -31
- package/dist/business/Poi/shader/circle.js.map +1 -1
- package/dist/business/Poi/shader/cylinder.js +3 -37
- package/dist/business/Poi/shader/cylinder.js.map +1 -1
- package/dist/business/Poi/shader/doubleCircle.js +3 -55
- package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
- package/dist/business/Poi/shader/dynamicCircle.js +3 -67
- package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
- package/dist/business/Poi/title/Border.js +27 -7
- package/dist/business/Poi/title/Border.js.map +1 -1
- package/dist/business/Poi/title/Ellipse.js +27 -7
- package/dist/business/Poi/title/Ellipse.js.map +1 -1
- package/dist/business/Poi/title/index.js +292 -208
- package/dist/business/Poi/title/index.js.map +1 -1
- package/dist/business/Poi/tools.js +17 -18
- package/dist/business/Poi/tools.js.map +1 -1
- package/dist/business/Sphere/index.js +72 -47
- package/dist/business/Sphere/index.js.map +1 -1
- package/dist/business/Spline/index.js +245 -190
- package/dist/business/Spline/index.js.map +1 -1
- package/dist/business/SplitBuilding/index.js +536 -327
- package/dist/business/SplitBuilding/index.js.map +1 -1
- package/dist/business/SplitBuilding/type.js +2 -2
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +275 -218
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +177 -132
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +1 -51
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +1 -6
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
- package/dist/business/TrafficComponents/base.js +55 -32
- package/dist/business/TrafficComponents/base.js.map +1 -1
- package/dist/business/TrafficComponents/utils.js +24 -25
- package/dist/business/TrafficComponents/utils.js.map +1 -1
- package/dist/business/Utils/Curve.js +56 -40
- package/dist/business/Utils/Curve.js.map +1 -1
- package/dist/business/Utils/constant.js +1 -1
- package/dist/business/Utils/constant.js.map +1 -1
- package/dist/business/Utils/defineProps.js +14 -13
- package/dist/business/Utils/defineProps.js.map +1 -1
- package/dist/business/Utils/round-curve.js +153 -127
- package/dist/business/Utils/round-curve.js.map +1 -1
- package/dist/business/VideoPanel/index.js +319 -258
- package/dist/business/VideoPanel/index.js.map +1 -1
- package/dist/business/Water/index.js +108 -78
- package/dist/business/Water/index.js.map +1 -1
- package/dist/business/Water/types.js +1 -1
- package/dist/business/Water/types.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +449 -383
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +142 -107
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
- package/dist/core/Controls/FirstViewControl/index.js +96 -84
- package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/action/input.js +98 -77
- package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/index.js +28 -19
- package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/animation.js +155 -126
- package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/camera.js +63 -47
- package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/control.js +49 -39
- package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player.js +91 -66
- package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
- package/dist/core/Controls/base.js +30 -14
- package/dist/core/Controls/base.js.map +1 -1
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +131 -92
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
- package/dist/core/Debug/PerformanceInfo/Performance.js +47 -22
- package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
- package/dist/core/Light/PointLight/PointLightExt.js +21 -4
- package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
- package/dist/core/Material/FinirMaterial/FinirMaterial.js +57 -37
- package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +153 -116
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js +1 -95
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js +1 -26
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
- package/dist/core/Material/SurfaceMaterial/index.js +172 -76
- package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
- package/dist/core/Material/decorators.js +11 -6
- package/dist/core/Material/decorators.js.map +1 -1
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +12 -16
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
- package/dist/core/PostEffects/addBrightnessContrastPass.js +13 -17
- package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
- package/dist/core/PostEffects/bloomPass.js +10 -17
- package/dist/core/PostEffects/bloomPass.js.map +1 -1
- package/dist/core/PostEffects/bloomSelect.js +43 -60
- package/dist/core/PostEffects/bloomSelect.js.map +1 -1
- package/dist/core/PostEffects/colorifyPass.js +13 -17
- package/dist/core/PostEffects/colorifyPass.js.map +1 -1
- package/dist/core/PostEffects/index.js +22 -28
- package/dist/core/PostEffects/index.js.map +1 -1
- package/dist/core/PostEffects/outlinePass.js +50 -37
- package/dist/core/PostEffects/outlinePass.js.map +1 -1
- package/dist/core/PostEffects/postprocessing.js +12 -14
- package/dist/core/PostEffects/postprocessing.js.map +1 -1
- package/dist/core/PostEffects/saoPass.js +10 -15
- package/dist/core/PostEffects/saoPass.js.map +1 -1
- package/dist/core/PostEffects/shader/colorify.js +3 -22
- package/dist/core/PostEffects/shader/colorify.js.map +1 -1
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js +3 -27
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
- package/dist/core/PostEffects/shader/mapping.js +3 -66
- package/dist/core/PostEffects/shader/mapping.js.map +1 -1
- package/dist/core/PostEffects/shader/thermalMaging.js +3 -28
- package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
- package/dist/core/SceneEffect/grow/grow.js +101 -85
- package/dist/core/SceneEffect/grow/grow.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_down.js +77 -60
- package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_up.js +81 -64
- package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
- package/dist/core/SceneEffect/grow/type.js +2 -2
- package/dist/core/SceneEffect/grow/type.js.map +1 -1
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js +76 -51
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
- package/dist/core/WeatherSystem/hdr/index.js +105 -69
- package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
- package/dist/core/WeatherSystem/index.js +124 -77
- package/dist/core/WeatherSystem/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/fog/index.js +80 -52
- package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/index.js +84 -72
- package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/lineRain.js +118 -88
- package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/plane.js +146 -116
- package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/point.js +148 -100
- package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/cloud.js +104 -71
- package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/index.js +84 -66
- package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/outline.js +45 -25
- package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/cloud.js +3 -74
- package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/fog.js +3 -103
- package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/rain.js +7 -206
- package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/sky.js +3 -87
- package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
- package/dist/core/WeatherSystem/sky/index.js +135 -104
- package/dist/core/WeatherSystem/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/utils/constant.js +38 -44
- package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
- package/dist/core/WeatherSystem/utils/math.js +25 -18
- package/dist/core/WeatherSystem/utils/math.js.map +1 -1
- package/dist/core/WeatherSystem/utils/type.js +1 -1
- package/dist/core/WeatherSystem/utils/type.js.map +1 -1
- package/dist/core/WeatherSystem/weather/index.js +141 -96
- package/dist/core/WeatherSystem/weather/index.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- 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" ==
|
|
5
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
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
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
_defineProperty(
|
|
34
|
-
_defineProperty(
|
|
35
|
-
_defineProperty(
|
|
36
|
-
_defineProperty(
|
|
37
|
-
_defineProperty(
|
|
38
|
-
_defineProperty(
|
|
39
|
-
_defineProperty(
|
|
40
|
-
_defineProperty(
|
|
41
|
-
_defineProperty(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var
|
|
115
|
-
return (
|
|
116
|
-
}
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
var
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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:
|
|
241
|
-
|
|
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
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
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
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
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
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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
|
-
|
|
417
|
-
|
|
501
|
+
// @ts-ignore
|
|
502
|
+
(_this$_attachmentMesh = this._attachmentMesh) === null || _this$_attachmentMesh === void 0 || _this$_attachmentMesh.material.dispose();
|
|
503
|
+
}
|
|
504
|
+
return this;
|
|
418
505
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
506
|
+
}]);
|
|
507
|
+
return HeatMap;
|
|
508
|
+
}(Object3D);
|
|
422
509
|
export default HeatMap;
|
|
423
510
|
//# sourceMappingURL=HeatMap.js.map
|