@antv/l7-layers 2.17.12 → 2.18.0

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 (42) hide show
  1. package/es/core/BaseLayer.js +7 -2
  2. package/es/earth/models/atmosphere.js +2 -1
  3. package/es/earth/models/bloomsphere.js +2 -1
  4. package/es/heatmap/models/heatmap.js +2 -2
  5. package/es/image/models/image.js +6 -29
  6. package/es/line/models/arc.js +2 -2
  7. package/es/line/models/linearline.js +2 -2
  8. package/es/line/models/simpleLine.js +2 -2
  9. package/es/line/models/wall.js +2 -2
  10. package/es/mask/models/fill.js +2 -2
  11. package/es/plugins/DataMappingPlugin.js +2 -2
  12. package/es/plugins/FeatureScalePlugin.js +4 -1
  13. package/es/plugins/ShaderUniformPlugin.js +1 -2
  14. package/es/point/models/earthExtrude.js +2 -2
  15. package/es/point/models/normal.js +2 -1
  16. package/es/point/models/text.js +2 -2
  17. package/es/polygon/models/ocean.js +2 -2
  18. package/es/polygon/models/water.js +2 -1
  19. package/es/tile/tileFactory/Tile.d.ts +0 -1
  20. package/es/tile/tileLayer/BaseLayer.js +2 -1
  21. package/es/utils/layerData.js +2 -2
  22. package/lib/core/BaseLayer.js +30 -25
  23. package/lib/earth/models/atmosphere.js +3 -2
  24. package/lib/earth/models/bloomsphere.js +3 -2
  25. package/lib/heatmap/models/heatmap.js +2 -2
  26. package/lib/image/models/image.js +6 -29
  27. package/lib/line/models/arc.js +2 -2
  28. package/lib/line/models/linearline.js +2 -2
  29. package/lib/line/models/simpleLine.js +2 -2
  30. package/lib/line/models/wall.js +2 -2
  31. package/lib/mask/models/fill.js +2 -2
  32. package/lib/plugins/DataMappingPlugin.js +2 -2
  33. package/lib/plugins/FeatureScalePlugin.js +8 -5
  34. package/lib/plugins/ShaderUniformPlugin.js +1 -2
  35. package/lib/point/models/earthExtrude.js +2 -2
  36. package/lib/point/models/normal.js +3 -2
  37. package/lib/point/models/text.js +2 -2
  38. package/lib/polygon/models/ocean.js +2 -2
  39. package/lib/polygon/models/water.js +3 -2
  40. package/lib/tile/tileLayer/BaseLayer.js +3 -2
  41. package/lib/utils/layerData.js +3 -3
  42. package/package.json +7 -8
@@ -25,7 +25,6 @@ var _l7Core = require("@antv/l7-core");
25
25
  var _l7Source = _interopRequireDefault(require("@antv/l7-source"));
26
26
  var _l7Utils = require("@antv/l7-utils");
27
27
  var _eventemitter = require("eventemitter3");
28
- var _lodash = require("lodash");
29
28
  var _blend = require("../utils/blend");
30
29
  var _layerData = require("../utils/layerData");
31
30
  var _multiPassRender = require("../utils/multiPassRender");
@@ -39,6 +38,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
39
38
  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; }
40
39
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
41
40
  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; } }
41
+ var isEqual = _l7Utils.lodashUtil.isEqual,
42
+ isFunction = _l7Utils.lodashUtil.isFunction,
43
+ isNumber = _l7Utils.lodashUtil.isNumber,
44
+ isObject = _l7Utils.lodashUtil.isObject,
45
+ isPlainObject = _l7Utils.lodashUtil.isPlainObject,
46
+ isUndefined = _l7Utils.lodashUtil.isUndefined;
42
47
  /**
43
48
  * 分配 layer id
44
49
  */
@@ -501,7 +506,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
501
506
  key: "animate",
502
507
  value: function animate(options) {
503
508
  var rawAnimate = {};
504
- if ((0, _lodash.isObject)(options)) {
509
+ if (isObject(options)) {
505
510
  rawAnimate.enable = true;
506
511
  rawAnimate = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rawAnimate), options);
507
512
  } else {
@@ -574,7 +579,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
574
579
  Object.keys(rest).forEach(function (key) {
575
580
  // @ts-ignore
576
581
  var values = rest[key];
577
- if (Array.isArray(values) && values.length === 2 && !(0, _lodash.isNumber)(values[0]) && !(0, _lodash.isNumber)(values[1])) {
582
+ if (Array.isArray(values) && values.length === 2 && !isNumber(values[0]) && !isNumber(values[1])) {
578
583
  newOption[key] = {
579
584
  field: values[0],
580
585
  value: values[1]
@@ -594,7 +599,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
594
599
  Object.keys(options).forEach(function (key) {
595
600
  if (
596
601
  // 需要数据映射
597
- [].concat((0, _toConsumableArray2.default)(_this6.enableShaderEncodeStyles), (0, _toConsumableArray2.default)(_this6.enableDataEncodeStyles)).includes(key) && (0, _lodash.isPlainObject)(options[key]) && (options[key].field || options[key].value) && !(0, _lodash.isEqual)(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
602
+ [].concat((0, _toConsumableArray2.default)(_this6.enableShaderEncodeStyles), (0, _toConsumableArray2.default)(_this6.enableDataEncodeStyles)).includes(key) && isPlainObject(options[key]) && (options[key].field || options[key].value) && !isEqual(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
598
603
  ) {
599
604
  _this6.encodeStyleAttribute[key] = options[key];
600
605
  _this6.updateStyleAttribute(key, options[key].field, options[key].value);
@@ -614,13 +619,13 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
614
619
  key: "scale",
615
620
  value: function scale(field, cfg) {
616
621
  var preOption = (0, _objectSpread2.default)({}, this.scaleOptions);
617
- if ((0, _lodash.isObject)(field)) {
622
+ if (isObject(field)) {
618
623
  this.scaleOptions = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.scaleOptions), field);
619
624
  } else {
620
625
  this.scaleOptions[field] = cfg;
621
626
  }
622
- if (this.styleAttributeService && !(0, _lodash.isEqual)(preOption, this.scaleOptions)) {
623
- var scaleOptions = (0, _lodash.isObject)(field) ? field : (0, _defineProperty2.default)({}, field, cfg);
627
+ if (this.styleAttributeService && !isEqual(preOption, this.scaleOptions)) {
628
+ var scaleOptions = isObject(field) ? field : (0, _defineProperty2.default)({}, field, cfg);
624
629
  this.styleAttributeService.updateScaleAttribute(scaleOptions);
625
630
  }
626
631
  return this;
@@ -701,8 +706,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
701
706
  key: "active",
702
707
  value: function active(options) {
703
708
  var activeOption = {};
704
- activeOption.enableHighlight = (0, _lodash.isObject)(options) ? true : options;
705
- if ((0, _lodash.isObject)(options)) {
709
+ activeOption.enableHighlight = isObject(options) ? true : options;
710
+ if (isObject(options)) {
706
711
  activeOption.enableHighlight = true;
707
712
  if (options.color) {
708
713
  activeOption.highlightColor = options.color;
@@ -720,14 +725,14 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
720
725
  key: "setActive",
721
726
  value: function setActive(id, options) {
722
727
  var _this7 = this;
723
- if ((0, _lodash.isObject)(id)) {
728
+ if (isObject(id)) {
724
729
  var _id$x = id.x,
725
730
  x = _id$x === void 0 ? 0 : _id$x,
726
731
  _id$y = id.y,
727
732
  y = _id$y === void 0 ? 0 : _id$y;
728
733
  this.updateLayerConfig({
729
- highlightColor: (0, _lodash.isObject)(options) ? options.color : this.getLayerConfig().highlightColor,
730
- activeMix: (0, _lodash.isObject)(options) ? options.mix : this.getLayerConfig().activeMix
734
+ highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
735
+ activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
731
736
  });
732
737
  this.pick({
733
738
  x: x,
@@ -736,8 +741,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
736
741
  } else {
737
742
  this.updateLayerConfig({
738
743
  pickedFeatureID: id,
739
- highlightColor: (0, _lodash.isObject)(options) ? options.color : this.getLayerConfig().highlightColor,
740
- activeMix: (0, _lodash.isObject)(options) ? options.mix : this.getLayerConfig().activeMix
744
+ highlightColor: isObject(options) ? options.color : this.getLayerConfig().highlightColor,
745
+ activeMix: isObject(options) ? options.mix : this.getLayerConfig().activeMix
741
746
  });
742
747
  this.hooks.beforeHighlight.call((0, _l7Utils.encodePickingColor)(id))
743
748
  // @ts-ignore
@@ -752,8 +757,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
752
757
  key: "select",
753
758
  value: function select(option) {
754
759
  var activeOption = {};
755
- activeOption.enableSelect = (0, _lodash.isObject)(option) ? true : option;
756
- if ((0, _lodash.isObject)(option)) {
760
+ activeOption.enableSelect = isObject(option) ? true : option;
761
+ if (isObject(option)) {
757
762
  activeOption.enableSelect = true;
758
763
  if (option.color) {
759
764
  activeOption.selectColor = option.color;
@@ -771,14 +776,14 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
771
776
  key: "setSelect",
772
777
  value: function setSelect(id, options) {
773
778
  var _this8 = this;
774
- if ((0, _lodash.isObject)(id)) {
779
+ if (isObject(id)) {
775
780
  var _id$x2 = id.x,
776
781
  x = _id$x2 === void 0 ? 0 : _id$x2,
777
782
  _id$y2 = id.y,
778
783
  y = _id$y2 === void 0 ? 0 : _id$y2;
779
784
  this.updateLayerConfig({
780
- selectColor: (0, _lodash.isObject)(options) ? options.color : this.getLayerConfig().selectColor,
781
- selectMix: (0, _lodash.isObject)(options) ? options.mix : this.getLayerConfig().selectMix
785
+ selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
786
+ selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
782
787
  });
783
788
  this.pick({
784
789
  x: x,
@@ -787,8 +792,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
787
792
  } else {
788
793
  this.updateLayerConfig({
789
794
  pickedFeatureID: id,
790
- selectColor: (0, _lodash.isObject)(options) ? options.color : this.getLayerConfig().selectColor,
791
- selectMix: (0, _lodash.isObject)(options) ? options.mix : this.getLayerConfig().selectMix
795
+ selectColor: isObject(options) ? options.color : this.getLayerConfig().selectColor,
796
+ selectMix: isObject(options) ? options.mix : this.getLayerConfig().selectMix
792
797
  });
793
798
  this.hooks.beforeSelect.call((0, _l7Utils.encodePickingColor)(id))
794
799
  // @ts-ignore
@@ -1146,7 +1151,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1146
1151
  } else if (scale !== null && scale !== void 0 && scale.domain) {
1147
1152
  // 枚举类型 Cat
1148
1153
  var _items2 = scale.domain().filter(function (item) {
1149
- return !(0, _lodash.isUndefined)(item);
1154
+ return !isUndefined(item);
1150
1155
  }).map(function (item) {
1151
1156
  return (0, _defineProperty2.default)({
1152
1157
  value: item
@@ -1361,7 +1366,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1361
1366
  // encode diff
1362
1367
  var preAttribute = this.configService.getAttributeConfig(this.id) || {};
1363
1368
  // @ts-ignore
1364
- if ((0, _lodash.isEqual)(preAttribute[type], {
1369
+ if (isEqual(preAttribute[type], {
1365
1370
  field: field,
1366
1371
  values: values
1367
1372
  })) {
@@ -1476,8 +1481,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1476
1481
  key: "splitValuesAndCallbackInAttribute",
1477
1482
  value: function splitValuesAndCallbackInAttribute(valuesOrCallback, defaultValues) {
1478
1483
  return {
1479
- values: (0, _lodash.isFunction)(valuesOrCallback) ? undefined : valuesOrCallback || defaultValues,
1480
- callback: (0, _lodash.isFunction)(valuesOrCallback) ? valuesOrCallback : undefined
1484
+ values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback || defaultValues,
1485
+ callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined
1481
1486
  };
1482
1487
  }
1483
1488
  }]);
@@ -13,7 +13,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _l7Core = require("@antv/l7-core");
16
- var _lodash = require("lodash");
16
+ var _l7Utils = require("@antv/l7-utils");
17
17
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
18
18
  var _triangulation = require("../../core/triangulation");
19
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -22,6 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
22
22
  var atmoSphereFrag = "\nuniform float u_opacity;\nuniform vec3 u_CameraPosition;\n\nvarying vec3 vVertexNormal;\nvarying float v_offset;\nvarying vec4 v_Color;\nvoid main() {\n \n \n // float intensity = pow(0.5 + dot(normalize(vVertexNormal), normalize(u_CameraPosition)), 3.0);\n float intensity = pow(v_offset + dot(normalize(vVertexNormal), normalize(u_CameraPosition)), 3.0);\n // \u53BB\u9664\u80CC\u9762\n if(intensity > 1.0) intensity = 0.0;\n\n gl_FragColor = vec4(v_Color.rgb, v_Color.a * intensity * u_opacity);\n}\n";
23
23
  /* babel-plugin-inline-import '../shaders/atmosphere_vert.glsl' */
24
24
  var atmoSphereVert = "\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nattribute vec4 a_Color;\nuniform vec3 u_CameraPosition;\nvarying float v_CamreaDistance;\n\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_ViewMatrix;\n\nvarying vec3 vVertexNormal;\nvarying vec4 v_Color;\nvarying float v_offset;\n\nvoid main() {\n float EARTH_RADIUS = 100.0;\n \n v_Color = a_Color;\n\n v_offset = min(((length(u_CameraPosition) - EARTH_RADIUS)/600.0) * 0.5 + 0.4, 1.0);\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
25
+ var isNumber = _l7Utils.lodashUtil.isNumber;
25
26
  var EarthAtomSphereModel = /*#__PURE__*/function (_BaseModel) {
26
27
  (0, _inherits2.default)(EarthAtomSphereModel, _BaseModel);
27
28
  var _super = _createSuper(EarthAtomSphereModel);
@@ -36,7 +37,7 @@ var EarthAtomSphereModel = /*#__PURE__*/function (_BaseModel) {
36
37
  _ref$opacity = _ref.opacity,
37
38
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity;
38
39
  return {
39
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0
40
+ u_opacity: isNumber(opacity) ? opacity : 1.0
40
41
  };
41
42
  }
42
43
  }, {
@@ -13,7 +13,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _l7Core = require("@antv/l7-core");
16
- var _lodash = require("lodash");
16
+ var _l7Utils = require("@antv/l7-utils");
17
17
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
18
18
  var _triangulation = require("../../core/triangulation");
19
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -22,6 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
22
22
  var bloomSphereFrag = "\nuniform float u_opacity;\nuniform vec3 u_CameraPosition;\nvarying vec3 vVertexNormal;\n\nvarying vec4 v_Color;\nvoid main() {\n\n\n float intensity = - dot(normalize(vVertexNormal), normalize(u_CameraPosition));\n // \u53BB\u9664\u80CC\u9762\n if(intensity > 1.0) intensity = 0.0;\n\n gl_FragColor = vec4(v_Color.rgb, v_Color.a * intensity * u_opacity);\n}\n";
23
23
  /* babel-plugin-inline-import '../shaders/bloomsphere_vert.glsl' */
24
24
  var bloomSphereVert = "\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nattribute vec4 a_Color;\nuniform vec3 u_CameraPosition;\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_ViewMatrix;\n\nvarying vec3 vVertexNormal;\nvarying vec4 v_Color;\n\nvoid main() {\n v_Color = a_Color;\n\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
25
+ var isNumber = _l7Utils.lodashUtil.isNumber;
25
26
  var EarthBloomSphereModel = /*#__PURE__*/function (_BaseModel) {
26
27
  (0, _inherits2.default)(EarthBloomSphereModel, _BaseModel);
27
28
  var _super = _createSuper(EarthBloomSphereModel);
@@ -36,7 +37,7 @@ var EarthBloomSphereModel = /*#__PURE__*/function (_BaseModel) {
36
37
  _ref$opacity = _ref.opacity,
37
38
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity;
38
39
  return {
39
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0
40
+ u_opacity: isNumber(opacity) ? opacity : 1.0
40
41
  };
41
42
  }
42
43
  }, {
@@ -21,7 +21,6 @@ var _inversify = require("inversify");
21
21
  require("reflect-metadata");
22
22
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
23
23
  var _triangulation = require("../../core/triangulation");
24
- var _lodash = require("lodash");
25
24
  var _triangulation2 = require("../triangulation");
26
25
  var _dec, _class;
27
26
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -38,6 +37,7 @@ var heatmapColorVert = "precision highp float;\nattribute vec3 a_Position;\nattr
38
37
  var heatmapFramebufferFrag = "precision highp float;\nuniform float u_intensity;\nvarying float v_weight;\nvarying vec2 v_extrude;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(){\n float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);\n float val = v_weight * u_intensity * GAUSS_COEF * exp(d);\n gl_FragColor = vec4(val, 1., 1., 1.);\n}\n";
39
38
  /* babel-plugin-inline-import '../shaders/heatmap_framebuffer_vert.glsl' */
40
39
  var heatmapFramebufferVert = "precision highp float;\nattribute vec3 a_Position;\nattribute float a_Size;\nattribute vec2 a_Dir;\nuniform float u_intensity;\nuniform float u_radius;\nvarying vec2 v_extrude;\nvarying float v_weight;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n\nvoid main(){\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
40
+ var isEqual = _l7Utils.lodashUtil.isEqual;
41
41
  var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
42
42
  (0, _inherits2.default)(HeatMapModel, _BaseModel);
43
43
  var _super = _createSuper(HeatMapModel);
@@ -63,7 +63,7 @@ var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE
63
63
  });
64
64
  _this.drawIntensityMode();
65
65
  });
66
- if (!(0, _lodash.isEqual)(this.preRampColors, rampColors)) {
66
+ if (!isEqual(this.preRampColors, rampColors)) {
67
67
  this.updateColorTexture();
68
68
  }
69
69
  this.shapeType === 'heatmap' ? this.drawColorMode(options) : this.draw3DHeatMap(options);
@@ -13,7 +13,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _l7Core = require("@antv/l7-core");
16
- var _l7Utils = require("@antv/l7-utils");
17
16
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
18
17
  var _triangulation = require("../../core/triangulation");
19
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -43,8 +42,7 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
43
42
  key: "initModels",
44
43
  value: function () {
45
44
  var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
46
- var _this = this;
47
- var source, createTexture2D, canvas, img, imageData, model;
45
+ var source, createTexture2D, imageData, model;
48
46
  return _regenerator.default.wrap(function _callee$(_context) {
49
47
  while (1) switch (_context.prev = _context.next) {
50
48
  case 0:
@@ -54,29 +52,9 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
54
52
  height: 0,
55
53
  width: 0
56
54
  });
57
- if (!_l7Utils.isMini) {
58
- _context.next = 11;
59
- break;
60
- }
61
- // @ts-ignore
62
- canvas = this.layerService.sceneService.getSceneConfig().canvas;
63
- img = canvas.createImage();
64
- img.crossOrigin = 'anonymous';
65
- img.src = source.data.originData;
66
- img.onload = function () {
67
- _this.texture = createTexture2D({
68
- data: img,
69
- width: img.width,
70
- height: img.height
71
- });
72
- _this.layerService.reRender();
73
- };
74
- _context.next = 15;
75
- break;
76
- case 11:
77
- _context.next = 13;
55
+ _context.next = 5;
78
56
  return source.data.images;
79
- case 13:
57
+ case 5:
80
58
  imageData = _context.sent;
81
59
  this.texture = createTexture2D({
82
60
  data: imageData[0],
@@ -85,8 +63,7 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
85
63
  mag: _l7Core.gl.LINEAR,
86
64
  min: _l7Core.gl.LINEAR
87
65
  });
88
- case 15:
89
- _context.next = 17;
66
+ _context.next = 9;
90
67
  return this.layer.buildLayerModel({
91
68
  moduleName: 'rasterImage',
92
69
  vertexShader: ImageVert,
@@ -101,10 +78,10 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
101
78
  enable: false
102
79
  }
103
80
  });
104
- case 17:
81
+ case 9:
105
82
  model = _context.sent;
106
83
  return _context.abrupt("return", [model]);
107
- case 19:
84
+ case 11:
108
85
  case "end":
109
86
  return _context.stop();
110
87
  }
@@ -16,7 +16,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
  var _l7Core = require("@antv/l7-core");
18
18
  var _l7Utils = require("@antv/l7-utils");
19
- var _lodash = require("lodash");
20
19
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
21
20
  var _triangulation = require("../../core/triangulation");
22
21
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -38,6 +37,7 @@ var lineStyleObj = {
38
37
  solid: 0.0,
39
38
  dash: 1.0
40
39
  };
40
+ var isNumber = _l7Utils.lodashUtil.isNumber;
41
41
  var ArcModel = /*#__PURE__*/function (_BaseModel) {
42
42
  (0, _inherits2.default)(ArcModel, _BaseModel);
43
43
  var _super = _createSuper(ArcModel);
@@ -111,7 +111,7 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
111
111
  return {
112
112
  u_thetaOffset: thetaOffset,
113
113
  // u_thetaOffset: 0.0,
114
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1,
114
+ u_opacity: isNumber(opacity) ? opacity : 1,
115
115
  u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
116
116
  segmentNumber: segmentNumber,
117
117
  u_line_type: lineStyleObj[lineType || 'solid'],
@@ -16,7 +16,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
  var _l7Core = require("@antv/l7-core");
18
18
  var _l7Utils = require("@antv/l7-utils");
19
- var _lodash = require("lodash");
20
19
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
21
20
  var _interface = require("../../core/interface");
22
21
  var _triangulation = require("../../core/triangulation");
@@ -26,6 +25,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
26
25
  var linear_line_frag = "\nvarying vec4 v_Color;\n#pragma include \"picking\"\nvoid main() {\n\n gl_FragColor = v_Color; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
27
26
  /* babel-plugin-inline-import '../shaders/linearLine/line_linear_vert.glsl' */
28
27
  var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity : 1.0;\nuniform sampler2D u_texture;\nuniform float u_linearDir: 1.0;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n float linearRadio =currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = texV;\n }\n\n v_Color = texture2D(u_texture, vec2(linearRadio, 0.5));\n\n v_Color.a *= u_opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n\n\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
28
+ var isNumber = _l7Utils.lodashUtil.isNumber;
29
29
  var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
30
30
  (0, _inherits2.default)(LinearLineModel, _BaseModel);
31
31
  var _super = _createSuper(LinearLineModel);
@@ -76,7 +76,7 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
76
76
  }
77
77
  return {
78
78
  u_linearDir: linearDir === _interface.LinearDir.VERTICAL ? 1.0 : 0.0,
79
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1,
79
+ u_opacity: isNumber(opacity) ? opacity : 1,
80
80
  // 纹理支持参数
81
81
  u_texture: this.colorTexture,
82
82
  // 贴图
@@ -14,7 +14,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _l7Core = require("@antv/l7-core");
16
16
  var _l7Utils = require("@antv/l7-utils");
17
- var _lodash = require("lodash");
18
17
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
19
18
  var _triangulation = require("../../core/triangulation");
20
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -25,6 +24,7 @@ var simple_line_frag = "\nvarying vec4 v_color;\nvoid main() {\n gl_FragColor =
25
24
  var simle_linear_frag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float opacity;\nvoid main() {\n gl_FragColor = mix(u_sourceColor, u_targetColor, v_distanceScale);\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n}\n";
26
25
  /* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
27
26
  var simple_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Position;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_vertexScale: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\nvarying float v_distanceScale;\n\nvoid main() {\n\n v_color = a_Color; \n v_distanceScale = a_Distance / a_Total_Distance;\n v_color = vec4(a_Color.xyz, a_Color.w * u_opacity); \n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_Size.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n }\n}\n";
27
+ var isNumber = _l7Utils.lodashUtil.isNumber;
28
28
  var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
29
29
  (0, _inherits2.default)(SimpleLineModel, _BaseModel);
30
30
  var _super = _createSuper(SimpleLineModel);
@@ -53,7 +53,7 @@ var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
53
53
  useLinearColor = 1;
54
54
  }
55
55
  return {
56
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1,
56
+ u_opacity: isNumber(opacity) ? opacity : 1,
57
57
  // 渐变色支持参数
58
58
  u_linearColor: useLinearColor,
59
59
  u_sourceColor: sourceColorArr,
@@ -16,7 +16,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
  var _l7Core = require("@antv/l7-core");
18
18
  var _l7Utils = require("@antv/l7-utils");
19
- var _lodash = require("lodash");
20
19
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
21
20
  var _triangulation = require("../../core/triangulation");
22
21
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -25,6 +24,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
25
24
  var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_color;\nvarying vec4 v_dataset;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_dataset.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = v_dataset.a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_dataset.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_dataset.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_dataset.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
26
25
  /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
27
26
  var line_vert = "#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\nuniform float u_linearColor: 0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\nvarying vec4 v_color;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_dataset;\n\nvoid main() {\n\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_animate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_float_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
27
+ var isNumber = _l7Utils.lodashUtil.isNumber;
28
28
  var LineWallModel = /*#__PURE__*/function (_BaseModel) {
29
29
  (0, _inherits2.default)(LineWallModel, _BaseModel);
30
30
  var _super = _createSuper(LineWallModel);
@@ -88,7 +88,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
88
88
  }
89
89
  return {
90
90
  u_heightfixed: Number(heightfixed),
91
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
91
+ u_opacity: isNumber(opacity) ? opacity : 1.0,
92
92
  u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
93
93
  // 纹理支持参数
94
94
  u_texture: this.texture,
@@ -13,7 +13,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _l7Utils = require("@antv/l7-utils");
16
- var _lodash = require("lodash");
17
16
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
18
17
  var _triangulation = require("../../core/triangulation");
19
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -22,6 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
22
21
  var mask_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
23
22
  /* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
24
23
  var mask_vert = "attribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
24
+ var isNumber = _l7Utils.lodashUtil.isNumber;
25
25
  var MaskModel = /*#__PURE__*/function (_BaseModel) {
26
26
  (0, _inherits2.default)(MaskModel, _BaseModel);
27
27
  var _super = _createSuper(MaskModel);
@@ -38,7 +38,7 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
38
38
  _ref$color = _ref.color,
39
39
  color = _ref$color === void 0 ? '#000' : _ref$color;
40
40
  return {
41
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 0.0,
41
+ u_opacity: isNumber(opacity) ? opacity : 0.0,
42
42
  u_color: (0, _l7Utils.rgb2arr)(color)
43
43
  };
44
44
  }
@@ -18,9 +18,9 @@ var _l7Core = require("@antv/l7-core");
18
18
  var _l7Maps = require("@antv/l7-maps");
19
19
  var _l7Utils = require("@antv/l7-utils");
20
20
  var _inversify = require("inversify");
21
- var _lodash = require("lodash");
22
21
  require("reflect-metadata");
23
22
  var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
23
+ var cloneDeep = _l7Utils.lodashUtil.cloneDeep;
24
24
  var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inversify.inject)(_l7Core.TYPES.IMapService), _dec3 = (0, _inversify.inject)(_l7Core.TYPES.IFontService), _dec(_class = (_class2 = /*#__PURE__*/function () {
25
25
  function DataMappingPlugin() {
26
26
  (0, _classCallCheck2.default)(this, DataMappingPlugin);
@@ -220,7 +220,7 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
220
220
  }).map(function (d) {
221
221
  d.version = _l7Maps.Version['GAODE2.x'];
222
222
  // @ts-ignore
223
- d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
223
+ d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
224
224
  // @ts-ignore
225
225
  // d.coordinates = this.mapService.lngLatToCoord(d.coordinates);
226
226
  d.coordinates = _this4.mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
@@ -13,16 +13,19 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
13
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _l7Core = require("@antv/l7-core");
16
+ var _l7Utils = require("@antv/l7-utils");
16
17
  var _d3Array = require("d3-array");
17
18
  var d3interpolate = _interopRequireWildcard(require("d3-interpolate"));
18
19
  var d3 = _interopRequireWildcard(require("d3-scale"));
19
20
  var _inversify = require("inversify");
20
- var _lodash = require("lodash");
21
21
  require("reflect-metadata");
22
22
  var _identityScale = _interopRequireDefault(require("../utils/identityScale"));
23
23
  var _scaleMap, _dec, _class;
24
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
25
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
+ var isNil = _l7Utils.lodashUtil.isNil,
27
+ isString = _l7Utils.lodashUtil.isString,
28
+ uniq = _l7Utils.lodashUtil.uniq;
26
29
  var dateRegex = /^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
27
30
  var scaleMap = (_scaleMap = {}, (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.LINEAR, d3.scaleLinear), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.POWER, d3.scalePow), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.LOG, d3.scaleLog), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.IDENTITY, _identityScale.default), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.SEQUENTIAL, d3.scaleSequential), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.TIME, d3.scaleTime), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.QUANTILE, d3.scaleQuantile), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.QUANTIZE, d3.scaleQuantize), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.THRESHOLD, d3.scaleThreshold), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.CAT, d3.scaleOrdinal), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.DIVERGING, d3.scaleDiverging), _scaleMap);
28
31
  /**
@@ -216,7 +219,7 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
216
219
  if (Array.isArray(field)) {
217
220
  return field;
218
221
  }
219
- if ((0, _lodash.isString)(field)) {
222
+ if (isString(field)) {
220
223
  return field.split('*');
221
224
  }
222
225
  return [field];
@@ -245,10 +248,10 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
245
248
  }
246
249
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
247
250
  var firstValue = (_find = data.find(function (d) {
248
- return !(0, _lodash.isNil)(d[field]);
251
+ return !isNil(d[field]);
249
252
  })) === null || _find === void 0 ? void 0 : _find[field];
250
253
  // 常量 Scale
251
- if (this.isNumber(field) || (0, _lodash.isNil)(firstValue) && !scaleOption) {
254
+ if (this.isNumber(field) || isNil(firstValue) && !scaleOption) {
252
255
  styleScale.scale = d3.scaleOrdinal([field]);
253
256
  styleScale.type = _l7Core.StyleScaleType.CONSTANT;
254
257
  } else {
@@ -286,7 +289,7 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
286
289
  if (scaleOption !== null && scaleOption !== void 0 && scaleOption.domain) {
287
290
  cfg.domain = scaleOption === null || scaleOption === void 0 ? void 0 : scaleOption.domain;
288
291
  } else if (type === _l7Core.ScaleTypes.CAT || type === _l7Core.ScaleTypes.IDENTITY) {
289
- cfg.domain = (0, _lodash.uniq)(values);
292
+ cfg.domain = uniq(values);
290
293
  } else if (type === _l7Core.ScaleTypes.QUANTILE) {
291
294
  cfg.domain = values;
292
295
  } else if (type === _l7Core.ScaleTypes.DIVERGING) {
@@ -12,7 +12,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
12
12
  var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
13
13
  var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
14
14
  var _l7Core = require("@antv/l7-core");
15
- var _l7Utils = require("@antv/l7-utils");
16
15
  var _inversify = require("inversify");
17
16
  require("reflect-metadata");
18
17
  var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
@@ -56,7 +55,7 @@ var ShaderUniformPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inv
56
55
  height = _this$rendererService.height;
57
56
  layer.models.forEach(function (model) {
58
57
  var _model$addUniforms;
59
- model.addUniforms((_model$addUniforms = {}, (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ProjectionMatrix, _this.cameraService.getProjectionMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ViewMatrix, _this.cameraService.getViewMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ViewProjectionMatrix, _this.cameraService.getViewProjectionMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.Zoom, _this.cameraService.getZoom()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ZoomScale, _this.cameraService.getZoomScale()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.FocalDistance, _this.cameraService.getFocalDistance()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.CameraPosition, _this.cameraService.getCameraPosition()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.CoordinateSystem, _this.coordinateSystemService.getCoordinateSystem()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.ViewportCenter, _this.coordinateSystemService.getViewportCenter()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.ViewportCenterProjection, _this.coordinateSystemService.getViewportCenterProjection()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerDegree, _this.coordinateSystemService.getPixelsPerDegree()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerDegree2, _this.coordinateSystemService.getPixelsPerDegree2()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerMeter, _this.coordinateSystemService.getPixelsPerMeter()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.Mvp, mvp), (0, _defineProperty2.default)(_model$addUniforms, "u_sceneCenterMercator", sceneCenterMercator), (0, _defineProperty2.default)(_model$addUniforms, "u_ViewportSize", [width, height]), (0, _defineProperty2.default)(_model$addUniforms, "u_ModelMatrix", _this.cameraService.getModelMatrix()), (0, _defineProperty2.default)(_model$addUniforms, "u_DevicePixelRatio", _l7Utils.$window.devicePixelRatio), (0, _defineProperty2.default)(_model$addUniforms, "u_PickingBuffer", layer.getLayerConfig().pickingBuffer || 0), (0, _defineProperty2.default)(_model$addUniforms, "u_shaderPick", Number(layer.getShaderPickStat())), _model$addUniforms));
58
+ model.addUniforms((_model$addUniforms = {}, (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ProjectionMatrix, _this.cameraService.getProjectionMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ViewMatrix, _this.cameraService.getViewMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ViewProjectionMatrix, _this.cameraService.getViewProjectionMatrix()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.Zoom, _this.cameraService.getZoom()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.ZoomScale, _this.cameraService.getZoomScale()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.FocalDistance, _this.cameraService.getFocalDistance()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CameraUniform.CameraPosition, _this.cameraService.getCameraPosition()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.CoordinateSystem, _this.coordinateSystemService.getCoordinateSystem()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.ViewportCenter, _this.coordinateSystemService.getViewportCenter()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.ViewportCenterProjection, _this.coordinateSystemService.getViewportCenterProjection()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerDegree, _this.coordinateSystemService.getPixelsPerDegree()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerDegree2, _this.coordinateSystemService.getPixelsPerDegree2()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.PixelsPerMeter, _this.coordinateSystemService.getPixelsPerMeter()), (0, _defineProperty2.default)(_model$addUniforms, _l7Core.CoordinateUniform.Mvp, mvp), (0, _defineProperty2.default)(_model$addUniforms, "u_sceneCenterMercator", sceneCenterMercator), (0, _defineProperty2.default)(_model$addUniforms, "u_ViewportSize", [width, height]), (0, _defineProperty2.default)(_model$addUniforms, "u_ModelMatrix", _this.cameraService.getModelMatrix()), (0, _defineProperty2.default)(_model$addUniforms, "u_DevicePixelRatio", window.devicePixelRatio), (0, _defineProperty2.default)(_model$addUniforms, "u_PickingBuffer", layer.getLayerConfig().pickingBuffer || 0), (0, _defineProperty2.default)(_model$addUniforms, "u_shaderPick", Number(layer.getShaderPickStat())), _model$addUniforms));
60
59
  });
61
60
 
62
61
  // TODO:脏检查,决定是否需要渲染
@@ -16,7 +16,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
  var _l7Core = require("@antv/l7-core");
18
18
  var _l7Utils = require("@antv/l7-utils");
19
- var _lodash = require("lodash");
20
19
  var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
21
20
  var _triangulation = require("../../core/triangulation");
22
21
  var _utils = require("../../earth/utils");
@@ -26,6 +25,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
26
25
  var pointExtrudeFrag = "varying vec4 v_color;\nuniform float u_opacity: 1.0;\n\nuniform float u_pickLight: 0.0;\n\n#pragma include \"picking\"\n\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nuniform float u_opacitylinear: 0.0;\nuniform float u_opacitylinear_dir: 1.0;\nvarying float v_lightWeight;\nvarying float v_barLinearZ;\nvoid main() {\n\n gl_FragColor = v_color;\n\n // \u5F00\u542F\u900F\u660E\u5EA6\u6E10\u53D8\n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;\n }\n\n // picking\n if(u_pickLight > 0.0) {\n gl_FragColor = filterColorAlpha(gl_FragColor, v_lightWeight);\n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
27
26
  /* babel-plugin-inline-import '../shaders/earth/extrude_vert.glsl' */
28
27
  var pointExtrudeVert = "precision highp float;\n\n#define pi 3.1415926535\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec3 a_Position;\nattribute vec3 a_Pos;\nattribute vec4 a_Color;\nattribute vec3 a_Size;\nattribute vec3 a_Normal;\n\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_globel;\nuniform float u_r;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nvarying vec4 v_color;\n\nuniform float u_opacity : 1;\nuniform float u_lightEnable: 1;\nvarying float v_lightWeight;\nvarying float v_barLinearZ;\n// \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nfloat getYRadian(float x, float z) {\n if(x > 0.0 && z > 0.0) {\n return atan(x/z);\n } else if(x > 0.0 && z <= 0.0){\n return atan(-z/x) + pi/2.0;\n } else if(x <= 0.0 && z <= 0.0) {\n return pi + atan(x/z); //atan(x/z) + \n } else {\n return atan(z/-x) + pi*3.0/2.0;\n }\n}\n\nfloat getXRadian(float y, float r) {\n return atan(y/r);\n}\n\nvoid main() {\n\n \n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec3 size = a_Size * a_Position;\n\n // a_Position.z \u662F\u5728\u6784\u5EFA\u7F51\u683C\u7684\u65F6\u5019\u4F20\u5165\u7684\u6807\u51C6\u503C 0 - 1\uFF0C\u5728\u63D2\u503C\u5668\u63D2\u503C\u53EF\u4EE5\u83B7\u53D6 0\uFF5E1 \u7EBF\u6027\u6E10\u53D8\u7684\u503C\n v_barLinearZ = a_Position.z;\n\n vec3 offset = size; // \u63A7\u5236\u5706\u67F1\u4F53\u7684\u5927\u5C0F - \u4ECE\u6807\u51C6\u5355\u4F4D\u5706\u67F1\u4F53\u8FDB\u884C\u504F\u79FB\n if(u_heightfixed < 1.0) { // \u5706\u67F1\u4F53\u4E0D\u56FA\u5B9A\u9AD8\u5EA6\n \n if (u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // P20 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF1\n offset = offset * pow(2.0, (19.0 - u_Zoom));\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n offset = offset * pow(2.0, (19.0 - 3.0 - u_Zoom));\n }\n } else {// \u5706\u67F1\u4F53\u56FA\u5B9A\u9AD8\u5EA6 \uFF08 \u5904\u7406 mapbox \uFF09\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n offset *= 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n }\n\n\n vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0));\n\n // u_r \u63A7\u5236\u5706\u67F1\u7684\u751F\u957F\n vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);\n\n // \u5706\u67F1\u5149\u7167\u6548\u679C\n float lightWeight = 1.0;\n if(u_lightEnable > 0.0) { // \u53D6\u6D88\u4E09\u5143\u8868\u8FBE\u5F0F\uFF0C\u589E\u5F3A\u5065\u58EE\u6027\n lightWeight = calc_lighting(pos);\n }\n v_lightWeight = lightWeight;\n // \u8BBE\u7F6E\u5706\u67F1\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n v_color = mix(u_sourceColor, u_targetColor, barLinearZ);\n v_color.rgb *= lightWeight;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n v_color = a_Color;\n }\n v_color.a *= u_opacity;\n\n \n // \u5728\u5730\u7403\u6A21\u5F0F\u4E0B\uFF0C\u5C06\u539F\u672C\u5782\u76F4\u4E8E xy \u5E73\u9762\u7684\u5706\u67F1\u8C03\u6574\u59FF\u6001\u5230\u9002\u5E94\u5706\u7684\u89D2\u5EA6\n //\u65CB\u8F6C\u77E9\u9635mx\uFF0C\u521B\u5EFA\u7ED5x\u8F74\u65CB\u8F6C\u77E9\u9635\n float r = sqrt(a_Pos.z*a_Pos.z + a_Pos.x*a_Pos.x);\n float xRadian = getXRadian(a_Pos.y, r);\n float xcos = cos(xRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u4F59\u5F26\u503C\n float xsin = sin(xRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u6B63\u5F26\u503C\n mat4 mx = mat4(\n 1,0,0,0, \n 0,xcos,-xsin,0, \n 0,xsin,xcos,0, \n 0,0,0,1);\n\n //\u65CB\u8F6C\u77E9\u9635my\uFF0C\u521B\u5EFA\u7ED5y\u8F74\u65CB\u8F6C\u77E9\u9635\n float yRadian = getYRadian(a_Pos.x, a_Pos.z);\n float ycos = cos(yRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u4F59\u5F26\u503C\n float ysin = sin(yRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u6B63\u5F26\u503C\n mat4 my = mat4(\n ycos,0,-ysin,0, \n 0,1,0,0, \n ysin,0,ycos,0, \n 0,0,0,1);\n\n gl_Position = u_ViewProjectionMatrix * vec4(( my * mx * vec4(a_Position * a_Size, 1.0)).xyz + a_Pos, 1.0);\n \n\n setPickingColor(a_PickingColor);\n}\n";
28
+ var isNumber = _l7Utils.lodashUtil.isNumber;
29
29
  var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
30
30
  (0, _inherits2.default)(ExtrudeModel, _BaseModel);
31
31
  var _super = _createSuper(ExtrudeModel);
@@ -96,7 +96,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
96
96
  // 圆柱体是否固定高度
97
97
  u_heightfixed: Number(heightfixed),
98
98
  u_r: animateOption.enable && this.raiseRepeat > 0 ? this.raiseCount : 1.0,
99
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
99
+ u_opacity: isNumber(opacity) ? opacity : 1.0,
100
100
  // 渐变色支持参数
101
101
  u_linearColor: useLinearColor,
102
102
  u_sourceColor: sourceColorArr,