@antv/l7-layers 2.9.27-alpha.3 → 2.9.27-alpha.4

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 (138) hide show
  1. package/es/Geometry/models/billboard.js +2 -5
  2. package/es/Geometry/models/plane.js +3 -3
  3. package/es/Geometry/models/sprite.js +2 -3
  4. package/es/core/BaseLayer.d.ts +5 -6
  5. package/es/core/BaseLayer.js +13 -19
  6. package/es/core/BaseModel.d.ts +1 -1
  7. package/es/core/BaseModel.js +15 -16
  8. package/es/core/interface.d.ts +2 -1
  9. package/es/earth/models/atmosphere.js +4 -7
  10. package/es/earth/models/base.js +10 -14
  11. package/es/earth/models/bloomsphere.js +4 -8
  12. package/es/heatmap/index.d.ts +2 -2
  13. package/es/heatmap/index.js +1 -3
  14. package/es/heatmap/models/grid.js +1 -3
  15. package/es/heatmap/models/grid3d.js +4 -11
  16. package/es/heatmap/models/heatmap.js +3 -6
  17. package/es/heatmap/models/hexagon.js +2 -6
  18. package/es/heatmap/triangulation.js +0 -1
  19. package/es/image/index.d.ts +1 -1
  20. package/es/image/index.js +4 -1
  21. package/es/image/models/dataImage.d.ts +1 -1
  22. package/es/image/models/dataImage.js +12 -34
  23. package/es/image/models/image.js +1 -3
  24. package/es/image/models/index.d.ts +1 -1
  25. package/es/image/models/index.js +3 -1
  26. package/es/image/models/tileDataImage.d.ts +19 -0
  27. package/es/image/models/tileDataImage.js +174 -0
  28. package/es/line/models/arc.js +7 -8
  29. package/es/line/models/arc_3d.js +8 -10
  30. package/es/line/models/earthArc_3d.js +8 -10
  31. package/es/line/models/great_circle.js +7 -7
  32. package/es/line/models/line.js +4 -4
  33. package/es/line/models/linearline.js +3 -4
  34. package/es/line/models/simpleLine.js +3 -3
  35. package/es/line/models/tile.js +1 -1
  36. package/es/line/models/wall.js +3 -3
  37. package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
  38. package/es/line/shaders/line_arc2d_vert.glsl +2 -2
  39. package/es/line/shaders/line_arc_3d_frag.glsl +10 -10
  40. package/es/line/shaders/line_arc_3d_vert.glsl +3 -4
  41. package/es/line/shaders/line_arc_frag.glsl +9 -10
  42. package/es/line/shaders/line_arc_great_circle_frag.glsl +6 -6
  43. package/es/line/shaders/line_arc_great_circle_vert.glsl +2 -3
  44. package/es/line/shaders/line_arc_vert.glsl +2 -2
  45. package/es/line/shaders/line_bezier_vert.glsl +2 -2
  46. package/es/line/shaders/line_frag.glsl +5 -5
  47. package/es/line/shaders/line_vert.glsl +1 -1
  48. package/es/line/shaders/linear/arc3d_linear_frag.glsl +6 -7
  49. package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -10
  50. package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
  51. package/es/line/shaders/wall/wall_frag.glsl +5 -5
  52. package/es/line/shaders/wall/wall_vert.glsl +2 -2
  53. package/es/plugins/LayerAnimateStylePlugin.js +2 -2
  54. package/es/point/index.js +3 -4
  55. package/es/point/models/earthExtrude.d.ts +1 -1
  56. package/es/point/models/earthExtrude.js +9 -14
  57. package/es/point/models/earthFill.js +2 -2
  58. package/es/point/models/extrude.d.ts +1 -1
  59. package/es/point/models/extrude.js +9 -12
  60. package/es/point/models/fill.d.ts +1 -1
  61. package/es/point/models/fill.js +7 -8
  62. package/es/point/models/fillmage.js +4 -5
  63. package/es/point/models/image.js +2 -2
  64. package/es/point/models/index.d.ts +1 -1
  65. package/es/point/models/index.js +3 -3
  66. package/es/point/models/normal.js +0 -2
  67. package/es/point/models/radar.js +1 -1
  68. package/es/point/models/text.js +1 -3
  69. package/es/point/models/tile.js +2 -3
  70. package/es/point/models/tileText.js +3 -5
  71. package/es/point/shaders/animate/wave_frag.glsl +2 -2
  72. package/es/polygon/models/extrude.js +3 -5
  73. package/es/raster/models/raster.d.ts +1 -1
  74. package/es/raster/models/raster.js +3 -3
  75. package/es/tile/manager/tileLayerManager.js +10 -0
  76. package/lib/Geometry/models/billboard.js +2 -5
  77. package/lib/Geometry/models/plane.js +3 -3
  78. package/lib/Geometry/models/sprite.js +2 -3
  79. package/lib/core/BaseLayer.js +13 -19
  80. package/lib/core/BaseModel.js +15 -16
  81. package/lib/earth/models/atmosphere.js +4 -7
  82. package/lib/earth/models/base.js +10 -14
  83. package/lib/earth/models/bloomsphere.js +4 -8
  84. package/lib/heatmap/index.js +1 -3
  85. package/lib/heatmap/models/grid.js +1 -3
  86. package/lib/heatmap/models/grid3d.js +4 -11
  87. package/lib/heatmap/models/heatmap.js +3 -6
  88. package/lib/heatmap/models/hexagon.js +2 -6
  89. package/lib/heatmap/triangulation.js +0 -1
  90. package/lib/image/index.js +4 -1
  91. package/lib/image/models/dataImage.js +11 -33
  92. package/lib/image/models/image.js +1 -3
  93. package/lib/image/models/index.js +4 -1
  94. package/lib/image/models/tileDataImage.js +188 -0
  95. package/lib/line/models/arc.js +7 -8
  96. package/lib/line/models/arc_3d.js +8 -10
  97. package/lib/line/models/earthArc_3d.js +8 -10
  98. package/lib/line/models/great_circle.js +7 -7
  99. package/lib/line/models/line.js +4 -4
  100. package/lib/line/models/linearline.js +3 -4
  101. package/lib/line/models/simpleLine.js +3 -3
  102. package/lib/line/models/tile.js +1 -1
  103. package/lib/line/models/wall.js +3 -3
  104. package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
  105. package/lib/line/shaders/line_arc2d_vert.glsl +2 -2
  106. package/lib/line/shaders/line_arc_3d_frag.glsl +10 -10
  107. package/lib/line/shaders/line_arc_3d_vert.glsl +3 -4
  108. package/lib/line/shaders/line_arc_frag.glsl +9 -10
  109. package/lib/line/shaders/line_arc_great_circle_frag.glsl +6 -6
  110. package/lib/line/shaders/line_arc_great_circle_vert.glsl +2 -3
  111. package/lib/line/shaders/line_arc_vert.glsl +2 -2
  112. package/lib/line/shaders/line_bezier_vert.glsl +2 -2
  113. package/lib/line/shaders/line_frag.glsl +5 -5
  114. package/lib/line/shaders/line_vert.glsl +1 -1
  115. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +6 -7
  116. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -10
  117. package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
  118. package/lib/line/shaders/wall/wall_frag.glsl +5 -5
  119. package/lib/line/shaders/wall/wall_vert.glsl +2 -2
  120. package/lib/plugins/LayerAnimateStylePlugin.js +2 -2
  121. package/lib/point/index.js +3 -4
  122. package/lib/point/models/earthExtrude.js +9 -14
  123. package/lib/point/models/earthFill.js +2 -2
  124. package/lib/point/models/extrude.js +9 -12
  125. package/lib/point/models/fill.js +7 -8
  126. package/lib/point/models/fillmage.js +4 -5
  127. package/lib/point/models/image.js +2 -2
  128. package/lib/point/models/index.js +1 -1
  129. package/lib/point/models/normal.js +0 -2
  130. package/lib/point/models/radar.js +1 -1
  131. package/lib/point/models/text.js +1 -3
  132. package/lib/point/models/tile.js +2 -3
  133. package/lib/point/models/tileText.js +3 -5
  134. package/lib/point/shaders/animate/wave_frag.glsl +2 -2
  135. package/lib/polygon/models/extrude.js +3 -5
  136. package/lib/raster/models/raster.js +3 -3
  137. package/lib/tile/manager/tileLayerManager.js +10 -0
  138. package/package.json +6 -6
@@ -152,18 +152,16 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
152
152
  descriptor: {
153
153
  name: 'a_Dir',
154
154
  buffer: {
155
- // give the WebGL driver a hint that this buffer may change
156
155
  usage: gl.DYNAMIC_DRAW,
157
156
  data: [],
158
157
  type: gl.FLOAT
159
158
  },
160
159
  size: 2,
161
- update: function update(feature, featureIdx, vertex, attributeIdx) {
160
+ update: function update(feature, featureIdx, vertex) {
162
161
  return [vertex[3], vertex[4]];
163
162
  }
164
163
  }
165
- }); // point layer size;
166
-
164
+ });
167
165
  this.styleAttributeService.registerStyleAttribute({
168
166
  name: 'size',
169
167
  type: AttributeType.Attribute,
@@ -176,7 +174,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
176
174
  type: gl.FLOAT
177
175
  },
178
176
  size: 1,
179
- update: function update(feature, featureIdx, vertex, attributeIdx) {
177
+ update: function update(feature) {
180
178
  var _feature$size = feature.size,
181
179
  size = _feature$size === void 0 ? 1 : _feature$size;
182
180
  return [size];
@@ -286,7 +284,6 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
286
284
  enable: false
287
285
  },
288
286
  blend: this.getBlend(),
289
- // count: 6,
290
287
  elements: createElements({
291
288
  data: [0, 2, 1, 2, 3, 1],
292
289
  type: gl.UNSIGNED_INT,
@@ -87,17 +87,13 @@ var HexagonModel = /*#__PURE__*/function (_BaseModel) {
87
87
  descriptor: {
88
88
  name: 'a_Pos',
89
89
  buffer: {
90
- // give the WebGL driver a hint that this buffer may change
91
90
  usage: gl.DYNAMIC_DRAW,
92
91
  data: [],
93
92
  type: gl.FLOAT
94
93
  },
95
94
  size: 3,
96
- update: function update(feature, featureIdx) {
97
- // const coordinates = (feature.verison==='GAODE2.x'?feature.originoordinates:feature.coordinates) as number[];
98
- var coordinates = feature.version === 'GAODE2.x' ? feature.originCoordinates : feature.coordinates; // const coordinates = feature.coordinates as number[];
99
- // const coordinates = feature.originCoordinates as number[];
100
-
95
+ update: function update(feature) {
96
+ var coordinates = feature.version === 'GAODE2.x' ? feature.originCoordinates : feature.coordinates;
101
97
  return [coordinates[0], coordinates[1], 0];
102
98
  }
103
99
  }
@@ -1,4 +1,3 @@
1
- // @ts-ignore
2
1
  export function heatMap3DTriangulation(width, height) {
3
2
  var indices = [];
4
3
  var vertices = [];
@@ -14,6 +14,6 @@ export default class ImageLayer extends BaseLayer<IImageLayerStyleOptions> {
14
14
  };
15
15
  };
16
16
  };
17
- protected getDefaultConfig(): {} | {};
17
+ protected getDefaultConfig(): {} | {} | {};
18
18
  protected getModelType(): ImageModelType;
19
19
  }
package/es/image/index.js CHANGED
@@ -79,7 +79,8 @@ var ImageLayer = /*#__PURE__*/function (_BaseLayer) {
79
79
  var type = this.getModelType();
80
80
  var defaultConfig = {
81
81
  image: {},
82
- dataImage: {}
82
+ dataImage: {},
83
+ tileDataImage: {}
83
84
  };
84
85
  return defaultConfig[type];
85
86
  }
@@ -95,6 +96,8 @@ var ImageLayer = /*#__PURE__*/function (_BaseLayer) {
95
96
  return 'dataImage';
96
97
  } else if (shape === 'image') {
97
98
  return 'image';
99
+ } else if (shape === 'tileDataImage') {
100
+ return 'tileDataImage';
98
101
  } else {
99
102
  return 'image';
100
103
  }
@@ -18,5 +18,5 @@ export default class ImageDataModel extends BaseModel {
18
18
  };
19
19
  };
20
20
  protected registerBuiltinAttributes(): void;
21
- private updateColorTexure;
21
+ private updateColorTexture;
22
22
  }
@@ -9,7 +9,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
9
9
  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; } }
10
10
 
11
11
  import { AttributeType, gl } from '@antv/l7-core';
12
- import { generateColorRamp, getMask, isMini } from '@antv/l7-utils';
12
+ import { generateColorRamp, getMask } from '@antv/l7-utils';
13
13
  import { isEqual } from 'lodash';
14
14
  import BaseModel from "../../core/BaseModel";
15
15
  import { RasterImageTriangulation } from "../../core/triangulation";
@@ -57,7 +57,7 @@ var ImageDataModel = /*#__PURE__*/function (_BaseModel) {
57
57
  pixelConstantRGB = _ref$pixelConstantRGB === void 0 ? 0.1 : _ref$pixelConstantRGB;
58
58
 
59
59
  if (!isEqual(this.rampColors, rampColors)) {
60
- this.updateColorTexure();
60
+ this.updateColorTexture();
61
61
  this.rampColors = rampColors;
62
62
  }
63
63
 
@@ -95,35 +95,15 @@ var ImageDataModel = /*#__PURE__*/function (_BaseModel) {
95
95
  height: 0,
96
96
  width: 0
97
97
  });
98
-
99
- if (isMini) {
100
- // @ts-ignore
101
- var canvas = this.layerService.sceneService.getSceneConfig().canvas;
102
- var img = canvas.createImage();
103
- img.crossOrigin = 'anonymous';
104
- img.src = source.data.originData;
105
-
106
- img.onload = function () {
107
- _this.texture = createTexture2D({
108
- data: img,
109
- width: img.width,
110
- height: img.height
111
- });
112
-
113
- _this.layerService.reRender();
114
- };
115
- } else {
116
- source.data.images.then(function (imageData) {
117
- _this.texture = createTexture2D({
118
- data: imageData[0],
119
- width: imageData[0].width,
120
- height: imageData[0].height
121
- });
122
-
123
- _this.layerService.reRender();
98
+ source.data.images.then(function (imageData) {
99
+ _this.texture = createTexture2D({
100
+ data: imageData[0],
101
+ width: imageData[0].width,
102
+ height: imageData[0].height
124
103
  });
125
- }
126
104
 
105
+ _this.layerService.reRender();
106
+ });
127
107
  var rampImageData = rampColorsData ? rampColorsData : generateColorRamp(rampColors);
128
108
  this.colorTexture = createTexture2D({
129
109
  data: rampImageData.data,
@@ -179,28 +159,26 @@ var ImageDataModel = /*#__PURE__*/function (_BaseModel) {
179
159
  }, {
180
160
  key: "registerBuiltinAttributes",
181
161
  value: function registerBuiltinAttributes() {
182
- // point layer size;
183
162
  this.styleAttributeService.registerStyleAttribute({
184
163
  name: 'uv',
185
164
  type: AttributeType.Attribute,
186
165
  descriptor: {
187
166
  name: 'a_Uv',
188
167
  buffer: {
189
- // give the WebGL driver a hint that this buffer may change
190
168
  usage: gl.DYNAMIC_DRAW,
191
169
  data: [],
192
170
  type: gl.FLOAT
193
171
  },
194
172
  size: 2,
195
- update: function update(feature, featureIdx, vertex, attributeIdx) {
173
+ update: function update(feature, featureIdx, vertex) {
196
174
  return [vertex[3], vertex[4]];
197
175
  }
198
176
  }
199
177
  });
200
178
  }
201
179
  }, {
202
- key: "updateColorTexure",
203
- value: function updateColorTexure() {
180
+ key: "updateColorTexture",
181
+ value: function updateColorTexture() {
204
182
  var createTexture2D = this.rendererService.createTexture2D;
205
183
 
206
184
  var _ref3 = this.layer.getLayerConfig(),
@@ -139,20 +139,18 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
139
139
  }, {
140
140
  key: "registerBuiltinAttributes",
141
141
  value: function registerBuiltinAttributes() {
142
- // point layer size;
143
142
  this.styleAttributeService.registerStyleAttribute({
144
143
  name: 'uv',
145
144
  type: AttributeType.Attribute,
146
145
  descriptor: {
147
146
  name: 'a_Uv',
148
147
  buffer: {
149
- // give the WebGL driver a hint that this buffer may change
150
148
  usage: gl.DYNAMIC_DRAW,
151
149
  data: [],
152
150
  type: gl.FLOAT
153
151
  },
154
152
  size: 2,
155
- update: function update(feature, featureIdx, vertex, attributeIdx) {
153
+ update: function update(feature, featureIdx, vertex) {
156
154
  return [vertex[3], vertex[4]];
157
155
  }
158
156
  }
@@ -1,4 +1,4 @@
1
- export declare type ImageModelType = 'image' | 'dataImage';
1
+ export declare type ImageModelType = 'image' | 'dataImage' | 'tileDataImage';
2
2
  declare const ImageModels: {
3
3
  [key in ImageModelType]: any;
4
4
  };
@@ -1,7 +1,9 @@
1
1
  import DataImageModel from "./dataImage";
2
2
  import ImageModel from "./image";
3
+ import TileDataImageModel from "./tileDataImage";
3
4
  var ImageModels = {
4
5
  image: ImageModel,
5
- dataImage: DataImageModel
6
+ dataImage: DataImageModel,
7
+ tileDataImage: TileDataImageModel
6
8
  };
7
9
  export default ImageModels;
@@ -0,0 +1,19 @@
1
+ import { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
2
+ import BaseModel from '../../core/BaseModel';
3
+ export default class ImageDataModel extends BaseModel {
4
+ protected texture: ITexture2D;
5
+ getUninforms(): IModelUniform;
6
+ initModels(callbackModel: (models: IModel[]) => void): void;
7
+ clearModels(): void;
8
+ buildModels(callbackModel: (models: IModel[]) => void): void;
9
+ protected getConfigSchema(): {
10
+ properties: {
11
+ opacity: {
12
+ type: string;
13
+ minimum: number;
14
+ maximum: number;
15
+ };
16
+ };
17
+ };
18
+ protected registerBuiltinAttributes(): void;
19
+ }
@@ -0,0 +1,174 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+
7
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
+
9
+ 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; } }
10
+
11
+ import { AttributeType, gl } from '@antv/l7-core';
12
+ import { getMask } from '@antv/l7-utils';
13
+ import BaseModel from "../../core/BaseModel";
14
+ import { RasterImageTriangulation } from "../../core/triangulation";
15
+
16
+ /* babel-plugin-inline-import '../shaders/dataImage_frag.glsl' */
17
+ var ImageFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nvarying vec2 v_texCoord;\n\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\n\nuniform float u_pixelConstant;\nuniform float u_pixelConstantR;\nuniform float u_pixelConstantG;\nuniform float u_pixelConstantB;\nuniform float u_pixelConstantRGB;\n\nvoid main() {\n vec4 baseColor = texture2D(u_texture, vec2(v_texCoord.x, v_texCoord.y));\n\n float r = baseColor.r;\n float g = baseColor.g;\n float b = baseColor.b;\n\n float value = u_pixelConstant + ((r * u_pixelConstantR + g * u_pixelConstantG + b * u_pixelConstantB) * u_pixelConstantRGB);\n if (value == u_noDataValue) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {\n gl_FragColor = vec4(0, 0, 0, 0);\n } else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec4 color = texture2D(u_colorTexture, vec2(normalisedValue, 0));\n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n }\n}\n";
18
+
19
+ /* babel-plugin-inline-import '../shaders/image_vert.glsl' */
20
+ var ImageVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
21
+
22
+ var ImageDataModel = /*#__PURE__*/function (_BaseModel) {
23
+ _inherits(ImageDataModel, _BaseModel);
24
+
25
+ var _super = _createSuper(ImageDataModel);
26
+
27
+ function ImageDataModel() {
28
+ _classCallCheck(this, ImageDataModel);
29
+
30
+ return _super.apply(this, arguments);
31
+ }
32
+
33
+ _createClass(ImageDataModel, [{
34
+ key: "getUninforms",
35
+ value: function getUninforms() {
36
+ var createTexture2D = this.rendererService.createTexture2D;
37
+
38
+ var _ref = this.layer.getLayerConfig(),
39
+ opacity = _ref.opacity,
40
+ _ref$clampLow = _ref.clampLow,
41
+ clampLow = _ref$clampLow === void 0 ? true : _ref$clampLow,
42
+ _ref$clampHigh = _ref.clampHigh,
43
+ clampHigh = _ref$clampHigh === void 0 ? true : _ref$clampHigh,
44
+ _ref$noDataValue = _ref.noDataValue,
45
+ noDataValue = _ref$noDataValue === void 0 ? -9999999 : _ref$noDataValue,
46
+ _ref$domain = _ref.domain,
47
+ domain = _ref$domain === void 0 ? [0, 1] : _ref$domain,
48
+ _ref$colorTexture = _ref.colorTexture,
49
+ colorTexture = _ref$colorTexture === void 0 ? createTexture2D({
50
+ height: 0,
51
+ width: 0
52
+ }) : _ref$colorTexture,
53
+ _ref$pixelConstant = _ref.pixelConstant,
54
+ pixelConstant = _ref$pixelConstant === void 0 ? 0.0 : _ref$pixelConstant,
55
+ _ref$pixelConstantR = _ref.pixelConstantR,
56
+ pixelConstantR = _ref$pixelConstantR === void 0 ? 256 * 256 : _ref$pixelConstantR,
57
+ _ref$pixelConstantG = _ref.pixelConstantG,
58
+ pixelConstantG = _ref$pixelConstantG === void 0 ? 256 : _ref$pixelConstantG,
59
+ _ref$pixelConstantB = _ref.pixelConstantB,
60
+ pixelConstantB = _ref$pixelConstantB === void 0 ? 1 : _ref$pixelConstantB,
61
+ _ref$pixelConstantRGB = _ref.pixelConstantRGB,
62
+ pixelConstantRGB = _ref$pixelConstantRGB === void 0 ? 0.1 : _ref$pixelConstantRGB;
63
+
64
+ return {
65
+ u_opacity: opacity || 1,
66
+ u_texture: this.texture,
67
+ u_pixelConstant: pixelConstant,
68
+ u_pixelConstantR: pixelConstantR,
69
+ u_pixelConstantG: pixelConstantG,
70
+ u_pixelConstantB: pixelConstantB,
71
+ u_pixelConstantRGB: pixelConstantRGB,
72
+ u_domain: domain,
73
+ u_clampLow: clampLow,
74
+ u_clampHigh: typeof clampHigh !== 'undefined' ? clampHigh : clampLow,
75
+ u_noDataValue: noDataValue,
76
+ u_colorTexture: colorTexture
77
+ };
78
+ }
79
+ }, {
80
+ key: "initModels",
81
+ value: function initModels(callbackModel) {
82
+ var _this = this;
83
+
84
+ var _ref2 = this.layer.getLayerConfig(),
85
+ _ref2$mask = _ref2.mask,
86
+ mask = _ref2$mask === void 0 ? false : _ref2$mask,
87
+ _ref2$maskInside = _ref2.maskInside,
88
+ maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
89
+
90
+ var source = this.layer.getSource();
91
+ var createTexture2D = this.rendererService.createTexture2D;
92
+ this.texture = createTexture2D({
93
+ height: 0,
94
+ width: 0
95
+ });
96
+ source.data.images.then(function (imageData) {
97
+ _this.texture = createTexture2D({
98
+ data: imageData[0],
99
+ width: imageData[0].width,
100
+ height: imageData[0].height
101
+ });
102
+
103
+ _this.layerService.reRender();
104
+ });
105
+ this.layer.buildLayerModel({
106
+ moduleName: 'RasterTileDataImage',
107
+ vertexShader: ImageVert,
108
+ fragmentShader: ImageFrag,
109
+ triangulation: RasterImageTriangulation,
110
+ primitive: gl.TRIANGLES,
111
+ depth: {
112
+ enable: false
113
+ },
114
+ blend: this.getBlend(),
115
+ stencil: getMask(mask, maskInside),
116
+ pick: false
117
+ }).then(function (model) {
118
+ callbackModel([model]);
119
+ }).catch(function (err) {
120
+ console.warn(err);
121
+ callbackModel([]);
122
+ });
123
+ }
124
+ }, {
125
+ key: "clearModels",
126
+ value: function clearModels() {
127
+ var _this$texture;
128
+
129
+ (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
130
+ }
131
+ }, {
132
+ key: "buildModels",
133
+ value: function buildModels(callbackModel) {
134
+ this.initModels(callbackModel);
135
+ }
136
+ }, {
137
+ key: "getConfigSchema",
138
+ value: function getConfigSchema() {
139
+ return {
140
+ properties: {
141
+ opacity: {
142
+ type: 'number',
143
+ minimum: 0,
144
+ maximum: 1
145
+ }
146
+ }
147
+ };
148
+ }
149
+ }, {
150
+ key: "registerBuiltinAttributes",
151
+ value: function registerBuiltinAttributes() {
152
+ this.styleAttributeService.registerStyleAttribute({
153
+ name: 'uv',
154
+ type: AttributeType.Attribute,
155
+ descriptor: {
156
+ name: 'a_Uv',
157
+ buffer: {
158
+ usage: gl.DYNAMIC_DRAW,
159
+ data: [],
160
+ type: gl.FLOAT
161
+ },
162
+ size: 2,
163
+ update: function update(feature, featureIdx, vertex) {
164
+ return [vertex[3], vertex[4]];
165
+ }
166
+ }
167
+ });
168
+ }
169
+ }]);
170
+
171
+ return ImageDataModel;
172
+ }(BaseModel);
173
+
174
+ export { ImageDataModel as default };
@@ -23,13 +23,13 @@ var arc_dash_frag = "\nuniform float u_opacity;\n\nvarying vec4 v_dash_array;\nv
23
23
  var arc_dash_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nvarying vec4 v_color;\n\n\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\n\nuniform float u_thetaOffset: 0.314;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // dataset \u6570\u636E\u96C6\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke -> thetaOffset... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n\n styleMappingMat[3].b = segmentIndex / segmentNumber;\n\n // styleMappingMat[0][1] - arcThetaOffset\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n gl_PointSize = 5.0;\n setPickingColor(a_PickingColor);\n}\n"; // arc normal line
24
24
 
25
25
  /* babel-plugin-inline-import '../shaders/line_arc_frag.glsl' */
26
- var arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n float d_distance_ratio = styleMappingMat[3].b; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u6BD4\u4F8B\n\n gl_FragColor = v_color;\n \n gl_FragColor.a *= opacity;\n\n if(u_aimate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = styleMappingMat[3].g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_aimate.x == Animate) {\n time = u_time / u_aimate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = styleMappingMat[3].a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_aimate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_aimate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\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 } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n // gl_FragColor = filterColor(gl_FragColor);\n}";
26
+ var arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n float d_distance_ratio = styleMappingMat[3].b; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u6BD4\u4F8B\n\n gl_FragColor = v_color;\n \n gl_FragColor.a *= opacity;\n\n if(u_animate.x == Animate && u_line_texture != LineTexture) {\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) + u_time / u_animate.y);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = styleMappingMat[3].g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_animate.x == Animate) {\n time = u_time / u_animate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = styleMappingMat[3].a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_animate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_animate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\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 } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}";
27
27
 
28
28
  /* babel-plugin-inline-import '../shaders/line_arc_vert.glsl' */
29
- var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n // return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // dataset \u6570\u636E\u96C6\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke -> thetaOffset... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n \n if(u_aimate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n styleMappingMat[3].b = d_distance_ratio;\n\n // styleMappingMat[0][1] - arcThetaOffset\n float arcThetaOffset = styleMappingMat[0][1];\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, arcThetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, arcThetaOffset), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n styleMappingMat[3].r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n arcDistrance *= 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n // arcDistrance *= 8.0;\n arcDistrance = project_pixel_allmap(arcDistrance);\n }\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel_texture(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n styleMappingMat[3].g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n"; // arc linear line
29
+ var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n // return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // dataset \u6570\u636E\u96C6\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke -> thetaOffset... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n \n if(u_animate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n styleMappingMat[3].b = d_distance_ratio;\n\n // styleMappingMat[0][1] - arcThetaOffset\n float arcThetaOffset = styleMappingMat[0][1];\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, arcThetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, arcThetaOffset), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n styleMappingMat[3].r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n arcDistrance *= 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n // arcDistrance *= 8.0;\n arcDistrance = project_pixel_allmap(arcDistrance);\n }\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel_texture(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n styleMappingMat[3].g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n"; // arc linear line
30
30
 
31
31
  /* babel-plugin-inline-import '../shaders/linear/arc_linear_frag.glsl' */
32
- var arc_linear_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}";
32
+ var arc_linear_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}";
33
33
 
34
34
  /* babel-plugin-inline-import '../shaders/linear/arc_linear_vert.glsl' */
35
35
  var arc_linear_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\nuniform float u_thetaOffset: 0.314;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // dataset \u6570\u636E\u96C6\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke -> thetaOffset... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n\n styleMappingMat[3].b = d_distance_ratio;\n\n // styleMappingMat[0][1] - arcThetaOffset\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, styleMappingMat[0][1]), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n styleMappingMat[3].r = d_segmentIndex;\n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
@@ -192,7 +192,7 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
192
192
  animateOption = _ref2.animateOption;
193
193
 
194
194
  return {
195
- u_aimate: this.animateOption2Array(animateOption),
195
+ u_animate: this.animateOption2Array(animateOption),
196
196
  u_time: this.layer.getLayerAnimateTime()
197
197
  };
198
198
  }
@@ -283,7 +283,6 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
283
283
  value: function registerBuiltinAttributes() {
284
284
  var _this2 = this;
285
285
 
286
- // point layer size;
287
286
  this.styleAttributeService.registerStyleAttribute({
288
287
  name: 'size',
289
288
  type: AttributeType.Attribute,
@@ -296,7 +295,7 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
296
295
  type: gl.FLOAT
297
296
  },
298
297
  size: 1,
299
- update: function update(feature, featureIdx, vertex, attributeIdx) {
298
+ update: function update(feature) {
300
299
  var _feature$size = feature.size,
301
300
  size = _feature$size === void 0 ? 1 : _feature$size;
302
301
  return Array.isArray(size) ? [size[0]] : [size];
@@ -315,7 +314,7 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
315
314
  type: gl.FLOAT
316
315
  },
317
316
  size: 4,
318
- update: function update(feature, featureIdx, vertex, attributeIdx) {
317
+ update: function update(feature, featureIdx, vertex) {
319
318
  return [vertex[3], vertex[4], vertex[5], vertex[6]];
320
319
  }
321
320
  }
@@ -332,7 +331,7 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
332
331
  type: gl.FLOAT
333
332
  },
334
333
  size: 2,
335
- update: function update(feature, featureIdx, vertex, attributeIdx) {
334
+ update: function update(feature) {
336
335
  var iconMap = _this2.iconService.getIconMap();
337
336
 
338
337
  var texture = feature.texture;