@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
package/es/tile/tile/Tile.js
CHANGED
|
@@ -80,7 +80,7 @@ var Tile = /*#__PURE__*/function (_EventEmitter) {
|
|
|
80
80
|
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
81
81
|
maskLayers = _this$parent$getLayer.maskLayers;
|
|
82
82
|
var layers = [];
|
|
83
|
-
maskLayers === null || maskLayers === void 0
|
|
83
|
+
maskLayers === null || maskLayers === void 0 || maskLayers.forEach(function (layer) {
|
|
84
84
|
if (!layer.tileLayer) {
|
|
85
85
|
// 非瓦片图层返回图层本身,瓦片图层返回对应的行列号图层
|
|
86
86
|
layers.push(layer);
|
|
@@ -233,7 +233,7 @@ var Tile = /*#__PURE__*/function (_EventEmitter) {
|
|
|
233
233
|
key: "destroy",
|
|
234
234
|
value: function destroy() {
|
|
235
235
|
var _this$tileMask;
|
|
236
|
-
(_this$tileMask = this.tileMask) === null || _this$tileMask === void 0
|
|
236
|
+
(_this$tileMask = this.tileMask) === null || _this$tileMask === void 0 || _this$tileMask.destroy();
|
|
237
237
|
this.layers.forEach(function (layer) {
|
|
238
238
|
return layer.destroy();
|
|
239
239
|
});
|
package/es/wind/models/wind.js
CHANGED
|
@@ -65,7 +65,6 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
65
65
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
66
66
|
var _source$data,
|
|
67
67
|
_source$data2,
|
|
68
|
-
_source$data2$images,
|
|
69
68
|
_this3 = this;
|
|
70
69
|
var _ref, _ref$uMin, uMin, _ref$uMax, uMax, _ref$vMin, vMin, _ref$vMax, vMax, _ref$fadeOpacity, fadeOpacity, _ref$speedFactor, speedFactor, _ref$dropRate, dropRate, _ref$dropRateBump, dropRateBump, _ref$rampColors, rampColors, _ref$sizeScale, sizeScale, createTexture2D, source, glContext, model;
|
|
71
70
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -81,7 +80,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
81
80
|
this.cacheZoom = Math.floor(this.mapService.getZoom());
|
|
82
81
|
glContext = this.rendererService.getGLContext();
|
|
83
82
|
this.imageCoords = (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.dataArray[0].coordinates;
|
|
84
|
-
(_source$data2 = source.data) === null || _source$data2 === void 0
|
|
83
|
+
(_source$data2 = source.data) === null || _source$data2 === void 0 || (_source$data2 = _source$data2.images) === null || _source$data2 === void 0 || _source$data2.then(function (imageData) {
|
|
85
84
|
var _this3$texture;
|
|
86
85
|
_this3.sizeScale = sizeScale * _this3.getZoomScale();
|
|
87
86
|
var _this3$getWindSize = _this3.getWindSize(),
|
|
@@ -107,7 +106,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
107
106
|
vMax: vMax,
|
|
108
107
|
image: imageData[0]
|
|
109
108
|
});
|
|
110
|
-
(_this3$texture = _this3.texture) === null || _this3$texture === void 0
|
|
109
|
+
(_this3$texture = _this3.texture) === null || _this3$texture === void 0 || _this3$texture.destroy();
|
|
111
110
|
_this3.texture = createTexture2D({
|
|
112
111
|
width: imageWidth,
|
|
113
112
|
height: imageHeight
|
|
@@ -175,8 +174,8 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
175
174
|
key: "clearModels",
|
|
176
175
|
value: function clearModels() {
|
|
177
176
|
var _this$texture, _this$wind;
|
|
178
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
179
|
-
(_this$wind = this.wind) === null || _this$wind === void 0
|
|
177
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
178
|
+
(_this$wind = this.wind) === null || _this$wind === void 0 || _this$wind.destroy();
|
|
180
179
|
}
|
|
181
180
|
}, {
|
|
182
181
|
key: "registerBuiltinAttributes",
|
|
@@ -274,7 +273,7 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
274
273
|
this.layerService.beforeRenderData(this.layer);
|
|
275
274
|
this.layer.hooks.beforeRender.call();
|
|
276
275
|
this.layerService.renderMask(this.layer.masks);
|
|
277
|
-
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0
|
|
276
|
+
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0 || _this$colorModel.draw({
|
|
278
277
|
uniforms: {
|
|
279
278
|
u_opacity: opacity || 1.0,
|
|
280
279
|
u_texture: this.texture
|
package/lib/canvas/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
|
18
18
|
var _index = _interopRequireDefault(require("./models/index"));
|
|
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 CanvasLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var CanvasLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(CanvasLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(CanvasLayer);
|
|
24
24
|
function CanvasLayer() {
|
|
@@ -99,5 +99,4 @@ var CanvasLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
99
99
|
}
|
|
100
100
|
}]);
|
|
101
101
|
return CanvasLayer;
|
|
102
|
-
}(_BaseLayer2.default);
|
|
103
|
-
exports.default = CanvasLayer;
|
|
102
|
+
}(_BaseLayer2.default);
|
|
@@ -19,7 +19,7 @@ var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
|
19
19
|
var _interface = require("../../core/interface");
|
|
20
20
|
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); }; }
|
|
21
21
|
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; } }
|
|
22
|
-
var CanvaModel = /*#__PURE__*/function (_BaseModel) {
|
|
22
|
+
var CanvaModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
23
23
|
(0, _inherits2.default)(CanvaModel, _BaseModel);
|
|
24
24
|
var _super = _createSuper(CanvaModel);
|
|
25
25
|
function CanvaModel() {
|
|
@@ -111,7 +111,7 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
111
111
|
value: function clearModels() {
|
|
112
112
|
if (this.canvas) {
|
|
113
113
|
var _this$mapService$getC;
|
|
114
|
-
(_this$mapService$getC = this.mapService.getContainer()) === null || _this$mapService$getC === void 0
|
|
114
|
+
(_this$mapService$getC = this.mapService.getContainer()) === null || _this$mapService$getC === void 0 || _this$mapService$getC.removeChild(this.canvas);
|
|
115
115
|
// @ts-ignore
|
|
116
116
|
this.canvas = null;
|
|
117
117
|
}
|
|
@@ -168,7 +168,7 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
168
168
|
canvas.style.top = '0';
|
|
169
169
|
canvas.style.left = '0';
|
|
170
170
|
canvas.style.zIndex = zIndex + '';
|
|
171
|
-
(_this$mapService$getC2 = this.mapService.getContainer()) === null || _this$mapService$getC2 === void 0
|
|
171
|
+
(_this$mapService$getC2 = this.mapService.getContainer()) === null || _this$mapService$getC2 === void 0 || _this$mapService$getC2.appendChild(canvas);
|
|
172
172
|
var ctx = canvas.getContext('2d');
|
|
173
173
|
this.ctx = ctx;
|
|
174
174
|
}
|
|
@@ -198,5 +198,4 @@ var CanvaModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
198
198
|
}
|
|
199
199
|
}]);
|
|
200
200
|
return CanvaModel;
|
|
201
|
-
}(_BaseModel2.default);
|
|
202
|
-
exports.default = CanvaModel;
|
|
201
|
+
}(_BaseModel2.default);
|
|
@@ -18,7 +18,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
|
18
18
|
var _build = _interopRequireDefault(require("./models/build"));
|
|
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 CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var CityBuildingLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(CityBuildingLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(CityBuildingLayer);
|
|
24
24
|
function CityBuildingLayer() {
|
|
@@ -66,5 +66,4 @@ var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
66
66
|
}
|
|
67
67
|
}]);
|
|
68
68
|
return CityBuildingLayer;
|
|
69
|
-
}(_BaseLayer2.default);
|
|
70
|
-
exports.default = CityBuildingLayer;
|
|
69
|
+
}(_BaseLayer2.default);
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
23
23
|
var buildFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\nuniform float u_near : 0;\nuniform float u_far : 1;\nvarying vec4 v_Color;\nvarying vec2 v_texCoord;\nuniform float u_Zoom : 1;\nuniform float u_time;\n\nuniform float u_circleSweep;\nuniform float u_cityMinSize;\nuniform vec3 u_circleSweepColor;\nuniform float u_circleSweepSpeed;\n\nvarying float v_worldDis;\n\n#pragma include \"picking\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n gl_FragColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n gl_FragColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n gl_FragColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n gl_FragColor.rgb += r * r * u_circleSweepColor;\n }\n \n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/build_vert.glsl' */
|
|
25
25
|
var buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvarying vec4 v_Color;\n\nuniform float u_circleSweep;\nuniform vec2 u_cityCenter;\n\nvarying float v_worldDis;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n if(u_CoordinateSystem != COORDINATE_SYSTEM_P20_2) {\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n }\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\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 float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
26
|
-
var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
|
+
var CityBuildModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
27
27
|
(0, _inherits2.default)(CityBuildModel, _BaseModel);
|
|
28
28
|
var _super = _createSuper(CityBuildModel);
|
|
29
29
|
function CityBuildModel() {
|
|
@@ -206,5 +206,4 @@ var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
206
206
|
}
|
|
207
207
|
}]);
|
|
208
208
|
return CityBuildModel;
|
|
209
|
-
}(_BaseModel2.default);
|
|
210
|
-
exports.default = CityBuildModel;
|
|
209
|
+
}(_BaseModel2.default);
|
package/lib/core/BaseLayer.js
CHANGED
|
@@ -30,7 +30,7 @@ var _multiPassRender = require("../utils/multiPassRender");
|
|
|
30
30
|
var _LayerPickService = _interopRequireDefault(require("./LayerPickService"));
|
|
31
31
|
var _TextureService = _interopRequireDefault(require("./TextureService"));
|
|
32
32
|
var _excluded = ["passes"],
|
|
33
|
-
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "
|
|
33
|
+
_excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "styleOption"];
|
|
34
34
|
var _dec, _class, _descriptor; // @ts-ignore
|
|
35
35
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
36
36
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -47,7 +47,7 @@ var isEqual = _l7Utils.lodashUtil.isEqual,
|
|
|
47
47
|
* 分配 layer id
|
|
48
48
|
*/
|
|
49
49
|
var layerIdCounter = 0;
|
|
50
|
-
var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
|
|
50
|
+
var BaseLayer = exports.default = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function (_ref) {
|
|
51
51
|
(0, _inherits2.default)(BaseLayer, _ref);
|
|
52
52
|
var _super = _createSuper(BaseLayer);
|
|
53
53
|
// private pickingPassRender: IPass<'pixelPicking'>;
|
|
@@ -381,7 +381,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
381
381
|
id: this.id,
|
|
382
382
|
type: this.type
|
|
383
383
|
};
|
|
384
|
-
(_this$debugService = this.debugService) === null || _this$debugService === void 0
|
|
384
|
+
(_this$debugService = this.debugService) === null || _this$debugService === void 0 || _this$debugService.log(key, values);
|
|
385
385
|
}
|
|
386
386
|
}, {
|
|
387
387
|
key: "updateModelData",
|
|
@@ -957,6 +957,12 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
957
957
|
if (this.isDestroyed) {
|
|
958
958
|
return;
|
|
959
959
|
}
|
|
960
|
+
|
|
961
|
+
// destroy all UBOs
|
|
962
|
+
this.layerModel.uniformBuffers.forEach(function (buffer) {
|
|
963
|
+
buffer.destroy();
|
|
964
|
+
});
|
|
965
|
+
|
|
960
966
|
// remove child layer
|
|
961
967
|
this.layerChildren.map(function (child) {
|
|
962
968
|
return child.destroy(false);
|
|
@@ -975,7 +981,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
975
981
|
this.hooks.beforeDestroy.call();
|
|
976
982
|
// 清除sources事件
|
|
977
983
|
this.layerSource.off('update', this.sourceEvent);
|
|
978
|
-
(_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0
|
|
984
|
+
(_this$multiPassRender = this.multiPassRenderer) === null || _this$multiPassRender === void 0 || _this$multiPassRender.destroy();
|
|
979
985
|
this.textureService.destroy();
|
|
980
986
|
|
|
981
987
|
// 清除所有属性以及关联的 vao == 销毁所有 => model this.models.forEach((model) => model.destroy());
|
|
@@ -985,11 +991,11 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
985
991
|
|
|
986
992
|
this.hooks.afterDestroy.call();
|
|
987
993
|
// Tip: 清除各个图层自定义的 models 资源
|
|
988
|
-
(_this$layerModel = this.layerModel) === null || _this$layerModel === void 0
|
|
989
|
-
(_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0
|
|
994
|
+
(_this$layerModel = this.layerModel) === null || _this$layerModel === void 0 || _this$layerModel.clearModels(refresh);
|
|
995
|
+
(_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 || _this$tileLayer.destroy();
|
|
990
996
|
this.models = [];
|
|
991
997
|
// 清除图层日志(如果有的话:非瓦片相关)
|
|
992
|
-
(_this$debugService2 = this.debugService) === null || _this$debugService2 === void 0
|
|
998
|
+
(_this$debugService2 = this.debugService) === null || _this$debugService2 === void 0 || _this$debugService2.removeLog(this.id);
|
|
993
999
|
this.emit('remove', {
|
|
994
1000
|
target: this,
|
|
995
1001
|
type: 'remove'
|
|
@@ -1016,7 +1022,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1016
1022
|
this.models.forEach(function (model) {
|
|
1017
1023
|
return model.destroy();
|
|
1018
1024
|
});
|
|
1019
|
-
(_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0
|
|
1025
|
+
(_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 || _this$layerModel2.clearModels();
|
|
1020
1026
|
this.models = [];
|
|
1021
1027
|
}
|
|
1022
1028
|
}, {
|
|
@@ -1099,10 +1105,10 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1099
1105
|
value: function getLegend(name) {
|
|
1100
1106
|
var _attribute$scale, _scales$0$option, _attribute$scale2;
|
|
1101
1107
|
var attribute = this.styleAttributeService.getLayerStyleAttribute(name);
|
|
1102
|
-
var scales = (attribute === null || attribute === void 0
|
|
1108
|
+
var scales = (attribute === null || attribute === void 0 || (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
1103
1109
|
return {
|
|
1104
1110
|
type: (_scales$0$option = scales[0].option) === null || _scales$0$option === void 0 ? void 0 : _scales$0$option.type,
|
|
1105
|
-
field: attribute === null || attribute === void 0
|
|
1111
|
+
field: attribute === null || attribute === void 0 || (_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.field,
|
|
1106
1112
|
items: this.getLegendItems(name)
|
|
1107
1113
|
};
|
|
1108
1114
|
}
|
|
@@ -1163,11 +1169,11 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1163
1169
|
value: function () {
|
|
1164
1170
|
var _buildLayerModel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(options) {
|
|
1165
1171
|
var _this10 = this;
|
|
1166
|
-
var moduleName, vertexShader, fragmentShader, inject, triangulation,
|
|
1172
|
+
var moduleName, vertexShader, fragmentShader, inject, triangulation, styleOption, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1167
1173
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
1168
1174
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1169
1175
|
case 0:
|
|
1170
|
-
moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, inject = options.inject, triangulation = options.triangulation,
|
|
1176
|
+
moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, inject = options.inject, triangulation = options.triangulation, styleOption = options.styleOption, rest = (0, _objectWithoutProperties2.default)(options, _excluded2);
|
|
1171
1177
|
this.shaderModuleService.registerModule(moduleName, {
|
|
1172
1178
|
vs: vertexShader,
|
|
1173
1179
|
fs: fragmentShader,
|
|
@@ -1176,8 +1182,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1176
1182
|
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1177
1183
|
createModel = this.rendererService.createModel;
|
|
1178
1184
|
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
1179
|
-
|
|
1180
|
-
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
|
|
1185
|
+
var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, styleOption),
|
|
1181
1186
|
attributes = _this10$styleAttribut.attributes,
|
|
1182
1187
|
elements = _this10$styleAttribut.elements,
|
|
1183
1188
|
count = _this10$styleAttribut.count;
|
|
@@ -1187,7 +1192,9 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1187
1192
|
fs: fs,
|
|
1188
1193
|
vs: vs,
|
|
1189
1194
|
elements: elements,
|
|
1190
|
-
blend: _blend.BlendTypes[_l7Core.BlendType.normal]
|
|
1195
|
+
blend: _blend.BlendTypes[_l7Core.BlendType.normal],
|
|
1196
|
+
uniformBuffers: [].concat((0, _toConsumableArray2.default)(_this10.layerModel.uniformBuffers), (0, _toConsumableArray2.default)(_this10.rendererService.uniformBuffers)),
|
|
1197
|
+
textures: _this10.layerModel.textures
|
|
1191
1198
|
}, rest);
|
|
1192
1199
|
if (count) {
|
|
1193
1200
|
modelOptions.count = count;
|
|
@@ -1476,5 +1483,4 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1476
1483
|
enumerable: true,
|
|
1477
1484
|
writable: true,
|
|
1478
1485
|
initializer: null
|
|
1479
|
-
})), _class));
|
|
1480
|
-
exports.default = BaseLayer;
|
|
1486
|
+
})), _class));
|
package/lib/core/BaseModel.js
CHANGED
|
@@ -18,11 +18,19 @@ var _l7Core = require("@antv/l7-core");
|
|
|
18
18
|
var _l7Utils = require("@antv/l7-utils");
|
|
19
19
|
var _blend = require("../utils/blend");
|
|
20
20
|
var _stencil = require("../utils/stencil");
|
|
21
|
-
var _CommonStyleAttribute = require("./CommonStyleAttribute");
|
|
22
21
|
var _constant = require("./constant");
|
|
22
|
+
var _CommonStyleAttribute = require("./CommonStyleAttribute");
|
|
23
23
|
var _dec, _class, _descriptor;
|
|
24
|
+
var shaderLocationMap = {
|
|
25
|
+
opacity: _CommonStyleAttribute.ShaderLocation.OPACITY,
|
|
26
|
+
stroke: _CommonStyleAttribute.ShaderLocation.STROKE,
|
|
27
|
+
offsets: _CommonStyleAttribute.ShaderLocation.OFFSETS,
|
|
28
|
+
rotation: _CommonStyleAttribute.ShaderLocation.ROTATION,
|
|
29
|
+
extrusionBase: _CommonStyleAttribute.ShaderLocation.EXTRUSION_BASE
|
|
30
|
+
};
|
|
31
|
+
|
|
24
32
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
-
var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
|
|
33
|
+
var BaseModel = exports.default = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
|
|
26
34
|
// @lazyInject(TYPES.IIconService)
|
|
27
35
|
// protected readonly iconService: IIconService;
|
|
28
36
|
|
|
@@ -35,7 +43,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
35
43
|
|
|
36
44
|
function BaseModel(layer) {
|
|
37
45
|
(0, _classCallCheck2.default)(this, BaseModel);
|
|
38
|
-
|
|
46
|
+
(0, _defineProperty2.default)(this, "uniformBuffers", []);
|
|
47
|
+
(0, _defineProperty2.default)(this, "textures", []);
|
|
39
48
|
(0, _defineProperty2.default)(this, "preStyleAttribute", {});
|
|
40
49
|
(0, _defineProperty2.default)(this, "encodeStyleAttribute", {});
|
|
41
50
|
(0, _initializerDefineProperty2.default)(this, "configService", _descriptor, this);
|
|
@@ -215,18 +224,30 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
215
224
|
value: function getInject() {
|
|
216
225
|
var encodeStyleAttribute = this.layer.encodeStyleAttribute;
|
|
217
226
|
var str = '';
|
|
227
|
+
// a_Position = 0
|
|
228
|
+
// a_Color = 1
|
|
229
|
+
// a_PickingColor = 2
|
|
230
|
+
|
|
231
|
+
var uniforms = [];
|
|
232
|
+
// 支持数据映射的类型
|
|
218
233
|
this.layer.enableShaderEncodeStyles.forEach(function (key) {
|
|
219
234
|
if (encodeStyleAttribute[key]) {
|
|
235
|
+
// 配置了数据映射的类型
|
|
220
236
|
str += "#define USE_ATTRIBUTE_".concat(key.toUpperCase(), " 0.0; \n\n");
|
|
237
|
+
} else {
|
|
238
|
+
uniforms.push(" ".concat(_constant.DefaultUniformStyleType[key], " u_").concat(key, ";"));
|
|
221
239
|
}
|
|
222
|
-
str += "\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n
|
|
240
|
+
str += "\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n layout(location = ").concat(shaderLocationMap[key], ") in ").concat(_constant.DefaultUniformStyleType[key], " a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n #endif\n\n ");
|
|
223
241
|
});
|
|
242
|
+
var attributeUniforms = uniforms.length ? "\nlayout(std140) uniform AttributeUniforms {\n".concat(uniforms.join('\n'), "\n};\n ") : '';
|
|
243
|
+
str += attributeUniforms;
|
|
224
244
|
var innerStr = '';
|
|
225
245
|
this.layer.enableShaderEncodeStyles.forEach(function (key) {
|
|
226
|
-
innerStr += "\n\n#ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n
|
|
246
|
+
innerStr += "\n\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n ").concat(_constant.DefaultUniformStyleType[key], " ").concat(key, " = a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n #else\n ").concat(_constant.DefaultUniformStyleType[key], " ").concat(key, " = u_").concat(key, ";\n #endif\n\n ");
|
|
227
247
|
});
|
|
228
248
|
return {
|
|
229
249
|
'vs:#decl': str,
|
|
250
|
+
'fs:#decl': attributeUniforms,
|
|
230
251
|
'vs:#main-start': innerStr
|
|
231
252
|
};
|
|
232
253
|
}
|
|
@@ -261,6 +282,9 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
261
282
|
var options = (0, _CommonStyleAttribute.getCommonStyleAttributeOptions)(key);
|
|
262
283
|
if (options) {
|
|
263
284
|
_this2.styleAttributeService.registerStyleAttribute(options);
|
|
285
|
+
if (options.descriptor) {
|
|
286
|
+
options.descriptor.shaderLocation = shaderLocationMap[key];
|
|
287
|
+
}
|
|
264
288
|
}
|
|
265
289
|
});
|
|
266
290
|
}
|
|
@@ -276,5 +300,4 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
276
300
|
enumerable: true,
|
|
277
301
|
writable: true,
|
|
278
302
|
initializer: null
|
|
279
|
-
})), _class));
|
|
280
|
-
exports.default = BaseModel;
|
|
303
|
+
})), _class));
|
|
@@ -3,8 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.ShaderLocation = void 0;
|
|
6
7
|
exports.getCommonStyleAttributeOptions = getCommonStyleAttributeOptions;
|
|
7
8
|
var _l7Core = require("@antv/l7-core");
|
|
9
|
+
var ShaderLocation = exports.ShaderLocation = /*#__PURE__*/function (ShaderLocation) {
|
|
10
|
+
ShaderLocation[ShaderLocation["POSITION"] = 0] = "POSITION";
|
|
11
|
+
ShaderLocation[ShaderLocation["COLOR"] = 1] = "COLOR";
|
|
12
|
+
ShaderLocation[ShaderLocation["VERTEX_ID"] = 2] = "VERTEX_ID";
|
|
13
|
+
ShaderLocation[ShaderLocation["PICKING_COLOR"] = 3] = "PICKING_COLOR";
|
|
14
|
+
ShaderLocation[ShaderLocation["STROKE"] = 4] = "STROKE";
|
|
15
|
+
ShaderLocation[ShaderLocation["OPACITY"] = 5] = "OPACITY";
|
|
16
|
+
ShaderLocation[ShaderLocation["OFFSETS"] = 6] = "OFFSETS";
|
|
17
|
+
ShaderLocation[ShaderLocation["ROTATION"] = 7] = "ROTATION";
|
|
18
|
+
ShaderLocation[ShaderLocation["EXTRUSION_BASE"] = 8] = "EXTRUSION_BASE";
|
|
19
|
+
ShaderLocation[ShaderLocation["SIZE"] = 9] = "SIZE";
|
|
20
|
+
ShaderLocation[ShaderLocation["SHAPE"] = 10] = "SHAPE";
|
|
21
|
+
ShaderLocation[ShaderLocation["EXTRUDE"] = 11] = "EXTRUDE";
|
|
22
|
+
ShaderLocation[ShaderLocation["MAX"] = 12] = "MAX";
|
|
23
|
+
return ShaderLocation;
|
|
24
|
+
}({});
|
|
8
25
|
function getCommonStyleAttributeOptions(name) {
|
|
9
26
|
switch (name) {
|
|
10
27
|
// // roate
|
|
@@ -14,6 +31,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
14
31
|
type: _l7Core.AttributeType.Attribute,
|
|
15
32
|
descriptor: {
|
|
16
33
|
name: 'a_Rotation',
|
|
34
|
+
shaderLocation: ShaderLocation.ROTATION,
|
|
17
35
|
buffer: {
|
|
18
36
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
19
37
|
data: [],
|
|
@@ -33,6 +51,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
33
51
|
type: _l7Core.AttributeType.Attribute,
|
|
34
52
|
descriptor: {
|
|
35
53
|
name: 'a_Stroke',
|
|
54
|
+
shaderLocation: ShaderLocation.STROKE,
|
|
36
55
|
buffer: {
|
|
37
56
|
// give the WebGL driver a hint that this buffer may change
|
|
38
57
|
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
@@ -53,6 +72,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
53
72
|
type: _l7Core.AttributeType.Attribute,
|
|
54
73
|
descriptor: {
|
|
55
74
|
name: 'a_Opacity',
|
|
75
|
+
shaderLocation: ShaderLocation.OPACITY,
|
|
56
76
|
buffer: {
|
|
57
77
|
// give the WebGL driver a hint that this buffer may change
|
|
58
78
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -73,6 +93,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
73
93
|
type: _l7Core.AttributeType.Attribute,
|
|
74
94
|
descriptor: {
|
|
75
95
|
name: 'a_ExtrusionBase',
|
|
96
|
+
shaderLocation: ShaderLocation.EXTRUSION_BASE,
|
|
76
97
|
buffer: {
|
|
77
98
|
// give the WebGL driver a hint that this buffer may change
|
|
78
99
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -93,6 +114,7 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
93
114
|
type: _l7Core.AttributeType.Attribute,
|
|
94
115
|
descriptor: {
|
|
95
116
|
name: 'a_Offsets',
|
|
117
|
+
shaderLocation: ShaderLocation.OFFSETS,
|
|
96
118
|
buffer: {
|
|
97
119
|
// give the WebGL driver a hint that this buffer may change
|
|
98
120
|
usage: _l7Core.gl.STATIC_DRAW,
|
|
@@ -11,7 +11,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _l7Core = require("@antv/l7-core");
|
|
13
13
|
var _l7Utils = require("@antv/l7-utils");
|
|
14
|
-
var BaseLayerPickService = /*#__PURE__*/function () {
|
|
14
|
+
var BaseLayerPickService = exports.default = /*#__PURE__*/function () {
|
|
15
15
|
function BaseLayerPickService(layer) {
|
|
16
16
|
(0, _classCallCheck2.default)(this, BaseLayerPickService);
|
|
17
17
|
this.layer = layer;
|
|
@@ -133,5 +133,4 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
133
133
|
}
|
|
134
134
|
}]);
|
|
135
135
|
return BaseLayerPickService;
|
|
136
|
-
}();
|
|
137
|
-
exports.default = BaseLayerPickService;
|
|
136
|
+
}();
|
|
@@ -9,7 +9,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _l7Core = require("@antv/l7-core");
|
|
11
11
|
var _l7Utils = require("@antv/l7-utils");
|
|
12
|
-
var TextureService = /*#__PURE__*/function () {
|
|
12
|
+
var TextureService = exports.default = /*#__PURE__*/function () {
|
|
13
13
|
function TextureService(layer) {
|
|
14
14
|
(0, _classCallCheck2.default)(this, TextureService);
|
|
15
15
|
this.layer = layer;
|
|
@@ -53,7 +53,7 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
53
53
|
key: "destroy",
|
|
54
54
|
value: function destroy() {
|
|
55
55
|
var _this$colorTexture;
|
|
56
|
-
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0
|
|
56
|
+
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 || _this$colorTexture.destroy();
|
|
57
57
|
}
|
|
58
58
|
}, {
|
|
59
59
|
key: "getColorRampBar",
|
|
@@ -75,9 +75,8 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
75
75
|
key: "getTextureKey",
|
|
76
76
|
value: function getTextureKey(colorRamp, domain) {
|
|
77
77
|
var _colorRamp$positions;
|
|
78
|
-
return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp === null || colorRamp === void 0
|
|
78
|
+
return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp === null || colorRamp === void 0 || (_colorRamp$positions = colorRamp.positions) === null || _colorRamp$positions === void 0 ? void 0 : _colorRamp$positions.join('_'), "_").concat(colorRamp.type, "_").concat(domain === null || domain === void 0 ? void 0 : domain.join('_'));
|
|
79
79
|
}
|
|
80
80
|
}]);
|
|
81
81
|
return TextureService;
|
|
82
|
-
}();
|
|
83
|
-
exports.default = TextureService;
|
|
82
|
+
}();
|
package/lib/core/constant.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DefaultUniformStyleValue = exports.DefaultUniformStyleType = void 0;
|
|
7
|
-
var DefaultUniformStyleValue = {
|
|
7
|
+
var DefaultUniformStyleValue = exports.DefaultUniformStyleValue = {
|
|
8
8
|
opacity: 1,
|
|
9
9
|
stroke: [1, 0, 0, 1],
|
|
10
10
|
offsets: [0, 0],
|
|
@@ -13,8 +13,7 @@ var DefaultUniformStyleValue = {
|
|
|
13
13
|
strokeOpacity: 1,
|
|
14
14
|
thetaOffset: 0.314
|
|
15
15
|
};
|
|
16
|
-
exports.
|
|
17
|
-
var DefaultUniformStyleType = {
|
|
16
|
+
var DefaultUniformStyleType = exports.DefaultUniformStyleType = {
|
|
18
17
|
opacity: 'float',
|
|
19
18
|
stroke: 'vec4',
|
|
20
19
|
offsets: 'vec2',
|
|
@@ -23,5 +22,4 @@ var DefaultUniformStyleType = {
|
|
|
23
22
|
extrusionBase: 'float',
|
|
24
23
|
strokeOpacity: 'float',
|
|
25
24
|
thetaOffset: 'float'
|
|
26
|
-
};
|
|
27
|
-
exports.DefaultUniformStyleType = DefaultUniformStyleType;
|
|
25
|
+
};
|
package/lib/core/interface.js
CHANGED
|
@@ -4,19 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.lineStyleType = exports.TextureBlend = exports.SizeUnitType = exports.LinearDir = exports.CanvasUpdateType = void 0;
|
|
7
|
-
var lineStyleType = /*#__PURE__*/function (lineStyleType) {
|
|
7
|
+
var lineStyleType = exports.lineStyleType = /*#__PURE__*/function (lineStyleType) {
|
|
8
8
|
lineStyleType[lineStyleType["solid"] = 0] = "solid";
|
|
9
9
|
lineStyleType[lineStyleType["dash"] = 1] = "dash";
|
|
10
10
|
return lineStyleType;
|
|
11
11
|
}({});
|
|
12
|
-
exports.
|
|
13
|
-
var LinearDir = /*#__PURE__*/function (LinearDir) {
|
|
12
|
+
var LinearDir = exports.LinearDir = /*#__PURE__*/function (LinearDir) {
|
|
14
13
|
LinearDir["VERTICAL"] = "vertical";
|
|
15
14
|
LinearDir["HORIZONTAL"] = "horizontal";
|
|
16
15
|
return LinearDir;
|
|
17
16
|
}({});
|
|
18
|
-
exports.
|
|
19
|
-
var TextureBlend = /*#__PURE__*/function (TextureBlend) {
|
|
17
|
+
var TextureBlend = exports.TextureBlend = /*#__PURE__*/function (TextureBlend) {
|
|
20
18
|
TextureBlend["NORMAL"] = "normal";
|
|
21
19
|
TextureBlend["REPLACE"] = "replace";
|
|
22
20
|
return TextureBlend;
|
|
@@ -24,16 +22,13 @@ var TextureBlend = /*#__PURE__*/function (TextureBlend) {
|
|
|
24
22
|
/**
|
|
25
23
|
* 基础图层类型定义
|
|
26
24
|
*/
|
|
27
|
-
exports.
|
|
28
|
-
var SizeUnitType = /*#__PURE__*/function (SizeUnitType) {
|
|
25
|
+
var SizeUnitType = exports.SizeUnitType = /*#__PURE__*/function (SizeUnitType) {
|
|
29
26
|
SizeUnitType[SizeUnitType["pixel"] = 0] = "pixel";
|
|
30
27
|
SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
|
|
31
28
|
return SizeUnitType;
|
|
32
29
|
}({}); // 栅格瓦片图层
|
|
33
|
-
exports.
|
|
34
|
-
var CanvasUpdateType = /*#__PURE__*/function (CanvasUpdateType) {
|
|
30
|
+
var CanvasUpdateType = exports.CanvasUpdateType = /*#__PURE__*/function (CanvasUpdateType) {
|
|
35
31
|
CanvasUpdateType["ALWAYS"] = "always";
|
|
36
32
|
CanvasUpdateType["DRAGEND"] = "dragend";
|
|
37
33
|
return CanvasUpdateType;
|
|
38
|
-
}({});
|
|
39
|
-
exports.CanvasUpdateType = CanvasUpdateType;
|
|
34
|
+
}({});
|