@antv/l7-layers 2.9.12 → 2.9.15
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/LICENSE.md +1 -1
- package/es/core/BaseLayer.d.ts +2 -5
- package/es/core/BaseLayer.js +4 -35
- package/es/core/BaseLayer.js.map +1 -1
- package/es/core/BaseModel.d.ts +1 -2
- package/es/core/BaseModel.js +0 -3
- package/es/core/BaseModel.js.map +1 -1
- package/es/core/LayerGroup.d.ts +9 -0
- package/es/{tile/tileFactory/rasterDataLayer.js → core/LayerGroup.js} +32 -39
- package/es/core/LayerGroup.js.map +1 -0
- package/es/core/interface.d.ts +1 -14
- package/es/core/interface.js.map +1 -1
- package/es/image/models/image.js.map +1 -1
- package/es/line/index.d.ts +1 -1
- package/es/line/index.js +1 -7
- package/es/line/index.js.map +1 -1
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +1 -5
- package/es/line/models/index.js.map +1 -1
- package/es/plugins/FeatureScalePlugin.js +9 -35
- package/es/plugins/FeatureScalePlugin.js.map +1 -1
- package/es/plugins/ShaderUniformPlugin.js +1 -3
- package/es/plugins/ShaderUniformPlugin.js.map +1 -1
- package/es/point/index.d.ts +1 -1
- package/es/point/index.js +2 -8
- package/es/point/index.js.map +1 -1
- package/es/point/models/fill.d.ts +1 -8
- package/es/point/models/fill.js +33 -49
- package/es/point/models/fill.js.map +1 -1
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +1 -5
- package/es/point/models/index.js.map +1 -1
- package/es/point/models/radar.js +6 -2
- package/es/point/models/radar.js.map +1 -1
- package/es/polygon/index.js +0 -6
- package/es/polygon/index.js.map +1 -1
- package/es/polygon/models/index.d.ts +1 -1
- package/es/polygon/models/index.js +1 -5
- package/es/polygon/models/index.js.map +1 -1
- package/es/raster/index.d.ts +2 -2
- package/es/raster/index.js +4 -4
- package/es/raster/index.js.map +1 -1
- package/es/raster/models/index.js +1 -1
- package/es/raster/models/index.js.map +1 -1
- package/es/raster/models/raste-tile.d.ts +23 -0
- package/es/raster/models/raste-tile.js +285 -0
- package/es/raster/models/raste-tile.js.map +1 -0
- package/es/raster/models/raster.d.ts +0 -2
- package/es/raster/models/raster.js +12 -24
- package/es/raster/models/raster.js.map +1 -1
- package/lib/core/BaseLayer.js +3 -33
- package/lib/core/BaseLayer.js.map +1 -1
- package/lib/core/BaseModel.js +0 -2
- package/lib/core/BaseModel.js.map +1 -1
- package/lib/{tile/tileFactory/rasterDataLayer.js → core/LayerGroup.js} +32 -40
- package/lib/core/LayerGroup.js.map +1 -0
- package/lib/core/interface.js.map +1 -1
- package/lib/image/models/image.js.map +1 -1
- package/lib/line/index.js +1 -7
- package/lib/line/index.js.map +1 -1
- package/lib/line/models/index.js +1 -7
- package/lib/line/models/index.js.map +1 -1
- package/lib/plugins/FeatureScalePlugin.js +9 -35
- package/lib/plugins/FeatureScalePlugin.js.map +1 -1
- package/lib/plugins/ShaderUniformPlugin.js +1 -3
- package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
- package/lib/point/index.js +2 -8
- package/lib/point/index.js.map +1 -1
- package/lib/point/models/fill.js +32 -46
- package/lib/point/models/fill.js.map +1 -1
- package/lib/point/models/index.js +1 -7
- package/lib/point/models/index.js.map +1 -1
- package/lib/point/models/radar.js +5 -1
- package/lib/point/models/radar.js.map +1 -1
- package/lib/polygon/index.js +0 -6
- package/lib/polygon/index.js.map +1 -1
- package/lib/polygon/models/index.js +1 -7
- package/lib/polygon/models/index.js.map +1 -1
- package/lib/raster/index.js +4 -4
- package/lib/raster/index.js.map +1 -1
- package/lib/raster/models/index.js +2 -2
- package/lib/raster/models/index.js.map +1 -1
- package/lib/raster/models/raste-tile.js +294 -0
- package/lib/raster/models/raste-tile.js.map +1 -0
- package/lib/raster/models/raster.js +12 -24
- package/lib/raster/models/raster.js.map +1 -1
- package/package.json +7 -9
- package/es/line/models/tile.d.ts +0 -20
- package/es/line/models/tile.js +0 -327
- package/es/line/models/tile.js.map +0 -1
- package/es/point/models/tile.d.ts +0 -31
- package/es/point/models/tile.js +0 -291
- package/es/point/models/tile.js.map +0 -1
- package/es/polygon/models/tile.d.ts +0 -16
- package/es/polygon/models/tile.js +0 -137
- package/es/polygon/models/tile.js.map +0 -1
- package/es/tile/interface.d.ts +0 -28
- package/es/tile/interface.js +0 -2
- package/es/tile/interface.js.map +0 -1
- package/es/tile/manager/tileConfigManager.d.ts +0 -17
- package/es/tile/manager/tileConfigManager.js +0 -123
- package/es/tile/manager/tileConfigManager.js.map +0 -1
- package/es/tile/manager/tileLayerManager.d.ts +0 -35
- package/es/tile/manager/tileLayerManager.js +0 -297
- package/es/tile/manager/tileLayerManager.js.map +0 -1
- package/es/tile/manager/tilePickerManager.d.ts +0 -21
- package/es/tile/manager/tilePickerManager.js +0 -189
- package/es/tile/manager/tilePickerManager.js.map +0 -1
- package/es/tile/models/tileModel.d.ts +0 -8
- package/es/tile/models/tileModel.js +0 -61
- package/es/tile/models/tileModel.js.map +0 -1
- package/es/tile/tileFactory/base.d.ts +0 -44
- package/es/tile/tileFactory/base.js +0 -423
- package/es/tile/tileFactory/base.js.map +0 -1
- package/es/tile/tileFactory/index.d.ts +0 -5
- package/es/tile/tileFactory/index.js +0 -30
- package/es/tile/tileFactory/index.js.map +0 -1
- package/es/tile/tileFactory/line.d.ts +0 -12
- package/es/tile/tileFactory/line.js +0 -65
- package/es/tile/tileFactory/line.js.map +0 -1
- package/es/tile/tileFactory/point.d.ts +0 -12
- package/es/tile/tileFactory/point.js +0 -65
- package/es/tile/tileFactory/point.js.map +0 -1
- package/es/tile/tileFactory/polygon.d.ts +0 -12
- package/es/tile/tileFactory/polygon.js +0 -65
- package/es/tile/tileFactory/polygon.js.map +0 -1
- package/es/tile/tileFactory/raster.d.ts +0 -12
- package/es/tile/tileFactory/raster.js +0 -61
- package/es/tile/tileFactory/raster.js.map +0 -1
- package/es/tile/tileFactory/rasterData.d.ts +0 -12
- package/es/tile/tileFactory/rasterData.js +0 -86
- package/es/tile/tileFactory/rasterData.js.map +0 -1
- package/es/tile/tileFactory/rasterDataLayer.d.ts +0 -19
- package/es/tile/tileFactory/rasterDataLayer.js.map +0 -1
- package/es/tile/tileFactory/vectorLayer.d.ts +0 -27
- package/es/tile/tileFactory/vectorLayer.js +0 -131
- package/es/tile/tileFactory/vectorLayer.js.map +0 -1
- package/es/tile/tileLayer/baseTileLayer.d.ts +0 -47
- package/es/tile/tileLayer/baseTileLayer.js +0 -409
- package/es/tile/tileLayer/baseTileLayer.js.map +0 -1
- package/es/tile/tmsTileLayer.d.ts +0 -7
- package/es/tile/tmsTileLayer.js +0 -100
- package/es/tile/tmsTileLayer.js.map +0 -1
- package/es/tile/utils.d.ts +0 -11
- package/es/tile/utils.js +0 -125
- package/es/tile/utils.js.map +0 -1
- package/lib/line/models/tile.js +0 -342
- package/lib/line/models/tile.js.map +0 -1
- package/lib/point/models/tile.js +0 -308
- package/lib/point/models/tile.js.map +0 -1
- package/lib/polygon/models/tile.js +0 -152
- package/lib/polygon/models/tile.js.map +0 -1
- package/lib/tile/interface.js +0 -2
- package/lib/tile/interface.js.map +0 -1
- package/lib/tile/manager/tileConfigManager.js +0 -134
- package/lib/tile/manager/tileConfigManager.js.map +0 -1
- package/lib/tile/manager/tileLayerManager.js +0 -305
- package/lib/tile/manager/tileLayerManager.js.map +0 -1
- package/lib/tile/manager/tilePickerManager.js +0 -195
- package/lib/tile/manager/tilePickerManager.js.map +0 -1
- package/lib/tile/models/tileModel.js +0 -73
- package/lib/tile/models/tileModel.js.map +0 -1
- package/lib/tile/tileFactory/base.js +0 -436
- package/lib/tile/tileFactory/base.js.map +0 -1
- package/lib/tile/tileFactory/index.js +0 -60
- package/lib/tile/tileFactory/index.js.map +0 -1
- package/lib/tile/tileFactory/line.js +0 -76
- package/lib/tile/tileFactory/line.js.map +0 -1
- package/lib/tile/tileFactory/point.js +0 -76
- package/lib/tile/tileFactory/point.js.map +0 -1
- package/lib/tile/tileFactory/polygon.js +0 -76
- package/lib/tile/tileFactory/polygon.js.map +0 -1
- package/lib/tile/tileFactory/raster.js +0 -74
- package/lib/tile/tileFactory/raster.js.map +0 -1
- package/lib/tile/tileFactory/rasterData.js +0 -99
- package/lib/tile/tileFactory/rasterData.js.map +0 -1
- package/lib/tile/tileFactory/rasterDataLayer.js.map +0 -1
- package/lib/tile/tileFactory/vectorLayer.js +0 -145
- package/lib/tile/tileFactory/vectorLayer.js.map +0 -1
- package/lib/tile/tileLayer/baseTileLayer.js +0 -407
- package/lib/tile/tileLayer/baseTileLayer.js.map +0 -1
- package/lib/tile/tmsTileLayer.js +0 -116
- package/lib/tile/tmsTileLayer.js.map +0 -1
- package/lib/tile/utils.js +0 -147
- package/lib/tile/utils.js.map +0 -1
package/es/point/models/tile.js
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
|
|
10
|
-
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
|
-
|
|
12
|
-
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
|
-
|
|
14
|
-
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
|
-
import { getCullFace, getMask } from '@antv/l7-utils';
|
|
16
|
-
import BaseModel from '../../core/BaseModel';
|
|
17
|
-
import { PointFillTriangulation } from '../../core/triangulation';
|
|
18
|
-
var point_tile_frag = "uniform float u_additive;\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\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\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";
|
|
19
|
-
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\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_isMeter;\n\nuniform vec2 u_tileOrigin;\nuniform 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];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 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\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\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 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, 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 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,shape_type);\n\n vec4 project_pos = project_position(vec4(aPosition.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\nif(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 gl_PointSize = 24.0;\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";
|
|
20
|
-
import { Version } from '@antv/l7-maps';
|
|
21
|
-
|
|
22
|
-
var FillModel = function (_BaseModel) {
|
|
23
|
-
_inherits(FillModel, _BaseModel);
|
|
24
|
-
|
|
25
|
-
var _super = _createSuper(FillModel);
|
|
26
|
-
|
|
27
|
-
function FillModel() {
|
|
28
|
-
var _this;
|
|
29
|
-
|
|
30
|
-
_classCallCheck(this, FillModel);
|
|
31
|
-
|
|
32
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33
|
-
args[_key] = arguments[_key];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
37
|
-
|
|
38
|
-
_defineProperty(_assertThisInitialized(_this), "meter2coord", 1);
|
|
39
|
-
|
|
40
|
-
_defineProperty(_assertThisInitialized(_this), "isMeter", false);
|
|
41
|
-
|
|
42
|
-
return _this;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
_createClass(FillModel, [{
|
|
46
|
-
key: "getUninforms",
|
|
47
|
-
value: function getUninforms() {
|
|
48
|
-
var _ref = this.layer.getLayerConfig(),
|
|
49
|
-
_ref$opacity = _ref.opacity,
|
|
50
|
-
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
51
|
-
_ref$strokeOpacity = _ref.strokeOpacity,
|
|
52
|
-
strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
|
|
53
|
-
_ref$strokeWidth = _ref.strokeWidth,
|
|
54
|
-
strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
|
|
55
|
-
_ref$stroke = _ref.stroke,
|
|
56
|
-
stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
|
|
57
|
-
_ref$offsets = _ref.offsets,
|
|
58
|
-
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
59
|
-
blend = _ref.blend,
|
|
60
|
-
_ref$blur = _ref.blur,
|
|
61
|
-
blur = _ref$blur === void 0 ? 0 : _ref$blur,
|
|
62
|
-
_ref$coord = _ref.coord,
|
|
63
|
-
coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
|
|
64
|
-
tileOrigin = _ref.tileOrigin;
|
|
65
|
-
|
|
66
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
67
|
-
opacity: opacity,
|
|
68
|
-
strokeOpacity: strokeOpacity,
|
|
69
|
-
strokeWidth: strokeWidth,
|
|
70
|
-
stroke: stroke,
|
|
71
|
-
offsets: offsets
|
|
72
|
-
})) {
|
|
73
|
-
this.judgeStyleAttributes({
|
|
74
|
-
opacity: opacity,
|
|
75
|
-
strokeOpacity: strokeOpacity,
|
|
76
|
-
strokeWidth: strokeWidth,
|
|
77
|
-
stroke: stroke,
|
|
78
|
-
offsets: offsets
|
|
79
|
-
});
|
|
80
|
-
var encodeData = this.layer.getEncodedData();
|
|
81
|
-
|
|
82
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
83
|
-
data = _this$calDataFrame.data,
|
|
84
|
-
width = _this$calDataFrame.width,
|
|
85
|
-
height = _this$calDataFrame.height;
|
|
86
|
-
|
|
87
|
-
this.rowCount = height;
|
|
88
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
89
|
-
flipY: true,
|
|
90
|
-
data: data,
|
|
91
|
-
format: gl.LUMINANCE,
|
|
92
|
-
type: gl.FLOAT,
|
|
93
|
-
width: width,
|
|
94
|
-
height: height
|
|
95
|
-
}) : this.createTexture2D({
|
|
96
|
-
flipY: true,
|
|
97
|
-
data: [1],
|
|
98
|
-
format: gl.LUMINANCE,
|
|
99
|
-
type: gl.FLOAT,
|
|
100
|
-
width: 1,
|
|
101
|
-
height: 1
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
u_tileOrigin: tileOrigin || [0, 0],
|
|
107
|
-
u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
108
|
-
u_isMeter: Number(this.isMeter),
|
|
109
|
-
u_blur: blur,
|
|
110
|
-
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
111
|
-
u_dataTexture: this.dataTexture,
|
|
112
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
113
|
-
u_opacity: Number(opacity),
|
|
114
|
-
u_stroke_opacity: Number(strokeOpacity),
|
|
115
|
-
u_stroke_width: Number(strokeWidth),
|
|
116
|
-
u_stroke_color: this.getStrokeColor(stroke),
|
|
117
|
-
u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}, {
|
|
121
|
-
key: "getAttribute",
|
|
122
|
-
value: function getAttribute() {
|
|
123
|
-
return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(), PointFillTriangulation);
|
|
124
|
-
}
|
|
125
|
-
}, {
|
|
126
|
-
key: "initModels",
|
|
127
|
-
value: function initModels() {
|
|
128
|
-
var _ref2 = this.layer.getLayerConfig(),
|
|
129
|
-
_ref2$unit = _ref2.unit,
|
|
130
|
-
unit = _ref2$unit === void 0 ? 'l7size' : _ref2$unit;
|
|
131
|
-
|
|
132
|
-
var version = this.mapService.version;
|
|
133
|
-
|
|
134
|
-
if (unit === 'meter' && version !== Version.L7MAP && version !== Version.GLOBEL) {
|
|
135
|
-
this.isMeter = true;
|
|
136
|
-
this.calMeter2Coord();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return this.buildModels();
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
key: "calMeter2Coord",
|
|
143
|
-
value: function calMeter2Coord() {
|
|
144
|
-
var _this$layer$getSource = _slicedToArray(this.layer.getSource().extent, 4),
|
|
145
|
-
minLng = _this$layer$getSource[0],
|
|
146
|
-
minLat = _this$layer$getSource[1],
|
|
147
|
-
maxLng = _this$layer$getSource[2],
|
|
148
|
-
maxLat = _this$layer$getSource[3];
|
|
149
|
-
|
|
150
|
-
var center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];
|
|
151
|
-
var version = this.mapService.version;
|
|
152
|
-
|
|
153
|
-
if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {
|
|
154
|
-
var coord = window.mapboxgl.MercatorCoordinate.fromLngLat({
|
|
155
|
-
lng: center[0],
|
|
156
|
-
lat: center[1]
|
|
157
|
-
}, 0);
|
|
158
|
-
var offsetInMeters = 1;
|
|
159
|
-
var offsetInMercatorCoordinateUnits = offsetInMeters * coord.meterInMercatorCoordinateUnits();
|
|
160
|
-
var westCoord = new window.mapboxgl.MercatorCoordinate(coord.x - offsetInMercatorCoordinateUnits, coord.y, coord.z);
|
|
161
|
-
var westLnglat = westCoord.toLngLat();
|
|
162
|
-
this.meter2coord = center[0] - westLnglat.lng;
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
var m1 = this.mapService.meterToCoord(center, [minLng, minLat]);
|
|
167
|
-
var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
|
|
168
|
-
this.meter2coord = (m1 + m2) / 2;
|
|
169
|
-
|
|
170
|
-
if (!Boolean(this.meter2coord)) {
|
|
171
|
-
this.meter2coord = 7.70681090738883;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}, {
|
|
175
|
-
key: "buildModels",
|
|
176
|
-
value: function buildModels() {
|
|
177
|
-
var _ref3 = this.layer.getLayerConfig(),
|
|
178
|
-
_ref3$mask = _ref3.mask,
|
|
179
|
-
mask = _ref3$mask === void 0 ? false : _ref3$mask,
|
|
180
|
-
_ref3$maskInside = _ref3.maskInside,
|
|
181
|
-
maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside;
|
|
182
|
-
|
|
183
|
-
var _this$getShaders = this.getShaders(),
|
|
184
|
-
frag = _this$getShaders.frag,
|
|
185
|
-
vert = _this$getShaders.vert,
|
|
186
|
-
type = _this$getShaders.type;
|
|
187
|
-
|
|
188
|
-
this.layer.triangulation = PointFillTriangulation;
|
|
189
|
-
return [this.layer.buildLayerModel({
|
|
190
|
-
moduleName: type,
|
|
191
|
-
vertexShader: vert,
|
|
192
|
-
fragmentShader: frag,
|
|
193
|
-
triangulation: PointFillTriangulation,
|
|
194
|
-
depth: {
|
|
195
|
-
enable: false
|
|
196
|
-
},
|
|
197
|
-
blend: this.getBlend(),
|
|
198
|
-
stencil: getMask(mask, maskInside),
|
|
199
|
-
cull: {
|
|
200
|
-
enable: true,
|
|
201
|
-
face: getCullFace(this.mapService.version)
|
|
202
|
-
}
|
|
203
|
-
})];
|
|
204
|
-
}
|
|
205
|
-
}, {
|
|
206
|
-
key: "getShaders",
|
|
207
|
-
value: function getShaders() {
|
|
208
|
-
return {
|
|
209
|
-
frag: point_tile_frag,
|
|
210
|
-
vert: point_tile_vert,
|
|
211
|
-
type: 'point_fill_tile'
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
}, {
|
|
215
|
-
key: "clearModels",
|
|
216
|
-
value: function clearModels() {
|
|
217
|
-
var _this$dataTexture;
|
|
218
|
-
|
|
219
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
220
|
-
}
|
|
221
|
-
}, {
|
|
222
|
-
key: "registerBuiltinAttributes",
|
|
223
|
-
value: function registerBuiltinAttributes() {
|
|
224
|
-
var _this2 = this;
|
|
225
|
-
|
|
226
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
227
|
-
name: 'extrude',
|
|
228
|
-
type: AttributeType.Attribute,
|
|
229
|
-
descriptor: {
|
|
230
|
-
name: 'a_Extrude',
|
|
231
|
-
buffer: {
|
|
232
|
-
usage: gl.DYNAMIC_DRAW,
|
|
233
|
-
data: [],
|
|
234
|
-
type: gl.FLOAT
|
|
235
|
-
},
|
|
236
|
-
size: 3,
|
|
237
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
238
|
-
var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
|
|
239
|
-
var extrudeIndex = attributeIdx % 4 * 3;
|
|
240
|
-
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
245
|
-
name: 'size',
|
|
246
|
-
type: AttributeType.Attribute,
|
|
247
|
-
descriptor: {
|
|
248
|
-
name: 'a_Size',
|
|
249
|
-
buffer: {
|
|
250
|
-
usage: gl.DYNAMIC_DRAW,
|
|
251
|
-
data: [],
|
|
252
|
-
type: gl.FLOAT
|
|
253
|
-
},
|
|
254
|
-
size: 1,
|
|
255
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
256
|
-
var _feature$size = feature.size,
|
|
257
|
-
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
258
|
-
return Array.isArray(size) ? [size[0] * _this2.meter2coord] : [size * _this2.meter2coord];
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
263
|
-
name: 'shape',
|
|
264
|
-
type: AttributeType.Attribute,
|
|
265
|
-
descriptor: {
|
|
266
|
-
name: 'a_Shape',
|
|
267
|
-
buffer: {
|
|
268
|
-
usage: gl.DYNAMIC_DRAW,
|
|
269
|
-
data: [],
|
|
270
|
-
type: gl.FLOAT
|
|
271
|
-
},
|
|
272
|
-
size: 1,
|
|
273
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
274
|
-
var _feature$shape = feature.shape,
|
|
275
|
-
shape = _feature$shape === void 0 ? 2 : _feature$shape;
|
|
276
|
-
|
|
277
|
-
var shape2d = _this2.layer.getLayerConfig().shape2d;
|
|
278
|
-
|
|
279
|
-
var shapeIndex = shape2d.indexOf(shape);
|
|
280
|
-
return [shapeIndex];
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}]);
|
|
286
|
-
|
|
287
|
-
return FillModel;
|
|
288
|
-
}(BaseModel);
|
|
289
|
-
|
|
290
|
-
export { FillModel as default };
|
|
291
|
-
//# sourceMappingURL=tile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/point/models/tile.ts"],"names":["AttributeType","gl","getCullFace","getMask","BaseModel","PointFillTriangulation","Version","FillModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","blur","coord","tileOrigin","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_tileOrigin","u_coord","u_isMeter","Number","isMeter","u_blur","u_additive","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_stroke_opacity","u_stroke_width","u_stroke_color","getStrokeColor","u_offsets","isOffsetStatic","styleAttributeService","createAttributesAndIndices","unit","version","mapService","L7MAP","GLOBEL","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","depth","enable","getBlend","stencil","cull","face","point_tile_frag","point_tile_vert","destroy","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","extrude","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QASO,eATP;AAUA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,gBAArC;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,sBAAT,QAAuC,0BAAvC;;;AAKA,SAASC,OAAT,QAAwB,eAAxB;;IACqBC,S;;;;;;;;;;;;;;;;kEACU,C;;8DACF,K;;;;;;;WAC3B,wBAAqC;AACnC,iBAUI,KAAKC,KAAL,CAAWC,cAAX,EAVJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,oCAEEC,aAFF;AAAA,UAEEA,aAFF,mCAEkB,CAFlB;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,CAHhB;AAAA,6BAIEC,MAJF;AAAA,UAIEA,MAJF,4BAIW,eAJX;AAAA,8BAKEC,OALF;AAAA,UAKEA,OALF,6BAKY,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AEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEpH,EAAE,CAACqH,YAFJ;AAGN3F,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAEpC,EAAE,CAACqC;AAJH,WAFE;AAQViF,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,iCAAsBH,OAAtB,CAAQQ,KAAR;AAAA,gBAAQA,KAAR,+BAAgB,CAAhB;;AACA,gBAAMC,OAAO,GAAG,MAAI,CAAC1H,KAAL,CAAWC,cAAX,GAA4ByH,OAA5C;;AACA,gBAAMC,UAAU,GAAGD,OAAO,CAACE,OAAR,CAAgBH,KAAhB,CAAnB;AACA,mBAAO,CAACE,UAAD,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EA5RoC/H,S;;SAAlBG,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAttribute,\n IElements,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport { PointFillTriangulation } from '../../core/triangulation';\n\nimport point_tile_frag from '../shaders/tile/fill_tile_frag.glsl';\nimport point_tile_vert from '../shaders/tile/fill_tile_vert.glsl';\n\nimport { Version } from '@antv/l7-maps';\nexport default class FillModel extends BaseModel {\n public meter2coord: number = 1;\n private isMeter: boolean = false;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n blur = 0,\n coord = 'lnglat',\n tileOrigin,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_tileOrigin: tileOrigin || [0, 0],\n u_coord: coord === 'lnglat' ? 1.0 : 0.0,\n\n u_isMeter: Number(this.isMeter),\n u_blur: blur,\n\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: Number(opacity),\n u_stroke_opacity: Number(strokeOpacity),\n u_stroke_width: Number(strokeWidth),\n u_stroke_color: this.getStrokeColor(stroke),\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as Partial<\n ILayerConfig & IPointLayerStyleOptions\n >;\n const { frag, vert, type } = this.getShaders();\n\n this.layer.triangulation = PointFillTriangulation;\n return [\n this.layer.buildLayerModel({\n // primitive: gl.POINTS,\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: PointFillTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: point_tile_frag,\n vert: point_tile_vert,\n type: 'point_fill_tile',\n };\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'shape',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Shape',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { shape = 2 } = feature;\n const shape2d = this.layer.getLayerConfig().shape2d as string[];\n const shapeIndex = shape2d.indexOf(shape as string);\n return [shapeIndex];\n },\n },\n });\n }\n}\n"],"file":"tile.js"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IModel } from '@antv/l7-core';
|
|
2
|
-
import BaseModel from '../../core/BaseModel';
|
|
3
|
-
export default class FillModel extends BaseModel {
|
|
4
|
-
getUninforms(): {
|
|
5
|
-
u_tileOrigin: number[];
|
|
6
|
-
u_coord: number;
|
|
7
|
-
u_dataTexture: import("@antv/l7-core").ITexture2D;
|
|
8
|
-
u_cellTypeLayout: number[];
|
|
9
|
-
u_opacity: number;
|
|
10
|
-
};
|
|
11
|
-
initModels(): IModel[];
|
|
12
|
-
buildModels(): IModel[];
|
|
13
|
-
clearModels(): void;
|
|
14
|
-
protected registerBuiltinAttributes(): void;
|
|
15
|
-
private getModelParams;
|
|
16
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
|
|
9
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
|
-
import { gl } from '@antv/l7-core';
|
|
12
|
-
import { getMask } from '@antv/l7-utils';
|
|
13
|
-
import BaseModel from '../../core/BaseModel';
|
|
14
|
-
import { polygonTriangulation } from '../../core/triangulation';
|
|
15
|
-
var polygon_tile_frag = "uniform float u_opacity: 1.0;\nvarying vec4 v_Color;\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 gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
16
|
-
var polygon_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nvarying vec4 v_Color;\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\nstyleMappingMat = 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 // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\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 project_pos.z *= mapboxZoomScale;\n }\n\nif(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n} else {\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 += 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";
|
|
17
|
-
|
|
18
|
-
var FillModel = function (_BaseModel) {
|
|
19
|
-
_inherits(FillModel, _BaseModel);
|
|
20
|
-
|
|
21
|
-
var _super = _createSuper(FillModel);
|
|
22
|
-
|
|
23
|
-
function FillModel() {
|
|
24
|
-
_classCallCheck(this, FillModel);
|
|
25
|
-
|
|
26
|
-
return _super.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_createClass(FillModel, [{
|
|
30
|
-
key: "getUninforms",
|
|
31
|
-
value: function getUninforms() {
|
|
32
|
-
var _ref = this.layer.getLayerConfig(),
|
|
33
|
-
_ref$opacity = _ref.opacity,
|
|
34
|
-
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
35
|
-
tileOrigin = _ref.tileOrigin,
|
|
36
|
-
_ref$coord = _ref.coord,
|
|
37
|
-
coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord;
|
|
38
|
-
|
|
39
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
40
|
-
opacity: opacity
|
|
41
|
-
})) {
|
|
42
|
-
this.judgeStyleAttributes({
|
|
43
|
-
opacity: opacity
|
|
44
|
-
});
|
|
45
|
-
var encodeData = this.layer.getEncodedData();
|
|
46
|
-
|
|
47
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
48
|
-
data = _this$calDataFrame.data,
|
|
49
|
-
width = _this$calDataFrame.width,
|
|
50
|
-
height = _this$calDataFrame.height;
|
|
51
|
-
|
|
52
|
-
this.rowCount = height;
|
|
53
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
54
|
-
flipY: true,
|
|
55
|
-
data: data,
|
|
56
|
-
format: gl.LUMINANCE,
|
|
57
|
-
type: gl.FLOAT,
|
|
58
|
-
width: width,
|
|
59
|
-
height: height
|
|
60
|
-
}) : this.createTexture2D({
|
|
61
|
-
flipY: true,
|
|
62
|
-
data: [1],
|
|
63
|
-
format: gl.LUMINANCE,
|
|
64
|
-
type: gl.FLOAT,
|
|
65
|
-
width: 1,
|
|
66
|
-
height: 1
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
u_tileOrigin: tileOrigin || [0, 0],
|
|
72
|
-
u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
73
|
-
u_dataTexture: this.dataTexture,
|
|
74
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
75
|
-
u_opacity: opacity
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "initModels",
|
|
80
|
-
value: function initModels() {
|
|
81
|
-
return this.buildModels();
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "buildModels",
|
|
85
|
-
value: function buildModels() {
|
|
86
|
-
var _this$getModelParams = this.getModelParams(),
|
|
87
|
-
frag = _this$getModelParams.frag,
|
|
88
|
-
vert = _this$getModelParams.vert,
|
|
89
|
-
triangulation = _this$getModelParams.triangulation,
|
|
90
|
-
type = _this$getModelParams.type;
|
|
91
|
-
|
|
92
|
-
var _ref2 = this.layer.getLayerConfig(),
|
|
93
|
-
_ref2$mask = _ref2.mask,
|
|
94
|
-
mask = _ref2$mask === void 0 ? false : _ref2$mask,
|
|
95
|
-
_ref2$maskInside = _ref2.maskInside,
|
|
96
|
-
maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside;
|
|
97
|
-
|
|
98
|
-
this.layer.triangulation = triangulation;
|
|
99
|
-
return [this.layer.buildLayerModel({
|
|
100
|
-
moduleName: type,
|
|
101
|
-
vertexShader: vert,
|
|
102
|
-
fragmentShader: frag,
|
|
103
|
-
triangulation: triangulation,
|
|
104
|
-
blend: this.getBlend(),
|
|
105
|
-
depth: {
|
|
106
|
-
enable: false
|
|
107
|
-
},
|
|
108
|
-
stencil: getMask(mask, maskInside)
|
|
109
|
-
})];
|
|
110
|
-
}
|
|
111
|
-
}, {
|
|
112
|
-
key: "clearModels",
|
|
113
|
-
value: function clearModels() {
|
|
114
|
-
var _this$dataTexture;
|
|
115
|
-
|
|
116
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
117
|
-
}
|
|
118
|
-
}, {
|
|
119
|
-
key: "registerBuiltinAttributes",
|
|
120
|
-
value: function registerBuiltinAttributes() {}
|
|
121
|
-
}, {
|
|
122
|
-
key: "getModelParams",
|
|
123
|
-
value: function getModelParams() {
|
|
124
|
-
return {
|
|
125
|
-
frag: polygon_tile_frag,
|
|
126
|
-
vert: polygon_tile_vert,
|
|
127
|
-
type: 'polygon_tile',
|
|
128
|
-
triangulation: polygonTriangulation
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
}]);
|
|
132
|
-
|
|
133
|
-
return FillModel;
|
|
134
|
-
}(BaseModel);
|
|
135
|
-
|
|
136
|
-
export { FillModel as default };
|
|
137
|
-
//# sourceMappingURL=tile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/polygon/models/tile.ts"],"names":["gl","getMask","BaseModel","polygonTriangulation","FillModel","layer","getLayerConfig","opacity","tileOrigin","coord","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_tileOrigin","u_coord","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","buildModels","getModelParams","frag","vert","triangulation","mask","maskInside","buildLayerModel","moduleName","vertexShader","fragmentShader","blend","getBlend","depth","enable","stencil","destroy","polygon_tile_frag","polygon_tile_vert"],"mappings":";;;;;;;;;;AAAA,SAASA,EAAT,QAA0C,eAA1C;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,oBAAT,QAAqC,0BAArC;;;;IAIqBC,S;;;;;;;;;;;;;WACnB,wBAAsB;AACpB,iBAII,KAAKC,KAAL,CAAWC,cAAX,EAJJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,UAFF,QAEEA,UAFF;AAAA,4BAGEC,KAHF;AAAA,UAGEA,KAHF,2BAGU,QAHV;;AAKA,UAAI,KAAKC,eAAL,IAAwB,KAAKC,qBAAL,CAA2B;AAAEJ,QAAAA,OAAO,EAAPA;AAAF,OAA3B,CAA5B,EAAqE;AACnE,aAAKK,oBAAL,CAA0B;AAAEL,UAAAA,OAAO,EAAPA;AAAF,SAA1B;AACA,YAAMM,UAAU,GAAG,KAAKR,KAAL,CAAWS,cAAX,EAAnB;;AACA,iCAAgC,KAAKC,YAAL,CAC9B,KAAKC,UADyB,EAE9BH,UAF8B,EAG9B,KAAKI,cAHyB,CAAhC;AAAA,YAAQC,IAAR,sBAAQA,IAAR;AAAA,YAAcC,KAAd,sBAAcA,KAAd;AAAA,YAAqBC,MAArB,sBAAqBA,MAArB;;AAKA,aAAKC,QAAL,GAAgBD,MAAhB;AAEA,aAAKE,WAAL,GACE,KAAKN,UAAL,GAAkB,CAAlB,IAAuBE,IAAI,CAACK,MAAL,GAAc,CAArC,GACI,KAAKC,eAAL,CAA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AIA,WAAKrC,KAAL,CAAWmC,aAAX,GAA2BA,aAA3B;AACA,aAAO,CACL,KAAKnC,KAAL,CAAWsC,eAAX,CAA2B;AACzBC,QAAAA,UAAU,EAAEhB,IADa;AAEzBiB,QAAAA,YAAY,EAAEN,IAFW;AAGzBO,QAAAA,cAAc,EAAER,IAHS;AAIzBE,QAAAA,aAAa,EAAbA,aAJyB;AAKzBO,QAAAA,KAAK,EAAE,KAAKC,QAAL,EALkB;AAMzBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,MAAM,EAAE;AAAV,SANkB;AAOzBC,QAAAA,OAAO,EAAElD,OAAO,CAACwC,IAAD,EAAOC,UAAP;AAPS,OAA3B,CADK,CAAP;AAWD;;;WAED,uBAAqB;AAAA;;AACnB,gCAAKpB,WAAL,wEAAkB8B,OAAlB;AACD;;;WAED,qCAAsC,CAErC;;;WAED,0BAKE;AACA,aAAO;AACLd,QAAAA,IAAI,EAAEe,iBADD;AAELd,QAAAA,IAAI,EAAEe,iBAFD;AAGL1B,QAAAA,IAAI,EAAE,cAHD;AAILY,QAAAA,aAAa,EAAErC;AAJV,OAAP;AAMD;;;;EA3FoCD,S;;SAAlBE,S","sourcesContent":["import { gl, IModel, Triangulation } from '@antv/l7-core';\nimport { getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPolygonLayerStyleOptions } from '../../core/interface';\nimport { polygonTriangulation } from '../../core/triangulation';\n\nimport polygon_tile_frag from '../shaders/tile/polygon_tile_frag.glsl';\nimport polygon_tile_vert from '../shaders/tile/polygon_tile_vert.glsl';\nexport default class FillModel extends BaseModel {\n public getUninforms() {\n const {\n opacity = 1,\n tileOrigin,\n coord = 'lnglat',\n } = this.layer.getLayerConfig() as IPolygonLayerStyleOptions;\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_tileOrigin: tileOrigin || [0, 0],\n u_coord: coord === 'lnglat' ? 1.0 : 0.0,\n\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: opacity,\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public buildModels(): IModel[] {\n const { frag, vert, triangulation, type } = this.getModelParams();\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IPolygonLayerStyleOptions;\n this.layer.triangulation = triangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation,\n blend: this.getBlend(),\n depth: { enable: false },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n protected registerBuiltinAttributes() {\n //\n }\n\n private getModelParams(): {\n frag: string;\n vert: string;\n type: string;\n triangulation: Triangulation;\n } {\n return {\n frag: polygon_tile_frag,\n vert: polygon_tile_vert,\n type: 'polygon_tile',\n triangulation: polygonTriangulation,\n };\n }\n}\n"],"file":"tile.js"}
|
package/es/tile/interface.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ILayer, IMapService, IRendererService, IScaleValue, ISource, ISubLayerInitOptions, ScaleAttributeType } from '@antv/l7-core';
|
|
2
|
-
import { Tile } from '@antv/l7-utils';
|
|
3
|
-
export declare type Timeout = any;
|
|
4
|
-
export declare type CacheEvent = 'click' | 'mousemove' | 'mouseup' | 'mousedown' | 'contextmenu';
|
|
5
|
-
export interface ITileFactoryOptions {
|
|
6
|
-
parent: ILayer;
|
|
7
|
-
mapService: IMapService;
|
|
8
|
-
rendererService: IRendererService;
|
|
9
|
-
}
|
|
10
|
-
export interface ITileStyles {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}
|
|
13
|
-
export interface ILayerTileConfig {
|
|
14
|
-
L7Layer?: any;
|
|
15
|
-
tile: Tile;
|
|
16
|
-
initOptions: ISubLayerInitOptions;
|
|
17
|
-
vectorTileLayer?: any;
|
|
18
|
-
source: ISource;
|
|
19
|
-
}
|
|
20
|
-
export interface ITileFactory {
|
|
21
|
-
createTile(tile: Tile, initOptions: ISubLayerInitOptions): {
|
|
22
|
-
layers: ILayer[];
|
|
23
|
-
layerIDList: string[];
|
|
24
|
-
};
|
|
25
|
-
createLayer(option: ILayerTileConfig): ILayer;
|
|
26
|
-
updateStyle(styles: ITileStyles): string;
|
|
27
|
-
setStyleAttributeField(layer: ILayer, type: ScaleAttributeType, value: IScaleValue): void;
|
|
28
|
-
}
|
package/es/tile/interface.js
DELETED
package/es/tile/interface.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"interface.js"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ILayer, IScaleValue } from '@antv/l7-core';
|
|
2
|
-
import EventEmitter from 'eventemitter3';
|
|
3
|
-
export interface ITileConfigManager {
|
|
4
|
-
setConfig(key: string, value: any): void;
|
|
5
|
-
checkConfig(layer: ILayer): void;
|
|
6
|
-
on(event: string, fn: (...args: any[]) => void): void;
|
|
7
|
-
getAttributeScale(layer: ILayer, name: string): IScaleValue;
|
|
8
|
-
}
|
|
9
|
-
export default class TileConfigManager extends EventEmitter {
|
|
10
|
-
cacheConfig: Map<string, any>;
|
|
11
|
-
checkConfigList: string[];
|
|
12
|
-
constructor();
|
|
13
|
-
setConfig(key: string, value: any): void;
|
|
14
|
-
removeConfig(key: string): void;
|
|
15
|
-
checkConfig(layer: ILayer): void;
|
|
16
|
-
getAttributeScale(layer: ILayer, name: string): IScaleValue;
|
|
17
|
-
}
|