@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
|
@@ -13,9 +13,6 @@ uniform vec4 u_dash_array: [10.0, 5., 0, 0];
|
|
|
13
13
|
uniform float u_lineDir: 1.0;
|
|
14
14
|
varying vec4 v_dash_array;
|
|
15
15
|
varying float v_distance_ratio;
|
|
16
|
-
|
|
17
|
-
uniform float u_thetaOffset: 0.314;
|
|
18
|
-
|
|
19
16
|
#pragma include "projection"
|
|
20
17
|
#pragma include "project"
|
|
21
18
|
#pragma include "picking"
|
|
@@ -92,8 +89,8 @@ void main() {
|
|
|
92
89
|
|
|
93
90
|
v_distance_ratio = segmentIndex / segmentNumber;
|
|
94
91
|
|
|
95
|
-
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio,
|
|
96
|
-
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio,
|
|
92
|
+
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, thetaOffset), 0.0, 1.0));
|
|
93
|
+
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, thetaOffset), 0.0, 1.0));
|
|
97
94
|
|
|
98
95
|
|
|
99
96
|
vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));
|
|
@@ -8,29 +8,59 @@ uniform mat4 u_ModelMatrix;
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
#pragma include "projection"
|
|
11
|
+
#pragma include "project"
|
|
11
12
|
#pragma include "picking"
|
|
12
13
|
varying vec4 v_color;
|
|
13
14
|
uniform float u_gap_width: 1.0;
|
|
14
15
|
uniform float u_stroke_width: 1.0;
|
|
15
16
|
uniform float u_stroke_opacity: 1.0;
|
|
16
17
|
|
|
18
|
+
vec2 project_pixel_offset(vec2 offsets) {
|
|
19
|
+
|
|
20
|
+
vec2 data = project_pixel(offsets);
|
|
21
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
22
|
+
// P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return vec2(data.x, -data.y);;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
vec2 line_dir(vec2 target, vec2 source) {
|
|
30
|
+
|
|
31
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
32
|
+
// P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
|
|
33
|
+
return normalize(target - source);
|
|
34
|
+
}
|
|
35
|
+
return normalize(ProjectFlat(target) - ProjectFlat(source));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
float flag_gap() {
|
|
39
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {
|
|
40
|
+
// P20_2 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减3
|
|
41
|
+
return 1.;
|
|
42
|
+
}
|
|
43
|
+
return -1.;
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
17
47
|
|
|
18
48
|
void main() {
|
|
19
49
|
|
|
20
50
|
// 透明度计算
|
|
21
51
|
vec2 source = a_Instance.rg; // 起始点
|
|
22
52
|
vec2 target = a_Instance.ba; // 终点
|
|
23
|
-
vec2 flowlineDir =
|
|
24
|
-
vec2 perpendicularDir = vec2(
|
|
53
|
+
vec2 flowlineDir = line_dir(target,source);
|
|
54
|
+
vec2 perpendicularDir = vec2(flowlineDir.y, flowlineDir.x); // mapbox || 高德
|
|
25
55
|
|
|
26
56
|
|
|
27
57
|
vec2 position = mix(source, target, a_Position.x);
|
|
28
58
|
|
|
29
59
|
float lengthCommon = length(project_position(vec4(target,0,1)) - project_position(vec4(source,0,1))); //
|
|
30
|
-
vec2 offsetDistances = a_Size.x *
|
|
60
|
+
vec2 offsetDistances = a_Size.x * project_pixel_offset(vec2(a_Position.y, a_Position.z)); // Mapbox || 高德
|
|
31
61
|
vec2 limitedOffsetDistances = clamp(
|
|
32
62
|
offsetDistances,
|
|
33
|
-
project_pixel(-lengthCommon*.
|
|
63
|
+
project_pixel(-lengthCommon*.2), project_pixel(lengthCommon*.2)
|
|
34
64
|
);
|
|
35
65
|
|
|
36
66
|
|
|
@@ -42,9 +72,9 @@ void main() {
|
|
|
42
72
|
a_Position.x
|
|
43
73
|
);
|
|
44
74
|
|
|
45
|
-
vec2 normalsCommon = u_stroke_width *
|
|
75
|
+
vec2 normalsCommon = u_stroke_width * project_pixel_offset(vec2(a_Normal.x, a_Normal.y)); // mapbox || 高德
|
|
46
76
|
|
|
47
|
-
float gapCommon =
|
|
77
|
+
float gapCommon = flag_gap() * project_pixel(u_gap_width);
|
|
48
78
|
vec3 offsetCommon = vec3(
|
|
49
79
|
flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) -
|
|
50
80
|
perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),
|
|
@@ -11,7 +11,6 @@ varying float v_segmentIndex;
|
|
|
11
11
|
|
|
12
12
|
uniform float u_lineDir: 1.0;
|
|
13
13
|
|
|
14
|
-
uniform float u_thetaOffset: 0.314;
|
|
15
14
|
uniform vec4 u_sourceColor;
|
|
16
15
|
uniform vec4 u_targetColor;
|
|
17
16
|
|
|
@@ -80,8 +79,8 @@ void main() {
|
|
|
80
79
|
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
|
|
81
80
|
float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
|
|
82
81
|
float d_distance_ratio;
|
|
83
|
-
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio,
|
|
84
|
-
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio,
|
|
82
|
+
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, thetaOffset), 0.0, 1.0));
|
|
83
|
+
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, thetaOffset), 0.0, 1.0));
|
|
85
84
|
// v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
|
|
86
85
|
//unProjCustomCoord
|
|
87
86
|
|
package/lib/mask/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
|
18
18
|
var _models = _interopRequireDefault(require("./models"));
|
|
19
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
-
var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var MaskLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(MaskLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(MaskLayer);
|
|
24
24
|
function MaskLayer() {
|
|
@@ -61,5 +61,4 @@ var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
61
61
|
}
|
|
62
62
|
}]);
|
|
63
63
|
return MaskLayer;
|
|
64
|
-
}(_BaseLayer2.default);
|
|
65
|
-
exports.default = MaskLayer;
|
|
64
|
+
}(_BaseLayer2.default);
|
package/lib/mask/models/fill.js
CHANGED
|
@@ -22,7 +22,7 @@ var mask_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid m
|
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
|
|
23
23
|
var mask_vert = "attribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\n\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
|
|
24
24
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
25
|
-
var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
25
|
+
var MaskModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
26
26
|
(0, _inherits2.default)(MaskModel, _BaseModel);
|
|
27
27
|
var _super = _createSuper(MaskModel);
|
|
28
28
|
function MaskModel() {
|
|
@@ -109,5 +109,4 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
109
109
|
}
|
|
110
110
|
}]);
|
|
111
111
|
return MaskModel;
|
|
112
|
-
}(_BaseModel2.default);
|
|
113
|
-
exports.default = MaskModel;
|
|
112
|
+
}(_BaseModel2.default);
|
package/lib/mask/models/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var _inversify = require("inversify");
|
|
|
20
20
|
require("reflect-metadata");
|
|
21
21
|
var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
|
|
22
22
|
var cloneDeep = _l7Utils.lodashUtil.cloneDeep;
|
|
23
|
-
var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inversify.inject)(_l7Core.TYPES.IMapService), _dec3 = (0, _inversify.inject)(_l7Core.TYPES.IFontService), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
23
|
+
var DataMappingPlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inversify.inject)(_l7Core.TYPES.IMapService), _dec3 = (0, _inversify.inject)(_l7Core.TYPES.IFontService), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
24
24
|
function DataMappingPlugin() {
|
|
25
25
|
(0, _classCallCheck2.default)(this, DataMappingPlugin);
|
|
26
26
|
(0, _initializerDefineProperty2.default)(this, "mapService", _descriptor, this);
|
|
@@ -147,11 +147,6 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
147
147
|
key: "mapping",
|
|
148
148
|
value: function mapping(layer, attributes, data, predata) {
|
|
149
149
|
var _this3 = this;
|
|
150
|
-
var _ref5 = layer.getLayerConfig(),
|
|
151
|
-
_ref5$arrow = _ref5.arrow,
|
|
152
|
-
arrow = _ref5$arrow === void 0 ? {
|
|
153
|
-
enable: false
|
|
154
|
-
} : _ref5$arrow;
|
|
155
150
|
var usedAttributes = attributes.filter(function (attribute) {
|
|
156
151
|
return attribute.scale !== undefined;
|
|
157
152
|
}).filter(function (attribute) {
|
|
@@ -179,18 +174,6 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
179
174
|
encodeRecord.shape = _this3.fontService.getIconFontKey(encodeRecord[attribute.name]);
|
|
180
175
|
}
|
|
181
176
|
});
|
|
182
|
-
if (arrow.enable && encodeRecord.shape === 'line') {
|
|
183
|
-
// 只有在线图层且支持配置箭头的时候进行插入顶点的处理
|
|
184
|
-
var coords = encodeRecord.coordinates;
|
|
185
|
-
// @ts-ignore
|
|
186
|
-
if (layer.arrowInsertCount < layer.encodeDataLength) {
|
|
187
|
-
// Tip: arrowInsert 的判断用于确保每一条线数据 arrow 的属性点只会被植入一次
|
|
188
|
-
var arrowPoint = _this3.getArrowPoints(coords[0], coords[1]);
|
|
189
|
-
encodeRecord.coordinates.splice(1, 0, arrowPoint, arrowPoint);
|
|
190
|
-
// @ts-ignore
|
|
191
|
-
layer.arrowInsertCount++;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
177
|
return encodeRecord;
|
|
195
178
|
});
|
|
196
179
|
attributes.forEach(function (attribute) {
|
|
@@ -278,11 +261,11 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
278
261
|
if (!attribute.scale) {
|
|
279
262
|
return [];
|
|
280
263
|
}
|
|
281
|
-
var scalers = (attribute === null || attribute === void 0
|
|
264
|
+
var scalers = (attribute === null || attribute === void 0 || (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
282
265
|
var params = [];
|
|
283
|
-
scalers.forEach(function (
|
|
266
|
+
scalers.forEach(function (_ref5) {
|
|
284
267
|
var _attribute$scale2;
|
|
285
|
-
var field =
|
|
268
|
+
var field = _ref5.field;
|
|
286
269
|
if (record.hasOwnProperty(field) || ((_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.type) === 'variable') {
|
|
287
270
|
// TODO:多字段,常量
|
|
288
271
|
params.push(record[field]);
|
|
@@ -312,5 +295,4 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
312
295
|
enumerable: true,
|
|
313
296
|
writable: true,
|
|
314
297
|
initializer: null
|
|
315
|
-
})), _class2)) || _class);
|
|
316
|
-
exports.default = DataMappingPlugin;
|
|
298
|
+
})), _class2)) || _class);
|
|
@@ -14,7 +14,7 @@ var _l7Source = _interopRequireDefault(require("@antv/l7-source"));
|
|
|
14
14
|
var _inversify = require("inversify");
|
|
15
15
|
require("reflect-metadata");
|
|
16
16
|
var _dec, _class;
|
|
17
|
-
var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
17
|
+
var DataSourcePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
18
18
|
function DataSourcePlugin() {
|
|
19
19
|
(0, _classCallCheck2.default)(this, DataSourcePlugin);
|
|
20
20
|
}
|
|
@@ -109,5 +109,4 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
|
|
|
109
109
|
}
|
|
110
110
|
}]);
|
|
111
111
|
return DataSourcePlugin;
|
|
112
|
-
}()) || _class);
|
|
113
|
-
exports.default = DataSourcePlugin;
|
|
112
|
+
}()) || _class);
|
|
@@ -21,8 +21,8 @@ var _inversify = require("inversify");
|
|
|
21
21
|
require("reflect-metadata");
|
|
22
22
|
var _identityScale = _interopRequireDefault(require("../utils/identityScale"));
|
|
23
23
|
var _scaleMap, _dec, _class;
|
|
24
|
-
function _getRequireWildcardCache(
|
|
25
|
-
function _interopRequireWildcard(
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
26
|
var isNil = _l7Utils.lodashUtil.isNil,
|
|
27
27
|
isString = _l7Utils.lodashUtil.isString,
|
|
28
28
|
uniq = _l7Utils.lodashUtil.uniq;
|
|
@@ -31,7 +31,7 @@ var scaleMap = (_scaleMap = {}, (0, _defineProperty2.default)(_scaleMap, _l7Core
|
|
|
31
31
|
/**
|
|
32
32
|
* 根据 Source 原始数据为指定字段创建 Scale,保存在 StyleAttribute 上,供下游插件使用
|
|
33
33
|
*/
|
|
34
|
-
var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
34
|
+
var FeatureScalePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
35
35
|
function FeatureScalePlugin() {
|
|
36
36
|
(0, _classCallCheck2.default)(this, FeatureScalePlugin);
|
|
37
37
|
(0, _defineProperty2.default)(this, "scaleOptions", {});
|
|
@@ -335,5 +335,4 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
335
335
|
}
|
|
336
336
|
}]);
|
|
337
337
|
return FeatureScalePlugin;
|
|
338
|
-
}()) || _class);
|
|
339
|
-
exports.default = FeatureScalePlugin;
|
|
338
|
+
}()) || _class);
|
|
@@ -11,7 +11,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
11
|
var _inversify = require("inversify");
|
|
12
12
|
require("reflect-metadata");
|
|
13
13
|
var _dec, _class;
|
|
14
|
-
var LayerAnimateStylePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
14
|
+
var LayerAnimateStylePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
15
15
|
function LayerAnimateStylePlugin() {
|
|
16
16
|
(0, _classCallCheck2.default)(this, LayerAnimateStylePlugin);
|
|
17
17
|
}
|
|
@@ -30,5 +30,4 @@ var LayerAnimateStylePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class
|
|
|
30
30
|
}
|
|
31
31
|
}]);
|
|
32
32
|
return LayerAnimateStylePlugin;
|
|
33
|
-
}()) || _class);
|
|
34
|
-
exports.default = LayerAnimateStylePlugin;
|
|
33
|
+
}()) || _class);
|
|
@@ -14,7 +14,7 @@ var _dec, _class;
|
|
|
14
14
|
/**
|
|
15
15
|
* 更新图层样式,初始图层相关配置
|
|
16
16
|
*/
|
|
17
|
-
var LayerStylePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
17
|
+
var LayerStylePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
18
18
|
function LayerStylePlugin() {
|
|
19
19
|
(0, _classCallCheck2.default)(this, LayerStylePlugin);
|
|
20
20
|
}
|
|
@@ -37,5 +37,4 @@ var LayerStylePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
|
|
|
37
37
|
}
|
|
38
38
|
}]);
|
|
39
39
|
return LayerStylePlugin;
|
|
40
|
-
}()) || _class);
|
|
41
|
-
exports.default = LayerStylePlugin;
|
|
40
|
+
}()) || _class);
|
|
@@ -17,7 +17,7 @@ var _dec, _class;
|
|
|
17
17
|
/**
|
|
18
18
|
* Layer Model 初始化,更新,销毁
|
|
19
19
|
*/
|
|
20
|
-
var LayerModelPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
20
|
+
var LayerModelPlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
21
21
|
function LayerModelPlugin() {
|
|
22
22
|
(0, _classCallCheck2.default)(this, LayerModelPlugin);
|
|
23
23
|
}
|
|
@@ -152,5 +152,4 @@ var LayerModelPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
|
|
|
152
152
|
}
|
|
153
153
|
}]);
|
|
154
154
|
return LayerModelPlugin;
|
|
155
|
-
}()) || _class);
|
|
156
|
-
exports.default = LayerModelPlugin;
|
|
155
|
+
}()) || _class);
|
|
@@ -13,7 +13,7 @@ var _dec, _class;
|
|
|
13
13
|
/**
|
|
14
14
|
* 更新图层样式,初始图层相关配置
|
|
15
15
|
*/
|
|
16
|
-
var LayerStylePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
16
|
+
var LayerStylePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
17
17
|
function LayerStylePlugin() {
|
|
18
18
|
(0, _classCallCheck2.default)(this, LayerStylePlugin);
|
|
19
19
|
}
|
|
@@ -33,5 +33,4 @@ var LayerStylePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
|
|
|
33
33
|
}
|
|
34
34
|
}]);
|
|
35
35
|
return LayerStylePlugin;
|
|
36
|
-
}()) || _class);
|
|
37
|
-
exports.default = LayerStylePlugin;
|
|
36
|
+
}()) || _class);
|
|
@@ -80,7 +80,7 @@ function generateLightingUniforms(lights) {
|
|
|
80
80
|
/**
|
|
81
81
|
* 光照 & Shadow
|
|
82
82
|
*/
|
|
83
|
-
var LightingPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
83
|
+
var LightingPlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
84
84
|
function LightingPlugin() {
|
|
85
85
|
(0, _classCallCheck2.default)(this, LightingPlugin);
|
|
86
86
|
}
|
|
@@ -102,5 +102,4 @@ var LightingPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PU
|
|
|
102
102
|
}
|
|
103
103
|
}]);
|
|
104
104
|
return LightingPlugin;
|
|
105
|
-
}()) || _class);
|
|
106
|
-
exports.default = LightingPlugin;
|
|
105
|
+
}()) || _class);
|
|
@@ -24,7 +24,7 @@ var _dec, _class;
|
|
|
24
24
|
* ],
|
|
25
25
|
* })
|
|
26
26
|
*/
|
|
27
|
-
var MultiPassRendererPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
27
|
+
var MultiPassRendererPlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
28
28
|
function MultiPassRendererPlugin() {
|
|
29
29
|
(0, _classCallCheck2.default)(this, MultiPassRendererPlugin);
|
|
30
30
|
}
|
|
@@ -62,5 +62,4 @@ var MultiPassRendererPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class
|
|
|
62
62
|
}
|
|
63
63
|
}]);
|
|
64
64
|
return MultiPassRendererPlugin;
|
|
65
|
-
}()) || _class);
|
|
66
|
-
exports.default = MultiPassRendererPlugin;
|
|
65
|
+
}()) || _class);
|
|
@@ -7,24 +7,81 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _l7Core = require("@antv/l7-core");
|
|
11
12
|
var _l7Utils = require("@antv/l7-utils");
|
|
12
13
|
var _inversify = require("inversify");
|
|
13
14
|
require("reflect-metadata");
|
|
15
|
+
var _CommonStyleAttribute = require("../core/CommonStyleAttribute");
|
|
14
16
|
var _dec, _class;
|
|
15
17
|
var PickingStage = {
|
|
16
18
|
NONE: 0.0,
|
|
17
19
|
ENCODE: 1.0,
|
|
18
20
|
HIGHLIGHT: 2.0
|
|
19
21
|
};
|
|
20
|
-
var PixelPickingPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
22
|
+
var PixelPickingPlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
21
23
|
function PixelPickingPlugin() {
|
|
22
24
|
(0, _classCallCheck2.default)(this, PixelPickingPlugin);
|
|
25
|
+
(0, _defineProperty2.default)(this, "PickOption", {
|
|
26
|
+
u_HighlightColor: [1, 0, 0, 1],
|
|
27
|
+
u_SelectColor: [1, 0, 0, 1],
|
|
28
|
+
u_PickingColor: [0, 0, 0],
|
|
29
|
+
u_PickingStage: 0,
|
|
30
|
+
u_CurrentSelectedId: [0, 0, 0],
|
|
31
|
+
u_PickingThreshold: 10,
|
|
32
|
+
u_PickingBuffer: 0,
|
|
33
|
+
// TODO: 更新机制
|
|
34
|
+
u_shaderPick: 0,
|
|
35
|
+
u_EnableSelect: 0,
|
|
36
|
+
u_activeMix: 0
|
|
37
|
+
});
|
|
23
38
|
}
|
|
24
39
|
(0, _createClass2.default)(PixelPickingPlugin, [{
|
|
40
|
+
key: "pickOption2Array",
|
|
41
|
+
value: function pickOption2Array() {
|
|
42
|
+
return Object.values(this.PickOption).flat();
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "updatePickOption",
|
|
46
|
+
value: function updatePickOption(option, rendererService) {
|
|
47
|
+
var _this = this;
|
|
48
|
+
Object.keys(option).forEach(function (key) {
|
|
49
|
+
_this.PickOption[key] = option[key];
|
|
50
|
+
});
|
|
51
|
+
rendererService.uniformBuffers[1].subData({
|
|
52
|
+
offset: 0,
|
|
53
|
+
data: new Uint8Array(new Float32Array(this.pickOption2Array()))
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
25
57
|
key: "apply",
|
|
26
58
|
value: function apply(layer, _ref) {
|
|
27
|
-
var
|
|
59
|
+
var _this2 = this;
|
|
60
|
+
var rendererService = _ref.rendererService,
|
|
61
|
+
styleAttributeService = _ref.styleAttributeService;
|
|
62
|
+
if (!rendererService.uniformBuffers[1]) {
|
|
63
|
+
// Create a Uniform Buffer Object(UBO).
|
|
64
|
+
var uniformBuffer = rendererService.createBuffer({
|
|
65
|
+
// vec4 u_HighlightColor;
|
|
66
|
+
// vec4 u_SelectColor;
|
|
67
|
+
// vec3 u_PickingColor;
|
|
68
|
+
// float u_PickingStage;
|
|
69
|
+
// vec3 u_CurrentSelectedId;
|
|
70
|
+
// float u_PickingThreshold;
|
|
71
|
+
// float u_PickingBuffer;
|
|
72
|
+
// float u_shaderPick;
|
|
73
|
+
// float u_EnableSelect;
|
|
74
|
+
// float u_activeMix;
|
|
75
|
+
data: new Float32Array(this.pickOption2Array().length),
|
|
76
|
+
isUBO: true
|
|
77
|
+
});
|
|
78
|
+
rendererService.uniformBuffers[1] = uniformBuffer;
|
|
79
|
+
this.updatePickOption({}, rendererService);
|
|
80
|
+
}
|
|
81
|
+
// u_PickingBuffer: layer.getLayerConfig().pickingBuffer || 0,
|
|
82
|
+
// // Tip: 当前地图是否在拖动
|
|
83
|
+
// u_shaderPick: Number(layer.getShaderPickStat()),
|
|
84
|
+
|
|
28
85
|
// TODO: 由于 Shader 目前无法根据是否开启拾取进行内容修改,因此即使不开启也需要生成 a_PickingColor
|
|
29
86
|
layer.hooks.init.tapPromise('PixelPickingPlugin', function () {
|
|
30
87
|
var _layer$getLayerConfig = layer.getLayerConfig(),
|
|
@@ -34,6 +91,7 @@ var PixelPickingPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
34
91
|
type: _l7Core.AttributeType.Attribute,
|
|
35
92
|
descriptor: {
|
|
36
93
|
name: 'a_PickingColor',
|
|
94
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.PICKING_COLOR,
|
|
37
95
|
buffer: {
|
|
38
96
|
data: [],
|
|
39
97
|
type: _l7Core.gl.FLOAT
|
|
@@ -53,6 +111,9 @@ var PixelPickingPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
53
111
|
var _layer$getLayerConfig2 = layer.getLayerConfig(),
|
|
54
112
|
enablePicking = _layer$getLayerConfig2.enablePicking;
|
|
55
113
|
if (enablePicking && layer.isVisible()) {
|
|
114
|
+
_this2.updatePickOption({
|
|
115
|
+
u_PickingStage: PickingStage.ENCODE
|
|
116
|
+
}, rendererService);
|
|
56
117
|
layer.models.forEach(function (model) {
|
|
57
118
|
return model.addUniforms({
|
|
58
119
|
u_PickingStage: PickingStage.ENCODE
|
|
@@ -65,6 +126,9 @@ var PixelPickingPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
65
126
|
enablePicking = _layer$getLayerConfig3.enablePicking;
|
|
66
127
|
// 区分选中高亮 和滑过高亮
|
|
67
128
|
if (enablePicking && layer.isVisible()) {
|
|
129
|
+
_this2.updatePickOption({
|
|
130
|
+
u_PickingStage: PickingStage.HIGHLIGHT
|
|
131
|
+
}, rendererService);
|
|
68
132
|
layer.models.forEach(function (model) {
|
|
69
133
|
return model.addUniforms({
|
|
70
134
|
u_PickingStage: PickingStage.HIGHLIGHT
|
|
@@ -81,15 +145,17 @@ var PixelPickingPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
81
145
|
layer.updateLayerConfig({
|
|
82
146
|
pickedFeatureID: (0, _l7Utils.decodePickingColor)(new Uint8Array(pickedColor))
|
|
83
147
|
});
|
|
148
|
+
var option = {
|
|
149
|
+
u_PickingStage: PickingStage.HIGHLIGHT,
|
|
150
|
+
u_PickingColor: pickedColor,
|
|
151
|
+
u_HighlightColor: highlightColorInArray.map(function (c) {
|
|
152
|
+
return c * 255;
|
|
153
|
+
}),
|
|
154
|
+
u_activeMix: activeMix
|
|
155
|
+
};
|
|
156
|
+
_this2.updatePickOption(option, rendererService);
|
|
84
157
|
layer.models.forEach(function (model) {
|
|
85
|
-
return model.addUniforms(
|
|
86
|
-
u_PickingStage: PickingStage.HIGHLIGHT,
|
|
87
|
-
u_PickingColor: pickedColor,
|
|
88
|
-
u_HighlightColor: highlightColorInArray.map(function (c) {
|
|
89
|
-
return c * 255;
|
|
90
|
-
}),
|
|
91
|
-
u_activeMix: activeMix
|
|
92
|
-
});
|
|
158
|
+
return model.addUniforms(option);
|
|
93
159
|
});
|
|
94
160
|
});
|
|
95
161
|
layer.hooks.beforeSelect.tap('PixelPickingPlugin', function (pickedColor) {
|
|
@@ -101,24 +167,26 @@ var PixelPickingPlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
101
167
|
layer.updateLayerConfig({
|
|
102
168
|
pickedFeatureID: (0, _l7Utils.decodePickingColor)(new Uint8Array(pickedColor))
|
|
103
169
|
});
|
|
170
|
+
var option = {
|
|
171
|
+
u_PickingStage: PickingStage.HIGHLIGHT,
|
|
172
|
+
u_PickingColor: pickedColor,
|
|
173
|
+
u_HighlightColor: highlightColorInArray.map(function (c) {
|
|
174
|
+
return c * 255;
|
|
175
|
+
}),
|
|
176
|
+
u_activeMix: selectMix,
|
|
177
|
+
u_CurrentSelectedId: pickedColor,
|
|
178
|
+
u_SelectColor: highlightColorInArray.map(function (c) {
|
|
179
|
+
return c * 255;
|
|
180
|
+
}),
|
|
181
|
+
u_EnableSelect: 1
|
|
182
|
+
};
|
|
183
|
+
console.log(option);
|
|
184
|
+
_this2.updatePickOption(option, rendererService);
|
|
104
185
|
layer.models.forEach(function (model) {
|
|
105
|
-
return model.addUniforms(
|
|
106
|
-
u_PickingStage: PickingStage.HIGHLIGHT,
|
|
107
|
-
u_PickingColor: pickedColor,
|
|
108
|
-
u_HighlightColor: highlightColorInArray.map(function (c) {
|
|
109
|
-
return c * 255;
|
|
110
|
-
}),
|
|
111
|
-
u_activeMix: selectMix,
|
|
112
|
-
u_CurrentSelectedId: pickedColor,
|
|
113
|
-
u_SelectColor: highlightColorInArray.map(function (c) {
|
|
114
|
-
return c * 255;
|
|
115
|
-
}),
|
|
116
|
-
u_EnableSelect: 1
|
|
117
|
-
});
|
|
186
|
+
return model.addUniforms(option);
|
|
118
187
|
});
|
|
119
188
|
});
|
|
120
189
|
}
|
|
121
190
|
}]);
|
|
122
191
|
return PixelPickingPlugin;
|
|
123
|
-
}()) || _class);
|
|
124
|
-
exports.default = PixelPickingPlugin;
|
|
192
|
+
}()) || _class);
|
|
@@ -10,12 +10,13 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _inversify = require("inversify");
|
|
12
12
|
require("reflect-metadata");
|
|
13
|
+
var _CommonStyleAttribute = require("../core/CommonStyleAttribute");
|
|
13
14
|
var _utils = require("../tile/utils/utils");
|
|
14
15
|
var _dec, _class;
|
|
15
16
|
/**
|
|
16
17
|
* 在初始化阶段完成属性的注册,以及首次根据 Layer 指定的三角化方法完成 indices 和 attribute 的创建
|
|
17
18
|
*/
|
|
18
|
-
var RegisterStyleAttributePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
19
|
+
var RegisterStyleAttributePlugin = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
19
20
|
function RegisterStyleAttributePlugin() {
|
|
20
21
|
(0, _classCallCheck2.default)(this, RegisterStyleAttributePlugin);
|
|
21
22
|
}
|
|
@@ -54,6 +55,7 @@ var RegisterStyleAttributePlugin = (_dec = (0, _inversify.injectable)(), _dec(_c
|
|
|
54
55
|
type: _l7Core.AttributeType.Attribute,
|
|
55
56
|
descriptor: {
|
|
56
57
|
name: 'a_Position',
|
|
58
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.POSITION,
|
|
57
59
|
buffer: {
|
|
58
60
|
data: [],
|
|
59
61
|
type: _l7Core.gl.FLOAT
|
|
@@ -65,28 +67,6 @@ var RegisterStyleAttributePlugin = (_dec = (0, _inversify.injectable)(), _dec(_c
|
|
|
65
67
|
}
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "registerFilterAttribute",
|
|
70
|
-
value: function registerFilterAttribute(styleAttributeService) {
|
|
71
|
-
styleAttributeService.registerStyleAttribute({
|
|
72
|
-
name: 'filter',
|
|
73
|
-
type: _l7Core.AttributeType.Attribute,
|
|
74
|
-
descriptor: {
|
|
75
|
-
name: 'filter',
|
|
76
|
-
buffer: {
|
|
77
|
-
// give the WebGL driver a hint that this buffer may change
|
|
78
|
-
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
79
|
-
data: [],
|
|
80
|
-
type: _l7Core.gl.FLOAT
|
|
81
|
-
},
|
|
82
|
-
size: 1,
|
|
83
|
-
update: function update(feature) {
|
|
84
|
-
var filter = feature.filter;
|
|
85
|
-
return filter ? [1] : [0];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
70
|
}, {
|
|
91
71
|
key: "registerColorAttribute",
|
|
92
72
|
value: function registerColorAttribute(styleAttributeService) {
|
|
@@ -95,6 +75,7 @@ var RegisterStyleAttributePlugin = (_dec = (0, _inversify.injectable)(), _dec(_c
|
|
|
95
75
|
type: _l7Core.AttributeType.Attribute,
|
|
96
76
|
descriptor: {
|
|
97
77
|
name: 'a_Color',
|
|
78
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.COLOR,
|
|
98
79
|
buffer: {
|
|
99
80
|
// give the WebGL driver a hint that this buffer may change
|
|
100
81
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -118,6 +99,7 @@ var RegisterStyleAttributePlugin = (_dec = (0, _inversify.injectable)(), _dec(_c
|
|
|
118
99
|
type: _l7Core.AttributeType.Attribute,
|
|
119
100
|
descriptor: {
|
|
120
101
|
name: 'a_vertexId',
|
|
102
|
+
shaderLocation: _CommonStyleAttribute.ShaderLocation.VERTEX_ID,
|
|
121
103
|
buffer: {
|
|
122
104
|
// give the WebGL driver a hint that this buffer may change
|
|
123
105
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -133,5 +115,4 @@ var RegisterStyleAttributePlugin = (_dec = (0, _inversify.injectable)(), _dec(_c
|
|
|
133
115
|
}
|
|
134
116
|
}]);
|
|
135
117
|
return RegisterStyleAttributePlugin;
|
|
136
|
-
}()) || _class);
|
|
137
|
-
exports.default = RegisterStyleAttributePlugin;
|
|
118
|
+
}()) || _class);
|