@antv/l7-layers 2.19.10 → 2.20.0
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/canvas/models/canvas.js +2 -2
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +22 -15
- package/es/core/BaseModel.d.ts +3 -1
- package/es/core/BaseModel.js +28 -4
- package/es/core/CommonStyleAttribute.d.ts +15 -0
- package/es/core/CommonStyleAttribute.js +21 -0
- package/es/core/TextureService.js +2 -2
- package/es/core/interface.d.ts +13 -9
- package/es/core/line_trangluation.d.ts +19 -0
- package/es/core/line_trangluation.js +91 -0
- package/es/core/shape/arrow.d.ts +25 -0
- package/es/core/shape/arrow.js +160 -0
- package/es/core/triangulation.d.ts +2 -8
- package/es/core/triangulation.js +6 -34
- package/es/earth/index.js +1 -1
- package/es/geometry/index.js +1 -1
- package/es/geometry/models/billboard.js +1 -1
- package/es/geometry/models/plane.js +2 -2
- package/es/geometry/models/sprite.js +2 -2
- package/es/heatmap/index.js +1 -1
- package/es/heatmap/models/heatmap.js +4 -4
- package/es/image/models/image.js +1 -1
- package/es/line/index.js +3 -2
- package/es/line/models/arc.js +6 -4
- package/es/line/models/arc_3d.js +4 -2
- package/es/line/models/earthArc_3d.js +4 -2
- package/es/line/models/flow.js +4 -5
- package/es/line/models/great_circle.js +1 -1
- package/es/line/models/line.js +3 -15
- package/es/line/models/linearline.js +1 -1
- package/es/line/models/wall.js +1 -1
- package/es/line/shaders/dash/arc_dash_vert.glsl +2 -5
- package/es/line/shaders/flow/flow_line_vert.glsl +36 -6
- package/es/line/shaders/linear/arc_linear_vert.glsl +2 -3
- package/es/plugins/DataMappingPlugin.js +3 -20
- package/es/plugins/PixelPickingPlugin.d.ts +4 -1
- package/es/plugins/PixelPickingPlugin.js +91 -22
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +4 -22
- package/es/plugins/ShaderUniformPlugin.d.ts +2 -0
- package/es/plugins/ShaderUniformPlugin.js +74 -6
- package/es/point/index.js +1 -1
- package/es/point/models/fill.js +31 -7
- package/es/point/models/fillmage.js +1 -1
- package/es/point/models/image.js +1 -1
- package/es/point/models/normal.js +30 -12
- package/es/point/models/text.js +1 -1
- package/es/point/shaders/fill_frag.glsl +20 -14
- package/es/point/shaders/fill_vert.glsl +19 -18
- package/es/point/shaders/normal_frag.glsl +4 -3
- package/es/point/shaders/normal_vert.glsl +12 -11
- package/es/polygon/index.js +1 -1
- package/es/polygon/models/extrude.js +1 -1
- package/es/polygon/models/extrusion.js +1 -1
- package/es/polygon/models/ocean.js +3 -3
- package/es/polygon/models/water.js +1 -1
- package/es/raster/models/raster.js +2 -2
- package/es/raster/models/rasterRgb.js +1 -1
- package/es/raster/models/rasterTerrainRgb.js +1 -1
- package/es/tile/core/BaseLayer.js +4 -4
- package/es/tile/interaction/getRasterData.js +4 -4
- package/es/tile/service/TileLayerService.js +4 -4
- package/es/tile/service/TilePickService.js +3 -3
- package/es/tile/tile/Tile.d.ts +3 -1
- package/es/tile/tile/Tile.js +2 -2
- package/es/wind/models/wind.js +5 -6
- package/lib/canvas/index.js +2 -3
- package/lib/canvas/models/canvas.js +4 -5
- package/lib/canvas/models/index.js +1 -2
- package/lib/citybuliding/building.js +2 -3
- package/lib/citybuliding/models/build.js +2 -3
- package/lib/core/BaseLayer.js +23 -17
- package/lib/core/BaseModel.js +30 -7
- package/lib/core/CommonStyleAttribute.js +22 -0
- package/lib/core/LayerPickService.js +2 -3
- package/lib/core/TextureService.js +4 -5
- package/lib/core/constant.js +3 -5
- package/lib/core/interface.js +6 -11
- package/lib/core/line_trangluation.js +99 -0
- package/lib/core/schema.js +2 -3
- package/lib/core/shape/Path.js +3 -6
- package/lib/core/shape/arrow.js +174 -0
- package/lib/core/triangulation.js +8 -37
- package/lib/earth/index.js +3 -4
- package/lib/earth/models/atmosphere.js +2 -3
- package/lib/earth/models/base.js +2 -3
- package/lib/earth/models/bloomsphere.js +2 -3
- package/lib/earth/utils.js +3 -6
- package/lib/geometry/index.js +3 -4
- package/lib/geometry/models/billboard.js +3 -4
- package/lib/geometry/models/index.js +1 -2
- package/lib/geometry/models/plane.js +4 -5
- package/lib/geometry/models/sprite.js +4 -5
- package/lib/heatmap/index.js +3 -4
- package/lib/heatmap/models/grid.js +2 -3
- package/lib/heatmap/models/grid3d.js +2 -3
- package/lib/heatmap/models/heatmap.js +6 -7
- package/lib/heatmap/models/hexagon.js +2 -3
- package/lib/heatmap/models/index.js +1 -2
- package/lib/image/index.js +2 -3
- package/lib/image/models/image.js +3 -4
- package/lib/image/models/index.js +1 -2
- package/lib/line/index.js +5 -5
- package/lib/line/models/arc.js +8 -7
- package/lib/line/models/arc_3d.js +6 -5
- package/lib/line/models/earthArc_3d.js +6 -5
- package/lib/line/models/flow.js +6 -8
- package/lib/line/models/great_circle.js +3 -4
- package/lib/line/models/index.js +1 -2
- package/lib/line/models/line.js +5 -18
- package/lib/line/models/linearline.js +3 -4
- package/lib/line/models/simpleLine.js +2 -3
- package/lib/line/models/wall.js +3 -4
- package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -5
- package/lib/line/shaders/flow/flow_line_vert.glsl +36 -6
- package/lib/line/shaders/linear/arc_linear_vert.glsl +2 -3
- package/lib/mask/index.js +2 -3
- package/lib/mask/models/fill.js +2 -3
- package/lib/mask/models/index.js +1 -2
- package/lib/plugins/DataMappingPlugin.js +5 -23
- package/lib/plugins/DataSourcePlugin.js +2 -3
- package/lib/plugins/FeatureScalePlugin.js +4 -5
- package/lib/plugins/LayerAnimateStylePlugin.js +2 -3
- package/lib/plugins/LayerMaskPlugin.js +2 -3
- package/lib/plugins/LayerModelPlugin.js +2 -3
- package/lib/plugins/LayerStylePlugin.js +2 -3
- package/lib/plugins/LightingPlugin.js +2 -3
- package/lib/plugins/MultiPassRendererPlugin.js +2 -3
- package/lib/plugins/PixelPickingPlugin.js +93 -25
- package/lib/plugins/RegisterStyleAttributePlugin.js +6 -25
- package/lib/plugins/ShaderUniformPlugin.js +75 -8
- package/lib/plugins/UpdateModelPlugin.js +2 -3
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -3
- package/lib/point/index.js +3 -4
- package/lib/point/models/billboard_point.js +2 -3
- package/lib/point/models/earthExtrude.js +2 -3
- package/lib/point/models/earthFill.js +2 -3
- package/lib/point/models/extrude.js +2 -3
- package/lib/point/models/fill.js +33 -10
- package/lib/point/models/fillmage.js +3 -4
- package/lib/point/models/image.js +3 -4
- package/lib/point/models/index.js +1 -2
- package/lib/point/models/normal.js +32 -15
- package/lib/point/models/radar.js +2 -3
- package/lib/point/models/text.js +3 -4
- package/lib/point/shaders/fill_frag.glsl +20 -14
- package/lib/point/shaders/fill_vert.glsl +19 -18
- package/lib/point/shaders/normal_frag.glsl +4 -3
- package/lib/point/shaders/normal_vert.glsl +12 -11
- package/lib/polygon/index.js +3 -4
- package/lib/polygon/models/extrude.js +3 -4
- package/lib/polygon/models/extrusion.js +3 -4
- package/lib/polygon/models/fill.js +2 -3
- package/lib/polygon/models/index.js +1 -2
- package/lib/polygon/models/ocean.js +5 -6
- package/lib/polygon/models/water.js +3 -4
- package/lib/raster/index.js +2 -3
- package/lib/raster/models/index.js +1 -2
- package/lib/raster/models/raster.js +4 -5
- package/lib/raster/models/rasterRgb.js +3 -4
- package/lib/raster/models/rasterTerrainRgb.js +3 -4
- package/lib/tile/core/BaseLayer.js +6 -7
- package/lib/tile/core/TileDebugLayer.js +2 -3
- package/lib/tile/interaction/getRasterData.js +4 -4
- package/lib/tile/service/TileLayerService.js +6 -7
- package/lib/tile/service/TilePickService.js +5 -6
- package/lib/tile/service/TileSourceService.js +4 -5
- package/lib/tile/tile/DebugTile.js +2 -3
- package/lib/tile/tile/ImageTile.js +2 -3
- package/lib/tile/tile/MaskTile.js +2 -3
- package/lib/tile/tile/RasterRGBTile.js +2 -3
- package/lib/tile/tile/RasterTerrainRGBTile.js +2 -3
- package/lib/tile/tile/RasterTile.js +2 -3
- package/lib/tile/tile/Tile.js +4 -5
- package/lib/tile/tile/VectorTile.js +2 -3
- package/lib/tile/utils/constants.js +2 -3
- package/lib/tile/utils/utils.js +1 -2
- package/lib/utils/blend.js +2 -3
- package/lib/utils/collision-index.js +2 -3
- package/lib/utils/extrude_polyline.js +2 -3
- package/lib/utils/grid-index.js +1 -2
- package/lib/utils/simpleLine.js +2 -3
- package/lib/wind/index.js +2 -3
- package/lib/wind/models/index.js +1 -2
- package/lib/wind/models/wind.js +7 -9
- package/lib/wind/models/windRender.js +4 -5
- package/lib/wind/models/windShader.js +6 -12
- package/package.json +7 -7
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import { circle } from "./Path";
|
|
4
|
+
import earcut from 'earcut';
|
|
5
|
+
var maxArrowWidthMap = {
|
|
6
|
+
circle: 2,
|
|
7
|
+
triangle: 2,
|
|
8
|
+
diamond: 4,
|
|
9
|
+
rect: 2,
|
|
10
|
+
classic: 3,
|
|
11
|
+
halfTriangle: 2,
|
|
12
|
+
'none': 0
|
|
13
|
+
};
|
|
14
|
+
var PathHeight = 1 / 2;
|
|
15
|
+
export function halfTriangleArrow(dir, options) {
|
|
16
|
+
var _options$width = options.width,
|
|
17
|
+
width = _options$width === void 0 ? 2 : _options$width,
|
|
18
|
+
_options$height = options.height,
|
|
19
|
+
height = _options$height === void 0 ? 1 : _options$height;
|
|
20
|
+
return {
|
|
21
|
+
vertices: [0, PathHeight * dir, 1 * dir * width, -(height + PathHeight) * dir, 1 * dir * width, (height - PathHeight) * dir, 0, PathHeight * dir, 1 * dir * width, -(height + PathHeight) * dir, 1 * dir * width, (height - PathHeight) * dir],
|
|
22
|
+
indices: [3, 4, 5],
|
|
23
|
+
outLineIndices: [0, 1, 2],
|
|
24
|
+
normals: [1 * dir, -2 * dir, 1,
|
|
25
|
+
// y,x
|
|
26
|
+
-2 * dir, 1.5 * dir, 1, 1 * dir, 1.5 * dir, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
27
|
+
dimensions: 2
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function triangleArrow(dir, options) {
|
|
31
|
+
var _options$width2 = options.width,
|
|
32
|
+
width = _options$width2 === void 0 ? 2 : _options$width2,
|
|
33
|
+
_options$height2 = options.height,
|
|
34
|
+
height = _options$height2 === void 0 ? 3 : _options$height2;
|
|
35
|
+
return {
|
|
36
|
+
vertices: [0, 0, 1 * dir * width, 1 * height, 1 * dir * width, -1 * height, 0, 0, 1 * dir * width, 1 * height, 1 * dir * width, -1 * height],
|
|
37
|
+
outLineIndices: [0, 1, 2],
|
|
38
|
+
indices: [3, 4, 5],
|
|
39
|
+
normals: [0, -1.5 * dir, 1, 2, 1 * dir, 1, -2, 1 * dir, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
40
|
+
dimensions: 2
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function rectArrow(dir, options) {
|
|
44
|
+
var _options$width3 = options.width,
|
|
45
|
+
width = _options$width3 === void 0 ? 2 : _options$width3,
|
|
46
|
+
_options$height3 = options.height,
|
|
47
|
+
height = _options$height3 === void 0 ? 2 : _options$height3;
|
|
48
|
+
return {
|
|
49
|
+
vertices: [0, height / 2, dir * width * 1, height / 2, dir * width * 1, -height / 2, 0, -height / 2, 0, height / 2, dir * width * 1, height / 2, dir * width * 1, -height / 2, 0, -height / 2],
|
|
50
|
+
dimensions: 2,
|
|
51
|
+
indices: [4, 5, 6, 4, 6, 7],
|
|
52
|
+
outLineIndices: [0, 1, 2, 0, 2, 3],
|
|
53
|
+
normals: [0, -dir, 1, 1, 0, 1, 0, -dir, 1, -1, -0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function diamondArrow(dir, options) {
|
|
57
|
+
var _options$width4 = options.width,
|
|
58
|
+
width = _options$width4 === void 0 ? 2 : _options$width4,
|
|
59
|
+
_options$height4 = options.height,
|
|
60
|
+
height = _options$height4 === void 0 ? 3 : _options$height4;
|
|
61
|
+
return {
|
|
62
|
+
vertices: [0, 0, 1 * width * dir, 0.5 * height, 2 * width * dir, 0, 1 * width * dir, -0.5 * height, 0, 0, 1 * width * dir, 0.5 * height, 2 * width * dir, 0, 1 * width * dir, -0.5 * height],
|
|
63
|
+
dimensions: 2,
|
|
64
|
+
indices: [4, 5, 6, 4, 6, 7],
|
|
65
|
+
outLineIndices: [0, 1, 2, 0, 2, 3],
|
|
66
|
+
normals: [0, -dir, 1, 1, 0, 1, 0, -dir, 1, -1, -0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export function classicArrow(dir, options) {
|
|
70
|
+
var _options$width5 = options.width,
|
|
71
|
+
width = _options$width5 === void 0 ? 2 : _options$width5,
|
|
72
|
+
_options$height5 = options.height,
|
|
73
|
+
height = _options$height5 === void 0 ? 3 : _options$height5;
|
|
74
|
+
return {
|
|
75
|
+
vertices: [0, 0, 2 * dir * width, 1 * height, 1.5 * dir * width, 0, 2 * dir * width, -1 * height, 0, 0, 2 * dir * width, 1 * height, 1.5 * dir * width, 0, 2 * dir * width, -1 * height],
|
|
76
|
+
dimensions: 2,
|
|
77
|
+
indices: [4, 5, 6, 4, 6, 7],
|
|
78
|
+
outLineIndices: [0, 1, 2, 0, 2, 3],
|
|
79
|
+
normals: [0, -dir, 1, 1, 0, 1, 0, -dir, 1, -1, -0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function circleArraw(dir, options) {
|
|
83
|
+
var _options$width6 = options.width,
|
|
84
|
+
width = _options$width6 === void 0 ? 2 : _options$width6,
|
|
85
|
+
_options$height6 = options.height,
|
|
86
|
+
height = _options$height6 === void 0 ? 2 : _options$height6;
|
|
87
|
+
var path = circle();
|
|
88
|
+
var flattengeo = earcut.flatten([path]);
|
|
89
|
+
var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
var vertice = path.map(function (t) {
|
|
92
|
+
return [t[0] * width * dir, t[1] * height];
|
|
93
|
+
}).flat();
|
|
94
|
+
return {
|
|
95
|
+
vertices: [].concat(_toConsumableArray(vertice), _toConsumableArray(vertice)),
|
|
96
|
+
dimensions: 2,
|
|
97
|
+
indices: triangles.map(function (v) {
|
|
98
|
+
return v + path.length;
|
|
99
|
+
}),
|
|
100
|
+
outLineIndices: triangles,
|
|
101
|
+
normals: [].concat(_toConsumableArray(path.map(function (t) {
|
|
102
|
+
return [t[1] * height, t[0] * width * dir, 1];
|
|
103
|
+
}).flat()), _toConsumableArray(new Array(path.length * 3).fill(0)))
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export function lineArrowPath(coord) {
|
|
107
|
+
var indexOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
108
|
+
var symbol = arguments.length > 2 ? arguments[2] : undefined;
|
|
109
|
+
var sourceType = _typeof(symbol['source']) === 'object' ? symbol['source'].type : symbol['source'];
|
|
110
|
+
var targetType = _typeof(symbol['target']) === 'object' ? symbol['target'].type : symbol['target'];
|
|
111
|
+
var _ref = _typeof(symbol['source']) === 'object' ? symbol['source'] : {},
|
|
112
|
+
_ref$width = _ref.width,
|
|
113
|
+
sourceWidth = _ref$width === void 0 ? sourceType ? maxArrowWidthMap[sourceType] : 0 : _ref$width,
|
|
114
|
+
_ref$height = _ref.height,
|
|
115
|
+
sourceHeight = _ref$height === void 0 ? 2 : _ref$height;
|
|
116
|
+
var _ref2 = _typeof(symbol['target']) === 'object' ? symbol['target'] : {},
|
|
117
|
+
_ref2$width = _ref2.width,
|
|
118
|
+
targetWidth = _ref2$width === void 0 ? targetType ? maxArrowWidthMap[targetType] : 0 : _ref2$width,
|
|
119
|
+
_ref2$height = _ref2.height,
|
|
120
|
+
targetHeight = _ref2$height === void 0 ? 2 : _ref2$height;
|
|
121
|
+
return {
|
|
122
|
+
vertices: [0, PathHeight, 1 * sourceWidth].concat(_toConsumableArray(coord), [1, PathHeight, -1 * targetWidth], _toConsumableArray(coord), [1, -PathHeight, -1 * targetWidth], _toConsumableArray(coord), [0, -PathHeight, 1 * sourceWidth], _toConsumableArray(coord), [0, PathHeight, 1 * sourceWidth], _toConsumableArray(coord), [1, PathHeight, -1 * targetWidth], _toConsumableArray(coord), [1, -PathHeight, -1 * targetWidth], _toConsumableArray(coord), [0, -PathHeight, 1 * sourceWidth], _toConsumableArray(coord)),
|
|
123
|
+
outLineIndices: [0, 1, 2, 0, 2, 3].map(function (t) {
|
|
124
|
+
return t + indexOffset;
|
|
125
|
+
}),
|
|
126
|
+
indices: [4, 5, 6, 4, 6, 7].map(function (t) {
|
|
127
|
+
return t + indexOffset;
|
|
128
|
+
}),
|
|
129
|
+
normals: [1, -1, 1, 1, 1, 1, -1, 0, 1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
130
|
+
dimensions: 2
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
export function getSymbol(type, position) {
|
|
134
|
+
var shape = _typeof(type) === 'object' ? type.type : type;
|
|
135
|
+
var dir = position === 'source' ? 1 : -1;
|
|
136
|
+
var option = _typeof(type) === 'object' ? type : {};
|
|
137
|
+
switch (shape) {
|
|
138
|
+
case 'circle':
|
|
139
|
+
return circleArraw(dir, option);
|
|
140
|
+
case 'triangle':
|
|
141
|
+
return triangleArrow(dir, option);
|
|
142
|
+
case 'diamond':
|
|
143
|
+
return diamondArrow(dir, option);
|
|
144
|
+
case 'rect':
|
|
145
|
+
return rectArrow(dir, option);
|
|
146
|
+
case 'classic':
|
|
147
|
+
return classicArrow(dir, option);
|
|
148
|
+
case 'halfTriangle':
|
|
149
|
+
return halfTriangleArrow(dir, option);
|
|
150
|
+
default:
|
|
151
|
+
return {
|
|
152
|
+
vertices: [],
|
|
153
|
+
indices: [],
|
|
154
|
+
normals: [],
|
|
155
|
+
dimensions: 2,
|
|
156
|
+
outLineIndices: [],
|
|
157
|
+
outLineNormals: []
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -48,13 +48,7 @@ export declare function LineTriangulation(feature: IEncodeFeature): {
|
|
|
48
48
|
size: number;
|
|
49
49
|
};
|
|
50
50
|
export declare function FlowLineFillTriangulation(feature: IEncodeFeature): {
|
|
51
|
-
vertices:
|
|
52
|
-
normals: number[];
|
|
53
|
-
indices: number[];
|
|
54
|
-
size: number;
|
|
55
|
-
};
|
|
56
|
-
export declare function FlowLineStrokeTriangulation(feature: IEncodeFeature): {
|
|
57
|
-
vertices: any[];
|
|
51
|
+
vertices: number[];
|
|
58
52
|
normals: number[];
|
|
59
53
|
indices: number[];
|
|
60
54
|
size: number;
|
|
@@ -107,7 +101,7 @@ export declare function RasterImageTriangulation(feature: IEncodeFeature): {
|
|
|
107
101
|
* @param feature 映射数据
|
|
108
102
|
* @param segNum 弧线线段数
|
|
109
103
|
*/
|
|
110
|
-
export declare function LineArcTriangulation(feature: IEncodeFeature,
|
|
104
|
+
export declare function LineArcTriangulation(feature: IEncodeFeature, styleOption?: unknown): {
|
|
111
105
|
vertices: number[];
|
|
112
106
|
indices: number[];
|
|
113
107
|
size: number;
|
package/es/core/triangulation.js
CHANGED
|
@@ -161,36 +161,6 @@ export function FlowLineFillTriangulation(feature) {
|
|
|
161
161
|
size: 7
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
|
-
export function FlowLineStrokeTriangulation(feature) {
|
|
165
|
-
// @ts-ignore
|
|
166
|
-
var coord = feature.coordinates.flat();
|
|
167
|
-
var tin = 1;
|
|
168
|
-
var tout = 1;
|
|
169
|
-
return {
|
|
170
|
-
vertices: [1, 0, 0].concat(_toConsumableArray(coord), [
|
|
171
|
-
// 0
|
|
172
|
-
1, 2, -3], _toConsumableArray(coord), [
|
|
173
|
-
// 1
|
|
174
|
-
1, 1, -3], _toConsumableArray(coord), [
|
|
175
|
-
// 2
|
|
176
|
-
0, 1, 0], _toConsumableArray(coord), [
|
|
177
|
-
// 3
|
|
178
|
-
0, 0, 0], _toConsumableArray(coord)),
|
|
179
|
-
normals: [-tin, 2 * tout, 1,
|
|
180
|
-
// 0
|
|
181
|
-
2 * tout, -tout, 1,
|
|
182
|
-
// 1
|
|
183
|
-
tout, -tout, 1,
|
|
184
|
-
// 2
|
|
185
|
-
tout, -tout, 1,
|
|
186
|
-
// 3
|
|
187
|
-
-tin, -tout, 1 // 4
|
|
188
|
-
],
|
|
189
|
-
|
|
190
|
-
indices: [0, 1, 1, 2, 2, 3, 3, 4, 4, 0],
|
|
191
|
-
size: 7
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
164
|
export function SimpleLineTriangulation(feature) {
|
|
195
165
|
var coordinates = feature.coordinates;
|
|
196
166
|
var pos = [];
|
|
@@ -392,8 +362,10 @@ export function RasterImageTriangulation(feature) {
|
|
|
392
362
|
* @param feature 映射数据
|
|
393
363
|
* @param segNum 弧线线段数
|
|
394
364
|
*/
|
|
395
|
-
export function LineArcTriangulation(feature,
|
|
396
|
-
|
|
365
|
+
export function LineArcTriangulation(feature, styleOption) {
|
|
366
|
+
// @ts-ignore
|
|
367
|
+
var _styleOption$segmentN = styleOption.segmentNumber,
|
|
368
|
+
segmentNumber = _styleOption$segmentN === void 0 ? 30 : _styleOption$segmentN;
|
|
397
369
|
var coordinates = feature.coordinates;
|
|
398
370
|
var positions = [];
|
|
399
371
|
var indexArray = [];
|
|
@@ -401,13 +373,13 @@ export function LineArcTriangulation(feature, segmentNumber) {
|
|
|
401
373
|
// 上线两个顶点
|
|
402
374
|
// [ x, y, z, sx,sy, tx,ty]
|
|
403
375
|
positions.push(i, 1, i, coordinates[0][0], coordinates[0][1], coordinates[1][0], coordinates[1][1], i, -1, i, coordinates[0][0], coordinates[0][1], coordinates[1][0], coordinates[1][1]);
|
|
404
|
-
if (i !==
|
|
376
|
+
if (i !== segmentNumber - 1) {
|
|
405
377
|
indexArray.push.apply(indexArray, _toConsumableArray([0, 1, 2, 1, 3, 2].map(function (v) {
|
|
406
378
|
return i * 2 + v;
|
|
407
379
|
})));
|
|
408
380
|
}
|
|
409
381
|
};
|
|
410
|
-
for (var i = 0; i <
|
|
382
|
+
for (var i = 0; i < segmentNumber; i++) {
|
|
411
383
|
_loop(i);
|
|
412
384
|
}
|
|
413
385
|
return {
|
package/es/earth/index.js
CHANGED
|
@@ -81,7 +81,7 @@ var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
81
81
|
value: function getModelType() {
|
|
82
82
|
var _shapeAttribute$scale;
|
|
83
83
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
84
|
-
var shape = (shapeAttribute === null || shapeAttribute === void 0
|
|
84
|
+
var shape = (shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field) || 'base';
|
|
85
85
|
if (earthLayerTypes.indexOf(shape) < 0) {
|
|
86
86
|
shape = 'base';
|
|
87
87
|
}
|
package/es/geometry/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
76
76
|
value: function getModelType() {
|
|
77
77
|
var _shapeAttribute$scale;
|
|
78
78
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
79
|
-
var shape = shapeAttribute === null || shapeAttribute === void 0
|
|
79
|
+
var shape = shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
80
80
|
if (shape === 'plane') {
|
|
81
81
|
return 'plane';
|
|
82
82
|
} else if (shape === 'sprite') {
|
|
@@ -79,7 +79,7 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
79
79
|
key: "clearModels",
|
|
80
80
|
value: function clearModels() {
|
|
81
81
|
var _this$texture;
|
|
82
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
82
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
83
83
|
}
|
|
84
84
|
}, {
|
|
85
85
|
key: "initModels",
|
|
@@ -123,7 +123,7 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
123
123
|
if (this.mapTexture !== mapTexture) {
|
|
124
124
|
var _this$texture;
|
|
125
125
|
this.mapTexture = mapTexture;
|
|
126
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
126
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
127
127
|
this.updateTexture(mapTexture);
|
|
128
128
|
}
|
|
129
129
|
return {
|
|
@@ -139,7 +139,7 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
139
139
|
var _this$texture2;
|
|
140
140
|
// @ts-ignore
|
|
141
141
|
this.terrainImage = null;
|
|
142
|
-
(_this$texture2 = this.texture) === null || _this$texture2 === void 0
|
|
142
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
143
143
|
}
|
|
144
144
|
}, {
|
|
145
145
|
key: "initModels",
|
|
@@ -141,7 +141,7 @@ var SpriteModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
141
141
|
if (this.mapTexture !== mapTexture) {
|
|
142
142
|
var _this$texture;
|
|
143
143
|
this.mapTexture = mapTexture;
|
|
144
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
144
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
145
145
|
this.updateTexture(mapTexture);
|
|
146
146
|
}
|
|
147
147
|
return {
|
|
@@ -156,7 +156,7 @@ var SpriteModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
156
156
|
value: function clearModels() {
|
|
157
157
|
var _this$texture2;
|
|
158
158
|
cancelAnimationFrame(this.timer);
|
|
159
|
-
(_this$texture2 = this.texture) === null || _this$texture2 === void 0
|
|
159
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
160
160
|
}
|
|
161
161
|
}, {
|
|
162
162
|
key: "initModels",
|
package/es/heatmap/index.js
CHANGED
|
@@ -92,7 +92,7 @@ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
92
92
|
shape3d = _this$getLayerConfig.shape3d;
|
|
93
93
|
var source = this.getSource();
|
|
94
94
|
var sourceType = source.data.type;
|
|
95
|
-
var shape = (shapeAttribute === null || shapeAttribute === void 0
|
|
95
|
+
var shape = (shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field) || 'heatmap';
|
|
96
96
|
if (shape === 'heatmap' || shape === 'heatmap3d') {
|
|
97
97
|
return 'heatmap';
|
|
98
98
|
}
|
|
@@ -77,7 +77,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
77
77
|
case 0:
|
|
78
78
|
_this$rendererService2 = this.rendererService, createFramebuffer = _this$rendererService2.createFramebuffer, getViewportSize = _this$rendererService2.getViewportSize, createTexture2D = _this$rendererService2.createTexture2D;
|
|
79
79
|
shapeAttr = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
80
|
-
shapeType = (shapeAttr === null || shapeAttr === void 0
|
|
80
|
+
shapeType = (shapeAttr === null || shapeAttr === void 0 || (_shapeAttr$scale = shapeAttr.scale) === null || _shapeAttr$scale === void 0 ? void 0 : _shapeAttr$scale.field) || 'heatmap';
|
|
81
81
|
this.shapeType = shapeType;
|
|
82
82
|
// 生成热力图密度图
|
|
83
83
|
_context.next = 6;
|
|
@@ -266,7 +266,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
266
266
|
this.layerService.beforeRenderData(this.layer);
|
|
267
267
|
this.layer.hooks.beforeRender.call();
|
|
268
268
|
// 绘制密度图
|
|
269
|
-
(_this$intensityModel = this.intensityModel) === null || _this$intensityModel === void 0
|
|
269
|
+
(_this$intensityModel = this.intensityModel) === null || _this$intensityModel === void 0 || _this$intensityModel.draw({
|
|
270
270
|
uniforms: {
|
|
271
271
|
u_opacity: opacity || 1.0,
|
|
272
272
|
u_radius: radius,
|
|
@@ -300,7 +300,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
300
300
|
var _this$colorModel;
|
|
301
301
|
var _ref3 = this.layer.getLayerConfig(),
|
|
302
302
|
opacity = _ref3.opacity;
|
|
303
|
-
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0
|
|
303
|
+
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0 || _this$colorModel.draw({
|
|
304
304
|
uniforms: {
|
|
305
305
|
u_opacity: opacity || 1.0,
|
|
306
306
|
u_colorTexture: this.colorTexture,
|
|
@@ -326,7 +326,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
326
326
|
// ) as mat4;
|
|
327
327
|
var invert = mat4.create();
|
|
328
328
|
mat4.invert(invert, this.cameraService.getViewProjectionMatrixUncentered());
|
|
329
|
-
(_this$colorModel2 = this.colorModel) === null || _this$colorModel2 === void 0
|
|
329
|
+
(_this$colorModel2 = this.colorModel) === null || _this$colorModel2 === void 0 || _this$colorModel2.draw({
|
|
330
330
|
uniforms: {
|
|
331
331
|
u_opacity: opacity || 1.0,
|
|
332
332
|
u_colorTexture: this.colorTexture,
|
package/es/image/models/image.js
CHANGED
|
@@ -89,7 +89,7 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
89
89
|
key: "clearModels",
|
|
90
90
|
value: function clearModels() {
|
|
91
91
|
var _this$texture;
|
|
92
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
92
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
93
93
|
}
|
|
94
94
|
}, {
|
|
95
95
|
key: "buildModels",
|
package/es/line/index.js
CHANGED
|
@@ -87,7 +87,8 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
87
87
|
},
|
|
88
88
|
tileLine: {},
|
|
89
89
|
earthArc3d: {},
|
|
90
|
-
flowline: {}
|
|
90
|
+
flowline: {},
|
|
91
|
+
arrow: {}
|
|
91
92
|
};
|
|
92
93
|
return defaultConfig[type];
|
|
93
94
|
}
|
|
@@ -99,7 +100,7 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
99
100
|
return this.layerType;
|
|
100
101
|
}
|
|
101
102
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
102
|
-
var shape = shapeAttribute === null || shapeAttribute === void 0
|
|
103
|
+
var shape = shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
103
104
|
return shape || 'line';
|
|
104
105
|
}
|
|
105
106
|
}, {
|
package/es/line/models/arc.js
CHANGED
|
@@ -18,7 +18,7 @@ import { LineArcTriangulation } from "../../core/triangulation";
|
|
|
18
18
|
/* babel-plugin-inline-import '../shaders/dash/arc_dash_frag.glsl' */
|
|
19
19
|
var arc_dash_frag = "varying vec4 v_dash_array;\nvarying vec4 v_color;\nvarying float v_distance_ratio;\n\nuniform float segmentNumber;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n\n float flag = 0.;\n float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n };\n gl_FragColor.a *=flag;\n \n gl_FragColor = filterColor(gl_FragColor);\n}";
|
|
20
20
|
/* babel-plugin-inline-import '../shaders/dash/arc_dash_vert.glsl' */
|
|
21
|
-
var arc_dash_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nvarying vec4 v_color;\n\n\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\nvarying float v_distance_ratio;\n
|
|
21
|
+
var arc_dash_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nvarying vec4 v_color;\n\n\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\nuniform float u_lineDir: 1.0;\nvarying vec4 v_dash_array;\nvarying float v_distance_ratio;\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // dash: index / (segmentNumber - 1.);\n // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n\n vec2 s = source;\n vec2 t = target;\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n s = unProjCustomCoord(source);\n t = unProjCustomCoord(target);\n }\n float total_Distance = pixelDistance(s, t) / 2.0 * PI;\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;\n\n v_distance_ratio = segmentIndex / segmentNumber;\n\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, thetaOffset), 0.0, 1.0));\n \n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));\n\n gl_PointSize = 5.0;\n setPickingColor(a_PickingColor);\n}\n"; // arc normal line
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/line_arc_frag.glsl' */
|
|
23
23
|
var arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\nvarying vec4 v_lineData;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n gl_FragColor = v_color;\n \n\n if(u_animate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (v_lineData.r / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = v_lineData.g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_animate.x == Animate) {\n time = u_time / u_animate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = v_lineData.a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_animate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_animate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n \n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}";
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/line_arc_vert.glsl' */
|
|
@@ -26,7 +26,7 @@ var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute v
|
|
|
26
26
|
/* babel-plugin-inline-import '../shaders/linear/arc_linear_frag.glsl' */
|
|
27
27
|
var arc_linear_frag = "varying vec4 v_color;\n\n#pragma include \"picking\"\n\nvoid main() {\n// \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n gl_FragColor = v_color;\n gl_FragColor = filterColor(gl_FragColor);\n}";
|
|
28
28
|
/* babel-plugin-inline-import '../shaders/linear/arc_linear_vert.glsl' */
|
|
29
|
-
var arc_linear_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nvarying vec4 v_color;\nvarying float v_segmentIndex;\n\nuniform float u_lineDir: 1.0;\n\nuniform
|
|
29
|
+
var arc_linear_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nuniform float segmentNumber;\nvarying vec4 v_color;\nvarying float v_segmentIndex;\n\nuniform float u_lineDir: 1.0;\n\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n\n\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, thetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, thetaOffset), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n v_color.a *= opacity;\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(curr.xy + offset, 0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
30
30
|
var lineStyleObj = {
|
|
31
31
|
solid: 0.0,
|
|
32
32
|
dash: 1.0
|
|
@@ -155,7 +155,7 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
155
155
|
key: "clearModels",
|
|
156
156
|
value: function clearModels() {
|
|
157
157
|
var _this$texture;
|
|
158
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
158
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
159
159
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
160
160
|
}
|
|
161
161
|
}, {
|
|
@@ -207,7 +207,9 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
207
207
|
depth: {
|
|
208
208
|
enable: false
|
|
209
209
|
},
|
|
210
|
-
|
|
210
|
+
styleOption: {
|
|
211
|
+
segmentNumber: segmentNumber
|
|
212
|
+
}
|
|
211
213
|
});
|
|
212
214
|
case 4:
|
|
213
215
|
model = _context2.sent;
|
package/es/line/models/arc_3d.js
CHANGED
|
@@ -153,7 +153,7 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
153
153
|
key: "clearModels",
|
|
154
154
|
value: function clearModels() {
|
|
155
155
|
var _this$texture;
|
|
156
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
156
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
157
157
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
158
158
|
}
|
|
159
159
|
}, {
|
|
@@ -194,7 +194,9 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
194
194
|
fragmentShader: frag,
|
|
195
195
|
inject: this.getInject(),
|
|
196
196
|
triangulation: LineArcTriangulation,
|
|
197
|
-
|
|
197
|
+
styleOption: {
|
|
198
|
+
segmentNumber: segmentNumber
|
|
199
|
+
}
|
|
198
200
|
});
|
|
199
201
|
case 4:
|
|
200
202
|
model = _context2.sent;
|
|
@@ -153,7 +153,7 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
153
153
|
key: "clearModels",
|
|
154
154
|
value: function clearModels() {
|
|
155
155
|
var _this$texture;
|
|
156
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
156
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
157
157
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
158
158
|
}
|
|
159
159
|
}, {
|
|
@@ -196,7 +196,9 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
196
196
|
depth: {
|
|
197
197
|
enable: true
|
|
198
198
|
},
|
|
199
|
-
|
|
199
|
+
styleOption: {
|
|
200
|
+
segmentNumber: segmentNumber
|
|
201
|
+
}
|
|
200
202
|
});
|
|
201
203
|
case 4:
|
|
202
204
|
model = _context2.sent;
|
package/es/line/models/flow.js
CHANGED
|
@@ -11,11 +11,11 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
11
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
12
12
|
import { rgb2arr } from '@antv/l7-utils';
|
|
13
13
|
import BaseModel from "../../core/BaseModel";
|
|
14
|
-
import {
|
|
14
|
+
import { FlowLineTriangulation } from "../../core/line_trangluation";
|
|
15
15
|
/* babel-plugin-inline-import '../shaders/flow/flow_line_frag.glsl' */
|
|
16
16
|
var flow_line_frag = "#extension GL_OES_standard_derivatives : enable\n\nvarying vec4 v_color;\n\n\n// line texture\n\n#pragma include \"picking\"\n\nvoid main() {\ngl_FragColor = v_color;\ngl_FragColor = filterColor(gl_FragColor);\n}\n"; // linear simple line shader
|
|
17
17
|
/* babel-plugin-inline-import '../shaders/flow/flow_line_vert.glsl' */
|
|
18
|
-
var flow_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec4 a_Instance;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvarying vec4 v_color;\nuniform float u_gap_width: 1.0;\nuniform float u_stroke_width: 1.0;\nuniform float u_stroke_opacity: 1.0;\n\n\nvoid main() {\n\n// \u900F\u660E\u5EA6\u8BA1\u7B97\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n vec2 flowlineDir =
|
|
18
|
+
var flow_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec4 a_Instance;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\nvarying vec4 v_color;\nuniform float u_gap_width: 1.0;\nuniform float u_stroke_width: 1.0;\nuniform float u_stroke_opacity: 1.0;\n\nvec2 project_pixel_offset(vec2 offsets) {\n\n vec2 data = project_pixel(offsets);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n return data;\n }\n\n return vec2(data.x, -data.y);;\n}\n\nvec2 line_dir(vec2 target, vec2 source) {\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n return normalize(target - source);\n }\n return normalize(ProjectFlat(target) - ProjectFlat(source));\n}\n\nfloat flag_gap() {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n return 1.;\n }\n return -1.;\n\n}\n\n\nvoid main() {\n\n// \u900F\u660E\u5EA6\u8BA1\u7B97\n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n vec2 flowlineDir = line_dir(target,source);\n vec2 perpendicularDir = vec2(flowlineDir.y, flowlineDir.x); // mapbox || \u9AD8\u5FB7\n\n\n vec2 position = mix(source, target, a_Position.x);\n \n float lengthCommon = length(project_position(vec4(target,0,1)) - project_position(vec4(source,0,1))); // \n vec2 offsetDistances = a_Size.x * project_pixel_offset(vec2(a_Position.y, a_Position.z)); // Mapbox || \u9AD8\u5FB7\n vec2 limitedOffsetDistances = clamp( \n offsetDistances,\n project_pixel(-lengthCommon*.2), project_pixel(lengthCommon*.2)\n );\n\n\n float startOffsetCommon = project_pixel(offsets[0]);\n float endOffsetCommon = project_pixel(offsets[1]);\n float endpointOffset = mix(\n clamp(startOffsetCommon, 0.0, lengthCommon*.2),\n -clamp(endOffsetCommon, 0.0, lengthCommon*.2),\n a_Position.x\n );\n\n vec2 normalsCommon = u_stroke_width * project_pixel_offset(vec2(a_Normal.x, a_Normal.y)); // mapbox || \u9AD8\u5FB7\n\n float gapCommon = flag_gap() * project_pixel(u_gap_width);\n vec3 offsetCommon = vec3(\n flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) -\n perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),\n 0.0\n );\n\n\n vec4 project_pos = project_position(vec4(position.xy, 0, 1.0));\n\n vec4 fillColor = vec4(a_Color.rgb, a_Color.a * opacity);\n v_color = mix(fillColor, vec4(u_stroke.xyz, u_stroke.w * fillColor.w * u_stroke_opacity), a_Normal.z);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));\n\n\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
19
19
|
var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
20
20
|
_inherits(FlowLineModel, _BaseModel);
|
|
21
21
|
var _super = _createSuper(FlowLineModel);
|
|
@@ -36,8 +36,6 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
36
36
|
_ref$strokeOpacity = _ref.strokeOpacity,
|
|
37
37
|
strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity;
|
|
38
38
|
return _objectSpread({
|
|
39
|
-
// u_opacity: opacity,
|
|
40
|
-
// u_offsets: offsets,
|
|
41
39
|
u_gap_width: gapWidth,
|
|
42
40
|
u_stroke_width: strokeWidth,
|
|
43
41
|
u_stroke: rgb2arr(stroke),
|
|
@@ -77,7 +75,8 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
77
75
|
vertexShader: flow_line_vert,
|
|
78
76
|
fragmentShader: flow_line_frag,
|
|
79
77
|
inject: this.getInject(),
|
|
80
|
-
triangulation:
|
|
78
|
+
triangulation: FlowLineTriangulation,
|
|
79
|
+
styleOption: this.layer.getLayerConfig().symbol,
|
|
81
80
|
primitive: gl.TRIANGLES,
|
|
82
81
|
depth: {
|
|
83
82
|
enable: false
|
|
@@ -139,7 +139,7 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
139
139
|
key: "clearModels",
|
|
140
140
|
value: function clearModels() {
|
|
141
141
|
var _this$texture;
|
|
142
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
142
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
143
143
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
144
144
|
}
|
|
145
145
|
}, {
|
package/es/line/models/line.js
CHANGED
|
@@ -96,14 +96,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
96
96
|
_ref$linearDir = _ref.linearDir,
|
|
97
97
|
linearDir = _ref$linearDir === void 0 ? LinearDir.VERTICAL : _ref$linearDir,
|
|
98
98
|
_ref$blur = _ref.blur,
|
|
99
|
-
blur = _ref$blur === void 0 ? [1, 1, 1] : _ref$blur
|
|
100
|
-
_ref$arrow = _ref.arrow,
|
|
101
|
-
arrow = _ref$arrow === void 0 ? {
|
|
102
|
-
enable: false,
|
|
103
|
-
arrowWidth: 2,
|
|
104
|
-
arrowHeight: 3,
|
|
105
|
-
tailWidth: 1
|
|
106
|
-
} : _ref$arrow;
|
|
99
|
+
blur = _ref$blur === void 0 ? [1, 1, 1] : _ref$blur;
|
|
107
100
|
if (dashArray.length === 2) {
|
|
108
101
|
dashArray.push(0, 0);
|
|
109
102
|
}
|
|
@@ -144,12 +137,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
144
137
|
u_heightfixed: Number(heightfixed),
|
|
145
138
|
// 顶点高度 scale
|
|
146
139
|
u_vertexScale: vertexHeightScale,
|
|
147
|
-
u_raisingHeight: Number(raisingHeight)
|
|
148
|
-
// arrow
|
|
149
|
-
u_arrow: Number(arrow.enable),
|
|
150
|
-
u_arrowHeight: arrow.arrowHeight || 3,
|
|
151
|
-
u_arrowWidth: arrow.arrowWidth || 2,
|
|
152
|
-
u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
|
|
140
|
+
u_raisingHeight: Number(raisingHeight)
|
|
153
141
|
}, this.getStyleAttribute());
|
|
154
142
|
}
|
|
155
143
|
}, {
|
|
@@ -192,7 +180,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
192
180
|
key: "clearModels",
|
|
193
181
|
value: function clearModels() {
|
|
194
182
|
var _this$texture;
|
|
195
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
183
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
196
184
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
197
185
|
}
|
|
198
186
|
}, {
|
|
@@ -105,7 +105,7 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
105
105
|
key: "clearModels",
|
|
106
106
|
value: function clearModels() {
|
|
107
107
|
var _this$colorTexture;
|
|
108
|
-
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0
|
|
108
|
+
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 || _this$colorTexture.destroy();
|
|
109
109
|
}
|
|
110
110
|
}, {
|
|
111
111
|
key: "buildModels",
|
package/es/line/models/wall.js
CHANGED
|
@@ -130,7 +130,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
130
130
|
key: "clearModels",
|
|
131
131
|
value: function clearModels() {
|
|
132
132
|
var _this$texture;
|
|
133
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
133
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
134
134
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
135
135
|
}
|
|
136
136
|
}, {
|