@antv/l7-layers 2.9.14 → 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 -4
- package/es/core/BaseLayer.js +21 -47
- 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 -13
- package/es/line/index.js.map +1 -1
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +1 -9
- package/es/line/models/index.js.map +1 -1
- package/es/plugins/DataMappingPlugin.js +1 -1
- package/es/plugins/DataMappingPlugin.js.map +1 -1
- package/es/plugins/DataSourcePlugin.js +6 -7
- package/es/plugins/DataSourcePlugin.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 -10
- package/es/point/index.js.map +1 -1
- package/es/point/models/extrude.d.ts +1 -0
- package/es/point/models/extrude.js +10 -2
- package/es/point/models/extrude.js.map +1 -1
- package/es/point/models/fill.d.ts +1 -8
- package/es/point/models/fill.js +75 -55
- 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 -9
- 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 +20 -45
- 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 -13
- package/lib/line/index.js.map +1 -1
- package/lib/line/models/index.js +1 -13
- package/lib/line/models/index.js.map +1 -1
- package/lib/plugins/DataMappingPlugin.js +1 -1
- package/lib/plugins/DataMappingPlugin.js.map +1 -1
- package/lib/plugins/DataSourcePlugin.js +6 -7
- package/lib/plugins/DataSourcePlugin.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 -10
- package/lib/point/index.js.map +1 -1
- package/lib/point/models/extrude.js +11 -2
- package/lib/point/models/extrude.js.map +1 -1
- package/lib/point/models/fill.js +93 -51
- package/lib/point/models/fill.js.map +1 -1
- package/lib/point/models/index.js +1 -13
- 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/earthArc_3d.d.ts +0 -17
- package/es/line/models/earthArc_3d.js +0 -311
- package/es/line/models/earthArc_3d.js.map +0 -1
- package/es/line/models/half.d.ts +0 -18
- package/es/line/models/half.js +0 -244
- package/es/line/models/half.js.map +0 -1
- 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/earthExtrude.d.ts +0 -24
- package/es/point/models/earthExtrude.js +0 -259
- package/es/point/models/earthExtrude.js.map +0 -1
- package/es/point/models/earthFill.d.ts +0 -20
- package/es/point/models/earthFill.js +0 -255
- package/es/point/models/earthFill.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/earthArc_3d.js +0 -328
- package/lib/line/models/earthArc_3d.js.map +0 -1
- package/lib/line/models/half.js +0 -260
- package/lib/line/models/half.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/earthExtrude.js +0 -277
- package/lib/point/models/earthExtrude.js.map +0 -1
- package/lib/point/models/earthFill.js +0 -291
- package/lib/point/models/earthFill.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/line/models/half.js
DELETED
|
@@ -1,244 +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
|
-
import _isNumber from "lodash/isNumber";
|
|
7
|
-
|
|
8
|
-
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); }; }
|
|
9
|
-
|
|
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
|
-
|
|
12
|
-
import { AttributeType, gl } from '@antv/l7-core';
|
|
13
|
-
import { getMask, rgb2arr } from '@antv/l7-utils';
|
|
14
|
-
import BaseModel from '../../core/BaseModel';
|
|
15
|
-
import { LineTriangulation } from '../../core/triangulation';
|
|
16
|
-
var line_half_frag = "#define COORDINATE_SYSTEM_LNGLAT 1.0 // mapbox\n#define COORDINATE_SYSTEM_LNGLAT_OFFSET 2.0 // mapbox offset\n#define COORDINATE_SYSTEM_VECTOR_TILE 3.0\n#define COORDINATE_SYSTEM_IDENTITY 4.0\n#define COORDINATE_SYSTEM_P20 5.0 // amap\n#define COORDINATE_SYSTEM_P20_OFFSET 6.0 // amap offset\n#define COORDINATE_SYSTEM_METER_OFFSET 7.0\n\n#define COORDINATE_SYSTEM_P20_2 8.0 // amap2.0\nuniform float u_CoordinateSystem;\nvarying vec4 v_color;\nuniform float u_arrow: 0.0;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\nvoid main() {\n float distanceAndIndex = styleMappingMat[0][3];\n float miter = styleMappingMat[0][2];\n\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n\n if(u_arrow > 0.0 && distanceAndIndex < 2.0) { // arrow\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) { \n if(cross(vec3(styleMappingMat[1].rg, 0.0), vec3(styleMappingMat[1].ba, 0.0)).z < 0.0) { // amap\n discard;\n }\n } else { // amap2 mapbox map\n if(cross(vec3(styleMappingMat[1].rg, 0.0), vec3(styleMappingMat[1].ba, 0.0)).z > 0.0) { \n discard;\n }\n }\n } else { // line body\n if(miter < 0.0) {\n discard;\n }\n }\n\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
17
|
-
var line_half_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute vec4 a_dirPoints;\nattribute vec3 a_DistanceAndIndex;\n\nuniform vec4 u_lineDir;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\nuniform float u_linearColor: 0;\nuniform float u_arrow: 0.0;\nuniform float u_arrowHeight: 3.0;\nuniform float u_arrowWidth: 2.0;\nuniform float u_tailWidth: 1.0;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvec2 calculateArrow(vec2 offset) {\n /*\n * \u5728\u652F\u6301\u7BAD\u5934\u7684\u65F6\u5019\uFF0C\u7B2C\u4E8C\u3001\u7B2C\u4E09\u7EC4\u9876\u70B9\u662F\u989D\u5916\u63D2\u5165\u7528\u4E8E\u6784\u5EFA\u9876\u70B9\u7684\n */\n float arrowFlag = -1.0;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // \u9AD8\u5FB7 2.0 \u7684\u65CB\u8F6C\u89D2\u5EA6\u4E0D\u540C\n arrowFlag = 1.0;\n }\n float pi = arrowFlag * 3.1415926/2.;\n if(a_Miter < 0.) {\n // \u6839\u636E\u7EBF\u7684\u4E24\u4FA7\u504F\u79FB\u4E0D\u540C\u3001\u65CB\u8F6C\u7684\u65B9\u5411\u76F8\u53CD\n pi = -pi;\n }\n highp float angle_sin = sin(pi);\n highp float angle_cos = cos(pi);\n // \u8BA1\u7B97\u5782\u76F4\u4E0E\u7EBF\u65B9\u5411\u7684\u65CB\u8F6C\u77E9\u9635\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float arrowWidth = u_arrowWidth;\n float arrowHeight = u_arrowHeight;\n\n vec2 arrowOffset = vec2(0.0);\n /*\n * a_DistanceAndIndex.y \u7528\u4E8E\u6807\u8BB0\u5F53\u524D\u9876\u70B9\u5C5E\u4E8E\u54EA\u4E00\u7EC4\uFF08\u4E24\u4E2A\u9876\u70B9\u4E00\u7EC4\uFF0C\u6784\u6210\u7EBF\u7684\u5176\u5B9E\u662F\u77E9\u5F62\uFF0C\u6700\u7B80\u9700\u8981\u56DB\u4E2A\u9876\u70B9\u3001\u4E24\u7EC4\u9876\u70B9\u6784\u6210\uFF09\n */\n if(a_DistanceAndIndex.y == 0.0) {\n // \u7BAD\u5934\u5C16\u90E8\n offset = vec2(0.0);\n } else if(a_DistanceAndIndex.y == 1.0) {\n // \u7BAD\u5934\u4E24\u4FA7\n arrowOffset = rotation_matrix*(offset * arrowHeight);\n offset += arrowOffset; // \u6CBF\u7EBF\u504F\u79FB\n offset = offset * arrowWidth; // \u5782\u76F4\u7EBF\u5411\u5916\u504F\u79FB\uFF08\u662F\u6784\u5EFA\u7BAD\u5934\u4E24\u4FA7\u7684\u9876\u70B9\uFF09\n } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {\n // \u504F\u79FB\u5176\u4F59\u7684\u70B9\u4F4D\uFF08\u5C06\u957F\u5EA6\u8BA9\u4F4D\u7ED9\u7BAD\u5934\uFF09\n arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;\n offset += arrowOffset;// \u6CBF\u7EBF\u504F\u79FB\n }\n\n return offset;\n}\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - a_Miter - a_DistanceAndIndex\n 0.0, 0.0, 0.0, 0.0, // originX - originY - vectorX - vectorY\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n styleMappingMat[0][3] = a_DistanceAndIndex.y;\n styleMappingMat[0][2] = a_Miter;\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\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n // styleMappingMat[1].rg = a_Position.xy + offset;\n\n vec2 copyOffset = vec2(offset.x, offset.y);\n\n float lineDistance = a_DistanceAndIndex.x;\n float total_Distance = a_DistanceAndIndex.z;\n float currentLinePointRatio = lineDistance / total_Distance;\n \n if(u_arrow > 0.0) {\n // \u8BA1\u7B97\u7BAD\u5934\n offset = calculateArrow(offset);\n\n if(a_DistanceAndIndex.y > 4.0) {\n offset *= mix(1.0, u_tailWidth, currentLinePointRatio);\n }\n }\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = lineDistance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z); // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight, 1.0));\n }\n \n if(u_arrow > 0.0 && a_DistanceAndIndex.y < 2.0) {\n vec2 startPoint = a_dirPoints.rg;\n vec2 endPoint = a_dirPoints.ba;\n vec4 t1 = project_position(vec4(startPoint, 0, 1.0));\n vec4 t2 = project_position(vec4(endPoint, 0, 1.0));\n // TODO\uFF1A \u540E\u7EED\u4F18\u5316\u53EF\u4EE5\u628A\u4F4D\u7F6E\u8BA1\u7B97\u653E\u5728 cpu \u4E2D\u5B8C\u6210\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n vec2 p1 = (u_Mvp * vec4(t1.xy, 0.0, 1.0)).xy;\n vec2 p2 = (u_Mvp * vec4(t2.xy, 0.0, 1.0)).xy;\n styleMappingMat[1].rg = normalize(p1 - p2);\n styleMappingMat[1].ba = normalize(gl_Position.xy - p2);\n } else {\n vec2 p1 = project_common_position_to_clipspace(vec4(t1.xy, 0.0, 1.0)).xy;\n vec2 p2 = project_common_position_to_clipspace(vec4(t2.xy, 0.0, 1.0)).xy;\n styleMappingMat[1].rg = normalize(p1 - p2);\n styleMappingMat[1].ba = normalize(gl_Position.xy - p2);\n }\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
18
|
-
|
|
19
|
-
var LineModel = function (_BaseModel) {
|
|
20
|
-
_inherits(LineModel, _BaseModel);
|
|
21
|
-
|
|
22
|
-
var _super = _createSuper(LineModel);
|
|
23
|
-
|
|
24
|
-
function LineModel() {
|
|
25
|
-
_classCallCheck(this, LineModel);
|
|
26
|
-
|
|
27
|
-
return _super.apply(this, arguments);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_createClass(LineModel, [{
|
|
31
|
-
key: "getUninforms",
|
|
32
|
-
value: function getUninforms() {
|
|
33
|
-
var _ref = this.layer.getLayerConfig(),
|
|
34
|
-
_ref$opacity = _ref.opacity,
|
|
35
|
-
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
36
|
-
sourceColor = _ref.sourceColor,
|
|
37
|
-
targetColor = _ref.targetColor,
|
|
38
|
-
_ref$arrow = _ref.arrow,
|
|
39
|
-
arrow = _ref$arrow === void 0 ? {
|
|
40
|
-
enable: false,
|
|
41
|
-
arrowWidth: 2,
|
|
42
|
-
arrowHeight: 3,
|
|
43
|
-
tailWidth: 1
|
|
44
|
-
} : _ref$arrow;
|
|
45
|
-
|
|
46
|
-
var useLinearColor = 0;
|
|
47
|
-
var sourceColorArr = [0, 0, 0, 0];
|
|
48
|
-
var targetColorArr = [0, 0, 0, 0];
|
|
49
|
-
|
|
50
|
-
if (sourceColor && targetColor) {
|
|
51
|
-
sourceColorArr = rgb2arr(sourceColor);
|
|
52
|
-
targetColorArr = rgb2arr(targetColor);
|
|
53
|
-
useLinearColor = 1;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
57
|
-
opacity: opacity
|
|
58
|
-
})) {
|
|
59
|
-
this.judgeStyleAttributes({
|
|
60
|
-
opacity: opacity
|
|
61
|
-
});
|
|
62
|
-
var encodeData = this.layer.getEncodedData();
|
|
63
|
-
|
|
64
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
65
|
-
data = _this$calDataFrame.data,
|
|
66
|
-
width = _this$calDataFrame.width,
|
|
67
|
-
height = _this$calDataFrame.height;
|
|
68
|
-
|
|
69
|
-
this.rowCount = height;
|
|
70
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
71
|
-
flipY: true,
|
|
72
|
-
data: data,
|
|
73
|
-
format: gl.LUMINANCE,
|
|
74
|
-
type: gl.FLOAT,
|
|
75
|
-
width: width,
|
|
76
|
-
height: height
|
|
77
|
-
}) : this.createTexture2D({
|
|
78
|
-
flipY: true,
|
|
79
|
-
data: [1],
|
|
80
|
-
format: gl.LUMINANCE,
|
|
81
|
-
type: gl.FLOAT,
|
|
82
|
-
width: 1,
|
|
83
|
-
height: 1
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
u_dataTexture: this.dataTexture,
|
|
89
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
90
|
-
u_opacity: _isNumber(opacity) ? opacity : 1.0,
|
|
91
|
-
u_linearColor: useLinearColor,
|
|
92
|
-
u_sourceColor: sourceColorArr,
|
|
93
|
-
u_targetColor: targetColorArr,
|
|
94
|
-
u_arrow: Number(arrow.enable),
|
|
95
|
-
u_arrowHeight: arrow.arrowHeight || 3,
|
|
96
|
-
u_arrowWidth: arrow.arrowWidth || 2,
|
|
97
|
-
u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
key: "initModels",
|
|
102
|
-
value: function initModels() {
|
|
103
|
-
return this.buildModels();
|
|
104
|
-
}
|
|
105
|
-
}, {
|
|
106
|
-
key: "clearModels",
|
|
107
|
-
value: function clearModels() {
|
|
108
|
-
var _this$dataTexture;
|
|
109
|
-
|
|
110
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
key: "buildModels",
|
|
114
|
-
value: function buildModels() {
|
|
115
|
-
var _ref2 = this.layer.getLayerConfig(),
|
|
116
|
-
_ref2$mask = _ref2.mask,
|
|
117
|
-
mask = _ref2$mask === void 0 ? false : _ref2$mask,
|
|
118
|
-
_ref2$maskInside = _ref2.maskInside,
|
|
119
|
-
maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
|
|
120
|
-
_ref2$depth = _ref2.depth,
|
|
121
|
-
depth = _ref2$depth === void 0 ? false : _ref2$depth;
|
|
122
|
-
|
|
123
|
-
var _this$getShaders = this.getShaders(),
|
|
124
|
-
frag = _this$getShaders.frag,
|
|
125
|
-
vert = _this$getShaders.vert;
|
|
126
|
-
|
|
127
|
-
this.layer.triangulation = LineTriangulation;
|
|
128
|
-
return [this.layer.buildLayerModel({
|
|
129
|
-
moduleName: 'line_half',
|
|
130
|
-
vertexShader: vert,
|
|
131
|
-
fragmentShader: frag,
|
|
132
|
-
triangulation: LineTriangulation,
|
|
133
|
-
primitive: gl.TRIANGLES,
|
|
134
|
-
blend: this.getBlend(),
|
|
135
|
-
depth: {
|
|
136
|
-
enable: depth
|
|
137
|
-
},
|
|
138
|
-
stencil: getMask(mask, maskInside)
|
|
139
|
-
})];
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
key: "getShaders",
|
|
143
|
-
value: function getShaders() {
|
|
144
|
-
return {
|
|
145
|
-
frag: line_half_frag,
|
|
146
|
-
vert: line_half_vert,
|
|
147
|
-
type: 'normal'
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
key: "registerBuiltinAttributes",
|
|
152
|
-
value: function registerBuiltinAttributes() {
|
|
153
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
154
|
-
name: 'distanceAndIndex',
|
|
155
|
-
type: AttributeType.Attribute,
|
|
156
|
-
descriptor: {
|
|
157
|
-
name: 'a_DistanceAndIndex',
|
|
158
|
-
buffer: {
|
|
159
|
-
usage: gl.STATIC_DRAW,
|
|
160
|
-
data: [],
|
|
161
|
-
type: gl.FLOAT
|
|
162
|
-
},
|
|
163
|
-
size: 3,
|
|
164
|
-
update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
|
|
165
|
-
return vertexIndex === undefined ? [vertex[3], 10, vertex[5]] : [vertex[3], vertexIndex, vertex[5]];
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
170
|
-
name: 'dirPoints',
|
|
171
|
-
type: AttributeType.Attribute,
|
|
172
|
-
descriptor: {
|
|
173
|
-
name: 'a_dirPoints',
|
|
174
|
-
buffer: {
|
|
175
|
-
usage: gl.STATIC_DRAW,
|
|
176
|
-
data: [],
|
|
177
|
-
type: gl.FLOAT
|
|
178
|
-
},
|
|
179
|
-
size: 4,
|
|
180
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
181
|
-
var startPoint = feature.coordinates[0] || [0, 0];
|
|
182
|
-
var endPoint = feature.coordinates[3] || [0, 0];
|
|
183
|
-
return [startPoint[0], startPoint[1], endPoint[0], endPoint[1]];
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
188
|
-
name: 'size',
|
|
189
|
-
type: AttributeType.Attribute,
|
|
190
|
-
descriptor: {
|
|
191
|
-
name: 'a_Size',
|
|
192
|
-
buffer: {
|
|
193
|
-
usage: gl.DYNAMIC_DRAW,
|
|
194
|
-
data: [],
|
|
195
|
-
type: gl.FLOAT
|
|
196
|
-
},
|
|
197
|
-
size: 2,
|
|
198
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
199
|
-
var _feature$size = feature.size,
|
|
200
|
-
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
201
|
-
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
206
|
-
name: 'normal',
|
|
207
|
-
type: AttributeType.Attribute,
|
|
208
|
-
descriptor: {
|
|
209
|
-
name: 'a_Normal',
|
|
210
|
-
buffer: {
|
|
211
|
-
usage: gl.STATIC_DRAW,
|
|
212
|
-
data: [],
|
|
213
|
-
type: gl.FLOAT
|
|
214
|
-
},
|
|
215
|
-
size: 3,
|
|
216
|
-
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
217
|
-
return normal;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
222
|
-
name: 'miter',
|
|
223
|
-
type: AttributeType.Attribute,
|
|
224
|
-
descriptor: {
|
|
225
|
-
name: 'a_Miter',
|
|
226
|
-
buffer: {
|
|
227
|
-
usage: gl.STATIC_DRAW,
|
|
228
|
-
data: [],
|
|
229
|
-
type: gl.FLOAT
|
|
230
|
-
},
|
|
231
|
-
size: 1,
|
|
232
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
233
|
-
return [vertex[4]];
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}]);
|
|
239
|
-
|
|
240
|
-
return LineModel;
|
|
241
|
-
}(BaseModel);
|
|
242
|
-
|
|
243
|
-
export { LineModel as default };
|
|
244
|
-
//# sourceMappingURL=half.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/half.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineTriangulation","LineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","arrow","enable","arrowWidth","arrowHeight","tailWidth","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_arrow","Number","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","buildModels","destroy","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_half_frag","line_half_vert","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","v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,EAAE,QAD0C;AAEhDrC,QAAAA,IAAI,EAAEtC,aAAa,CAAC4E,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,UADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE9E,EAAE,CAAC+E,WAFJ;AAGNpD,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAErC,EAAE,CAACsC;AAJH,WAFE;AAQV0C,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKNC,MALM,EAMH;AACH,mBAAOA,MAAP;AACD;AAjBS;AAHoC,OAAlD;AAwBA,WAAKd,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDrC,QAAAA,IAAI,EAAEtC,aAAa,CAAC4E,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE9E,EAAE,CAAC+E,WAFJ;AAGNpD,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAErC,EAAE,CAACsC;AAJH,WAFE;AAQV0C,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EA9OoCjF,S;;SAAlBE,S","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_half_frag from '../shaders/half/line_half_frag.glsl';\nimport line_half_vert from '../shaders/half/line_half_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\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_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'line_half',\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: line_half_frag,\n vert: line_half_vert,\n type: 'normal',\n };\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10, vertex[5]]\n : [vertex[3], vertexIndex, vertex[5]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'dirPoints',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_dirPoints',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n // console.log(feature)\n const startPoint = (feature.coordinates[0] || [0, 0]) as number[];\n const endPoint = (feature.coordinates[3] || [0, 0]) as number[];\n\n return [startPoint[0], startPoint[1], endPoint[0], endPoint[1]];\n },\n },\n });\n\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: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_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 return [vertex[4]];\n },\n },\n });\n }\n}\n"],"file":"half.js"}
|
package/es/line/models/tile.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
|
|
2
|
-
import BaseModel from '../../core/BaseModel';
|
|
3
|
-
export default class LineModel extends BaseModel {
|
|
4
|
-
protected texture: ITexture2D;
|
|
5
|
-
getUninforms(): IModelUniform;
|
|
6
|
-
initModels(): IModel[];
|
|
7
|
-
clearModels(): void;
|
|
8
|
-
buildModels(): IModel[];
|
|
9
|
-
/**
|
|
10
|
-
* 根据参数获取不同的 shader 代码
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
getShaders(): {
|
|
14
|
-
frag: string;
|
|
15
|
-
vert: string;
|
|
16
|
-
type: string;
|
|
17
|
-
};
|
|
18
|
-
protected registerBuiltinAttributes(): void;
|
|
19
|
-
private updateTexture;
|
|
20
|
-
}
|
package/es/line/models/tile.js
DELETED
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
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); }; }
|
|
10
|
-
|
|
11
|
-
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; } }
|
|
12
|
-
|
|
13
|
-
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
|
-
import { getMask, rgb2arr } from '@antv/l7-utils';
|
|
15
|
-
import BaseModel from '../../core/BaseModel';
|
|
16
|
-
import { LineTriangulation } from '../../core/triangulation';
|
|
17
|
-
var line_tile_frag = "#define LineTexture 1.0\nuniform float u_blur : 0.99;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\n\nuniform float u_borderWidth: 0.0;\nuniform vec4 u_borderColor;\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying vec2 v_iconMapUV;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n \n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));\n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor += pattern;\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = pattern;\n }\n } \n\n float v = styleMappingMat[3].a;\n float borderWidth = min(0.5, u_borderWidth);\n // \u7ED8\u5236 border\n if(borderWidth > 0.01) {\n float borderOuterWidth = borderWidth/2.0;\n\n if(v >= 1.0 - borderWidth || v <= borderWidth) {\n if(v > borderWidth) {\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);\n } else if(v <= borderWidth) {\n float linear = smoothstep(0.0, 1.0, v/borderWidth);\n gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
18
|
-
var line_tile_vert = "\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_icon_step: 100;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\n\nuniform float u_linearColor: 0;\nuniform float u_arrow: 0.0;\nuniform float u_arrowHeight: 3.0;\nuniform float u_arrowWidth: 2.0;\nuniform float u_tailWidth: 1.0;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvec2 calculateArrow(vec2 offset) {\n /*\n * \u5728\u652F\u6301\u7BAD\u5934\u7684\u65F6\u5019\uFF0C\u7B2C\u4E8C\u3001\u7B2C\u4E09\u7EC4\u9876\u70B9\u662F\u989D\u5916\u63D2\u5165\u7528\u4E8E\u6784\u5EFA\u9876\u70B9\u7684\n */\n float arrowFlag = -1.0;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // \u9AD8\u5FB7 2.0 \u7684\u65CB\u8F6C\u89D2\u5EA6\u4E0D\u540C\n arrowFlag = 1.0;\n }\n float pi = arrowFlag * 3.1415926/2.;\n if(a_Miter < 0.) {\n // \u6839\u636E\u7EBF\u7684\u4E24\u4FA7\u504F\u79FB\u4E0D\u540C\u3001\u65CB\u8F6C\u7684\u65B9\u5411\u76F8\u53CD\n pi = -pi;\n }\n highp float angle_sin = sin(pi);\n highp float angle_cos = cos(pi);\n // \u8BA1\u7B97\u5782\u76F4\u4E0E\u7EBF\u65B9\u5411\u7684\u65CB\u8F6C\u77E9\u9635\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float arrowWidth = u_arrowWidth;\n float arrowHeight = u_arrowHeight;\n\n vec2 arrowOffset = vec2(0.0);\n /*\n * a_DistanceAndIndex.y \u7528\u4E8E\u6807\u8BB0\u5F53\u524D\u9876\u70B9\u5C5E\u4E8E\u54EA\u4E00\u7EC4\uFF08\u4E24\u4E2A\u9876\u70B9\u4E00\u7EC4\uFF0C\u6784\u6210\u7EBF\u7684\u5176\u5B9E\u662F\u77E9\u5F62\uFF0C\u6700\u7B80\u9700\u8981\u56DB\u4E2A\u9876\u70B9\u3001\u4E24\u7EC4\u9876\u70B9\u6784\u6210\uFF09\n */\n if(a_DistanceAndIndex.y == 0.0) {\n // \u7BAD\u5934\u5C16\u90E8\n offset = vec2(0.0);\n } else if(a_DistanceAndIndex.y == 1.0) {\n // \u7BAD\u5934\u4E24\u4FA7\n arrowOffset = rotation_matrix*(offset * arrowHeight);\n offset += arrowOffset; // \u6CBF\u7EBF\u504F\u79FB\n offset = offset * arrowWidth; // \u5782\u76F4\u7EBF\u5411\u5916\u504F\u79FB\uFF08\u662F\u6784\u5EFA\u7BAD\u5934\u4E24\u4FA7\u7684\u9876\u70B9\uFF09\n } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {\n // \u504F\u79FB\u5176\u4F59\u7684\u70B9\u4F4D\uFF08\u5C06\u957F\u5EA6\u8BA9\u4F4D\u7ED9\u7BAD\u5934\uFF09\n arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;\n offset += arrowOffset;// \u6CBF\u7EBF\u504F\u79FB\n }\n\n return offset;\n}\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\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 float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n if(u_arrow > 0.0) {\n // \u8BA1\u7B97\u7BAD\u5934\n offset = calculateArrow(offset);\n\n if(a_DistanceAndIndex.y > 4.0) {\n offset *= mix(1.0, u_tailWidth, currentLinePointRatio);\n }\n }\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = lineDistance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\nif(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n} else {\n vec2 pointPos = a_Position.xy;\n vec4 tileWorld = 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 tileWorld.xy += pointOffset;\n\n tileWorld.xy += offset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n tileWorld.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;\n}\n\n\n setPickingColor(a_PickingColor);\n\n\n}\n";
|
|
19
|
-
|
|
20
|
-
var LineModel = function (_BaseModel) {
|
|
21
|
-
_inherits(LineModel, _BaseModel);
|
|
22
|
-
|
|
23
|
-
var _super = _createSuper(LineModel);
|
|
24
|
-
|
|
25
|
-
function LineModel() {
|
|
26
|
-
var _this;
|
|
27
|
-
|
|
28
|
-
_classCallCheck(this, LineModel);
|
|
29
|
-
|
|
30
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31
|
-
args[_key] = arguments[_key];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
35
|
-
|
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "texture", void 0);
|
|
37
|
-
|
|
38
|
-
_defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
|
|
39
|
-
var createTexture2D = _this.rendererService.createTexture2D;
|
|
40
|
-
|
|
41
|
-
if (_this.texture) {
|
|
42
|
-
_this.texture.update({
|
|
43
|
-
data: _this.iconService.getCanvas()
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
_this.layer.render();
|
|
47
|
-
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_this.texture = createTexture2D({
|
|
52
|
-
data: _this.iconService.getCanvas(),
|
|
53
|
-
mag: gl.NEAREST,
|
|
54
|
-
min: gl.NEAREST,
|
|
55
|
-
premultiplyAlpha: false,
|
|
56
|
-
width: 1024,
|
|
57
|
-
height: _this.iconService.canvasHeight || 128
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
return _this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
_createClass(LineModel, [{
|
|
65
|
-
key: "getUninforms",
|
|
66
|
-
value: function getUninforms() {
|
|
67
|
-
var _ref = this.layer.getLayerConfig(),
|
|
68
|
-
_ref$opacity = _ref.opacity,
|
|
69
|
-
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
70
|
-
_ref$textureBlend = _ref.textureBlend,
|
|
71
|
-
textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
|
|
72
|
-
_ref$lineTexture = _ref.lineTexture,
|
|
73
|
-
lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
|
|
74
|
-
_ref$iconStep = _ref.iconStep,
|
|
75
|
-
iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
|
|
76
|
-
_ref$vertexHeightScal = _ref.vertexHeightScale,
|
|
77
|
-
vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal,
|
|
78
|
-
_ref$borderWidth = _ref.borderWidth,
|
|
79
|
-
borderWidth = _ref$borderWidth === void 0 ? 0.0 : _ref$borderWidth,
|
|
80
|
-
_ref$borderColor = _ref.borderColor,
|
|
81
|
-
borderColor = _ref$borderColor === void 0 ? '#ccc' : _ref$borderColor,
|
|
82
|
-
_ref$heightfixed = _ref.heightfixed,
|
|
83
|
-
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
84
|
-
_ref$arrow = _ref.arrow,
|
|
85
|
-
arrow = _ref$arrow === void 0 ? {
|
|
86
|
-
enable: false,
|
|
87
|
-
arrowWidth: 2,
|
|
88
|
-
arrowHeight: 3,
|
|
89
|
-
tailWidth: 1
|
|
90
|
-
} : _ref$arrow,
|
|
91
|
-
_ref$coord = _ref.coord,
|
|
92
|
-
coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
|
|
93
|
-
tileOrigin = _ref.tileOrigin;
|
|
94
|
-
|
|
95
|
-
if (this.rendererService.getDirty()) {
|
|
96
|
-
this.texture.bind();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
100
|
-
opacity: opacity
|
|
101
|
-
})) {
|
|
102
|
-
this.judgeStyleAttributes({
|
|
103
|
-
opacity: opacity
|
|
104
|
-
});
|
|
105
|
-
var encodeData = this.layer.getEncodedData();
|
|
106
|
-
|
|
107
|
-
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
108
|
-
data = _this$calDataFrame.data,
|
|
109
|
-
width = _this$calDataFrame.width,
|
|
110
|
-
height = _this$calDataFrame.height;
|
|
111
|
-
|
|
112
|
-
this.rowCount = height;
|
|
113
|
-
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
114
|
-
flipY: true,
|
|
115
|
-
data: data,
|
|
116
|
-
format: gl.LUMINANCE,
|
|
117
|
-
type: gl.FLOAT,
|
|
118
|
-
width: width,
|
|
119
|
-
height: height
|
|
120
|
-
}) : this.createTexture2D({
|
|
121
|
-
flipY: true,
|
|
122
|
-
data: [1],
|
|
123
|
-
format: gl.LUMINANCE,
|
|
124
|
-
type: gl.FLOAT,
|
|
125
|
-
width: 1,
|
|
126
|
-
height: 1
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
u_tileOrigin: tileOrigin || [0, 0],
|
|
132
|
-
u_coord: coord === 'lnglat' ? 1.0 : 0.0,
|
|
133
|
-
u_dataTexture: this.dataTexture,
|
|
134
|
-
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
135
|
-
u_opacity: Number(opacity),
|
|
136
|
-
u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
|
|
137
|
-
u_texture: this.texture,
|
|
138
|
-
u_line_texture: lineTexture ? 1.0 : 0.0,
|
|
139
|
-
u_icon_step: iconStep,
|
|
140
|
-
u_textSize: [1024, this.iconService.canvasHeight || 128],
|
|
141
|
-
u_borderWidth: borderWidth,
|
|
142
|
-
u_borderColor: rgb2arr(borderColor),
|
|
143
|
-
u_heightfixed: Number(heightfixed),
|
|
144
|
-
u_vertexScale: vertexHeightScale,
|
|
145
|
-
u_arrow: Number(arrow.enable),
|
|
146
|
-
u_arrowHeight: arrow.arrowHeight || 3,
|
|
147
|
-
u_arrowWidth: arrow.arrowWidth || 2,
|
|
148
|
-
u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}, {
|
|
152
|
-
key: "initModels",
|
|
153
|
-
value: function initModels() {
|
|
154
|
-
this.updateTexture();
|
|
155
|
-
this.iconService.on('imageUpdate', this.updateTexture);
|
|
156
|
-
return this.buildModels();
|
|
157
|
-
}
|
|
158
|
-
}, {
|
|
159
|
-
key: "clearModels",
|
|
160
|
-
value: function clearModels() {
|
|
161
|
-
var _this$texture, _this$dataTexture;
|
|
162
|
-
|
|
163
|
-
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
164
|
-
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
165
|
-
this.iconService.off('imageUpdate', this.updateTexture);
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
key: "buildModels",
|
|
169
|
-
value: function buildModels() {
|
|
170
|
-
var _ref2 = this.layer.getLayerConfig(),
|
|
171
|
-
_ref2$mask = _ref2.mask,
|
|
172
|
-
mask = _ref2$mask === void 0 ? false : _ref2$mask,
|
|
173
|
-
_ref2$maskInside = _ref2.maskInside,
|
|
174
|
-
maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
|
|
175
|
-
_ref2$depth = _ref2.depth,
|
|
176
|
-
depth = _ref2$depth === void 0 ? false : _ref2$depth;
|
|
177
|
-
|
|
178
|
-
var _this$getShaders = this.getShaders(),
|
|
179
|
-
frag = _this$getShaders.frag,
|
|
180
|
-
vert = _this$getShaders.vert,
|
|
181
|
-
type = _this$getShaders.type;
|
|
182
|
-
|
|
183
|
-
this.layer.triangulation = LineTriangulation;
|
|
184
|
-
return [this.layer.buildLayerModel({
|
|
185
|
-
moduleName: type,
|
|
186
|
-
vertexShader: vert,
|
|
187
|
-
fragmentShader: frag,
|
|
188
|
-
triangulation: LineTriangulation,
|
|
189
|
-
primitive: gl.TRIANGLES,
|
|
190
|
-
blend: this.getBlend(),
|
|
191
|
-
depth: {
|
|
192
|
-
enable: depth
|
|
193
|
-
},
|
|
194
|
-
stencil: getMask(mask, maskInside)
|
|
195
|
-
})];
|
|
196
|
-
}
|
|
197
|
-
}, {
|
|
198
|
-
key: "getShaders",
|
|
199
|
-
value: function getShaders() {
|
|
200
|
-
return {
|
|
201
|
-
frag: line_tile_frag,
|
|
202
|
-
vert: line_tile_vert,
|
|
203
|
-
type: 'line_tile'
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "registerBuiltinAttributes",
|
|
208
|
-
value: function registerBuiltinAttributes() {
|
|
209
|
-
var _this2 = this;
|
|
210
|
-
|
|
211
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
212
|
-
name: 'distanceAndIndex',
|
|
213
|
-
type: AttributeType.Attribute,
|
|
214
|
-
descriptor: {
|
|
215
|
-
name: 'a_DistanceAndIndex',
|
|
216
|
-
buffer: {
|
|
217
|
-
usage: gl.STATIC_DRAW,
|
|
218
|
-
data: [],
|
|
219
|
-
type: gl.FLOAT
|
|
220
|
-
},
|
|
221
|
-
size: 2,
|
|
222
|
-
update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
|
|
223
|
-
return vertexIndex === undefined ? [vertex[3], 10] : [vertex[3], vertexIndex];
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
228
|
-
name: 'total_distance',
|
|
229
|
-
type: AttributeType.Attribute,
|
|
230
|
-
descriptor: {
|
|
231
|
-
name: 'a_Total_Distance',
|
|
232
|
-
buffer: {
|
|
233
|
-
usage: gl.STATIC_DRAW,
|
|
234
|
-
data: [],
|
|
235
|
-
type: gl.FLOAT
|
|
236
|
-
},
|
|
237
|
-
size: 1,
|
|
238
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
239
|
-
return [vertex[5]];
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
244
|
-
name: 'size',
|
|
245
|
-
type: AttributeType.Attribute,
|
|
246
|
-
descriptor: {
|
|
247
|
-
name: 'a_Size',
|
|
248
|
-
buffer: {
|
|
249
|
-
usage: gl.DYNAMIC_DRAW,
|
|
250
|
-
data: [],
|
|
251
|
-
type: gl.FLOAT
|
|
252
|
-
},
|
|
253
|
-
size: 2,
|
|
254
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
255
|
-
var _feature$size = feature.size,
|
|
256
|
-
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
257
|
-
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
262
|
-
name: 'normal',
|
|
263
|
-
type: AttributeType.Attribute,
|
|
264
|
-
descriptor: {
|
|
265
|
-
name: 'a_Normal',
|
|
266
|
-
buffer: {
|
|
267
|
-
usage: gl.STATIC_DRAW,
|
|
268
|
-
data: [],
|
|
269
|
-
type: gl.FLOAT
|
|
270
|
-
},
|
|
271
|
-
size: 3,
|
|
272
|
-
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
273
|
-
return normal;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
278
|
-
name: 'miter',
|
|
279
|
-
type: AttributeType.Attribute,
|
|
280
|
-
descriptor: {
|
|
281
|
-
name: 'a_Miter',
|
|
282
|
-
buffer: {
|
|
283
|
-
usage: gl.STATIC_DRAW,
|
|
284
|
-
data: [],
|
|
285
|
-
type: gl.FLOAT
|
|
286
|
-
},
|
|
287
|
-
size: 1,
|
|
288
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
289
|
-
return [vertex[4]];
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
294
|
-
name: 'uv',
|
|
295
|
-
type: AttributeType.Attribute,
|
|
296
|
-
descriptor: {
|
|
297
|
-
name: 'a_iconMapUV',
|
|
298
|
-
buffer: {
|
|
299
|
-
usage: gl.DYNAMIC_DRAW,
|
|
300
|
-
data: [],
|
|
301
|
-
type: gl.FLOAT
|
|
302
|
-
},
|
|
303
|
-
size: 2,
|
|
304
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
305
|
-
var iconMap = _this2.iconService.getIconMap();
|
|
306
|
-
|
|
307
|
-
var texture = feature.texture;
|
|
308
|
-
|
|
309
|
-
var _ref3 = iconMap[texture] || {
|
|
310
|
-
x: 0,
|
|
311
|
-
y: 0
|
|
312
|
-
},
|
|
313
|
-
x = _ref3.x,
|
|
314
|
-
y = _ref3.y;
|
|
315
|
-
|
|
316
|
-
return [x, y];
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
}]);
|
|
322
|
-
|
|
323
|
-
return LineModel;
|
|
324
|
-
}(BaseModel);
|
|
325
|
-
|
|
326
|
-
export { LineModel as default };
|
|
327
|
-
//# sourceMappingURL=tile.js.map
|