@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/lib/heatmap/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 HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var HeatMapLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(HeatMapLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(HeatMapLayer);
|
|
24
24
|
function HeatMapLayer() {
|
|
@@ -99,7 +99,7 @@ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
99
99
|
shape3d = _this$getLayerConfig.shape3d;
|
|
100
100
|
var source = this.getSource();
|
|
101
101
|
var sourceType = source.data.type;
|
|
102
|
-
var shape = (shapeAttribute === null || shapeAttribute === void 0
|
|
102
|
+
var shape = (shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field) || 'heatmap';
|
|
103
103
|
if (shape === 'heatmap' || shape === 'heatmap3d') {
|
|
104
104
|
return 'heatmap';
|
|
105
105
|
}
|
|
@@ -113,5 +113,4 @@ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
113
113
|
}
|
|
114
114
|
}]);
|
|
115
115
|
return HeatMapLayer;
|
|
116
|
-
}(_BaseLayer2.default);
|
|
117
|
-
exports.default = HeatMapLayer;
|
|
116
|
+
}(_BaseLayer2.default);
|
|
@@ -21,7 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
21
21
|
var heatmapGridVert = "precision highp float;\r\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\r\nattribute vec3 a_Position;\r\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\r\nattribute vec3 a_Pos;\r\nattribute float a_Size;\r\nattribute vec4 a_Color;\r\nuniform vec2 u_radius;\r\nuniform float u_coverage: 0.9;\r\nuniform float u_angle: 0;\r\nuniform mat4 u_ModelMatrix;\r\n\r\nvarying vec4 v_color;\r\n\r\nuniform vec2 u_sceneCenterMercator;\r\n\r\n#pragma include \"projection\"\r\n#pragma include \"project\"\r\n#pragma include \"picking\"\r\n\r\nvoid main() {\r\n v_color = a_Color;\r\n\r\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\r\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage ;\r\n // vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n // gl_Position = project_common_position_to_clipspace(project_pos);\r\n\r\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\r\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\r\n gl_Position = u_Mvp * (project_pos);\r\n } else {\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n gl_Position = project_common_position_to_clipspace(project_pos);\r\n }\r\n\r\n setPickingColor(a_PickingColor);\r\n}\r\n";
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/hexagon_frag.glsl' */
|
|
23
23
|
var heatmapGridFrag = "precision highp float;\nvarying vec4 v_color;\nuniform float u_opacity: 1;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
24
|
-
var GridModel = /*#__PURE__*/function (_BaseModel) {
|
|
24
|
+
var GridModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
25
25
|
(0, _inherits2.default)(GridModel, _BaseModel);
|
|
26
26
|
var _super = _createSuper(GridModel);
|
|
27
27
|
function GridModel() {
|
|
@@ -118,5 +118,4 @@ var GridModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
118
118
|
}
|
|
119
119
|
}]);
|
|
120
120
|
return GridModel;
|
|
121
|
-
}(_BaseModel2.default);
|
|
122
|
-
exports.default = GridModel;
|
|
121
|
+
}(_BaseModel2.default);
|
|
@@ -21,7 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
21
21
|
var heatmapGrid3dVert = "precision highp float;\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\nattribute vec3 a_Position;\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\nattribute vec3 a_Pos;\n\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec4 a_Color;\nuniform vec2 u_radius;\nuniform float u_coverage: 0.9;\nuniform float u_angle: 0;\nuniform mat4 u_ModelMatrix;\n\nvarying vec4 v_color;\n\nuniform vec2 u_sceneCenterMercator;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n \n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u7ECF\u7EAC\u5EA6\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\n vec4 project_pos = project_position(vec4(customLnglat, a_Position.z * a_Size, 1.0));\n\n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = u_Mvp * vec4(customLnglat , a_Position.z * a_Size, 1.0);\n } else {\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset); // \u5B9E\u9645\u7684\u7ECF\u7EAC\u5EA6\n vec4 project_pos = project_position(vec4(lnglat, a_Position.z * a_Size, 1.0));\n \n float lightWeight = calc_lighting(project_pos);\n v_color =vec4(a_Color.rgb*lightWeight, a_Color.w);\n \n gl_Position = project_common_position_to_clipspace(project_pos);\n }\n\n\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/hexagon_frag.glsl' */
|
|
23
23
|
var heatmapGridFrag = "precision highp float;\nvarying vec4 v_color;\nuniform float u_opacity: 1;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
24
|
-
var Grid3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
24
|
+
var Grid3DModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
25
25
|
(0, _inherits2.default)(Grid3DModel, _BaseModel);
|
|
26
26
|
var _super = _createSuper(Grid3DModel);
|
|
27
27
|
function Grid3DModel() {
|
|
@@ -151,5 +151,4 @@ var Grid3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
151
151
|
}
|
|
152
152
|
}]);
|
|
153
153
|
return Grid3DModel;
|
|
154
|
-
}(_BaseModel2.default);
|
|
155
|
-
exports.default = Grid3DModel;
|
|
154
|
+
}(_BaseModel2.default);
|
|
@@ -38,7 +38,7 @@ var heatmapFramebufferFrag = "precision highp float;\nuniform float u_intensity;
|
|
|
38
38
|
/* babel-plugin-inline-import '../shaders/heatmap_framebuffer_vert.glsl' */
|
|
39
39
|
var heatmapFramebufferVert = "precision highp float;\nattribute vec3 a_Position;\nattribute float a_Size;\nattribute vec2 a_Dir;\nuniform float u_intensity;\nuniform float u_radius;\nvarying vec2 v_extrude;\nvarying float v_weight;\nuniform mat4 u_ModelMatrix;\n\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n\nvoid main(){\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
|
|
40
40
|
var isEqual = _l7Utils.lodashUtil.isEqual;
|
|
41
|
-
var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
|
|
41
|
+
var HeatMapModel = exports.default = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
|
|
42
42
|
(0, _inherits2.default)(HeatMapModel, _BaseModel);
|
|
43
43
|
var _super = _createSuper(HeatMapModel);
|
|
44
44
|
function HeatMapModel() {
|
|
@@ -84,7 +84,7 @@ var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE
|
|
|
84
84
|
case 0:
|
|
85
85
|
_this$rendererService2 = this.rendererService, createFramebuffer = _this$rendererService2.createFramebuffer, getViewportSize = _this$rendererService2.getViewportSize, createTexture2D = _this$rendererService2.createTexture2D;
|
|
86
86
|
shapeAttr = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
87
|
-
shapeType = (shapeAttr === null || shapeAttr === void 0
|
|
87
|
+
shapeType = (shapeAttr === null || shapeAttr === void 0 || (_shapeAttr$scale = shapeAttr.scale) === null || _shapeAttr$scale === void 0 ? void 0 : _shapeAttr$scale.field) || 'heatmap';
|
|
88
88
|
this.shapeType = shapeType;
|
|
89
89
|
// 生成热力图密度图
|
|
90
90
|
_context.next = 6;
|
|
@@ -273,7 +273,7 @@ var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE
|
|
|
273
273
|
this.layerService.beforeRenderData(this.layer);
|
|
274
274
|
this.layer.hooks.beforeRender.call();
|
|
275
275
|
// 绘制密度图
|
|
276
|
-
(_this$intensityModel = this.intensityModel) === null || _this$intensityModel === void 0
|
|
276
|
+
(_this$intensityModel = this.intensityModel) === null || _this$intensityModel === void 0 || _this$intensityModel.draw({
|
|
277
277
|
uniforms: {
|
|
278
278
|
u_opacity: opacity || 1.0,
|
|
279
279
|
u_radius: radius,
|
|
@@ -307,7 +307,7 @@ var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE
|
|
|
307
307
|
var _this$colorModel;
|
|
308
308
|
var _ref3 = this.layer.getLayerConfig(),
|
|
309
309
|
opacity = _ref3.opacity;
|
|
310
|
-
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0
|
|
310
|
+
(_this$colorModel = this.colorModel) === null || _this$colorModel === void 0 || _this$colorModel.draw({
|
|
311
311
|
uniforms: {
|
|
312
312
|
u_opacity: opacity || 1.0,
|
|
313
313
|
u_colorTexture: this.colorTexture,
|
|
@@ -333,7 +333,7 @@ var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE
|
|
|
333
333
|
// ) as mat4;
|
|
334
334
|
var invert = _glMatrix.mat4.create();
|
|
335
335
|
_glMatrix.mat4.invert(invert, this.cameraService.getViewProjectionMatrixUncentered());
|
|
336
|
-
(_this$colorModel2 = this.colorModel) === null || _this$colorModel2 === void 0
|
|
336
|
+
(_this$colorModel2 = this.colorModel) === null || _this$colorModel2 === void 0 || _this$colorModel2.draw({
|
|
337
337
|
uniforms: {
|
|
338
338
|
u_opacity: opacity || 1.0,
|
|
339
339
|
u_colorTexture: this.colorTexture,
|
|
@@ -443,5 +443,4 @@ var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE
|
|
|
443
443
|
}
|
|
444
444
|
}]);
|
|
445
445
|
return HeatMapModel;
|
|
446
|
-
}(_BaseModel2.default)) || _class);
|
|
447
|
-
exports.default = HeatMapModel;
|
|
446
|
+
}(_BaseModel2.default)) || _class);
|
|
@@ -21,7 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
21
21
|
var heatmapGridFrag = "precision highp float;\nvarying vec4 v_color;\nuniform float u_opacity: 1;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/hexagon_vert.glsl' */
|
|
23
23
|
var heatmapGridVert = "precision highp float;\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\nattribute vec3 a_Position;\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\nattribute vec3 a_Pos;\nattribute float a_Size;\nattribute vec4 a_Color;\nuniform vec2 u_radius;\nuniform float u_coverage: 0.9;\nuniform float u_angle: 0;\nuniform mat4 u_ModelMatrix;\n\nvarying vec4 v_color;\n\nuniform vec2 u_sceneCenterMercator;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nvoid main() {\n v_color = a_Color;\n \n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\n vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix * u_coverage));\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\n \n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy, 0., 1.0));\n // gl_Position = u_Mvp * (vec4(a_Pos.xy + offset, 0., 1.0));\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator;\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\n gl_Position = u_Mvp * vec4(project_pos.xy, 0.0, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n";
|
|
24
|
-
var HexagonModel = /*#__PURE__*/function (_BaseModel) {
|
|
24
|
+
var HexagonModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
25
25
|
(0, _inherits2.default)(HexagonModel, _BaseModel);
|
|
26
26
|
var _super = _createSuper(HexagonModel);
|
|
27
27
|
function HexagonModel() {
|
|
@@ -118,5 +118,4 @@ var HexagonModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
118
118
|
}
|
|
119
119
|
}]);
|
|
120
120
|
return HexagonModel;
|
|
121
|
-
}(_BaseModel2.default);
|
|
122
|
-
exports.default = HexagonModel;
|
|
121
|
+
}(_BaseModel2.default);
|
package/lib/image/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 ImageLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var ImageLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(ImageLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(ImageLayer);
|
|
24
24
|
function ImageLayer() {
|
|
@@ -70,5 +70,4 @@ var ImageLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
70
70
|
}
|
|
71
71
|
}]);
|
|
72
72
|
return ImageLayer;
|
|
73
|
-
}(_BaseLayer2.default);
|
|
74
|
-
exports.default = ImageLayer;
|
|
73
|
+
}(_BaseLayer2.default);
|
|
@@ -21,7 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
21
21
|
var ImageFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n if(gl_FragColor.a < 0.01)\n discard;\n}\n";
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/image_vert.glsl' */
|
|
23
23
|
var ImageVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n \n}\n";
|
|
24
|
-
var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
24
|
+
var ImageModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
25
25
|
(0, _inherits2.default)(ImageModel, _BaseModel);
|
|
26
26
|
var _super = _createSuper(ImageModel);
|
|
27
27
|
function ImageModel() {
|
|
@@ -96,7 +96,7 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
96
96
|
key: "clearModels",
|
|
97
97
|
value: function clearModels() {
|
|
98
98
|
var _this$texture;
|
|
99
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
99
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
100
100
|
}
|
|
101
101
|
}, {
|
|
102
102
|
key: "buildModels",
|
|
@@ -139,5 +139,4 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
139
139
|
}
|
|
140
140
|
}]);
|
|
141
141
|
return ImageModel;
|
|
142
|
-
}(_BaseModel2.default);
|
|
143
|
-
exports.default = ImageModel;
|
|
142
|
+
}(_BaseModel2.default);
|
package/lib/line/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
|
19
19
|
var _models = _interopRequireDefault(require("./models"));
|
|
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 LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
22
|
+
var LineLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
23
23
|
(0, _inherits2.default)(LineLayer, _BaseLayer);
|
|
24
24
|
var _super = _createSuper(LineLayer);
|
|
25
25
|
function LineLayer() {
|
|
@@ -94,7 +94,8 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
94
94
|
},
|
|
95
95
|
tileLine: {},
|
|
96
96
|
earthArc3d: {},
|
|
97
|
-
flowline: {}
|
|
97
|
+
flowline: {},
|
|
98
|
+
arrow: {}
|
|
98
99
|
};
|
|
99
100
|
return defaultConfig[type];
|
|
100
101
|
}
|
|
@@ -106,7 +107,7 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
106
107
|
return this.layerType;
|
|
107
108
|
}
|
|
108
109
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
109
|
-
var shape = shapeAttribute === null || shapeAttribute === void 0
|
|
110
|
+
var shape = shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
110
111
|
return shape || 'line';
|
|
111
112
|
}
|
|
112
113
|
}, {
|
|
@@ -133,5 +134,4 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
133
134
|
}
|
|
134
135
|
}]);
|
|
135
136
|
return LineLayer;
|
|
136
|
-
}(_BaseLayer2.default);
|
|
137
|
-
exports.default = LineLayer;
|
|
137
|
+
}(_BaseLayer2.default);
|
package/lib/line/models/arc.js
CHANGED
|
@@ -25,7 +25,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
25
25
|
// arc dash line
|
|
26
26
|
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}";
|
|
27
27
|
/* babel-plugin-inline-import '../shaders/dash/arc_dash_vert.glsl' */
|
|
28
|
-
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
|
|
28
|
+
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
|
|
29
29
|
/* babel-plugin-inline-import '../shaders/line_arc_frag.glsl' */
|
|
30
30
|
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}";
|
|
31
31
|
/* babel-plugin-inline-import '../shaders/line_arc_vert.glsl' */
|
|
@@ -33,13 +33,13 @@ var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute v
|
|
|
33
33
|
/* babel-plugin-inline-import '../shaders/linear/arc_linear_frag.glsl' */
|
|
34
34
|
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}";
|
|
35
35
|
/* babel-plugin-inline-import '../shaders/linear/arc_linear_vert.glsl' */
|
|
36
|
-
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
|
|
36
|
+
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";
|
|
37
37
|
var lineStyleObj = {
|
|
38
38
|
solid: 0.0,
|
|
39
39
|
dash: 1.0
|
|
40
40
|
};
|
|
41
41
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
42
|
-
var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
42
|
+
var ArcModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
43
43
|
(0, _inherits2.default)(ArcModel, _BaseModel);
|
|
44
44
|
var _super = _createSuper(ArcModel);
|
|
45
45
|
function ArcModel() {
|
|
@@ -162,7 +162,7 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
162
162
|
key: "clearModels",
|
|
163
163
|
value: function clearModels() {
|
|
164
164
|
var _this$texture;
|
|
165
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
165
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
166
166
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
167
167
|
}
|
|
168
168
|
}, {
|
|
@@ -214,7 +214,9 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
214
214
|
depth: {
|
|
215
215
|
enable: false
|
|
216
216
|
},
|
|
217
|
-
|
|
217
|
+
styleOption: {
|
|
218
|
+
segmentNumber: segmentNumber
|
|
219
|
+
}
|
|
218
220
|
});
|
|
219
221
|
case 4:
|
|
220
222
|
model = _context2.sent;
|
|
@@ -298,5 +300,4 @@ var ArcModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
298
300
|
}
|
|
299
301
|
}]);
|
|
300
302
|
return ArcModel;
|
|
301
|
-
}(_BaseModel2.default);
|
|
302
|
-
exports.default = ArcModel;
|
|
303
|
+
}(_BaseModel2.default);
|
|
@@ -35,7 +35,7 @@ var lineStyleObj = {
|
|
|
35
35
|
solid: 0.0,
|
|
36
36
|
dash: 1.0
|
|
37
37
|
};
|
|
38
|
-
var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
38
|
+
var Arc3DModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
39
39
|
(0, _inherits2.default)(Arc3DModel, _BaseModel);
|
|
40
40
|
var _super = _createSuper(Arc3DModel);
|
|
41
41
|
function Arc3DModel() {
|
|
@@ -160,7 +160,7 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
160
160
|
key: "clearModels",
|
|
161
161
|
value: function clearModels() {
|
|
162
162
|
var _this$texture;
|
|
163
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
163
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
164
164
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
165
165
|
}
|
|
166
166
|
}, {
|
|
@@ -201,7 +201,9 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
201
201
|
fragmentShader: frag,
|
|
202
202
|
inject: this.getInject(),
|
|
203
203
|
triangulation: _triangulation.LineArcTriangulation,
|
|
204
|
-
|
|
204
|
+
styleOption: {
|
|
205
|
+
segmentNumber: segmentNumber
|
|
206
|
+
}
|
|
205
207
|
});
|
|
206
208
|
case 4:
|
|
207
209
|
model = _context2.sent;
|
|
@@ -284,5 +286,4 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
284
286
|
}
|
|
285
287
|
}]);
|
|
286
288
|
return Arc3DModel;
|
|
287
|
-
}(_BaseModel2.default);
|
|
288
|
-
exports.default = Arc3DModel;
|
|
289
|
+
}(_BaseModel2.default);
|
|
@@ -34,7 +34,7 @@ var lineStyleObj = {
|
|
|
34
34
|
solid: 0.0,
|
|
35
35
|
dash: 1.0
|
|
36
36
|
};
|
|
37
|
-
var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
37
|
+
var Arc3DModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
38
38
|
(0, _inherits2.default)(Arc3DModel, _BaseModel);
|
|
39
39
|
var _super = _createSuper(Arc3DModel);
|
|
40
40
|
function Arc3DModel() {
|
|
@@ -160,7 +160,7 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
160
160
|
key: "clearModels",
|
|
161
161
|
value: function clearModels() {
|
|
162
162
|
var _this$texture;
|
|
163
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
163
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
164
164
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
165
165
|
}
|
|
166
166
|
}, {
|
|
@@ -203,7 +203,9 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
203
203
|
depth: {
|
|
204
204
|
enable: true
|
|
205
205
|
},
|
|
206
|
-
|
|
206
|
+
styleOption: {
|
|
207
|
+
segmentNumber: segmentNumber
|
|
208
|
+
}
|
|
207
209
|
});
|
|
208
210
|
case 4:
|
|
209
211
|
model = _context2.sent;
|
|
@@ -286,5 +288,4 @@ var Arc3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
286
288
|
}
|
|
287
289
|
}]);
|
|
288
290
|
return Arc3DModel;
|
|
289
|
-
}(_BaseModel2.default);
|
|
290
|
-
exports.default = Arc3DModel;
|
|
291
|
+
}(_BaseModel2.default);
|
package/lib/line/models/flow.js
CHANGED
|
@@ -16,14 +16,14 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
16
16
|
var _l7Core = require("@antv/l7-core");
|
|
17
17
|
var _l7Utils = require("@antv/l7-utils");
|
|
18
18
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
19
|
-
var
|
|
19
|
+
var _line_trangluation = require("../../core/line_trangluation");
|
|
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
22
|
/* babel-plugin-inline-import '../shaders/flow/flow_line_frag.glsl' */
|
|
23
23
|
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
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/flow/flow_line_vert.glsl' */
|
|
25
|
-
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 =
|
|
26
|
-
var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
25
|
+
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";
|
|
26
|
+
var FlowLineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
27
27
|
(0, _inherits2.default)(FlowLineModel, _BaseModel);
|
|
28
28
|
var _super = _createSuper(FlowLineModel);
|
|
29
29
|
function FlowLineModel() {
|
|
@@ -43,8 +43,6 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
43
43
|
_ref$strokeOpacity = _ref.strokeOpacity,
|
|
44
44
|
strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity;
|
|
45
45
|
return (0, _objectSpread2.default)({
|
|
46
|
-
// u_opacity: opacity,
|
|
47
|
-
// u_offsets: offsets,
|
|
48
46
|
u_gap_width: gapWidth,
|
|
49
47
|
u_stroke_width: strokeWidth,
|
|
50
48
|
u_stroke: (0, _l7Utils.rgb2arr)(stroke),
|
|
@@ -84,7 +82,8 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
84
82
|
vertexShader: flow_line_vert,
|
|
85
83
|
fragmentShader: flow_line_frag,
|
|
86
84
|
inject: this.getInject(),
|
|
87
|
-
triangulation:
|
|
85
|
+
triangulation: _line_trangluation.FlowLineTriangulation,
|
|
86
|
+
styleOption: this.layer.getLayerConfig().symbol,
|
|
88
87
|
primitive: _l7Core.gl.TRIANGLES,
|
|
89
88
|
depth: {
|
|
90
89
|
enable: false
|
|
@@ -166,5 +165,4 @@ var FlowLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
166
165
|
}
|
|
167
166
|
}]);
|
|
168
167
|
return FlowLineModel;
|
|
169
|
-
}(_BaseModel2.default);
|
|
170
|
-
exports.default = FlowLineModel;
|
|
168
|
+
}(_BaseModel2.default);
|
|
@@ -29,7 +29,7 @@ var lineStyleObj = {
|
|
|
29
29
|
solid: 0.0,
|
|
30
30
|
dash: 1.0
|
|
31
31
|
};
|
|
32
|
-
var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
32
|
+
var GreatCircleModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
33
33
|
(0, _inherits2.default)(GreatCircleModel, _BaseModel);
|
|
34
34
|
var _super = _createSuper(GreatCircleModel);
|
|
35
35
|
function GreatCircleModel() {
|
|
@@ -146,7 +146,7 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
146
146
|
key: "clearModels",
|
|
147
147
|
value: function clearModels() {
|
|
148
148
|
var _this$texture;
|
|
149
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
149
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
150
150
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
151
151
|
}
|
|
152
152
|
}, {
|
|
@@ -251,5 +251,4 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
251
251
|
}
|
|
252
252
|
}]);
|
|
253
253
|
return GreatCircleModel;
|
|
254
|
-
}(_BaseModel2.default);
|
|
255
|
-
exports.default = GreatCircleModel;
|
|
254
|
+
}(_BaseModel2.default);
|
package/lib/line/models/index.js
CHANGED
package/lib/line/models/line.js
CHANGED
|
@@ -37,7 +37,7 @@ var lineStyleObj = {
|
|
|
37
37
|
solid: 0.0,
|
|
38
38
|
dash: 1.0
|
|
39
39
|
};
|
|
40
|
-
var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
40
|
+
var LineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
41
41
|
(0, _inherits2.default)(LineModel, _BaseModel);
|
|
42
42
|
var _super = _createSuper(LineModel);
|
|
43
43
|
function LineModel() {
|
|
@@ -103,14 +103,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
103
103
|
_ref$linearDir = _ref.linearDir,
|
|
104
104
|
linearDir = _ref$linearDir === void 0 ? _interface.LinearDir.VERTICAL : _ref$linearDir,
|
|
105
105
|
_ref$blur = _ref.blur,
|
|
106
|
-
blur = _ref$blur === void 0 ? [1, 1, 1] : _ref$blur
|
|
107
|
-
_ref$arrow = _ref.arrow,
|
|
108
|
-
arrow = _ref$arrow === void 0 ? {
|
|
109
|
-
enable: false,
|
|
110
|
-
arrowWidth: 2,
|
|
111
|
-
arrowHeight: 3,
|
|
112
|
-
tailWidth: 1
|
|
113
|
-
} : _ref$arrow;
|
|
106
|
+
blur = _ref$blur === void 0 ? [1, 1, 1] : _ref$blur;
|
|
114
107
|
if (dashArray.length === 2) {
|
|
115
108
|
dashArray.push(0, 0);
|
|
116
109
|
}
|
|
@@ -151,12 +144,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
151
144
|
u_heightfixed: Number(heightfixed),
|
|
152
145
|
// 顶点高度 scale
|
|
153
146
|
u_vertexScale: vertexHeightScale,
|
|
154
|
-
u_raisingHeight: Number(raisingHeight)
|
|
155
|
-
// arrow
|
|
156
|
-
u_arrow: Number(arrow.enable),
|
|
157
|
-
u_arrowHeight: arrow.arrowHeight || 3,
|
|
158
|
-
u_arrowWidth: arrow.arrowWidth || 2,
|
|
159
|
-
u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
|
|
147
|
+
u_raisingHeight: Number(raisingHeight)
|
|
160
148
|
}, this.getStyleAttribute());
|
|
161
149
|
}
|
|
162
150
|
}, {
|
|
@@ -199,7 +187,7 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
199
187
|
key: "clearModels",
|
|
200
188
|
value: function clearModels() {
|
|
201
189
|
var _this$texture;
|
|
202
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
190
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
203
191
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
204
192
|
}
|
|
205
193
|
}, {
|
|
@@ -392,5 +380,4 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
392
380
|
}
|
|
393
381
|
}]);
|
|
394
382
|
return LineModel;
|
|
395
|
-
}(_BaseModel2.default);
|
|
396
|
-
exports.default = LineModel;
|
|
383
|
+
}(_BaseModel2.default);
|
|
@@ -27,7 +27,7 @@ var linear_line_frag = "\nvarying vec4 v_Color;\n#pragma include \"picking\"\nvo
|
|
|
27
27
|
/* babel-plugin-inline-import '../shaders/linearLine/line_linear_vert.glsl' */
|
|
28
28
|
var linear_line_vert = "\nattribute float a_Miter;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\nuniform sampler2D u_texture;\nuniform float u_linearDir: 1.0;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n float linearRadio =currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n linearRadio = texV;\n }\n\n v_Color = texture2D(u_texture, vec2(linearRadio, 0.5));\n\n v_Color.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n\n\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
29
29
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
30
|
-
var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
30
|
+
var LinearLineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
31
31
|
(0, _inherits2.default)(LinearLineModel, _BaseModel);
|
|
32
32
|
var _super = _createSuper(LinearLineModel);
|
|
33
33
|
function LinearLineModel() {
|
|
@@ -112,7 +112,7 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
112
112
|
key: "clearModels",
|
|
113
113
|
value: function clearModels() {
|
|
114
114
|
var _this$colorTexture;
|
|
115
|
-
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0
|
|
115
|
+
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 || _this$colorTexture.destroy();
|
|
116
116
|
}
|
|
117
117
|
}, {
|
|
118
118
|
key: "buildModels",
|
|
@@ -244,5 +244,4 @@ var LinearLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
244
244
|
}
|
|
245
245
|
}]);
|
|
246
246
|
return LinearLineModel;
|
|
247
|
-
}(_BaseModel2.default);
|
|
248
|
-
exports.default = LinearLineModel;
|
|
247
|
+
}(_BaseModel2.default);
|
|
@@ -26,7 +26,7 @@ var simle_linear_frag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor
|
|
|
26
26
|
/* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
|
|
27
27
|
var simple_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Position;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_vertexScale: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\nvarying float v_distanceScale;\n\nvoid main() {\n\n v_color = a_Color; \n v_distanceScale = a_Distance / a_Total_Distance;\n v_color.a = v_color.a * opacity;\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_Size.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n }\n}\n";
|
|
28
28
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
29
|
-
var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
|
+
var SimpleLineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
30
30
|
(0, _inherits2.default)(SimpleLineModel, _BaseModel);
|
|
31
31
|
var _super = _createSuper(SimpleLineModel);
|
|
32
32
|
function SimpleLineModel() {
|
|
@@ -197,5 +197,4 @@ var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
197
197
|
}
|
|
198
198
|
}]);
|
|
199
199
|
return SimpleLineModel;
|
|
200
|
-
}(_BaseModel2.default);
|
|
201
|
-
exports.default = SimpleLineModel;
|
|
200
|
+
}(_BaseModel2.default);
|
package/lib/line/models/wall.js
CHANGED
|
@@ -26,7 +26,7 @@ var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture
|
|
|
26
26
|
/* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
|
|
27
27
|
var line_vert = "#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\n\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\nuniform float u_linearColor: 0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\nvarying vec4 v_color;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_dataset;\n\nvoid main() {\n\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_animate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_float_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
28
28
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
29
|
-
var LineWallModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
|
+
var LineWallModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
30
30
|
(0, _inherits2.default)(LineWallModel, _BaseModel);
|
|
31
31
|
var _super = _createSuper(LineWallModel);
|
|
32
32
|
function LineWallModel() {
|
|
@@ -137,7 +137,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
137
137
|
key: "clearModels",
|
|
138
138
|
value: function clearModels() {
|
|
139
139
|
var _this$texture;
|
|
140
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
140
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
141
141
|
this.iconService.off('imageUpdate', this.updateTexture);
|
|
142
142
|
}
|
|
143
143
|
}, {
|
|
@@ -296,5 +296,4 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
296
296
|
}
|
|
297
297
|
}]);
|
|
298
298
|
return LineWallModel;
|
|
299
|
-
}(_BaseModel2.default);
|
|
300
|
-
exports.default = LineWallModel;
|
|
299
|
+
}(_BaseModel2.default);
|