@antv/l7-layers 2.9.25-alpha.0 → 2.9.26-alpha.1

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 (126) hide show
  1. package/es/heatmap/models/heatmap.js +1 -1
  2. package/es/tile/tileFactory/base.d.ts +1 -1
  3. package/es/tile/utils.js +1 -1
  4. package/lib/Geometry/index.js +114 -77
  5. package/lib/Geometry/models/billboard.js +232 -181
  6. package/lib/Geometry/models/index.js +18 -34
  7. package/lib/Geometry/models/plane.js +407 -278
  8. package/lib/Geometry/models/sprite.js +291 -189
  9. package/lib/canvas/index.js +101 -66
  10. package/lib/canvas/models/canvas.js +207 -140
  11. package/lib/canvas/models/index.js +12 -30
  12. package/lib/citybuliding/building.js +98 -63
  13. package/lib/citybuliding/models/build.js +192 -146
  14. package/lib/core/BaseLayer.js +1331 -814
  15. package/lib/core/BaseModel.js +457 -279
  16. package/lib/core/interface.js +40 -53
  17. package/lib/core/schema.js +21 -39
  18. package/lib/core/shape/Path.js +67 -79
  19. package/lib/core/shape/extrude.js +132 -91
  20. package/lib/core/triangulation.js +378 -196
  21. package/lib/earth/index.js +100 -62
  22. package/lib/earth/models/atmosphere.js +146 -112
  23. package/lib/earth/models/base.js +210 -150
  24. package/lib/earth/models/bloomsphere.js +146 -112
  25. package/lib/earth/utils.js +111 -91
  26. package/lib/heatmap/index.js +149 -92
  27. package/lib/heatmap/models/grid.js +118 -91
  28. package/lib/heatmap/models/grid3d.js +155 -123
  29. package/lib/heatmap/models/heatmap.js +475 -338
  30. package/lib/heatmap/models/hexagon.js +121 -92
  31. package/lib/heatmap/models/index.js +22 -37
  32. package/lib/heatmap/triangulation.js +31 -47
  33. package/lib/image/index.js +111 -74
  34. package/lib/image/models/dataImage.js +232 -174
  35. package/lib/image/models/image.js +175 -128
  36. package/lib/image/models/index.js +15 -32
  37. package/lib/index.js +263 -97
  38. package/lib/line/index.js +131 -85
  39. package/lib/line/models/arc.js +352 -237
  40. package/lib/line/models/arc_3d.js +334 -228
  41. package/lib/line/models/earthArc_3d.js +336 -228
  42. package/lib/line/models/great_circle.js +291 -200
  43. package/lib/line/models/half.js +286 -201
  44. package/lib/line/models/index.js +42 -50
  45. package/lib/line/models/line.js +428 -299
  46. package/lib/line/models/linearline.js +277 -203
  47. package/lib/line/models/simpleLine.js +239 -175
  48. package/lib/line/models/tile.js +348 -237
  49. package/lib/line/models/wall.js +327 -235
  50. package/lib/mask/index.js +92 -59
  51. package/lib/mask/models/fill.js +134 -82
  52. package/lib/mask/models/index.js +12 -30
  53. package/lib/plugins/DataMappingPlugin.js +342 -224
  54. package/lib/plugins/DataSourcePlugin.js +102 -87
  55. package/lib/plugins/FeatureScalePlugin.js +330 -240
  56. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  57. package/lib/plugins/LayerModelPlugin.js +80 -73
  58. package/lib/plugins/LayerStylePlugin.js +48 -51
  59. package/lib/plugins/LightingPlugin.js +80 -68
  60. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  61. package/lib/plugins/PixelPickingPlugin.js +150 -109
  62. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  63. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  64. package/lib/plugins/UpdateModelPlugin.js +40 -47
  65. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  66. package/lib/point/index.js +226 -150
  67. package/lib/point/models/earthExtrude.js +279 -201
  68. package/lib/point/models/earthFill.js +287 -202
  69. package/lib/point/models/extrude.js +299 -203
  70. package/lib/point/models/fill.js +406 -275
  71. package/lib/point/models/fillmage.js +365 -256
  72. package/lib/point/models/image.js +241 -168
  73. package/lib/point/models/index.js +46 -52
  74. package/lib/point/models/normal.js +183 -134
  75. package/lib/point/models/radar.js +304 -211
  76. package/lib/point/models/simplePoint.js +194 -142
  77. package/lib/point/models/text.js +608 -385
  78. package/lib/point/models/tile.js +314 -223
  79. package/lib/point/shape/extrude.js +56 -52
  80. package/lib/polygon/index.js +154 -102
  81. package/lib/polygon/models/extrude.js +311 -223
  82. package/lib/polygon/models/fill.js +215 -153
  83. package/lib/polygon/models/index.js +46 -52
  84. package/lib/polygon/models/ocean.js +244 -173
  85. package/lib/polygon/models/tile.js +144 -100
  86. package/lib/polygon/models/water.js +222 -153
  87. package/lib/raster/buffers/triangulation.js +27 -40
  88. package/lib/raster/index.js +115 -75
  89. package/lib/raster/models/index.js +16 -33
  90. package/lib/raster/models/raster.js +178 -135
  91. package/lib/raster/raster.js +187 -132
  92. package/lib/tile/interface.js +4 -16
  93. package/lib/tile/manager/tileConfigManager.js +125 -86
  94. package/lib/tile/manager/tileLayerManager.js +313 -229
  95. package/lib/tile/manager/tilePickerManager.js +192 -123
  96. package/lib/tile/models/tileModel.js +71 -52
  97. package/lib/tile/tileFactory/base.js +432 -309
  98. package/lib/tile/tileFactory/index.js +51 -49
  99. package/lib/tile/tileFactory/line.js +65 -50
  100. package/lib/tile/tileFactory/point.js +65 -50
  101. package/lib/tile/tileFactory/polygon.js +65 -50
  102. package/lib/tile/tileFactory/raster.js +66 -54
  103. package/lib/tile/tileFactory/rasterData.js +88 -76
  104. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  105. package/lib/tile/tileFactory/vectorLayer.js +168 -109
  106. package/lib/tile/tileLayer/baseTileLayer.js +420 -221
  107. package/lib/tile/tmsTileLayer.js +110 -67
  108. package/lib/tile/utils.js +110 -92
  109. package/lib/utils/blend.js +59 -79
  110. package/lib/utils/collision-index.js +107 -64
  111. package/lib/utils/dataMappingStyle.js +105 -60
  112. package/lib/utils/extrude_polyline.js +600 -398
  113. package/lib/utils/grid-index.js +163 -111
  114. package/lib/utils/layerData.js +130 -99
  115. package/lib/utils/multiPassRender.js +49 -41
  116. package/lib/utils/polylineNormal.js +148 -96
  117. package/lib/utils/simpleLine.js +100 -85
  118. package/lib/utils/symbol-layout.js +219 -116
  119. package/lib/utils/updateShape.js +15 -41
  120. package/lib/wind/index.js +109 -71
  121. package/lib/wind/models/index.js +12 -30
  122. package/lib/wind/models/utils.js +144 -105
  123. package/lib/wind/models/wind.js +333 -224
  124. package/lib/wind/models/windRender.js +329 -218
  125. package/lib/wind/models/windShader.js +23 -181
  126. package/package.json +6 -6
@@ -1,66 +1,101 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/citybuliding/building.ts
23
- var building_exports = {};
24
- __export(building_exports, {
25
- default: () => CityBuildingLayer
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
26
7
  });
27
- module.exports = __toCommonJS(building_exports);
28
- var import_BaseLayer = __toESM(require("../core/BaseLayer"));
29
- var import_build = __toESM(require("./models/build"));
30
- var CityBuildingLayer = class extends import_BaseLayer.default {
31
- constructor() {
32
- super(...arguments);
33
- this.type = "CityBuildingLayer";
34
- }
35
- buildModels() {
36
- this.layerModel = new import_build.default(this);
37
- this.layerModel.initModels((models) => {
38
- this.models = models;
39
- this.renderLayers();
40
- });
41
- }
42
- rebuildModels() {
43
- this.layerModel.buildModels((models) => this.models = models);
44
- }
45
- setLight(t) {
46
- this.updateLayerConfig({
47
- time: t
48
- });
8
+ exports.default = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
+
24
+ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
25
+
26
+ var _build = _interopRequireDefault(require("./models/build"));
27
+
28
+ 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); }; }
29
+
30
+ 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; } }
31
+
32
+ var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
33
+ (0, _inherits2.default)(CityBuildingLayer, _BaseLayer);
34
+
35
+ var _super = _createSuper(CityBuildingLayer);
36
+
37
+ function CityBuildingLayer() {
38
+ var _this;
39
+
40
+ (0, _classCallCheck2.default)(this, CityBuildingLayer);
41
+
42
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
44
+ }
45
+
46
+ _this = _super.call.apply(_super, [this].concat(args));
47
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'CityBuildingLayer');
48
+ return _this;
49
49
  }
50
- getConfigSchema() {
51
- return {
52
- properties: {
53
- opacity: {
54
- type: "number",
55
- minimum: 0,
56
- maximum: 1
50
+
51
+ (0, _createClass2.default)(CityBuildingLayer, [{
52
+ key: "buildModels",
53
+ value: function buildModels() {
54
+ var _this2 = this;
55
+
56
+ this.layerModel = new _build.default(this);
57
+ this.layerModel.initModels(function (models) {
58
+ _this2.models = models;
59
+
60
+ _this2.renderLayers();
61
+ });
62
+ }
63
+ }, {
64
+ key: "rebuildModels",
65
+ value: function rebuildModels() {
66
+ var _this3 = this;
67
+
68
+ this.layerModel.buildModels(function (models) {
69
+ return _this3.models = models;
70
+ });
71
+ }
72
+ }, {
73
+ key: "setLight",
74
+ value: function setLight(t) {
75
+ this.updateLayerConfig({
76
+ time: t
77
+ });
78
+ }
79
+ }, {
80
+ key: "getConfigSchema",
81
+ value: function getConfigSchema() {
82
+ return {
83
+ properties: {
84
+ opacity: {
85
+ type: 'number',
86
+ minimum: 0,
87
+ maximum: 1
88
+ }
57
89
  }
58
- }
59
- };
60
- }
61
- getModelType() {
62
- return "citybuilding";
63
- }
64
- };
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {});
90
+ };
91
+ }
92
+ }, {
93
+ key: "getModelType",
94
+ value: function getModelType() {
95
+ return 'citybuilding';
96
+ }
97
+ }]);
98
+ return CityBuildingLayer;
99
+ }(_BaseLayer2.default);
100
+
101
+ exports.default = CityBuildingLayer;
@@ -1,157 +1,203 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/citybuliding/models/build.ts
23
- var build_exports = {};
24
- __export(build_exports, {
25
- default: () => CityBuildModel
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
26
7
  });
27
- module.exports = __toCommonJS(build_exports);
28
- var import_l7_core = require("@antv/l7-core");
29
- var import_l7_utils = require("@antv/l7-utils");
30
- var import_BaseModel = __toESM(require("../../core/BaseModel"));
31
- var import_triangulation = require("../../core/triangulation");
32
- var import_build_frag = __toESM(require("../shaders/build_frag.glsl"));
33
- var import_build_vert = __toESM(require("../shaders/build_vert.glsl"));
34
- var CityBuildModel = class extends import_BaseModel.default {
35
- getUninforms() {
36
- const {
37
- opacity = 1,
38
- baseColor = "rgb(16,16,16)",
39
- brightColor = "rgb(255,176,38)",
40
- windowColor = "rgb(30,60,89)",
41
- time = 0,
42
- sweep = {
8
+ exports.default = void 0;
9
+
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _l7Core = require("@antv/l7-core");
23
+
24
+ var _l7Utils = require("@antv/l7-utils");
25
+
26
+ var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
27
+
28
+ var _triangulation = require("../../core/triangulation");
29
+
30
+ 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); }; }
31
+
32
+ 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; } }
33
+
34
+ /* babel-plugin-inline-import '../shaders/build_frag.glsl' */
35
+ var buildFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\nuniform float u_near : 0;\nuniform float u_far : 1;\nvarying vec4 v_Color;\nvarying vec2 v_texCoord;\nuniform float u_Zoom : 1;\nuniform float u_time;\n\nuniform float u_circleSweep;\nuniform float u_cityMinSize;\nuniform vec3 u_circleSweepColor;\nuniform float u_circleSweepSpeed;\n\nvarying float v_worldDis;\n\n#pragma include \"picking\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n gl_FragColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n gl_FragColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n gl_FragColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n gl_FragColor.rgb += r * r * u_circleSweepColor;\n }\n \n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
36
+
37
+ /* babel-plugin-inline-import '../shaders/build_vert.glsl' */
38
+ var buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvarying vec4 v_Color;\nuniform mat4 u_Mvp;\n\nuniform float u_circleSweep;\nuniform vec2 u_cityCenter;\n\nvarying float v_worldDis;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n if(u_CoordinateSystem != COORDINATE_SYSTEM_P20_2) {\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n }\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\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 float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
39
+
40
+ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
41
+ (0, _inherits2.default)(CityBuildModel, _BaseModel);
42
+
43
+ var _super = _createSuper(CityBuildModel);
44
+
45
+ function CityBuildModel() {
46
+ (0, _classCallCheck2.default)(this, CityBuildModel);
47
+ return _super.apply(this, arguments);
48
+ }
49
+
50
+ (0, _createClass2.default)(CityBuildModel, [{
51
+ key: "getUninforms",
52
+ value: function getUninforms() {
53
+ var _ref = this.layer.getLayerConfig(),
54
+ _ref$opacity = _ref.opacity,
55
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
56
+ _ref$baseColor = _ref.baseColor,
57
+ baseColor = _ref$baseColor === void 0 ? 'rgb(16,16,16)' : _ref$baseColor,
58
+ _ref$brightColor = _ref.brightColor,
59
+ brightColor = _ref$brightColor === void 0 ? 'rgb(255,176,38)' : _ref$brightColor,
60
+ _ref$windowColor = _ref.windowColor,
61
+ windowColor = _ref$windowColor === void 0 ? 'rgb(30,60,89)' : _ref$windowColor,
62
+ _ref$time = _ref.time,
63
+ time = _ref$time === void 0 ? 0 : _ref$time,
64
+ _ref$sweep = _ref.sweep,
65
+ sweep = _ref$sweep === void 0 ? {
43
66
  enable: false,
44
67
  sweepRadius: 1,
45
- sweepColor: "rgb(255, 255, 255)",
68
+ sweepColor: 'rgb(255, 255, 255)',
46
69
  sweepSpeed: 0.4,
47
70
  sweepCenter: this.cityCenter
48
- }
49
- } = this.layer.getLayerConfig();
50
- return {
51
- u_cityCenter: sweep.sweepCenter || this.cityCenter,
52
- u_cityMinSize: this.cityMinSize * sweep.sweepRadius,
53
- u_circleSweep: sweep.enable ? 1 : 0,
54
- u_circleSweepColor: (0, import_l7_utils.rgb2arr)(sweep.sweepColor).slice(0, 3),
55
- u_circleSweepSpeed: sweep.sweepSpeed,
56
- u_opacity: opacity,
57
- u_baseColor: (0, import_l7_utils.rgb2arr)(baseColor),
58
- u_brightColor: (0, import_l7_utils.rgb2arr)(brightColor),
59
- u_windowColor: (0, import_l7_utils.rgb2arr)(windowColor),
60
- u_time: this.layer.getLayerAnimateTime() || time
61
- };
62
- }
63
- calCityGeo() {
64
- const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;
65
- if (this.mapService.version === "GAODE2.x") {
66
- this.cityCenter = this.mapService.lngLatToCoord([
67
- (maxLng + minLng) / 2,
68
- (maxLat + minLat) / 2
69
- ]);
70
- const l1 = this.mapService.lngLatToCoord([maxLng, maxLat]);
71
- const l2 = this.mapService.lngLatToCoord([minLng, minLat]);
72
- this.cityMinSize = Math.sqrt(Math.pow(l1[0] - l2[0], 2) + Math.pow(l1[1] - l2[1], 2)) / 4;
73
- } else {
74
- const w = maxLng - minLng;
75
- const h = maxLat - minLat;
76
- this.cityCenter = [(maxLng + minLng) / 2, (maxLat + minLat) / 2];
77
- this.cityMinSize = Math.sqrt(Math.pow(w, 2) + Math.pow(h, 2)) / 4;
71
+ } : _ref$sweep;
72
+
73
+ return {
74
+ u_cityCenter: sweep.sweepCenter || this.cityCenter,
75
+ u_cityMinSize: this.cityMinSize * sweep.sweepRadius,
76
+ u_circleSweep: sweep.enable ? 1.0 : 0.0,
77
+ u_circleSweepColor: (0, _l7Utils.rgb2arr)(sweep.sweepColor).slice(0, 3),
78
+ u_circleSweepSpeed: sweep.sweepSpeed,
79
+ u_opacity: opacity,
80
+ u_baseColor: (0, _l7Utils.rgb2arr)(baseColor),
81
+ u_brightColor: (0, _l7Utils.rgb2arr)(brightColor),
82
+ u_windowColor: (0, _l7Utils.rgb2arr)(windowColor),
83
+ u_time: this.layer.getLayerAnimateTime() || time
84
+ };
78
85
  }
79
- }
80
- initModels(callbackModel) {
81
- this.calCityGeo();
82
- this.startModelAnimate();
83
- this.buildModels(callbackModel);
84
- }
85
- buildModels(callbackModel) {
86
- this.layer.buildLayerModel({
87
- moduleName: "cityBuilding",
88
- vertexShader: import_build_vert.default,
89
- fragmentShader: import_build_frag.default,
90
- triangulation: import_triangulation.PolygonExtrudeTriangulation,
91
- depth: { enable: true },
92
- cull: {
93
- enable: true,
94
- face: import_l7_core.gl.BACK
86
+ }, {
87
+ key: "calCityGeo",
88
+ value: function calCityGeo() {
89
+ // @ts-ignore
90
+ var _this$layer$getSource = (0, _slicedToArray2.default)(this.layer.getSource().extent, 4),
91
+ minLng = _this$layer$getSource[0],
92
+ minLat = _this$layer$getSource[1],
93
+ maxLng = _this$layer$getSource[2],
94
+ maxLat = _this$layer$getSource[3];
95
+
96
+ if (this.mapService.version === 'GAODE2.x') {
97
+ // @ts-ignore
98
+ this.cityCenter = this.mapService.lngLatToCoord([(maxLng + minLng) / 2, (maxLat + minLat) / 2]); // @ts-ignore
99
+
100
+ var l1 = this.mapService.lngLatToCoord([maxLng, maxLat]); // @ts-ignore
101
+
102
+ var l2 = this.mapService.lngLatToCoord([minLng, minLat]);
103
+ this.cityMinSize = Math.sqrt(Math.pow(l1[0] - l2[0], 2) + Math.pow(l1[1] - l2[1], 2)) / 4;
104
+ } else {
105
+ var w = maxLng - minLng;
106
+ var h = maxLat - minLat;
107
+ this.cityCenter = [(maxLng + minLng) / 2, (maxLat + minLat) / 2];
108
+ this.cityMinSize = Math.sqrt(Math.pow(w, 2) + Math.pow(h, 2)) / 4;
95
109
  }
96
- }).then((model) => {
97
- callbackModel([model]);
98
- }).catch((err) => {
99
- console.warn(err);
100
- callbackModel([]);
101
- });
102
- }
103
- registerBuiltinAttributes() {
104
- this.styleAttributeService.registerStyleAttribute({
105
- name: "normal",
106
- type: import_l7_core.AttributeType.Attribute,
107
- descriptor: {
108
- name: "a_Normal",
109
- buffer: {
110
- usage: import_l7_core.gl.STATIC_DRAW,
111
- data: [],
112
- type: import_l7_core.gl.FLOAT
110
+ }
111
+ }, {
112
+ key: "initModels",
113
+ value: function initModels(callbackModel) {
114
+ this.calCityGeo();
115
+ this.startModelAnimate();
116
+ this.buildModels(callbackModel);
117
+ }
118
+ }, {
119
+ key: "buildModels",
120
+ value: function buildModels(callbackModel) {
121
+ this.layer.buildLayerModel({
122
+ moduleName: 'cityBuilding',
123
+ vertexShader: buildVert,
124
+ fragmentShader: buildFrag,
125
+ triangulation: _triangulation.PolygonExtrudeTriangulation,
126
+ depth: {
127
+ enable: true
113
128
  },
114
- size: 3,
115
- update: (feature, featureIdx, vertex, attributeIdx, normal) => {
116
- return normal;
129
+ cull: {
130
+ enable: true,
131
+ face: _l7Core.gl.BACK
117
132
  }
118
- }
119
- });
120
- this.styleAttributeService.registerStyleAttribute({
121
- name: "size",
122
- type: import_l7_core.AttributeType.Attribute,
123
- descriptor: {
124
- name: "a_Size",
125
- buffer: {
126
- usage: import_l7_core.gl.DYNAMIC_DRAW,
127
- data: [],
128
- type: import_l7_core.gl.FLOAT
129
- },
130
- size: 1,
131
- update: (feature, featureIdx, vertex, attributeIdx) => {
132
- const { size = 10 } = feature;
133
- return Array.isArray(size) ? [size[0]] : [size];
133
+ }).then(function (model) {
134
+ callbackModel([model]);
135
+ }).catch(function (err) {
136
+ console.warn(err);
137
+ callbackModel([]);
138
+ });
139
+ }
140
+ }, {
141
+ key: "registerBuiltinAttributes",
142
+ value: function registerBuiltinAttributes() {
143
+ // point layer size;
144
+ this.styleAttributeService.registerStyleAttribute({
145
+ name: 'normal',
146
+ type: _l7Core.AttributeType.Attribute,
147
+ descriptor: {
148
+ name: 'a_Normal',
149
+ buffer: {
150
+ // give the WebGL driver a hint that this buffer may change
151
+ usage: _l7Core.gl.STATIC_DRAW,
152
+ data: [],
153
+ type: _l7Core.gl.FLOAT
154
+ },
155
+ size: 3,
156
+ update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
157
+ return normal;
158
+ }
134
159
  }
135
- }
136
- });
137
- this.styleAttributeService.registerStyleAttribute({
138
- name: "uv",
139
- type: import_l7_core.AttributeType.Attribute,
140
- descriptor: {
141
- name: "a_Uv",
142
- buffer: {
143
- usage: import_l7_core.gl.DYNAMIC_DRAW,
144
- data: [],
145
- type: import_l7_core.gl.FLOAT
146
- },
147
- size: 2,
148
- update: (feature, featureIdx, vertex, attributeIdx) => {
149
- const { size } = feature;
150
- return [vertex[3], vertex[4]];
160
+ });
161
+ this.styleAttributeService.registerStyleAttribute({
162
+ name: 'size',
163
+ type: _l7Core.AttributeType.Attribute,
164
+ descriptor: {
165
+ name: 'a_Size',
166
+ buffer: {
167
+ // give the WebGL driver a hint that this buffer may change
168
+ usage: _l7Core.gl.DYNAMIC_DRAW,
169
+ data: [],
170
+ type: _l7Core.gl.FLOAT
171
+ },
172
+ size: 1,
173
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
174
+ var _feature$size = feature.size,
175
+ size = _feature$size === void 0 ? 10 : _feature$size;
176
+ return Array.isArray(size) ? [size[0]] : [size];
177
+ }
151
178
  }
152
- }
153
- });
154
- }
155
- };
156
- // Annotate the CommonJS export names for ESM import in node:
157
- 0 && (module.exports = {});
179
+ });
180
+ this.styleAttributeService.registerStyleAttribute({
181
+ name: 'uv',
182
+ type: _l7Core.AttributeType.Attribute,
183
+ descriptor: {
184
+ name: 'a_Uv',
185
+ buffer: {
186
+ // give the WebGL driver a hint that this buffer may change
187
+ usage: _l7Core.gl.DYNAMIC_DRAW,
188
+ data: [],
189
+ type: _l7Core.gl.FLOAT
190
+ },
191
+ size: 2,
192
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
193
+ var size = feature.size;
194
+ return [vertex[3], vertex[4]];
195
+ }
196
+ }
197
+ });
198
+ }
199
+ }]);
200
+ return CityBuildModel;
201
+ }(_BaseModel2.default);
202
+
203
+ exports.default = CityBuildModel;