@antv/l7-layers 2.9.23 → 2.9.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/models/plane.d.ts +1 -0
- package/es/citybuliding/building.js +1 -1
- package/es/core/BaseLayer.js +10 -3
- package/es/core/interface.d.ts +26 -48
- package/es/core/interface.js +3 -0
- package/es/core/schema.d.ts +3 -3
- package/es/core/triangulation.d.ts +4 -3
- package/es/core/triangulation.js +54 -39
- package/es/image/models/image.js +7 -1
- package/es/line/models/arc.js +1 -1
- package/es/line/models/simpleLine.js +1 -1
- package/es/line/shaders/line_arc_vert.glsl +5 -3
- package/es/line/shaders/simple/simpleline_vert.glsl +1 -0
- package/es/point/models/fill.js +5 -2
- package/es/point/models/fillmage.js +9 -3
- package/es/point/models/image.js +8 -2
- package/es/point/models/radar.js +2 -3
- package/es/point/models/tile.js +1 -1
- package/es/point/shaders/fill_vert.glsl +13 -6
- package/es/point/shaders/image/fillImage_vert.glsl +13 -5
- package/es/point/shaders/image_vert.glsl +17 -8
- package/es/tile/manager/tileLayerManager.d.ts +3 -2
- package/es/tile/manager/tileLayerManager.js +3 -1
- package/es/tile/models/tileModel.js +4 -3
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/tileFactory/base.js +32 -5
- package/es/tile/tileFactory/vectorLayer.d.ts +3 -1
- package/es/tile/tileFactory/vectorLayer.js +22 -1
- package/es/tile/tileLayer/baseTileLayer.d.ts +1 -1
- package/es/tile/tileLayer/baseTileLayer.js +3 -2
- package/es/tile/utils.js +1 -1
- package/lib/citybuliding/building.js +1 -1
- package/lib/core/BaseLayer.js +8 -3
- package/lib/core/triangulation.js +48 -31
- package/lib/image/models/image.js +6 -1
- package/lib/line/shaders/line_arc_vert.glsl +5 -3
- package/lib/line/shaders/simple/simpleline_vert.glsl +1 -0
- package/lib/point/models/fill.js +3 -1
- package/lib/point/models/fillmage.js +6 -2
- package/lib/point/models/image.js +5 -1
- package/lib/point/models/radar.js +2 -3
- package/lib/point/models/tile.js +1 -1
- package/lib/point/shaders/fill_vert.glsl +13 -6
- package/lib/point/shaders/image/fillImage_vert.glsl +13 -5
- package/lib/point/shaders/image_vert.glsl +17 -8
- package/lib/tile/manager/tileLayerManager.js +3 -1
- package/lib/tile/models/tileModel.js +4 -3
- package/lib/tile/tileFactory/base.js +22 -4
- package/lib/tile/tileFactory/vectorLayer.js +16 -1
- package/lib/tile/tileLayer/baseTileLayer.js +3 -2
- package/lib/tile/utils.js +1 -1
- package/package.json +7 -6
|
@@ -22,7 +22,7 @@ import { PointFillTriangulation } from "../../core/triangulation"; // static poi
|
|
|
22
22
|
var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv;\n\nvoid main() {\n\n float opacity = styleMappingMat[0][0];\n\n vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;\n gl_FragColor = texture2D(u_texture, pos);\n gl_FragColor.a *= opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
23
23
|
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/image/fillImage_vert.glsl' */
|
|
25
|
-
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n
|
|
25
|
+
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform float u_isMeter;\n\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // height fixed\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
26
26
|
|
|
27
27
|
var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
28
28
|
_inherits(FillImageModel, _BaseModel);
|
|
@@ -87,7 +87,11 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
87
87
|
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
88
88
|
_ref$offsets = _ref.offsets,
|
|
89
89
|
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
90
|
-
rotation = _ref.rotation
|
|
90
|
+
rotation = _ref.rotation,
|
|
91
|
+
_ref$raisingHeight = _ref.raisingHeight,
|
|
92
|
+
raisingHeight = _ref$raisingHeight === void 0 ? 0.0 : _ref$raisingHeight,
|
|
93
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
94
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed;
|
|
91
95
|
|
|
92
96
|
if (this.rendererService.getDirty()) {
|
|
93
97
|
this.texture.bind();
|
|
@@ -146,6 +150,8 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
return {
|
|
153
|
+
u_raisingHeight: Number(raisingHeight),
|
|
154
|
+
u_heightfixed: Number(heightfixed),
|
|
149
155
|
u_isMeter: Number(this.isMeter),
|
|
150
156
|
u_RotateMatrix: new Float32Array([Math.cos(this.radian), Math.sin(this.radian), -Math.sin(this.radian), Math.cos(this.radian)]),
|
|
151
157
|
u_dataTexture: this.dataTexture,
|
|
@@ -217,7 +223,7 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
217
223
|
var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
|
|
218
224
|
this.meter2coord = (m1 + m2) / 2;
|
|
219
225
|
|
|
220
|
-
if (!
|
|
226
|
+
if (!this.meter2coord) {
|
|
221
227
|
// Tip: 兼容单个数据导致的 m1、m2 为 NaN
|
|
222
228
|
this.meter2coord = 7.70681090738883;
|
|
223
229
|
}
|
package/es/point/models/image.js
CHANGED
|
@@ -20,7 +20,7 @@ import { PointImageTriangulation } from "../../core/triangulation";
|
|
|
20
20
|
var pointImageFrag = "\nuniform sampler2D u_texture;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform vec2 u_textSize;\nuniform float u_opacity : 1;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main(){\n float opacity = styleMappingMat[0][0];\n float size = styleMappingMat[1][0];\n vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;\n vec4 textureColor;\n\n // Y = 0.299R + 0.587G + 0.114B // \u4EAE\u5EA6\u63D0\u53D6\n \n textureColor = texture2D(u_texture, pos);\n\n // Tip: \u53BB\u9664\u8FB9\u7F18\u90E8\u5206 mipmap \u5BFC\u81F4\u7684\u6DF7\u5408\u53D8\u6697\n float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);\n if(fragmengTocenter >= 0.5) {\n float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;\n textureColor.a *= luma;\n }\n \n \n\n if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){\n gl_FragColor= textureColor;\n }else {\n gl_FragColor= step(0.01, textureColor.z) * v_color;\n }\n\n gl_FragColor.a = gl_FragColor.a * opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
21
21
|
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/image_vert.glsl' */
|
|
23
|
-
var pointImageVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec4 a_Color;\nattribute vec2 a_Uv;\nattribute float a_Size;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec2 u_offsets;\n\nuniform float u_opacity : 1;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n styleMappingMat[1][0] = a_Size;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n
|
|
23
|
+
var pointImageVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec4 a_Color;\nattribute vec2 a_Uv;\nattribute float a_Size;\nvarying vec4 v_color;\nvarying vec2 v_uv;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec2 u_offsets;\n\nuniform float u_opacity : 1;\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n styleMappingMat[1][0] = a_Size;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n v_color = a_Color;\n v_uv = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n vec2 offset = project_pixel(textrueOffsets);\n\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // false\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
|
|
24
24
|
|
|
25
25
|
var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
26
|
_inherits(ImageModel, _BaseModel);
|
|
@@ -76,7 +76,11 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
76
76
|
_ref$opacity = _ref.opacity,
|
|
77
77
|
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
78
78
|
_ref$offsets = _ref.offsets,
|
|
79
|
-
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets
|
|
79
|
+
offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
|
|
80
|
+
_ref$raisingHeight = _ref.raisingHeight,
|
|
81
|
+
raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
|
|
82
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
83
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed;
|
|
80
84
|
|
|
81
85
|
if (this.rendererService.getDirty()) {
|
|
82
86
|
this.texture.bind();
|
|
@@ -117,6 +121,8 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
return {
|
|
124
|
+
u_raisingHeight: Number(raisingHeight),
|
|
125
|
+
u_heightfixed: Number(heightfixed),
|
|
120
126
|
u_dataTexture: this.dataTexture,
|
|
121
127
|
// 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
|
|
122
128
|
u_cellTypeLayout: this.getCellTypeLayout(),
|
package/es/point/models/radar.js
CHANGED
|
@@ -176,7 +176,7 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
176
176
|
var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
|
|
177
177
|
this.meter2coord = (m1 + m2) / 2;
|
|
178
178
|
|
|
179
|
-
if (!
|
|
179
|
+
if (!this.meter2coord) {
|
|
180
180
|
// Tip: 兼容单个数据导致的 m1、m2 为 NaN
|
|
181
181
|
this.meter2coord = 7.70681090738883;
|
|
182
182
|
}
|
|
@@ -238,8 +238,7 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
238
238
|
},
|
|
239
239
|
size: 3,
|
|
240
240
|
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
241
|
-
var extrude;
|
|
242
|
-
extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
|
|
241
|
+
var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
|
|
243
242
|
var extrudeIndex = attributeIdx % 4 * 3;
|
|
244
243
|
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
245
244
|
}
|
package/es/point/models/tile.js
CHANGED
|
@@ -181,7 +181,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
181
181
|
var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
|
|
182
182
|
this.meter2coord = (m1 + m2) / 2;
|
|
183
183
|
|
|
184
|
-
if (!
|
|
184
|
+
if (!this.meter2coord) {
|
|
185
185
|
// Tip: 兼容单个数据导致的 m1、m2 为 NaN
|
|
186
186
|
this.meter2coord = 7.70681090738883;
|
|
187
187
|
}
|
|
@@ -24,6 +24,7 @@ uniform vec2 u_offsets;
|
|
|
24
24
|
|
|
25
25
|
uniform float u_blur : 0.0;
|
|
26
26
|
uniform float u_raisingHeight: 0.0;
|
|
27
|
+
uniform float u_heightfixed: 0.0;
|
|
27
28
|
|
|
28
29
|
#pragma include "styleMapping"
|
|
29
30
|
#pragma include "styleMappingCalOpacity"
|
|
@@ -164,16 +165,22 @@ void main() {
|
|
|
164
165
|
vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));
|
|
165
166
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
|
|
166
167
|
|
|
167
|
-
float
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
float raisingHeight = u_raisingHeight;
|
|
169
|
+
|
|
170
|
+
if(u_heightfixed < 1.0) { // false
|
|
171
|
+
raisingHeight = project_pixel(u_raisingHeight);
|
|
172
|
+
} else {
|
|
173
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
174
|
+
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
|
|
175
|
+
raisingHeight = u_raisingHeight * mapboxZoomScale;
|
|
176
|
+
}
|
|
171
177
|
}
|
|
178
|
+
|
|
172
179
|
|
|
173
180
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
174
|
-
gl_Position = u_Mvp * vec4(project_pos.xy + offset,
|
|
181
|
+
gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);
|
|
175
182
|
} else {
|
|
176
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset,
|
|
183
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
177
184
|
}
|
|
178
185
|
|
|
179
186
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
@@ -15,6 +15,8 @@ uniform float u_isMeter;
|
|
|
15
15
|
varying vec2 v_uv; // 本身的 uv 坐标
|
|
16
16
|
varying vec2 v_Iconuv; // icon 贴图的 uv 坐标
|
|
17
17
|
|
|
18
|
+
uniform float u_raisingHeight: 0.0;
|
|
19
|
+
uniform float u_heightfixed: 0.0;
|
|
18
20
|
uniform float u_opacity : 1;
|
|
19
21
|
uniform vec2 u_offsets;
|
|
20
22
|
|
|
@@ -91,15 +93,21 @@ void main() {
|
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
// vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));
|
|
96
96
|
vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));
|
|
97
|
-
|
|
97
|
+
float raisingHeight = u_raisingHeight;
|
|
98
|
+
if(u_heightfixed < 1.0) { // height fixed
|
|
99
|
+
raisingHeight = project_pixel(u_raisingHeight);
|
|
100
|
+
} else {
|
|
101
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
102
|
+
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
|
|
103
|
+
raisingHeight = u_raisingHeight * mapboxZoomScale;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
98
106
|
|
|
99
107
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
100
|
-
gl_Position = u_Mvp * vec4(project_pos.xy + offset,
|
|
108
|
+
gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);
|
|
101
109
|
} else {
|
|
102
|
-
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset,
|
|
110
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
|
|
@@ -10,6 +10,8 @@ uniform mat4 u_Mvp;
|
|
|
10
10
|
uniform vec2 u_offsets;
|
|
11
11
|
|
|
12
12
|
uniform float u_opacity : 1;
|
|
13
|
+
uniform float u_raisingHeight: 0.0;
|
|
14
|
+
uniform float u_heightfixed: 0.0;
|
|
13
15
|
|
|
14
16
|
varying mat4 styleMappingMat; // 用于将在顶点着色器中计算好的样式值传递给片元
|
|
15
17
|
|
|
@@ -61,21 +63,28 @@ void main() {
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
// cal style mapping - 数据纹理映射部分的计算
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
v_color = a_Color;
|
|
67
|
+
v_uv = a_Uv;
|
|
68
|
+
vec4 project_pos = project_position(vec4(a_Position, 1.0));
|
|
67
69
|
|
|
68
|
-
// vec2 offset = project_pixel(u_offsets);
|
|
69
70
|
vec2 offset = project_pixel(textrueOffsets);
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
float raisingHeight = u_raisingHeight;
|
|
73
|
+
if(u_heightfixed < 1.0) { // false
|
|
74
|
+
raisingHeight = project_pixel(u_raisingHeight);
|
|
75
|
+
} else {
|
|
76
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
77
|
+
float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
|
|
78
|
+
raisingHeight = u_raisingHeight * mapboxZoomScale;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
72
81
|
|
|
73
82
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
74
|
-
gl_Position = u_Mvp * vec4(
|
|
83
|
+
gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);
|
|
75
84
|
} else {
|
|
76
|
-
gl_Position = project_common_position_to_clipspace(vec4(
|
|
85
|
+
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
|
|
77
86
|
}
|
|
78
|
-
gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
|
|
79
87
|
|
|
88
|
+
gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
|
|
80
89
|
setPickingColor(a_PickingColor);
|
|
81
90
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IInteractionTarget, ILayer, ILayerService, IMapService, IPickingService, IRendererService, ITileLayerManager, ITilePickManager } from '@antv/l7-core';
|
|
1
|
+
import { IInteractionTarget, ILayer, ILayerService, IMapService, IPickingService, IRendererService, ITileLayerManager, ITilePickManager, ITransform } from '@antv/l7-core';
|
|
2
2
|
import { Tile } from '@antv/l7-utils';
|
|
3
3
|
import { ITileConfigManager } from './tileConfigManager';
|
|
4
4
|
export declare class TileLayerManager implements ITileLayerManager {
|
|
@@ -12,7 +12,8 @@ export declare class TileLayerManager implements ITileLayerManager {
|
|
|
12
12
|
private tileFactory;
|
|
13
13
|
private initOptions;
|
|
14
14
|
private rampColorsData;
|
|
15
|
-
|
|
15
|
+
private transforms;
|
|
16
|
+
constructor(parent: ILayer, mapService: IMapService, rendererService: IRendererService, pickingService: IPickingService, layerService: ILayerService, transforms: ITransform[]);
|
|
16
17
|
createTile(tile: Tile): {
|
|
17
18
|
layers: ILayer[];
|
|
18
19
|
layerIDList: string[];
|
|
@@ -8,13 +8,14 @@ import { getLayerShape, getMaskValue } from "../utils";
|
|
|
8
8
|
import TileConfigManager from "./tileConfigManager";
|
|
9
9
|
import TilePickManager from "./tilePickerManager";
|
|
10
10
|
export var TileLayerManager = /*#__PURE__*/function () {
|
|
11
|
-
function TileLayerManager(parent, mapService, rendererService, pickingService, layerService) {
|
|
11
|
+
function TileLayerManager(parent, mapService, rendererService, pickingService, layerService, transforms) {
|
|
12
12
|
_classCallCheck(this, TileLayerManager);
|
|
13
13
|
|
|
14
14
|
this.parent = parent;
|
|
15
15
|
this.children = parent.layerChildren;
|
|
16
16
|
this.mapService = mapService;
|
|
17
17
|
this.rendererService = rendererService;
|
|
18
|
+
this.transforms = transforms;
|
|
18
19
|
this.tilePickManager = new TilePickManager(parent, rendererService, pickingService, this.children, layerService);
|
|
19
20
|
this.tileConfigManager = new TileConfigManager();
|
|
20
21
|
this.setSubLayerInitOptipn();
|
|
@@ -181,6 +182,7 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
181
182
|
|
|
182
183
|
this.initOptions = {
|
|
183
184
|
layerType: this.parent.type,
|
|
185
|
+
transforms: this.transforms,
|
|
184
186
|
shape: layerShape,
|
|
185
187
|
zIndex: zIndex,
|
|
186
188
|
opacity: opacity,
|
|
@@ -30,15 +30,16 @@ var RasterTileModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
30
30
|
}, {
|
|
31
31
|
key: "initModels",
|
|
32
32
|
value: function initModels() {
|
|
33
|
-
var
|
|
33
|
+
var source = this.layer.getSource();
|
|
34
34
|
|
|
35
|
-
if (
|
|
35
|
+
if (source !== null && source !== void 0 && source.data.isTile) {
|
|
36
36
|
this.layer.tileLayer = new TMSTileLayer({
|
|
37
37
|
parent: this.layer,
|
|
38
38
|
rendererService: this.rendererService,
|
|
39
39
|
mapService: this.mapService,
|
|
40
40
|
layerService: this.layerService,
|
|
41
|
-
pickingService: this.pickingService
|
|
41
|
+
pickingService: this.pickingService,
|
|
42
|
+
transforms: source.transforms
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -32,7 +32,7 @@ export default class TileFactory implements ITileFactory {
|
|
|
32
32
|
updateStyle(styles: ITileStyles): string;
|
|
33
33
|
getDefautStyleAttributeField(layer: ILayer, type: string): string | string[] | 2;
|
|
34
34
|
setStyleAttributeField(layer: ILayer, type: ScaleAttributeType, value: IScaleValue | undefined | string | string[]): ILayer | undefined;
|
|
35
|
-
protected parseScaleValue(value: IScaleValue | string, type: string): (string | number | unknown[])[] | (
|
|
35
|
+
protected parseScaleValue(value: IScaleValue | string, type: string): (string | number | unknown[])[] | (import("@antv/l7-core").StyleAttributeField | ((...args: any[]) => [] | undefined))[];
|
|
36
36
|
protected getTile(lng: number, lat: number): Tile;
|
|
37
37
|
protected emitEvent(layers: ILayer[], isVector?: boolean): void;
|
|
38
38
|
protected getCombineFeature(features: IParseDataItem[]): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
@@ -10,6 +10,7 @@ import { getLayerShape, readRasterValue, registerLayers } from "../utils";
|
|
|
10
10
|
import VectorLayer from "./vectorLayer";
|
|
11
11
|
import * as turf from '@turf/helpers';
|
|
12
12
|
import union from '@turf/union';
|
|
13
|
+
import polygonToLineString from '@turf/polygon-to-line';
|
|
13
14
|
|
|
14
15
|
var TileFactory = /*#__PURE__*/function () {
|
|
15
16
|
// 用于记录图层内事件,辅助判断图层外事件逻辑
|
|
@@ -52,7 +53,10 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
52
53
|
source: null
|
|
53
54
|
};
|
|
54
55
|
var sourceLayer = initOptions.sourceLayer,
|
|
55
|
-
featureId = initOptions.featureId
|
|
56
|
+
featureId = initOptions.featureId,
|
|
57
|
+
transforms = initOptions.transforms,
|
|
58
|
+
layerType = initOptions.layerType,
|
|
59
|
+
shape = initOptions.shape;
|
|
56
60
|
|
|
57
61
|
if (!sourceLayer) {
|
|
58
62
|
return emptyData;
|
|
@@ -64,17 +68,40 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
64
68
|
if (!(Array.isArray(features) && features.length > 0)) {
|
|
65
69
|
return emptyData;
|
|
66
70
|
} else {
|
|
71
|
+
var geofeatures = [];
|
|
72
|
+
|
|
73
|
+
if (layerType === 'LineLayer' && shape === 'simple') {
|
|
74
|
+
features.map(function (feature) {
|
|
75
|
+
if (feature.geometry.type === 'MultiPolygon') {
|
|
76
|
+
var _geofeatures;
|
|
77
|
+
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
var linefeatures = polygonToLineString(feature).features;
|
|
80
|
+
|
|
81
|
+
(_geofeatures = geofeatures).push.apply(_geofeatures, _toConsumableArray(linefeatures));
|
|
82
|
+
} else if (feature.geometry.type === 'Polygon') {
|
|
83
|
+
feature.geometry.type = 'MultiLineString';
|
|
84
|
+
geofeatures.push(feature);
|
|
85
|
+
} else {
|
|
86
|
+
geofeatures.push(feature);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
geofeatures = features;
|
|
91
|
+
}
|
|
92
|
+
|
|
67
93
|
var source = new Source({
|
|
68
94
|
type: 'FeatureCollection',
|
|
69
|
-
features:
|
|
95
|
+
features: geofeatures
|
|
70
96
|
}, {
|
|
71
97
|
parser: {
|
|
72
98
|
type: 'geojson',
|
|
73
99
|
featureId: featureId
|
|
74
|
-
}
|
|
100
|
+
},
|
|
101
|
+
transforms: transforms
|
|
75
102
|
});
|
|
76
103
|
return {
|
|
77
|
-
features:
|
|
104
|
+
features: geofeatures,
|
|
78
105
|
featureId: featureId,
|
|
79
106
|
vectorTileLayer: vectorTileLayer,
|
|
80
107
|
source: source
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BaseLayer from '../../core/BaseLayer';
|
|
2
2
|
import { ILineLayerStyleOptions, IPointLayerStyleOptions, IPolygonLayerStyleOptions } from '../../core/interface';
|
|
3
3
|
import lineFillModel from '../../line/models/tile';
|
|
4
|
+
import lineSimpleModel from '../../line/models/simpleLine';
|
|
4
5
|
import pointTextModel from '../../point/models/text';
|
|
5
6
|
import pointFillModel from '../../point/models/tile';
|
|
6
7
|
import polygonFillModel from '../../polygon/models/tile';
|
|
@@ -12,7 +13,8 @@ export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOpt
|
|
|
12
13
|
setPickID(): number | null;
|
|
13
14
|
buildModels(): void;
|
|
14
15
|
rebuildModels(): void;
|
|
15
|
-
protected getModelType(): typeof lineFillModel | typeof pointTextModel | typeof pointFillModel | typeof polygonFillModel;
|
|
16
|
+
protected getModelType(): typeof lineFillModel | typeof lineSimpleModel | typeof pointTextModel | typeof pointFillModel | typeof polygonFillModel;
|
|
17
|
+
protected getLineModel(): typeof lineFillModel | typeof lineSimpleModel;
|
|
16
18
|
protected getPointModel(): typeof pointTextModel | typeof pointFillModel;
|
|
17
19
|
protected getConfigSchema(): {
|
|
18
20
|
properties: {
|
|
@@ -12,6 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
|
|
13
13
|
import BaseLayer from "../../core/BaseLayer";
|
|
14
14
|
import lineFillModel from "../../line/models/tile";
|
|
15
|
+
import lineSimpleModel from "../../line/models/simpleLine";
|
|
15
16
|
import pointTextModel from "../../point/models/text";
|
|
16
17
|
import pointFillModel from "../../point/models/tile";
|
|
17
18
|
import polygonFillModel from "../../polygon/models/tile";
|
|
@@ -81,7 +82,7 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
81
82
|
return polygonFillModel;
|
|
82
83
|
|
|
83
84
|
case 'LineLayer':
|
|
84
|
-
return
|
|
85
|
+
return this.getLineModel();
|
|
85
86
|
|
|
86
87
|
case 'PointLayer':
|
|
87
88
|
return this.getPointModel();
|
|
@@ -90,6 +91,26 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
90
91
|
return pointFillModel;
|
|
91
92
|
}
|
|
92
93
|
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "getLineModel",
|
|
96
|
+
value: function getLineModel() {
|
|
97
|
+
var _shapeAttribute$scale;
|
|
98
|
+
|
|
99
|
+
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
100
|
+
var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
101
|
+
|
|
102
|
+
switch (shape) {
|
|
103
|
+
case 'tileline':
|
|
104
|
+
case 'line':
|
|
105
|
+
return lineFillModel;
|
|
106
|
+
|
|
107
|
+
case 'simple':
|
|
108
|
+
return lineSimpleModel;
|
|
109
|
+
|
|
110
|
+
default:
|
|
111
|
+
return lineFillModel;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
93
114
|
}, {
|
|
94
115
|
key: "getPointModel",
|
|
95
116
|
value: function getPointModel() {
|
|
@@ -14,7 +14,7 @@ export default class BaseTileLayer implements ITileLayer {
|
|
|
14
14
|
private mapService;
|
|
15
15
|
private layerService;
|
|
16
16
|
private pickColors;
|
|
17
|
-
constructor({ parent, rendererService, mapService, layerService, pickingService, }: ITileLayerOPtions);
|
|
17
|
+
constructor({ parent, rendererService, mapService, layerService, pickingService, transforms }: ITileLayerOPtions);
|
|
18
18
|
/**
|
|
19
19
|
* 渲染瓦片的图层
|
|
20
20
|
*/
|
|
@@ -14,7 +14,8 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
14
14
|
rendererService = _ref.rendererService,
|
|
15
15
|
mapService = _ref.mapService,
|
|
16
16
|
layerService = _ref.layerService,
|
|
17
|
-
pickingService = _ref.pickingService
|
|
17
|
+
pickingService = _ref.pickingService,
|
|
18
|
+
transforms = _ref.transforms;
|
|
18
19
|
|
|
19
20
|
_classCallCheck(this, BaseTileLayer);
|
|
20
21
|
|
|
@@ -38,7 +39,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
38
39
|
this.parent = parent;
|
|
39
40
|
this.mapService = mapService;
|
|
40
41
|
this.layerService = layerService;
|
|
41
|
-
this.tileLayerManager = new TileLayerManager(parent, mapService, rendererService, pickingService, layerService);
|
|
42
|
+
this.tileLayerManager = new TileLayerManager(parent, mapService, rendererService, pickingService, layerService, transforms);
|
|
42
43
|
this.initTileSetManager();
|
|
43
44
|
this.bindSubLayerEvent();
|
|
44
45
|
this.bindSubLayerPick();
|
package/es/tile/utils.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_build = __toESM(require("./models/build"));
|
|
|
30
30
|
var CityBuildingLayer = class extends import_BaseLayer.default {
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments);
|
|
33
|
-
this.type = "
|
|
33
|
+
this.type = "CityBuildingLayer";
|
|
34
34
|
}
|
|
35
35
|
buildModels() {
|
|
36
36
|
this.layerModel = new import_build.default(this);
|
package/lib/core/BaseLayer.js
CHANGED
|
@@ -750,9 +750,10 @@ var BaseLayer = class extends import_eventemitter3.EventEmitter {
|
|
|
750
750
|
} else {
|
|
751
751
|
const {
|
|
752
752
|
attributes,
|
|
753
|
-
elements
|
|
753
|
+
elements,
|
|
754
|
+
count
|
|
754
755
|
} = this.styleAttributeService.createAttributesAndIndices(this.encodedData, triangulation, segmentNumber);
|
|
755
|
-
const
|
|
756
|
+
const modeloptions = {
|
|
756
757
|
attributes,
|
|
757
758
|
uniforms,
|
|
758
759
|
fs,
|
|
@@ -760,7 +761,11 @@ var BaseLayer = class extends import_eventemitter3.EventEmitter {
|
|
|
760
761
|
elements,
|
|
761
762
|
blend: import_blend.BlendTypes[import_l7_core.BlendType.normal],
|
|
762
763
|
...rest
|
|
763
|
-
}
|
|
764
|
+
};
|
|
765
|
+
if (count) {
|
|
766
|
+
modeloptions.count = count;
|
|
767
|
+
}
|
|
768
|
+
const m = createModel(modeloptions);
|
|
764
769
|
resolve(m);
|
|
765
770
|
}
|
|
766
771
|
});
|
|
@@ -121,41 +121,58 @@ function LineTriangulation(feature) {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
function SimpleLineTriangulation(feature) {
|
|
124
|
-
const { coordinates
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
const { coordinates } = feature;
|
|
125
|
+
const pos = [];
|
|
126
|
+
const { results, totalDistance } = getSimpleLineVertices(coordinates);
|
|
127
|
+
results.map((point) => {
|
|
128
|
+
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
128
129
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
130
|
+
return {
|
|
131
|
+
vertices: pos,
|
|
132
|
+
indices: [],
|
|
133
|
+
normals: [],
|
|
134
|
+
size: 6,
|
|
135
|
+
count: results.length
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function lineSegmentDistance(b1, a1) {
|
|
139
|
+
const dx = a1[0] - b1[0];
|
|
140
|
+
const dy = a1[1] - b1[1];
|
|
141
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
142
|
+
}
|
|
143
|
+
function pushDis(point, n) {
|
|
144
|
+
if (point.length < 3) {
|
|
145
|
+
point.push(0);
|
|
146
|
+
}
|
|
147
|
+
point.push(n);
|
|
148
|
+
return point;
|
|
149
|
+
}
|
|
150
|
+
function getSimpleLineVertices(points) {
|
|
151
|
+
let distance = 0;
|
|
152
|
+
if (points.length < 2) {
|
|
153
|
+
return {
|
|
154
|
+
results: points,
|
|
155
|
+
totalDistance: 0
|
|
156
|
+
};
|
|
143
157
|
} else {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
const results = [];
|
|
159
|
+
const point = pushDis(points[0], distance);
|
|
160
|
+
results.push(point);
|
|
161
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
162
|
+
const subDistance = lineSegmentDistance(points[i - 1], points[i]);
|
|
163
|
+
distance += subDistance;
|
|
164
|
+
const mulPoint = pushDis(points[i], distance);
|
|
165
|
+
results.push(mulPoint);
|
|
166
|
+
results.push(mulPoint);
|
|
147
167
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
168
|
+
const pointDistance = lineSegmentDistance(points[points.length - 2], points[points.length - 1]);
|
|
169
|
+
distance += pointDistance;
|
|
170
|
+
results.push(pushDis(points[points.length - 1], distance));
|
|
171
|
+
return {
|
|
172
|
+
results,
|
|
173
|
+
totalDistance: distance
|
|
174
|
+
};
|
|
151
175
|
}
|
|
152
|
-
const linebuffer = line.complex;
|
|
153
|
-
return {
|
|
154
|
-
vertices: linebuffer.positions,
|
|
155
|
-
indices: linebuffer.indices,
|
|
156
|
-
normals: linebuffer.normals,
|
|
157
|
-
size: 6
|
|
158
|
-
};
|
|
159
176
|
}
|
|
160
177
|
function polygonTriangulation(feature) {
|
|
161
178
|
const { coordinates } = feature;
|