@antv/l7-layers 2.9.27-alpha.1 → 2.9.27-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.d.ts +13 -0
- package/es/Geometry/index.js +20 -2
- package/es/Geometry/models/billboard.js +1 -2
- package/es/Geometry/models/plane.js +2 -4
- package/es/Geometry/models/sprite.js +2 -4
- package/es/canvas/index.d.ts +4 -0
- package/es/canvas/index.js +38 -2
- package/es/citybuliding/building.js +6 -2
- package/es/citybuliding/models/build.js +2 -3
- package/es/core/BaseLayer.d.ts +17 -6
- package/es/core/BaseLayer.js +89 -94
- package/es/core/BaseModel.d.ts +1 -1
- package/es/core/BaseModel.js +7 -3
- package/es/core/interface.d.ts +18 -0
- package/es/core/triangulation.d.ts +6 -0
- package/es/core/triangulation.js +64 -2
- package/es/earth/index.d.ts +5 -0
- package/es/earth/index.js +12 -1
- package/es/earth/models/base.js +2 -4
- package/es/earth/shaders/atmosphere_frag.glsl +1 -1
- package/es/earth/shaders/bloomsphere_frag.glsl +1 -1
- package/es/heatmap/index.js +6 -2
- package/es/heatmap/models/heatmap.js +5 -3
- package/es/image/index.js +6 -2
- package/es/image/models/dataImage.js +4 -7
- package/es/image/models/image.js +4 -7
- package/es/line/index.d.ts +1 -0
- package/es/line/index.js +8 -2
- package/es/line/models/arc.js +6 -5
- package/es/line/models/half.js +3 -4
- package/es/line/models/line.js +9 -8
- package/es/line/models/simpleLine.js +2 -1
- package/es/line/models/simpleTileLine.d.ts +9 -0
- package/es/line/models/simpleTileLine.js +100 -0
- package/es/line/models/tile.d.ts +1 -4
- package/es/line/models/tile.js +49 -222
- package/es/line/models/wall.js +10 -46
- package/es/line/shaders/dash/arc_dash_vert.glsl +2 -0
- package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
- package/es/line/shaders/line_arc2d_vert.glsl +1 -1
- package/es/line/shaders/line_arc_3d_frag.glsl +1 -1
- package/es/line/shaders/line_arc_3d_vert.glsl +3 -3
- package/es/line/shaders/line_arc_frag.glsl +1 -1
- package/es/line/shaders/line_arc_great_circle_frag.glsl +1 -1
- package/es/line/shaders/line_arc_great_circle_vert.glsl +1 -1
- package/es/line/shaders/line_arc_vert.glsl +5 -3
- package/es/line/shaders/line_bezier_vert.glsl +1 -1
- package/es/line/shaders/line_frag.glsl +1 -2
- package/es/line/shaders/line_vert.glsl +1 -1
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
- package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
- package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/es/line/shaders/tile/line_tile_vert.glsl +19 -177
- package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/es/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
- package/es/line/shaders/wall/wall_vert.glsl +77 -0
- package/es/mask/index.d.ts +1 -0
- package/es/mask/index.js +80 -5
- package/es/mask/models/fill.d.ts +2 -1
- package/es/mask/models/fill.js +13 -10
- package/es/mask/shaders/mask_vert.glsl +0 -6
- package/es/plugins/DataMappingPlugin.d.ts +4 -3
- package/es/plugins/DataMappingPlugin.js +129 -58
- package/es/plugins/DataSourcePlugin.js +3 -2
- package/es/plugins/FeatureScalePlugin.d.ts +0 -2
- package/es/plugins/FeatureScalePlugin.js +8 -51
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -2
- package/es/plugins/LayerAnimateStylePlugin.js +7 -27
- package/es/plugins/LayerModelPlugin.js +2 -6
- package/es/plugins/LightingPlugin.js +1 -7
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
- package/es/plugins/MultiPassRendererPlugin.js +4 -16
- package/es/plugins/PixelPickingPlugin.d.ts +1 -1
- package/es/plugins/PixelPickingPlugin.js +8 -28
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +4 -0
- package/es/plugins/RegisterStyleAttributePlugin.js +56 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +2 -9
- package/es/point/index.js +6 -2
- package/es/point/models/fill.js +2 -2
- package/es/point/models/fillmage.js +1 -1
- package/es/point/models/image.js +1 -1
- package/es/point/models/normal.d.ts +0 -1
- package/es/point/models/normal.js +9 -60
- package/es/point/models/radar.js +4 -69
- package/es/point/models/simplePoint.d.ts +0 -1
- package/es/point/models/simplePoint.js +2 -11
- package/es/point/models/text.js +6 -7
- package/es/point/models/tile.d.ts +0 -7
- package/es/point/models/tile.js +22 -155
- package/es/point/models/tileText.d.ts +0 -4
- package/es/point/models/tileText.js +98 -185
- package/es/point/shaders/animate/wave_frag.glsl +3 -3
- package/es/point/shaders/earth/fill_vert.glsl +0 -1
- package/es/point/shaders/fill_vert.glsl +0 -1
- package/es/point/shaders/normal_frag.glsl +1 -10
- package/es/point/shaders/normal_vert.glsl +5 -60
- package/es/point/shaders/radar/radar_frag.glsl +4 -15
- package/es/point/shaders/radar/radar_vert.glsl +4 -54
- package/es/point/shaders/tile/fill_tile_frag.glsl +10 -17
- package/es/point/shaders/tile/fill_tile_vert.glsl +20 -123
- package/es/point/shaders/tile/text_frag.glsl +33 -0
- package/es/point/shaders/tile/text_map_frag.glsl +31 -0
- package/es/point/shaders/tile/text_map_vert.glsl +38 -0
- package/es/point/shaders/tile/text_vert.glsl +48 -0
- package/es/polygon/index.js +6 -2
- package/es/polygon/models/extrude.js +1 -3
- package/es/polygon/models/fill.js +3 -4
- package/es/polygon/models/ocean.d.ts +0 -2
- package/es/polygon/models/ocean.js +13 -47
- package/es/polygon/models/tile.d.ts +1 -4
- package/es/polygon/models/tile.js +25 -57
- package/es/polygon/models/water.d.ts +0 -2
- package/es/polygon/models/water.js +13 -47
- package/es/polygon/shaders/polygon_frag.glsl +2 -2
- package/es/polygon/shaders/polygon_vert.glsl +2 -2
- package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/es/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
- package/es/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
- package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
- package/es/polygon/shaders/water/polygon_water_frag.glsl +1 -3
- package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -29
- package/es/raster/buffers/triangulation.js +1 -4
- package/es/raster/index.js +6 -2
- package/es/raster/models/raster.js +3 -2
- package/es/shader/minify_frag.glsl +7 -0
- package/es/shader/minify_picking_frag.glsl +10 -0
- package/es/tile/manager/baseMapTileLayerManager.d.ts +29 -0
- package/es/tile/manager/baseMapTileLayerManager.js +207 -0
- package/es/tile/manager/tileLayerManager.d.ts +2 -2
- package/es/tile/manager/tileLayerManager.js +2 -2
- package/es/tile/manager/tilePickerManager.d.ts +2 -3
- package/es/tile/manager/tilePickerManager.js +1 -2
- package/es/tile/models/tileModel.d.ts +1 -0
- package/es/tile/models/tileModel.js +18 -2
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/tileFactory/base.js +58 -33
- package/es/tile/tileFactory/line.js +3 -0
- package/es/tile/tileFactory/point.js +3 -0
- package/es/tile/tileFactory/polygon.js +3 -0
- package/es/tile/tileFactory/raster.js +3 -0
- package/es/tile/tileFactory/rasterData.js +3 -0
- package/es/tile/tileFactory/rasterDataLayer.js +6 -2
- package/es/tile/tileFactory/test.js +26 -5
- package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
- package/es/tile/tileFactory/vectorLayer.js +110 -7
- package/es/tile/tileLayer/baseMapTileLayer.d.ts +29 -0
- package/es/tile/tileLayer/baseMapTileLayer.js +188 -0
- package/es/tile/tileLayer/baseTileLayer.d.ts +4 -4
- package/es/tile/tileLayer/baseTileLayer.js +46 -75
- package/es/tile/tileTest.d.ts +1 -0
- package/es/tile/tileTest.js +3 -2
- package/es/tile/tmsMapTileLayer.d.ts +9 -0
- package/es/tile/tmsMapTileLayer.js +119 -0
- package/es/tile/tmsTileLayer.d.ts +2 -0
- package/es/tile/tmsTileLayer.js +24 -2
- package/es/tile/utils.d.ts +4 -0
- package/es/tile/utils.js +30 -0
- package/es/utils/dataMappingStyle.js +3 -0
- package/es/utils/layerData.js +2 -2
- package/es/utils/updateShape.js +2 -2
- package/es/wind/index.js +6 -2
- package/es/wind/models/wind.js +8 -8
- package/es/wind/shaders/wind_vert.glsl +1 -1
- package/lib/Geometry/index.js +19 -2
- package/lib/Geometry/models/billboard.js +1 -2
- package/lib/Geometry/models/plane.js +2 -4
- package/lib/Geometry/models/sprite.js +2 -4
- package/lib/canvas/index.js +37 -2
- package/lib/citybuliding/building.js +6 -2
- package/lib/citybuliding/models/build.js +2 -3
- package/lib/core/BaseLayer.js +86 -94
- package/lib/core/BaseModel.js +7 -3
- package/lib/core/triangulation.js +66 -2
- package/lib/earth/index.js +11 -1
- package/lib/earth/models/base.js +2 -4
- package/lib/earth/shaders/atmosphere_frag.glsl +1 -1
- package/lib/earth/shaders/bloomsphere_frag.glsl +1 -1
- package/lib/heatmap/index.js +6 -2
- package/lib/heatmap/models/heatmap.js +5 -3
- package/lib/image/index.js +6 -2
- package/lib/image/models/dataImage.js +4 -7
- package/lib/image/models/image.js +4 -7
- package/lib/line/index.js +7 -2
- package/lib/line/models/arc.js +6 -5
- package/lib/line/models/half.js +3 -4
- package/lib/line/models/line.js +9 -8
- package/lib/line/models/simpleLine.js +2 -1
- package/lib/line/models/simpleTileLine.js +115 -0
- package/lib/line/models/tile.js +49 -223
- package/lib/line/models/wall.js +10 -46
- package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -0
- package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
- package/lib/line/shaders/line_arc2d_vert.glsl +1 -1
- package/lib/line/shaders/line_arc_3d_frag.glsl +1 -1
- package/lib/line/shaders/line_arc_3d_vert.glsl +3 -3
- package/lib/line/shaders/line_arc_frag.glsl +1 -1
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +1 -1
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +1 -1
- package/lib/line/shaders/line_arc_vert.glsl +5 -3
- package/lib/line/shaders/line_bezier_vert.glsl +1 -1
- package/lib/line/shaders/line_frag.glsl +1 -2
- package/lib/line/shaders/line_vert.glsl +1 -1
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
- package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
- package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/lib/line/shaders/tile/line_tile_vert.glsl +19 -177
- package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/lib/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
- package/lib/line/shaders/wall/wall_vert.glsl +77 -0
- package/lib/mask/index.js +82 -5
- package/lib/mask/models/fill.js +14 -10
- package/lib/mask/shaders/mask_vert.glsl +0 -6
- package/lib/plugins/DataMappingPlugin.js +127 -57
- package/lib/plugins/DataSourcePlugin.js +3 -2
- package/lib/plugins/FeatureScalePlugin.js +6 -50
- package/lib/plugins/LayerAnimateStylePlugin.js +6 -29
- package/lib/plugins/LayerModelPlugin.js +2 -6
- package/lib/plugins/LightingPlugin.js +1 -7
- package/lib/plugins/MultiPassRendererPlugin.js +3 -19
- package/lib/plugins/PixelPickingPlugin.js +8 -28
- package/lib/plugins/RegisterStyleAttributePlugin.js +56 -5
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -9
- package/lib/point/index.js +6 -2
- package/lib/point/models/fill.js +2 -2
- package/lib/point/models/fillmage.js +1 -1
- package/lib/point/models/image.js +1 -1
- package/lib/point/models/normal.js +8 -59
- package/lib/point/models/radar.js +4 -69
- package/lib/point/models/simplePoint.js +1 -10
- package/lib/point/models/text.js +6 -7
- package/lib/point/models/tile.js +21 -156
- package/lib/point/models/tileText.js +97 -184
- package/lib/point/shaders/animate/wave_frag.glsl +3 -3
- package/lib/point/shaders/earth/fill_vert.glsl +0 -1
- package/lib/point/shaders/fill_vert.glsl +0 -1
- package/lib/point/shaders/normal_frag.glsl +1 -10
- package/lib/point/shaders/normal_vert.glsl +5 -60
- package/lib/point/shaders/radar/radar_frag.glsl +4 -15
- package/lib/point/shaders/radar/radar_vert.glsl +4 -54
- package/lib/point/shaders/tile/fill_tile_frag.glsl +10 -17
- package/lib/point/shaders/tile/fill_tile_vert.glsl +20 -123
- package/lib/point/shaders/tile/text_frag.glsl +33 -0
- package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
- package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
- package/lib/point/shaders/tile/text_vert.glsl +48 -0
- package/lib/polygon/index.js +6 -2
- package/lib/polygon/models/extrude.js +1 -3
- package/lib/polygon/models/fill.js +3 -4
- package/lib/polygon/models/ocean.js +14 -47
- package/lib/polygon/models/tile.js +24 -57
- package/lib/polygon/models/water.js +14 -47
- package/lib/polygon/shaders/polygon_frag.glsl +2 -2
- package/lib/polygon/shaders/polygon_vert.glsl +2 -2
- package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
- package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
- package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +1 -3
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -29
- package/lib/raster/buffers/triangulation.js +1 -4
- package/lib/raster/index.js +6 -2
- package/lib/raster/models/raster.js +3 -2
- package/lib/shader/minify_frag.glsl +7 -0
- package/lib/shader/minify_picking_frag.glsl +10 -0
- package/lib/tile/manager/baseMapTileLayerManager.js +222 -0
- package/lib/tile/manager/tileLayerManager.js +2 -2
- package/lib/tile/manager/tilePickerManager.js +1 -2
- package/lib/tile/models/tileModel.js +19 -2
- package/lib/tile/tileFactory/base.js +60 -33
- package/lib/tile/tileFactory/line.js +3 -0
- package/lib/tile/tileFactory/point.js +3 -0
- package/lib/tile/tileFactory/polygon.js +3 -0
- package/lib/tile/tileFactory/raster.js +3 -0
- package/lib/tile/tileFactory/rasterData.js +3 -0
- package/lib/tile/tileFactory/rasterDataLayer.js +6 -2
- package/lib/tile/tileFactory/test.js +26 -5
- package/lib/tile/tileFactory/vectorLayer.js +112 -8
- package/lib/tile/tileLayer/baseMapTileLayer.js +195 -0
- package/lib/tile/tileLayer/baseTileLayer.js +46 -75
- package/lib/tile/tileTest.js +3 -2
- package/lib/tile/tmsMapTileLayer.js +136 -0
- package/lib/tile/tmsTileLayer.js +25 -2
- package/lib/tile/utils.js +38 -0
- package/lib/utils/dataMappingStyle.js +3 -0
- package/lib/utils/layerData.js +2 -2
- package/lib/utils/updateShape.js +2 -2
- package/lib/wind/index.js +6 -2
- package/lib/wind/models/wind.js +7 -7
- package/lib/wind/shaders/wind_vert.glsl +1 -1
- package/package.json +8 -7
- package/es/line/shaders/tile/line_tile_frag.glsl +0 -79
- package/es/line/shaders/wall_vert.glsl +0 -111
- package/es/mask/shaders/mask_frag.glsl +0 -7
- package/es/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
- package/lib/line/shaders/tile/line_tile_frag.glsl +0 -79
- package/lib/line/shaders/wall_vert.glsl +0 -111
- package/lib/mask/shaders/mask_frag.glsl +0 -7
- package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
package/es/point/models/radar.js
CHANGED
|
@@ -18,10 +18,10 @@ import BaseModel from "../../core/BaseModel";
|
|
|
18
18
|
import { PointFillTriangulation } from "../../core/triangulation";
|
|
19
19
|
|
|
20
20
|
/* babel-plugin-inline-import '../shaders/radar/radar_frag.glsl' */
|
|
21
|
-
var pointFillFrag = "\nuniform float u_additive;\
|
|
21
|
+
var pointFillFrag = "\nuniform float u_additive;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n vec2 extrude = v_exteude;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n // full circle\n // float rades = dot(dir, baseDir);\n // float flag = sign(dir.y);\n // float radar_v = (flag - 1.0) * -0.5 + flag * acos(rades)/pi/2.0;\n \n // half circle\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n gl_FragColor.a *= radar_v;\n}\n";
|
|
22
22
|
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/radar/radar_vert.glsl' */
|
|
24
|
-
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\
|
|
24
|
+
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nuniform float u_speed: 1.0;\nuniform float u_time;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float newSize = setPickingSize(a_Size);\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2( \n cos(time), sin(time), \n -sin(time), cos(time)\n );\n v_exteude = rotateMatrix * a_Extrude.xy;\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // anti-alias\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);\n\n vec2 offset = (extrude.xy * (newSize));\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 antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\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 v_data = vec4(extrude.x, extrude.y, antialiasblur, -1.0);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 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 setPickingColor(a_PickingColor);\n}\n";
|
|
25
25
|
import { Version } from '@antv/l7-maps';
|
|
26
26
|
|
|
27
27
|
var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
@@ -53,56 +53,15 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
53
53
|
var _ref = this.layer.getLayerConfig(),
|
|
54
54
|
_ref$opacity = _ref.opacity,
|
|
55
55
|
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
56
|
-
_ref$offsets = _ref.offsets,
|
|
57
|
-
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
58
56
|
blend = _ref.blend,
|
|
59
57
|
_ref$speed = _ref.speed,
|
|
60
58
|
speed = _ref$speed === void 0 ? 1 : _ref$speed;
|
|
61
59
|
|
|
62
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
63
|
-
opacity: opacity,
|
|
64
|
-
offsets: offsets
|
|
65
|
-
})) {
|
|
66
|
-
// 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
67
|
-
this.judgeStyleAttributes({
|
|
68
|
-
opacity: opacity,
|
|
69
|
-
offsets: offsets
|
|
70
|
-
});
|
|
71
|
-
var encodeData = this.layer.getEncodedData();
|
|
72
|
-
|
|
73
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
74
|
-
data = _this$calDataFrame.data,
|
|
75
|
-
width = _this$calDataFrame.width,
|
|
76
|
-
height = _this$calDataFrame.height;
|
|
77
|
-
|
|
78
|
-
this.rowCount = height; // 当前数据纹理有多少行
|
|
79
|
-
|
|
80
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
81
|
-
flipY: true,
|
|
82
|
-
data: data,
|
|
83
|
-
format: gl.LUMINANCE,
|
|
84
|
-
type: gl.FLOAT,
|
|
85
|
-
width: width,
|
|
86
|
-
height: height
|
|
87
|
-
}) : this.createTexture2D({
|
|
88
|
-
flipY: true,
|
|
89
|
-
data: [1],
|
|
90
|
-
format: gl.LUMINANCE,
|
|
91
|
-
type: gl.FLOAT,
|
|
92
|
-
width: 1,
|
|
93
|
-
height: 1
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
60
|
return {
|
|
98
61
|
u_isMeter: Number(this.isMeter),
|
|
99
62
|
u_speed: speed,
|
|
100
63
|
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
101
|
-
|
|
102
|
-
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
103
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
104
|
-
u_opacity: isNumber(opacity) ? opacity : 1.0,
|
|
105
|
-
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
64
|
+
u_opacity: isNumber(opacity) ? opacity : 1.0
|
|
106
65
|
};
|
|
107
66
|
}
|
|
108
67
|
}, {
|
|
@@ -257,36 +216,12 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
257
216
|
type: gl.FLOAT
|
|
258
217
|
},
|
|
259
218
|
size: 1,
|
|
260
|
-
update: function update(feature
|
|
219
|
+
update: function update(feature) {
|
|
261
220
|
var _feature$size = feature.size,
|
|
262
221
|
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
263
222
|
return Array.isArray(size) ? [size[0] * _this2.meter2coord] : [size * _this2.meter2coord];
|
|
264
223
|
}
|
|
265
224
|
}
|
|
266
|
-
}); // point layer size;
|
|
267
|
-
|
|
268
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
269
|
-
name: 'shape',
|
|
270
|
-
type: AttributeType.Attribute,
|
|
271
|
-
descriptor: {
|
|
272
|
-
name: 'a_Shape',
|
|
273
|
-
buffer: {
|
|
274
|
-
// give the WebGL driver a hint that this buffer may change
|
|
275
|
-
usage: gl.DYNAMIC_DRAW,
|
|
276
|
-
data: [],
|
|
277
|
-
type: gl.FLOAT
|
|
278
|
-
},
|
|
279
|
-
size: 1,
|
|
280
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
281
|
-
var _feature$shape = feature.shape,
|
|
282
|
-
shape = _feature$shape === void 0 ? 2 : _feature$shape;
|
|
283
|
-
|
|
284
|
-
var shape2d = _this2.layer.getLayerConfig().shape2d;
|
|
285
|
-
|
|
286
|
-
var shapeIndex = shape2d.indexOf(shape);
|
|
287
|
-
return [shapeIndex];
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
225
|
});
|
|
291
226
|
}
|
|
292
227
|
}]);
|
|
@@ -9,7 +9,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
9
9
|
|
|
10
10
|
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; } }
|
|
11
11
|
|
|
12
|
-
import { AttributeType,
|
|
12
|
+
import { AttributeType, gl } from '@antv/l7-core';
|
|
13
13
|
import { getMask } from '@antv/l7-utils';
|
|
14
14
|
import { isNumber } from 'lodash';
|
|
15
15
|
import BaseModel from "../../core/BaseModel";
|
|
@@ -152,20 +152,18 @@ var SimplePointModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
152
152
|
}, {
|
|
153
153
|
key: "registerBuiltinAttributes",
|
|
154
154
|
value: function registerBuiltinAttributes() {
|
|
155
|
-
// point layer size;
|
|
156
155
|
this.styleAttributeService.registerStyleAttribute({
|
|
157
156
|
name: 'size',
|
|
158
157
|
type: AttributeType.Attribute,
|
|
159
158
|
descriptor: {
|
|
160
159
|
name: 'a_Size',
|
|
161
160
|
buffer: {
|
|
162
|
-
// give the WebGL driver a hint that this buffer may change
|
|
163
161
|
usage: gl.DYNAMIC_DRAW,
|
|
164
162
|
data: [],
|
|
165
163
|
type: gl.FLOAT
|
|
166
164
|
},
|
|
167
165
|
size: 1,
|
|
168
|
-
update: function update(feature
|
|
166
|
+
update: function update(feature) {
|
|
169
167
|
var _feature$size = feature.size,
|
|
170
168
|
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
171
169
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
@@ -173,13 +171,6 @@ var SimplePointModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
173
171
|
}
|
|
174
172
|
});
|
|
175
173
|
}
|
|
176
|
-
}, {
|
|
177
|
-
key: "defaultStyleOptions",
|
|
178
|
-
value: function defaultStyleOptions() {
|
|
179
|
-
return {
|
|
180
|
-
blend: BlendType.additive
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
174
|
}]);
|
|
184
175
|
|
|
185
176
|
return SimplePointModel;
|
package/es/point/models/text.js
CHANGED
|
@@ -289,7 +289,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
289
289
|
type: gl.FLOAT
|
|
290
290
|
},
|
|
291
291
|
size: 1,
|
|
292
|
-
update: function update(feature
|
|
292
|
+
update: function update(feature) {
|
|
293
293
|
var _feature$rotate = feature.rotate,
|
|
294
294
|
rotate = _feature$rotate === void 0 ? 0 : _feature$rotate;
|
|
295
295
|
return Array.isArray(rotate) ? [rotate[0]] : [rotate];
|
|
@@ -308,7 +308,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
308
308
|
type: gl.FLOAT
|
|
309
309
|
},
|
|
310
310
|
size: 2,
|
|
311
|
-
update: function update(feature, featureIdx, vertex
|
|
311
|
+
update: function update(feature, featureIdx, vertex) {
|
|
312
312
|
return [vertex[5], vertex[6]];
|
|
313
313
|
}
|
|
314
314
|
}
|
|
@@ -326,7 +326,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
326
326
|
type: gl.FLOAT
|
|
327
327
|
},
|
|
328
328
|
size: 1,
|
|
329
|
-
update: function update(feature
|
|
329
|
+
update: function update(feature) {
|
|
330
330
|
var _feature$size = feature.size,
|
|
331
331
|
size = _feature$size === void 0 ? 12 : _feature$size;
|
|
332
332
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
@@ -346,7 +346,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
346
346
|
type: gl.FLOAT
|
|
347
347
|
},
|
|
348
348
|
size: 2,
|
|
349
|
-
update: function update(feature, featureIdx, vertex
|
|
349
|
+
update: function update(feature, featureIdx, vertex) {
|
|
350
350
|
return [vertex[3], vertex[4]];
|
|
351
351
|
}
|
|
352
352
|
}
|
|
@@ -443,7 +443,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
443
443
|
value: function generateGlyphLayout(iconfont) {
|
|
444
444
|
var _this2 = this;
|
|
445
445
|
|
|
446
|
-
//
|
|
446
|
+
// 更新文字布局
|
|
447
447
|
var mapping = this.fontService.mapping;
|
|
448
448
|
|
|
449
449
|
var _ref8 = this.layer.getLayerConfig(),
|
|
@@ -531,7 +531,6 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
531
531
|
box = _collisionIndex$place.box;
|
|
532
532
|
|
|
533
533
|
if (box && box.length) {
|
|
534
|
-
// TODO:featureIndex
|
|
535
534
|
collisionIndex.insertCollisionBox(box, id);
|
|
536
535
|
return true;
|
|
537
536
|
} else {
|
|
@@ -608,7 +607,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
608
607
|
}).then(function (model) {
|
|
609
608
|
_this4.layer.models = [model];
|
|
610
609
|
|
|
611
|
-
_this4.
|
|
610
|
+
_this4.layerService.throttleRenderLayers();
|
|
612
611
|
}).catch(function (err) {
|
|
613
612
|
console.warn(err);
|
|
614
613
|
_this4.layer.models = [];
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { IAttribute, IElements, IModel, IModelUniform } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class FillModel extends BaseModel {
|
|
4
|
-
meter2coord: number;
|
|
5
|
-
private isMeter;
|
|
6
4
|
getUninforms(): IModelUniform;
|
|
7
5
|
getAttribute(): {
|
|
8
6
|
attributes: {
|
|
@@ -11,11 +9,6 @@ export default class FillModel extends BaseModel {
|
|
|
11
9
|
elements: IElements;
|
|
12
10
|
};
|
|
13
11
|
initModels(callbackModel: (models: IModel[]) => void): void;
|
|
14
|
-
/**
|
|
15
|
-
* 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
calMeter2Coord(): void;
|
|
19
12
|
buildModels(callbackModel: (models: IModel[]) => void): void;
|
|
20
13
|
clearModels(): void;
|
|
21
14
|
protected registerBuiltinAttributes(): void;
|
package/es/point/models/tile.js
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
6
|
|
|
10
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); }; }
|
|
11
8
|
|
|
12
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; } }
|
|
13
10
|
|
|
14
11
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
|
-
import { getCullFace
|
|
12
|
+
import { getCullFace } from '@antv/l7-utils';
|
|
16
13
|
import BaseModel from "../../core/BaseModel";
|
|
17
14
|
import { PointFillTriangulation } from "../../core/triangulation";
|
|
18
15
|
|
|
19
16
|
/* babel-plugin-inline-import '../shaders/tile/fill_tile_frag.glsl' */
|
|
20
|
-
var point_tile_frag = "uniform float u_additive;\
|
|
17
|
+
var point_tile_frag = "uniform float u_additive;\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];\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + u_stroke_width);\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\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(u_stroke_width < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), u_stroke_color * u_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";
|
|
21
18
|
|
|
22
19
|
/* babel-plugin-inline-import '../shaders/tile/fill_tile_vert.glsl' */
|
|
23
|
-
var point_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\
|
|
24
|
-
import { Version } from '@antv/l7-maps';
|
|
20
|
+
var point_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n// uniform vec2 u_tileOrigin;\n// uniform float u_coord;\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];\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping\n\n v_color = a_Color;\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, 0.0);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width));\n offset = project_pixel(offset);\n\n v_data = vec4(extrude.x, extrude.y, antialiasblur,shape_type);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\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 }\n\n// if(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n// } else {\n\n // vec2 pointPos = a_Position.xy;\n // vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n // vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n // world.xy += offset;\n // world.xy += pointOffset;\n\n // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // // Needs to be divided with project_uCommonUnitsPerMeter\n // world.w *= u_PixelsPerMeter.z;\n // }\n\n // gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n// }\n\n \n setPickingColor(a_PickingColor);\n\n\n}\n";
|
|
25
21
|
|
|
26
22
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
27
23
|
_inherits(FillModel, _BaseModel);
|
|
@@ -29,21 +25,9 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
29
25
|
var _super = _createSuper(FillModel);
|
|
30
26
|
|
|
31
27
|
function FillModel() {
|
|
32
|
-
var _this;
|
|
33
|
-
|
|
34
28
|
_classCallCheck(this, FillModel);
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
args[_key] = arguments[_key];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
-
|
|
42
|
-
_defineProperty(_assertThisInitialized(_this), "meter2coord", 1);
|
|
43
|
-
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "isMeter", false);
|
|
45
|
-
|
|
46
|
-
return _this;
|
|
30
|
+
return _super.apply(this, arguments);
|
|
47
31
|
}
|
|
48
32
|
|
|
49
33
|
_createClass(FillModel, [{
|
|
@@ -58,70 +42,16 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
58
42
|
strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
|
|
59
43
|
_ref$stroke = _ref.stroke,
|
|
60
44
|
stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
|
|
61
|
-
|
|
62
|
-
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
63
|
-
blend = _ref.blend,
|
|
64
|
-
_ref$blur = _ref.blur,
|
|
65
|
-
blur = _ref$blur === void 0 ? 0 : _ref$blur,
|
|
66
|
-
_ref$coord = _ref.coord,
|
|
67
|
-
coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
|
|
68
|
-
tileOrigin = _ref.tileOrigin;
|
|
69
|
-
|
|
70
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
71
|
-
opacity: opacity,
|
|
72
|
-
strokeOpacity: strokeOpacity,
|
|
73
|
-
strokeWidth: strokeWidth,
|
|
74
|
-
stroke: stroke,
|
|
75
|
-
offsets: offsets
|
|
76
|
-
})) {
|
|
77
|
-
// 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
78
|
-
this.judgeStyleAttributes({
|
|
79
|
-
opacity: opacity,
|
|
80
|
-
strokeOpacity: strokeOpacity,
|
|
81
|
-
strokeWidth: strokeWidth,
|
|
82
|
-
stroke: stroke,
|
|
83
|
-
offsets: offsets
|
|
84
|
-
});
|
|
85
|
-
var encodeData = this.layer.getEncodedData();
|
|
86
|
-
|
|
87
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
88
|
-
data = _this$calDataFrame.data,
|
|
89
|
-
width = _this$calDataFrame.width,
|
|
90
|
-
height = _this$calDataFrame.height;
|
|
91
|
-
|
|
92
|
-
this.rowCount = height; // 当前数据纹理有多少行
|
|
93
|
-
|
|
94
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
95
|
-
flipY: true,
|
|
96
|
-
data: data,
|
|
97
|
-
format: gl.LUMINANCE,
|
|
98
|
-
type: gl.FLOAT,
|
|
99
|
-
width: width,
|
|
100
|
-
height: height
|
|
101
|
-
}) : this.createTexture2D({
|
|
102
|
-
flipY: true,
|
|
103
|
-
data: [1],
|
|
104
|
-
format: gl.LUMINANCE,
|
|
105
|
-
type: gl.FLOAT,
|
|
106
|
-
width: 1,
|
|
107
|
-
height: 1
|
|
108
|
-
});
|
|
109
|
-
}
|
|
45
|
+
blend = _ref.blend;
|
|
110
46
|
|
|
111
47
|
return {
|
|
112
|
-
u_tileOrigin: tileOrigin || [0, 0],
|
|
113
|
-
u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
114
|
-
u_isMeter: Number(this.isMeter),
|
|
115
|
-
u_blur: blur,
|
|
48
|
+
// u_tileOrigin: tileOrigin || [0, 0],
|
|
49
|
+
// u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
116
50
|
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
117
|
-
u_dataTexture: this.dataTexture,
|
|
118
|
-
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
119
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
120
51
|
u_opacity: Number(opacity),
|
|
121
52
|
u_stroke_opacity: Number(strokeOpacity),
|
|
122
53
|
u_stroke_width: Number(strokeWidth),
|
|
123
|
-
u_stroke_color: this.getStrokeColor(stroke)
|
|
124
|
-
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
54
|
+
u_stroke_color: this.getStrokeColor(stroke)
|
|
125
55
|
};
|
|
126
56
|
}
|
|
127
57
|
}, {
|
|
@@ -132,74 +62,19 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
132
62
|
}, {
|
|
133
63
|
key: "initModels",
|
|
134
64
|
value: function initModels(callbackModel) {
|
|
135
|
-
var _ref2 = this.layer.getLayerConfig(),
|
|
136
|
-
_ref2$unit = _ref2.unit,
|
|
137
|
-
unit = _ref2$unit === void 0 ? 'l7size' : _ref2$unit;
|
|
138
|
-
|
|
139
|
-
var version = this.mapService.version;
|
|
140
|
-
|
|
141
|
-
if (unit === 'meter' && version !== Version.L7MAP && version !== Version.GLOBEL) {
|
|
142
|
-
this.isMeter = true;
|
|
143
|
-
this.calMeter2Coord();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
65
|
this.buildModels(callbackModel);
|
|
147
66
|
}
|
|
148
|
-
/**
|
|
149
|
-
* 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
|
|
150
|
-
* @returns
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
}, {
|
|
154
|
-
key: "calMeter2Coord",
|
|
155
|
-
value: function calMeter2Coord() {
|
|
156
|
-
var _this$layer$getSource = _slicedToArray(this.layer.getSource().extent, 4),
|
|
157
|
-
minLng = _this$layer$getSource[0],
|
|
158
|
-
minLat = _this$layer$getSource[1],
|
|
159
|
-
maxLng = _this$layer$getSource[2],
|
|
160
|
-
maxLat = _this$layer$getSource[3];
|
|
161
|
-
|
|
162
|
-
var center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];
|
|
163
|
-
var version = this.mapService.version;
|
|
164
|
-
|
|
165
|
-
if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {
|
|
166
|
-
var coord = window.mapboxgl.MercatorCoordinate.fromLngLat({
|
|
167
|
-
lng: center[0],
|
|
168
|
-
lat: center[1]
|
|
169
|
-
}, 0);
|
|
170
|
-
var offsetInMeters = 1;
|
|
171
|
-
var offsetInMercatorCoordinateUnits = offsetInMeters * coord.meterInMercatorCoordinateUnits();
|
|
172
|
-
var westCoord = new window.mapboxgl.MercatorCoordinate(coord.x - offsetInMercatorCoordinateUnits, coord.y, coord.z);
|
|
173
|
-
var westLnglat = westCoord.toLngLat();
|
|
174
|
-
this.meter2coord = center[0] - westLnglat.lng;
|
|
175
|
-
return;
|
|
176
|
-
} // @ts-ignore
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
var m1 = this.mapService.meterToCoord(center, [minLng, minLat]); // @ts-ignore
|
|
180
|
-
|
|
181
|
-
var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
|
|
182
|
-
this.meter2coord = (m1 + m2) / 2;
|
|
183
|
-
|
|
184
|
-
if (!this.meter2coord) {
|
|
185
|
-
// Tip: 兼容单个数据导致的 m1、m2 为 NaN
|
|
186
|
-
this.meter2coord = 7.70681090738883;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
67
|
}, {
|
|
190
68
|
key: "buildModels",
|
|
191
69
|
value: function buildModels(callbackModel) {
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside,
|
|
197
|
-
_ref3$workerEnabled = _ref3.workerEnabled,
|
|
198
|
-
workerEnabled = _ref3$workerEnabled === void 0 ? false : _ref3$workerEnabled;
|
|
70
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
71
|
+
_ref2$workerEnabled = _ref2.workerEnabled,
|
|
72
|
+
workerEnabled = _ref2$workerEnabled === void 0 ? false : _ref2$workerEnabled,
|
|
73
|
+
usage = _ref2.usage;
|
|
199
74
|
|
|
200
75
|
this.layer.triangulation = PointFillTriangulation;
|
|
201
76
|
this.layer.buildLayerModel({
|
|
202
|
-
moduleName: '
|
|
77
|
+
moduleName: 'pointTile_' + usage,
|
|
203
78
|
vertexShader: point_tile_vert,
|
|
204
79
|
fragmentShader: point_tile_frag,
|
|
205
80
|
triangulation: PointFillTriangulation,
|
|
@@ -211,11 +86,11 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
211
86
|
face: getCullFace(this.mapService.version)
|
|
212
87
|
},
|
|
213
88
|
blend: this.getBlend(),
|
|
214
|
-
stencil: getMask(mask, maskInside),
|
|
215
89
|
workerEnabled: workerEnabled,
|
|
216
90
|
workerOptions: {
|
|
217
91
|
modelType: 'pointTile'
|
|
218
|
-
}
|
|
92
|
+
},
|
|
93
|
+
pick: usage !== 'basemap'
|
|
219
94
|
}).then(function (model) {
|
|
220
95
|
callbackModel([model]);
|
|
221
96
|
}).catch(function (err) {
|
|
@@ -225,16 +100,11 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
225
100
|
}
|
|
226
101
|
}, {
|
|
227
102
|
key: "clearModels",
|
|
228
|
-
value: function clearModels() {
|
|
229
|
-
var _this$dataTexture;
|
|
230
|
-
|
|
231
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
232
|
-
} // overwrite baseModel func
|
|
233
|
-
|
|
103
|
+
value: function clearModels() {}
|
|
234
104
|
}, {
|
|
235
105
|
key: "registerBuiltinAttributes",
|
|
236
106
|
value: function registerBuiltinAttributes() {
|
|
237
|
-
var
|
|
107
|
+
var _this = this;
|
|
238
108
|
|
|
239
109
|
this.styleAttributeService.registerStyleAttribute({
|
|
240
110
|
name: 'extrude',
|
|
@@ -254,8 +124,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
254
124
|
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
255
125
|
}
|
|
256
126
|
}
|
|
257
|
-
});
|
|
258
|
-
|
|
127
|
+
});
|
|
259
128
|
this.styleAttributeService.registerStyleAttribute({
|
|
260
129
|
name: 'size',
|
|
261
130
|
type: AttributeType.Attribute,
|
|
@@ -270,13 +139,11 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
270
139
|
size: 1,
|
|
271
140
|
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
272
141
|
var _feature$size = feature.size,
|
|
273
|
-
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
274
|
-
|
|
275
|
-
return Array.isArray(size) ? [size[0] * _this2.meter2coord] : [size * _this2.meter2coord];
|
|
142
|
+
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
143
|
+
return Array.isArray(size) ? [size[0]] : [size];
|
|
276
144
|
}
|
|
277
145
|
}
|
|
278
|
-
});
|
|
279
|
-
|
|
146
|
+
});
|
|
280
147
|
this.styleAttributeService.registerStyleAttribute({
|
|
281
148
|
name: 'shape',
|
|
282
149
|
type: AttributeType.Attribute,
|
|
@@ -293,7 +160,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
293
160
|
var _feature$shape = feature.shape,
|
|
294
161
|
shape = _feature$shape === void 0 ? 2 : _feature$shape;
|
|
295
162
|
|
|
296
|
-
var shape2d =
|
|
163
|
+
var shape2d = _this.layer.getLayerConfig().shape2d;
|
|
297
164
|
|
|
298
165
|
var shapeIndex = shape2d.indexOf(shape);
|
|
299
166
|
return [shapeIndex];
|