@antv/l7-layers 2.9.23 → 2.9.25

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 (166) hide show
  1. package/es/Geometry/models/plane.d.ts +1 -0
  2. package/es/citybuliding/building.js +1 -1
  3. package/es/core/BaseLayer.js +10 -3
  4. package/es/core/interface.d.ts +26 -48
  5. package/es/core/interface.js +3 -0
  6. package/es/core/schema.d.ts +3 -3
  7. package/es/core/triangulation.d.ts +4 -3
  8. package/es/core/triangulation.js +54 -39
  9. package/es/heatmap/models/heatmap.js +1 -1
  10. package/es/image/models/image.js +7 -1
  11. package/es/line/index.js +4 -1
  12. package/es/line/models/arc.js +1 -1
  13. package/es/line/models/simpleLine.js +1 -1
  14. package/es/line/shaders/line_arc_vert.glsl +5 -3
  15. package/es/line/shaders/simple/simpleline_vert.glsl +1 -0
  16. package/es/plugins/FeatureScalePlugin.js +0 -1
  17. package/es/point/index.js +3 -1
  18. package/es/point/models/fill.js +5 -2
  19. package/es/point/models/fillmage.js +9 -3
  20. package/es/point/models/image.js +8 -2
  21. package/es/point/models/radar.js +2 -3
  22. package/es/point/models/tile.js +1 -1
  23. package/es/point/shaders/fill_vert.glsl +13 -6
  24. package/es/point/shaders/image/fillImage_vert.glsl +13 -5
  25. package/es/point/shaders/image_vert.glsl +17 -8
  26. package/es/polygon/index.js +4 -1
  27. package/es/raster/index.js +3 -1
  28. package/es/tile/manager/tileLayerManager.d.ts +3 -2
  29. package/es/tile/manager/tileLayerManager.js +5 -2
  30. package/es/tile/models/tileModel.js +4 -3
  31. package/es/tile/tileFactory/base.d.ts +1 -1
  32. package/es/tile/tileFactory/base.js +32 -5
  33. package/es/tile/tileFactory/vectorLayer.d.ts +3 -1
  34. package/es/tile/tileFactory/vectorLayer.js +22 -1
  35. package/es/tile/tileLayer/baseTileLayer.d.ts +1 -1
  36. package/es/tile/tileLayer/baseTileLayer.js +3 -2
  37. package/es/tile/utils.d.ts +2 -0
  38. package/es/tile/utils.js +5 -1
  39. package/lib/Geometry/index.js +114 -77
  40. package/lib/Geometry/models/billboard.js +232 -181
  41. package/lib/Geometry/models/index.js +18 -34
  42. package/lib/Geometry/models/plane.js +407 -278
  43. package/lib/Geometry/models/sprite.js +291 -189
  44. package/lib/canvas/index.js +101 -66
  45. package/lib/canvas/models/canvas.js +207 -140
  46. package/lib/canvas/models/index.js +12 -30
  47. package/lib/citybuliding/building.js +98 -63
  48. package/lib/citybuliding/models/build.js +192 -146
  49. package/lib/core/BaseLayer.js +1331 -809
  50. package/lib/core/BaseModel.js +457 -279
  51. package/lib/core/interface.js +40 -53
  52. package/lib/core/schema.js +21 -39
  53. package/lib/core/shape/Path.js +67 -79
  54. package/lib/core/shape/extrude.js +132 -91
  55. package/lib/core/triangulation.js +412 -213
  56. package/lib/earth/index.js +100 -62
  57. package/lib/earth/models/atmosphere.js +146 -112
  58. package/lib/earth/models/base.js +210 -150
  59. package/lib/earth/models/bloomsphere.js +146 -112
  60. package/lib/earth/utils.js +111 -91
  61. package/lib/heatmap/index.js +149 -92
  62. package/lib/heatmap/models/grid.js +118 -91
  63. package/lib/heatmap/models/grid3d.js +155 -123
  64. package/lib/heatmap/models/heatmap.js +475 -338
  65. package/lib/heatmap/models/hexagon.js +121 -92
  66. package/lib/heatmap/models/index.js +22 -37
  67. package/lib/heatmap/triangulation.js +31 -47
  68. package/lib/image/index.js +111 -74
  69. package/lib/image/models/dataImage.js +232 -174
  70. package/lib/image/models/image.js +175 -123
  71. package/lib/image/models/index.js +15 -32
  72. package/lib/index.js +263 -97
  73. package/lib/line/index.js +131 -83
  74. package/lib/line/models/arc.js +352 -237
  75. package/lib/line/models/arc_3d.js +334 -228
  76. package/lib/line/models/earthArc_3d.js +336 -228
  77. package/lib/line/models/great_circle.js +291 -200
  78. package/lib/line/models/half.js +286 -201
  79. package/lib/line/models/index.js +42 -50
  80. package/lib/line/models/line.js +428 -299
  81. package/lib/line/models/linearline.js +277 -203
  82. package/lib/line/models/simpleLine.js +239 -175
  83. package/lib/line/models/tile.js +348 -237
  84. package/lib/line/models/wall.js +327 -235
  85. package/lib/line/shaders/line_arc_vert.glsl +5 -3
  86. package/lib/line/shaders/simple/simpleline_vert.glsl +1 -0
  87. package/lib/mask/index.js +92 -59
  88. package/lib/mask/models/fill.js +134 -82
  89. package/lib/mask/models/index.js +12 -30
  90. package/lib/plugins/DataMappingPlugin.js +342 -224
  91. package/lib/plugins/DataSourcePlugin.js +102 -87
  92. package/lib/plugins/FeatureScalePlugin.js +330 -241
  93. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  94. package/lib/plugins/LayerModelPlugin.js +80 -73
  95. package/lib/plugins/LayerStylePlugin.js +48 -51
  96. package/lib/plugins/LightingPlugin.js +80 -68
  97. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  98. package/lib/plugins/PixelPickingPlugin.js +150 -109
  99. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  100. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  101. package/lib/plugins/UpdateModelPlugin.js +40 -47
  102. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  103. package/lib/point/index.js +226 -148
  104. package/lib/point/models/earthExtrude.js +279 -201
  105. package/lib/point/models/earthFill.js +287 -202
  106. package/lib/point/models/extrude.js +299 -203
  107. package/lib/point/models/fill.js +406 -273
  108. package/lib/point/models/fillmage.js +365 -252
  109. package/lib/point/models/image.js +241 -164
  110. package/lib/point/models/index.js +46 -52
  111. package/lib/point/models/normal.js +183 -134
  112. package/lib/point/models/radar.js +304 -212
  113. package/lib/point/models/simplePoint.js +194 -142
  114. package/lib/point/models/text.js +608 -385
  115. package/lib/point/models/tile.js +314 -223
  116. package/lib/point/shaders/fill_vert.glsl +13 -6
  117. package/lib/point/shaders/image/fillImage_vert.glsl +13 -5
  118. package/lib/point/shaders/image_vert.glsl +17 -8
  119. package/lib/point/shape/extrude.js +56 -52
  120. package/lib/polygon/index.js +154 -100
  121. package/lib/polygon/models/extrude.js +311 -223
  122. package/lib/polygon/models/fill.js +215 -153
  123. package/lib/polygon/models/index.js +46 -52
  124. package/lib/polygon/models/ocean.js +244 -173
  125. package/lib/polygon/models/tile.js +144 -100
  126. package/lib/polygon/models/water.js +222 -153
  127. package/lib/raster/buffers/triangulation.js +27 -40
  128. package/lib/raster/index.js +115 -74
  129. package/lib/raster/models/index.js +16 -33
  130. package/lib/raster/models/raster.js +178 -135
  131. package/lib/raster/raster.js +187 -132
  132. package/lib/tile/interface.js +4 -16
  133. package/lib/tile/manager/tileConfigManager.js +125 -86
  134. package/lib/tile/manager/tileLayerManager.js +314 -227
  135. package/lib/tile/manager/tilePickerManager.js +192 -123
  136. package/lib/tile/models/tileModel.js +71 -51
  137. package/lib/tile/tileFactory/base.js +433 -292
  138. package/lib/tile/tileFactory/index.js +51 -49
  139. package/lib/tile/tileFactory/line.js +65 -50
  140. package/lib/tile/tileFactory/point.js +65 -50
  141. package/lib/tile/tileFactory/polygon.js +65 -50
  142. package/lib/tile/tileFactory/raster.js +66 -54
  143. package/lib/tile/tileFactory/rasterData.js +88 -76
  144. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  145. package/lib/tile/tileFactory/vectorLayer.js +169 -95
  146. package/lib/tile/tileLayer/baseTileLayer.js +420 -220
  147. package/lib/tile/tmsTileLayer.js +110 -67
  148. package/lib/tile/utils.js +113 -87
  149. package/lib/utils/blend.js +59 -79
  150. package/lib/utils/collision-index.js +107 -64
  151. package/lib/utils/dataMappingStyle.js +105 -60
  152. package/lib/utils/extrude_polyline.js +600 -398
  153. package/lib/utils/grid-index.js +163 -111
  154. package/lib/utils/layerData.js +130 -99
  155. package/lib/utils/multiPassRender.js +49 -41
  156. package/lib/utils/polylineNormal.js +148 -96
  157. package/lib/utils/simpleLine.js +100 -85
  158. package/lib/utils/symbol-layout.js +219 -116
  159. package/lib/utils/updateShape.js +15 -41
  160. package/lib/wind/index.js +109 -71
  161. package/lib/wind/models/index.js +12 -30
  162. package/lib/wind/models/utils.js +144 -105
  163. package/lib/wind/models/wind.js +333 -224
  164. package/lib/wind/models/windRender.js +329 -218
  165. package/lib/wind/models/windShader.js +23 -181
  166. package/package.json +7 -6
@@ -27,7 +27,7 @@ var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat;
27
27
  var pointFillFrag = "uniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
28
28
 
29
29
  /* babel-plugin-inline-import '../shaders/fill_vert.glsl' */
30
- var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\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\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_meter2coord;\nuniform float u_meteryScale;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\nuniform float u_raisingHeight: 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size) * u_meter2coord;\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\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\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 ... \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 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n if(newSize * pow(2.0, u_Zoom) < 48.0) {\n antialiasblur = max(antialiasblur, -0.05);\n } else if(newSize * pow(2.0, u_Zoom) < 128.0) {\n antialiasblur = max(antialiasblur, -0.6/pow(u_Zoom, 2.0));\n } else {\n antialiasblur = max(antialiasblur, -0.8/pow(u_Zoom, 2.0));\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.x += offset.x / u_meteryScale;\n aPosition.y += offset.y;\n offset = vec2(0.0);\n }\n }\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raiseHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, u_raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
30
+ var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\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\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_meter2coord;\nuniform float u_meteryScale;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size) * u_meter2coord;\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\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\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 ... \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 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n if(newSize * pow(2.0, u_Zoom) < 48.0) {\n antialiasblur = max(antialiasblur, -0.05);\n } else if(newSize * pow(2.0, u_Zoom) < 128.0) {\n antialiasblur = max(antialiasblur, -0.6/pow(u_Zoom, 2.0));\n } else {\n antialiasblur = max(antialiasblur, -0.8/pow(u_Zoom, 2.0));\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.x += offset.x / u_meteryScale;\n aPosition.y += offset.y;\n offset = vec2(0.0);\n }\n }\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raisingHeight = u_raisingHeight;\n\n if(u_heightfixed < 1.0) { // false\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n \n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
31
31
  import { Version } from '@antv/l7-maps';
32
32
 
33
33
  var FillModel = /*#__PURE__*/function (_BaseModel) {
@@ -76,6 +76,8 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
76
76
  blur = _ref$blur === void 0 ? 0 : _ref$blur,
77
77
  _ref$raisingHeight = _ref.raisingHeight,
78
78
  raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
79
+ _ref$heightfixed = _ref.heightfixed,
80
+ heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
79
81
  _ref$unit = _ref.unit,
80
82
  unit = _ref$unit === void 0 ? 'l7size' : _ref$unit;
81
83
 
@@ -124,6 +126,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
124
126
 
125
127
  return {
126
128
  u_raisingHeight: Number(raisingHeight),
129
+ u_heightfixed: Number(heightfixed),
127
130
  u_meter2coord: this.meter2coord,
128
131
  u_meteryScale: this.meteryScale,
129
132
  u_isMeter: Number(this.isMeter),
@@ -203,7 +206,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
203
206
  var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
204
207
  this.meter2coord = (m1 + m2) / 2;
205
208
 
206
- if (!Boolean(this.meter2coord)) {
209
+ if (!this.meter2coord) {
207
210
  // Tip: 兼容单个数据导致的 m1、m2 为 NaN
208
211
  this.meter2coord = 7.70681090738883;
209
212
  }
@@ -22,7 +22,7 @@ import { PointFillTriangulation } from "../../core/triangulation"; // static poi
22
22
  var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv;\n\nvoid main() {\n\n float opacity = styleMappingMat[0][0];\n\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n gl_FragColor = texture2D(u_texture, pos);\n gl_FragColor.a *= opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
23
23
 
24
24
  /* babel-plugin-inline-import '../shaders/image/fillImage_vert.glsl' */
25
- var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\n\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\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\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 - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\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 ... \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 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
25
+ var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\n\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\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\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 - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\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 ... \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 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // height fixed\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
26
26
 
27
27
  var FillImageModel = /*#__PURE__*/function (_BaseModel) {
28
28
  _inherits(FillImageModel, _BaseModel);
@@ -87,7 +87,11 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
87
87
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
88
88
  _ref$offsets = _ref.offsets,
89
89
  offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
90
- rotation = _ref.rotation;
90
+ rotation = _ref.rotation,
91
+ _ref$raisingHeight = _ref.raisingHeight,
92
+ raisingHeight = _ref$raisingHeight === void 0 ? 0.0 : _ref$raisingHeight,
93
+ _ref$heightfixed = _ref.heightfixed,
94
+ heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed;
91
95
 
92
96
  if (this.rendererService.getDirty()) {
93
97
  this.texture.bind();
@@ -146,6 +150,8 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
146
150
  }
147
151
 
148
152
  return {
153
+ u_raisingHeight: Number(raisingHeight),
154
+ u_heightfixed: Number(heightfixed),
149
155
  u_isMeter: Number(this.isMeter),
150
156
  u_RotateMatrix: new Float32Array([Math.cos(this.radian), Math.sin(this.radian), -Math.sin(this.radian), Math.cos(this.radian)]),
151
157
  u_dataTexture: this.dataTexture,
@@ -217,7 +223,7 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
217
223
  var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
218
224
  this.meter2coord = (m1 + m2) / 2;
219
225
 
220
- if (!Boolean(this.meter2coord)) {
226
+ if (!this.meter2coord) {
221
227
  // Tip: 兼容单个数据导致的 m1、m2 为 NaN
222
228
  this.meter2coord = 7.70681090738883;
223
229
  }
@@ -20,7 +20,7 @@ import { PointImageTriangulation } from "../../core/triangulation";
20
20
  var pointImageFrag = "\nuniform sampler2D u_texture;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform vec2 u_textSize;\nuniform float u_opacity : 1;\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 size = styleMappingMat[1][0];\n vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;\n vec4 textureColor;\n\n // Y = 0.299R + 0.587G + 0.114B // \u4EAE\u5EA6\u63D0\u53D6\n \n textureColor = texture2D(u_texture, pos);\n\n // Tip: \u53BB\u9664\u8FB9\u7F18\u90E8\u5206 mipmap \u5BFC\u81F4\u7684\u6DF7\u5408\u53D8\u6697\n float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);\n if(fragmengTocenter >= 0.5) {\n float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;\n textureColor.a *= luma;\n }\n \n \n\n if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){\n gl_FragColor= textureColor;\n }else {\n gl_FragColor= step(0.01, textureColor.z) * v_color;\n }\n\n gl_FragColor.a = gl_FragColor.a * opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
21
21
 
22
22
  /* babel-plugin-inline-import '../shaders/image_vert.glsl' */
23
- var pointImageVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec4 a_Color;\nattribute vec2 a_Uv;\nattribute float a_Size;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec2 u_offsets;\n\nuniform float u_opacity : 1;\n\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\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\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\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 ... \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 styleMappingMat[1][0] = a_Size;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n v_color = a_Color;\n v_uv = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n // vec2 offset = project_pixel(u_offsets);\n vec2 offset = project_pixel(textrueOffsets);\n\n // gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0));\n }\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n\n setPickingColor(a_PickingColor);\n}\n";
23
+ var pointImageVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec4 a_Color;\nattribute vec2 a_Uv;\nattribute float a_Size;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec2 u_offsets;\n\nuniform float u_opacity : 1;\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\n\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\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\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\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 ... \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 styleMappingMat[1][0] = a_Size;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n v_color = a_Color;\n v_uv = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n vec2 offset = project_pixel(textrueOffsets);\n\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // false\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
24
24
 
25
25
  var ImageModel = /*#__PURE__*/function (_BaseModel) {
26
26
  _inherits(ImageModel, _BaseModel);
@@ -76,7 +76,11 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
76
76
  _ref$opacity = _ref.opacity,
77
77
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
78
78
  _ref$offsets = _ref.offsets,
79
- offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets;
79
+ offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
80
+ _ref$raisingHeight = _ref.raisingHeight,
81
+ raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
82
+ _ref$heightfixed = _ref.heightfixed,
83
+ heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed;
80
84
 
81
85
  if (this.rendererService.getDirty()) {
82
86
  this.texture.bind();
@@ -117,6 +121,8 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
117
121
  }
118
122
 
119
123
  return {
124
+ u_raisingHeight: Number(raisingHeight),
125
+ u_heightfixed: Number(heightfixed),
120
126
  u_dataTexture: this.dataTexture,
121
127
  // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
122
128
  u_cellTypeLayout: this.getCellTypeLayout(),
@@ -176,7 +176,7 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
176
176
  var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
177
177
  this.meter2coord = (m1 + m2) / 2;
178
178
 
179
- if (!Boolean(this.meter2coord)) {
179
+ if (!this.meter2coord) {
180
180
  // Tip: 兼容单个数据导致的 m1、m2 为 NaN
181
181
  this.meter2coord = 7.70681090738883;
182
182
  }
@@ -238,8 +238,7 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
238
238
  },
239
239
  size: 3,
240
240
  update: function update(feature, featureIdx, vertex, attributeIdx) {
241
- var extrude;
242
- extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
241
+ var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
243
242
  var extrudeIndex = attributeIdx % 4 * 3;
244
243
  return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
245
244
  }
@@ -181,7 +181,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
181
181
  var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
182
182
  this.meter2coord = (m1 + m2) / 2;
183
183
 
184
- if (!Boolean(this.meter2coord)) {
184
+ if (!this.meter2coord) {
185
185
  // Tip: 兼容单个数据导致的 m1、m2 为 NaN
186
186
  this.meter2coord = 7.70681090738883;
187
187
  }
@@ -24,6 +24,7 @@ uniform vec2 u_offsets;
24
24
 
25
25
  uniform float u_blur : 0.0;
26
26
  uniform float u_raisingHeight: 0.0;
27
+ uniform float u_heightfixed: 0.0;
27
28
 
28
29
  #pragma include "styleMapping"
29
30
  #pragma include "styleMappingCalOpacity"
@@ -164,16 +165,22 @@ void main() {
164
165
  vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));
165
166
  // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
166
167
 
167
- float raiseHeight = u_raisingHeight;
168
- if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
169
- float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
170
- raiseHeight = u_raisingHeight * mapboxZoomScale;
168
+ float raisingHeight = u_raisingHeight;
169
+
170
+ if(u_heightfixed < 1.0) { // false
171
+ raisingHeight = project_pixel(u_raisingHeight);
172
+ } else {
173
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
174
+ float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
175
+ raisingHeight = u_raisingHeight * mapboxZoomScale;
176
+ }
171
177
  }
178
+
172
179
 
173
180
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
174
- gl_Position = u_Mvp * vec4(project_pos.xy + offset, raiseHeight, 1.0);
181
+ gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);
175
182
  } else {
176
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, u_raisingHeight, 1.0));
183
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
177
184
  }
178
185
 
179
186
  // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
@@ -15,6 +15,8 @@ uniform float u_isMeter;
15
15
  varying vec2 v_uv; // 本身的 uv 坐标
16
16
  varying vec2 v_Iconuv; // icon 贴图的 uv 坐标
17
17
 
18
+ uniform float u_raisingHeight: 0.0;
19
+ uniform float u_heightfixed: 0.0;
18
20
  uniform float u_opacity : 1;
19
21
  uniform vec2 u_offsets;
20
22
 
@@ -91,15 +93,21 @@ void main() {
91
93
  }
92
94
  }
93
95
 
94
-
95
- // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));
96
96
  vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));
97
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
97
+ float raisingHeight = u_raisingHeight;
98
+ if(u_heightfixed < 1.0) { // height fixed
99
+ raisingHeight = project_pixel(u_raisingHeight);
100
+ } else {
101
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
102
+ float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
103
+ raisingHeight = u_raisingHeight * mapboxZoomScale;
104
+ }
105
+ }
98
106
 
99
107
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
100
- gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);
108
+ gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);
101
109
  } else {
102
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
110
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
103
111
  }
104
112
 
105
113
  // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
@@ -10,6 +10,8 @@ uniform mat4 u_Mvp;
10
10
  uniform vec2 u_offsets;
11
11
 
12
12
  uniform float u_opacity : 1;
13
+ uniform float u_raisingHeight: 0.0;
14
+ uniform float u_heightfixed: 0.0;
13
15
 
14
16
  varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
15
17
 
@@ -61,21 +63,28 @@ void main() {
61
63
  }
62
64
 
63
65
  // cal style mapping - 数据纹理映射部分的计算
64
- v_color = a_Color;
65
- v_uv = a_Uv;
66
- vec4 project_pos = project_position(vec4(a_Position, 1.0));
66
+ v_color = a_Color;
67
+ v_uv = a_Uv;
68
+ vec4 project_pos = project_position(vec4(a_Position, 1.0));
67
69
 
68
- // vec2 offset = project_pixel(u_offsets);
69
70
  vec2 offset = project_pixel(textrueOffsets);
70
71
 
71
- // gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0));
72
+ float raisingHeight = u_raisingHeight;
73
+ if(u_heightfixed < 1.0) { // false
74
+ raisingHeight = project_pixel(u_raisingHeight);
75
+ } else {
76
+ if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
77
+ float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
78
+ raisingHeight = u_raisingHeight * mapboxZoomScale;
79
+ }
80
+ }
72
81
 
73
82
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
74
- gl_Position = u_Mvp * vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0);
83
+ gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);
75
84
  } else {
76
- gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy + offset),project_pos.z, 1.0));
85
+ gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
77
86
  }
78
- gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
79
87
 
88
+ gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
80
89
  setPickingColor(a_PickingColor);
81
90
  }
@@ -12,6 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  import BaseLayer from "../core/BaseLayer";
14
14
  import PolygonModels from "./models/";
15
+ import { isVectorTile } from "../tile/utils";
15
16
 
16
17
  var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
17
18
  _inherits(PolygonLayer, _BaseLayer);
@@ -74,7 +75,9 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
74
75
  value: function getModelType() {
75
76
  var _shapeAttribute$scale;
76
77
 
77
- if (this.layerSource.parser.type === 'mvt') {
78
+ var parserType = this.layerSource.getParserType();
79
+
80
+ if (isVectorTile(parserType)) {
78
81
  return 'vectorpolygon';
79
82
  }
80
83
 
@@ -84,7 +84,9 @@ var RaterLayer = /*#__PURE__*/function (_BaseLayer) {
84
84
  key: "getModelType",
85
85
  value: function getModelType() {
86
86
  // 根据 source 的类型判断 model type
87
- switch (this.layerSource.parser.type) {
87
+ var parserType = this.layerSource.getParserType();
88
+
89
+ switch (parserType) {
88
90
  case 'raster':
89
91
  return 'raster';
90
92
 
@@ -1,4 +1,4 @@
1
- import { IInteractionTarget, ILayer, ILayerService, IMapService, IPickingService, IRendererService, ITileLayerManager, ITilePickManager } from '@antv/l7-core';
1
+ import { IInteractionTarget, ILayer, ILayerService, IMapService, IPickingService, IRendererService, ITileLayerManager, ITilePickManager, ITransform } from '@antv/l7-core';
2
2
  import { Tile } from '@antv/l7-utils';
3
3
  import { ITileConfigManager } from './tileConfigManager';
4
4
  export declare class TileLayerManager implements ITileLayerManager {
@@ -12,7 +12,8 @@ export declare class TileLayerManager implements ITileLayerManager {
12
12
  private tileFactory;
13
13
  private initOptions;
14
14
  private rampColorsData;
15
- constructor(parent: ILayer, mapService: IMapService, rendererService: IRendererService, pickingService: IPickingService, layerService: ILayerService);
15
+ private transforms;
16
+ constructor(parent: ILayer, mapService: IMapService, rendererService: IRendererService, pickingService: IPickingService, layerService: ILayerService, transforms: ITransform[]);
16
17
  createTile(tile: Tile): {
17
18
  layers: ILayer[];
18
19
  layerIDList: string[];
@@ -8,13 +8,14 @@ import { getLayerShape, getMaskValue } from "../utils";
8
8
  import TileConfigManager from "./tileConfigManager";
9
9
  import TilePickManager from "./tilePickerManager";
10
10
  export var TileLayerManager = /*#__PURE__*/function () {
11
- function TileLayerManager(parent, mapService, rendererService, pickingService, layerService) {
11
+ function TileLayerManager(parent, mapService, rendererService, pickingService, layerService, transforms) {
12
12
  _classCallCheck(this, TileLayerManager);
13
13
 
14
14
  this.parent = parent;
15
15
  this.children = parent.layerChildren;
16
16
  this.mapService = mapService;
17
17
  this.rendererService = rendererService;
18
+ this.transforms = transforms;
18
19
  this.tilePickManager = new TilePickManager(parent, rendererService, pickingService, this.children, layerService);
19
20
  this.tileConfigManager = new TileConfigManager();
20
21
  this.setSubLayerInitOptipn();
@@ -172,6 +173,7 @@ export var TileLayerManager = /*#__PURE__*/function () {
172
173
  var _ref2 = (source === null || source === void 0 ? void 0 : (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.tilesetOptions) || {},
173
174
  coords = _ref2.coords;
174
175
 
176
+ var parentParserType = source.getParserType();
175
177
  var layerShape = getLayerShape(this.parent.type, this.parent);
176
178
 
177
179
  if (rampColors) {
@@ -181,10 +183,11 @@ export var TileLayerManager = /*#__PURE__*/function () {
181
183
 
182
184
  this.initOptions = {
183
185
  layerType: this.parent.type,
186
+ transforms: this.transforms,
184
187
  shape: layerShape,
185
188
  zIndex: zIndex,
186
189
  opacity: opacity,
187
- sourceLayer: sourceLayer,
190
+ sourceLayer: parentParserType === 'geojsonvt' ? 'geojsonvt' : sourceLayer,
188
191
  coords: coords,
189
192
  featureId: featureId,
190
193
  color: colorValue,
@@ -30,15 +30,16 @@ var RasterTileModel = /*#__PURE__*/function (_BaseModel) {
30
30
  }, {
31
31
  key: "initModels",
32
32
  value: function initModels() {
33
- var _this$layer$getSource;
33
+ var source = this.layer.getSource();
34
34
 
35
- if ((_this$layer$getSource = this.layer.getSource()) !== null && _this$layer$getSource !== void 0 && _this$layer$getSource.data.isTile) {
35
+ if (source !== null && source !== void 0 && source.data.isTile) {
36
36
  this.layer.tileLayer = new TMSTileLayer({
37
37
  parent: this.layer,
38
38
  rendererService: this.rendererService,
39
39
  mapService: this.mapService,
40
40
  layerService: this.layerService,
41
- pickingService: this.pickingService
41
+ pickingService: this.pickingService,
42
+ transforms: source.transforms
42
43
  });
43
44
  }
44
45
 
@@ -32,7 +32,7 @@ export default class TileFactory implements ITileFactory {
32
32
  updateStyle(styles: ITileStyles): string;
33
33
  getDefautStyleAttributeField(layer: ILayer, type: string): string | string[] | 2;
34
34
  setStyleAttributeField(layer: ILayer, type: ScaleAttributeType, value: IScaleValue | undefined | string | string[]): ILayer | undefined;
35
- protected parseScaleValue(value: IScaleValue | string, type: string): (string | number | unknown[])[] | (string | number | string[] | number[] | ((...args: any[]) => [] | undefined))[];
35
+ protected parseScaleValue(value: IScaleValue | string, type: string): (string | number | unknown[])[] | (import("@antv/l7-core").StyleAttributeField | ((...args: any[]) => [] | undefined))[];
36
36
  protected getTile(lng: number, lat: number): Tile;
37
37
  protected emitEvent(layers: ILayer[], isVector?: boolean): void;
38
38
  protected getCombineFeature(features: IParseDataItem[]): any;
@@ -1,5 +1,5 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
@@ -10,6 +10,7 @@ import { getLayerShape, readRasterValue, registerLayers } from "../utils";
10
10
  import VectorLayer from "./vectorLayer";
11
11
  import * as turf from '@turf/helpers';
12
12
  import union from '@turf/union';
13
+ import polygonToLineString from '@turf/polygon-to-line';
13
14
 
14
15
  var TileFactory = /*#__PURE__*/function () {
15
16
  // 用于记录图层内事件,辅助判断图层外事件逻辑
@@ -52,7 +53,10 @@ var TileFactory = /*#__PURE__*/function () {
52
53
  source: null
53
54
  };
54
55
  var sourceLayer = initOptions.sourceLayer,
55
- featureId = initOptions.featureId;
56
+ featureId = initOptions.featureId,
57
+ transforms = initOptions.transforms,
58
+ layerType = initOptions.layerType,
59
+ shape = initOptions.shape;
56
60
 
57
61
  if (!sourceLayer) {
58
62
  return emptyData;
@@ -64,17 +68,40 @@ var TileFactory = /*#__PURE__*/function () {
64
68
  if (!(Array.isArray(features) && features.length > 0)) {
65
69
  return emptyData;
66
70
  } else {
71
+ var geofeatures = [];
72
+
73
+ if (layerType === 'LineLayer' && shape === 'simple') {
74
+ features.map(function (feature) {
75
+ if (feature.geometry.type === 'MultiPolygon') {
76
+ var _geofeatures;
77
+
78
+ // @ts-ignore
79
+ var linefeatures = polygonToLineString(feature).features;
80
+
81
+ (_geofeatures = geofeatures).push.apply(_geofeatures, _toConsumableArray(linefeatures));
82
+ } else if (feature.geometry.type === 'Polygon') {
83
+ feature.geometry.type = 'MultiLineString';
84
+ geofeatures.push(feature);
85
+ } else {
86
+ geofeatures.push(feature);
87
+ }
88
+ });
89
+ } else {
90
+ geofeatures = features;
91
+ }
92
+
67
93
  var source = new Source({
68
94
  type: 'FeatureCollection',
69
- features: features
95
+ features: geofeatures
70
96
  }, {
71
97
  parser: {
72
98
  type: 'geojson',
73
99
  featureId: featureId
74
- }
100
+ },
101
+ transforms: transforms
75
102
  });
76
103
  return {
77
- features: features,
104
+ features: geofeatures,
78
105
  featureId: featureId,
79
106
  vectorTileLayer: vectorTileLayer,
80
107
  source: source
@@ -1,6 +1,7 @@
1
1
  import BaseLayer from '../../core/BaseLayer';
2
2
  import { ILineLayerStyleOptions, IPointLayerStyleOptions, IPolygonLayerStyleOptions } from '../../core/interface';
3
3
  import lineFillModel from '../../line/models/tile';
4
+ import lineSimpleModel from '../../line/models/simpleLine';
4
5
  import pointTextModel from '../../point/models/text';
5
6
  import pointFillModel from '../../point/models/tile';
6
7
  import polygonFillModel from '../../polygon/models/tile';
@@ -12,7 +13,8 @@ export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOpt
12
13
  setPickID(): number | null;
13
14
  buildModels(): void;
14
15
  rebuildModels(): void;
15
- protected getModelType(): typeof lineFillModel | typeof pointTextModel | typeof pointFillModel | typeof polygonFillModel;
16
+ protected getModelType(): typeof lineFillModel | typeof lineSimpleModel | typeof pointTextModel | typeof pointFillModel | typeof polygonFillModel;
17
+ protected getLineModel(): typeof lineFillModel | typeof lineSimpleModel;
16
18
  protected getPointModel(): typeof pointTextModel | typeof pointFillModel;
17
19
  protected getConfigSchema(): {
18
20
  properties: {
@@ -12,6 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  import BaseLayer from "../../core/BaseLayer";
14
14
  import lineFillModel from "../../line/models/tile";
15
+ import lineSimpleModel from "../../line/models/simpleLine";
15
16
  import pointTextModel from "../../point/models/text";
16
17
  import pointFillModel from "../../point/models/tile";
17
18
  import polygonFillModel from "../../polygon/models/tile";
@@ -81,7 +82,7 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
81
82
  return polygonFillModel;
82
83
 
83
84
  case 'LineLayer':
84
- return lineFillModel;
85
+ return this.getLineModel();
85
86
 
86
87
  case 'PointLayer':
87
88
  return this.getPointModel();
@@ -90,6 +91,26 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
90
91
  return pointFillModel;
91
92
  }
92
93
  }
94
+ }, {
95
+ key: "getLineModel",
96
+ value: function getLineModel() {
97
+ var _shapeAttribute$scale;
98
+
99
+ var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
100
+ var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
101
+
102
+ switch (shape) {
103
+ case 'tileline':
104
+ case 'line':
105
+ return lineFillModel;
106
+
107
+ case 'simple':
108
+ return lineSimpleModel;
109
+
110
+ default:
111
+ return lineFillModel;
112
+ }
113
+ }
93
114
  }, {
94
115
  key: "getPointModel",
95
116
  value: function getPointModel() {
@@ -14,7 +14,7 @@ export default class BaseTileLayer implements ITileLayer {
14
14
  private mapService;
15
15
  private layerService;
16
16
  private pickColors;
17
- constructor({ parent, rendererService, mapService, layerService, pickingService, }: ITileLayerOPtions);
17
+ constructor({ parent, rendererService, mapService, layerService, pickingService, transforms }: ITileLayerOPtions);
18
18
  /**
19
19
  * 渲染瓦片的图层
20
20
  */
@@ -14,7 +14,8 @@ var BaseTileLayer = /*#__PURE__*/function () {
14
14
  rendererService = _ref.rendererService,
15
15
  mapService = _ref.mapService,
16
16
  layerService = _ref.layerService,
17
- pickingService = _ref.pickingService;
17
+ pickingService = _ref.pickingService,
18
+ transforms = _ref.transforms;
18
19
 
19
20
  _classCallCheck(this, BaseTileLayer);
20
21
 
@@ -38,7 +39,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
38
39
  this.parent = parent;
39
40
  this.mapService = mapService;
40
41
  this.layerService = layerService;
41
- this.tileLayerManager = new TileLayerManager(parent, mapService, rendererService, pickingService, layerService);
42
+ this.tileLayerManager = new TileLayerManager(parent, mapService, rendererService, pickingService, layerService, transforms);
42
43
  this.initTileSetManager();
43
44
  this.bindSubLayerEvent();
44
45
  this.bindSubLayerPick();
@@ -1,5 +1,7 @@
1
1
  import { ILayer, IMapService, IRendererService } from '@antv/l7-core';
2
2
  import { Tile } from '@antv/l7-utils';
3
+ export declare const tileVectorParser: string[];
4
+ export declare function isVectorTile(parserType: string): boolean;
3
5
  export declare function registerLayers(parentLayer: ILayer, layers: ILayer[]): void;
4
6
  export declare function getLayerShape(layerType: string, layer: ILayer): string | string[];
5
7
  export declare function getMaskValue(layerType: string, mask: boolean): boolean;