@antv/l7-layers 2.21.0 → 2.21.1
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/core/BaseLayer.d.ts +1 -0
- package/es/core/BaseLayer.js +50 -43
- package/es/core/BaseModel.js +0 -2
- package/es/core/LayerPickService.js +0 -1
- package/es/core/shape/Path.js +1 -2
- package/es/core/shape/extrude.js +0 -1
- package/es/core/triangulation.js +2 -2
- package/es/earth/models/base.js +0 -1
- package/es/heatmap/index.js +0 -1
- package/es/line/models/arc_3d.js +0 -1
- package/es/line/models/line.js +3 -4
- package/es/line/models/wall.js +1 -1
- package/es/line/shaders/line/line_vert.glsl +0 -2
- package/es/line/shaders/wall/wall_vert.glsl +15 -0
- package/es/plugins/DataMappingPlugin.js +0 -2
- package/es/plugins/FeatureScalePlugin.js +1 -1
- package/es/plugins/PixelPickingPlugin.js +2 -3
- package/es/plugins/ShaderUniformPlugin.js +1 -1
- package/es/point/models/fill.js +1 -1
- package/es/polygon/models/fill.js +2 -3
- package/es/polygon/models/index.js +0 -1
- package/es/tile/interaction/getRasterData.js +0 -1
- package/es/utils/blend.js +7 -8
- package/es/utils/polylineNormal.js +0 -1
- package/es/utils/rampcolor_legend.js +1 -2
- package/es/wind/index.js +0 -1
- package/lib/core/BaseLayer.js +50 -43
- package/lib/core/BaseModel.js +0 -2
- package/lib/core/LayerPickService.js +0 -1
- package/lib/core/shape/Path.js +1 -2
- package/lib/core/shape/extrude.js +0 -1
- package/lib/core/triangulation.js +2 -2
- package/lib/earth/models/base.js +0 -1
- package/lib/heatmap/index.js +0 -1
- package/lib/line/models/arc_3d.js +0 -1
- package/lib/line/models/line.js +5 -4
- package/lib/line/models/wall.js +1 -1
- package/lib/line/shaders/line/line_vert.glsl +0 -2
- package/lib/line/shaders/wall/wall_vert.glsl +15 -0
- package/lib/plugins/DataMappingPlugin.js +0 -2
- package/lib/plugins/FeatureScalePlugin.js +1 -1
- package/lib/plugins/PixelPickingPlugin.js +2 -3
- package/lib/plugins/ShaderUniformPlugin.js +1 -1
- package/lib/point/models/fill.js +4 -4
- package/lib/polygon/models/fill.js +1 -2
- package/lib/tile/interaction/getRasterData.js +0 -1
- package/lib/utils/blend.js +7 -8
- package/lib/utils/polylineNormal.js +0 -1
- package/lib/utils/rampcolor_legend.js +1 -2
- package/lib/wind/index.js +0 -1
- package/package.json +7 -7
package/es/wind/index.js
CHANGED
package/lib/core/BaseLayer.js
CHANGED
|
@@ -564,29 +564,36 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
564
564
|
key: "setData",
|
|
565
565
|
value: function setData(data, options) {
|
|
566
566
|
var _this4 = this;
|
|
567
|
-
this.log(_l7Core.IDebugLog.SourceInitStart, _l7Core.ILayerStage.UPDATE);
|
|
568
567
|
if (this.inited) {
|
|
568
|
+
this.dataUpdatelog();
|
|
569
569
|
this.layerSource.setData(data, options);
|
|
570
570
|
} else {
|
|
571
571
|
this.on('inited', function () {
|
|
572
|
+
_this4.dataUpdatelog();
|
|
572
573
|
_this4.layerSource.setData(data, options);
|
|
573
574
|
});
|
|
574
575
|
}
|
|
576
|
+
return this;
|
|
577
|
+
}
|
|
578
|
+
}, {
|
|
579
|
+
key: "dataUpdatelog",
|
|
580
|
+
value: function dataUpdatelog() {
|
|
581
|
+
var _this5 = this;
|
|
582
|
+
this.log(_l7Core.IDebugLog.SourceInitStart, _l7Core.ILayerStage.UPDATE);
|
|
575
583
|
this.layerSource.once('update', function () {
|
|
576
|
-
|
|
584
|
+
_this5.log(_l7Core.IDebugLog.SourceInitEnd, _l7Core.ILayerStage.UPDATE);
|
|
577
585
|
});
|
|
578
|
-
return this;
|
|
579
586
|
}
|
|
580
587
|
}, {
|
|
581
588
|
key: "style",
|
|
582
589
|
value: function style(options) {
|
|
583
|
-
var
|
|
590
|
+
var _this6 = this;
|
|
584
591
|
var passes = options.passes,
|
|
585
592
|
rest = (0, _objectWithoutProperties2.default)(options, _excluded);
|
|
586
593
|
// passes 特殊处理
|
|
587
594
|
if (passes) {
|
|
588
595
|
(0, _multiPassRender.normalizePasses)(passes).forEach(function (pass) {
|
|
589
|
-
var postProcessingPass =
|
|
596
|
+
var postProcessingPass = _this6.multiPassRenderer.getPostProcessor().getPostProcessingPassByName(pass[0]);
|
|
590
597
|
if (postProcessingPass) {
|
|
591
598
|
postProcessingPass.updateOptions(pass[1]);
|
|
592
599
|
}
|
|
@@ -625,22 +632,22 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
625
632
|
}, {
|
|
626
633
|
key: "encodeStyle",
|
|
627
634
|
value: function encodeStyle(options) {
|
|
628
|
-
var
|
|
635
|
+
var _this7 = this;
|
|
629
636
|
Object.keys(options).forEach(function (key) {
|
|
630
637
|
if (
|
|
631
638
|
// 需要数据映射
|
|
632
|
-
[].concat((0, _toConsumableArray2.default)(
|
|
639
|
+
[].concat((0, _toConsumableArray2.default)(_this7.enableShaderEncodeStyles), (0, _toConsumableArray2.default)(_this7.enableDataEncodeStyles)).includes(key) && isPlainObject(options[key]) && (options[key].field || options[key].value) && !isEqual(_this7.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
|
|
633
640
|
) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
if (
|
|
637
|
-
|
|
641
|
+
_this7.encodeStyleAttribute[key] = options[key];
|
|
642
|
+
_this7.updateStyleAttribute(key, options[key].field, options[key].value);
|
|
643
|
+
if (_this7.inited) {
|
|
644
|
+
_this7.dataState.dataMappingNeedUpdate = true;
|
|
638
645
|
}
|
|
639
646
|
} else {
|
|
640
647
|
// 不需要数据映射
|
|
641
|
-
if (
|
|
642
|
-
delete
|
|
643
|
-
|
|
648
|
+
if (_this7.encodeStyleAttribute[key]) {
|
|
649
|
+
delete _this7.encodeStyleAttribute[key]; // 删除已经存在的属性
|
|
650
|
+
_this7.dataState.dataSourceNeedUpdate = true;
|
|
644
651
|
}
|
|
645
652
|
}
|
|
646
653
|
});
|
|
@@ -697,7 +704,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
697
704
|
*/
|
|
698
705
|
}, {
|
|
699
706
|
key: "renderMultiPass",
|
|
700
|
-
value: function () {
|
|
707
|
+
value: (function () {
|
|
701
708
|
var _renderMultiPass = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
702
709
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
703
710
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -734,7 +741,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
734
741
|
return _renderMultiPass.apply(this, arguments);
|
|
735
742
|
}
|
|
736
743
|
return renderMultiPass;
|
|
737
|
-
}()
|
|
744
|
+
}())
|
|
738
745
|
}, {
|
|
739
746
|
key: "active",
|
|
740
747
|
value: function active(options) {
|
|
@@ -757,7 +764,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
757
764
|
}, {
|
|
758
765
|
key: "setActive",
|
|
759
766
|
value: function setActive(id, options) {
|
|
760
|
-
var
|
|
767
|
+
var _this8 = this;
|
|
761
768
|
if (isObject(id)) {
|
|
762
769
|
var _id$x = id.x,
|
|
763
770
|
x = _id$x === void 0 ? 0 : _id$x,
|
|
@@ -781,7 +788,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
781
788
|
// @ts-ignore
|
|
782
789
|
.then(function () {
|
|
783
790
|
setTimeout(function () {
|
|
784
|
-
|
|
791
|
+
_this8.reRender();
|
|
785
792
|
}, 1);
|
|
786
793
|
});
|
|
787
794
|
}
|
|
@@ -808,7 +815,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
808
815
|
}, {
|
|
809
816
|
key: "setSelect",
|
|
810
817
|
value: function setSelect(id, options) {
|
|
811
|
-
var
|
|
818
|
+
var _this9 = this;
|
|
812
819
|
if (isObject(id)) {
|
|
813
820
|
var _id$x2 = id.x,
|
|
814
821
|
x = _id$x2 === void 0 ? 0 : _id$x2,
|
|
@@ -832,7 +839,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
832
839
|
// @ts-ignore
|
|
833
840
|
.then(function () {
|
|
834
841
|
setTimeout(function () {
|
|
835
|
-
|
|
842
|
+
_this9.reRender();
|
|
836
843
|
}, 1);
|
|
837
844
|
});
|
|
838
845
|
}
|
|
@@ -1085,7 +1092,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
1085
1092
|
}, {
|
|
1086
1093
|
key: "setSource",
|
|
1087
1094
|
value: function setSource(source) {
|
|
1088
|
-
var
|
|
1095
|
+
var _this10 = this;
|
|
1089
1096
|
// 解除原 sources 事件
|
|
1090
1097
|
if (this.layerSource) {
|
|
1091
1098
|
this.layerSource.off('update', this.sourceEvent);
|
|
@@ -1104,22 +1111,22 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
1104
1111
|
// this.layerSource.inited 为 true update 事件不会再触发
|
|
1105
1112
|
this.layerSource.on('update', function (_ref4) {
|
|
1106
1113
|
var type = _ref4.type;
|
|
1107
|
-
if (
|
|
1108
|
-
var
|
|
1109
|
-
var layerCenter =
|
|
1110
|
-
|
|
1111
|
-
if ((
|
|
1112
|
-
|
|
1114
|
+
if (_this10.coordCenter === undefined) {
|
|
1115
|
+
var _this10$mapService;
|
|
1116
|
+
var layerCenter = _this10.layerSource.center;
|
|
1117
|
+
_this10.coordCenter = layerCenter;
|
|
1118
|
+
if ((_this10$mapService = _this10.mapService) !== null && _this10$mapService !== void 0 && _this10$mapService.setCoordCenter) {
|
|
1119
|
+
_this10.mapService.setCoordCenter(layerCenter);
|
|
1113
1120
|
}
|
|
1114
1121
|
}
|
|
1115
1122
|
if (type === 'update') {
|
|
1116
|
-
if (
|
|
1123
|
+
if (_this10.tileLayer) {
|
|
1117
1124
|
// 瓦片图层独立更新
|
|
1118
|
-
|
|
1125
|
+
_this10.tileLayer.reload();
|
|
1119
1126
|
return;
|
|
1120
1127
|
}
|
|
1121
1128
|
// source 初始化不需要处理
|
|
1122
|
-
|
|
1129
|
+
_this10.sourceEvent();
|
|
1123
1130
|
}
|
|
1124
1131
|
});
|
|
1125
1132
|
}
|
|
@@ -1217,7 +1224,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
1217
1224
|
key: "buildLayerModel",
|
|
1218
1225
|
value: function () {
|
|
1219
1226
|
var _buildLayerModel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(options) {
|
|
1220
|
-
var
|
|
1227
|
+
var _this11 = this;
|
|
1221
1228
|
var moduleName, vertexShader, fragmentShader, inject, triangulation, styleOption, _options$pickingEnabl, pickingEnabled, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
|
|
1222
1229
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
1223
1230
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -1231,13 +1238,13 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
1231
1238
|
_this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
|
|
1232
1239
|
createModel = this.rendererService.createModel;
|
|
1233
1240
|
return _context3.abrupt("return", new Promise(function (resolve) {
|
|
1234
|
-
var
|
|
1235
|
-
attributes =
|
|
1236
|
-
elements =
|
|
1237
|
-
count =
|
|
1238
|
-
var uniformBuffers = [].concat((0, _toConsumableArray2.default)(
|
|
1241
|
+
var _this11$styleAttribut = _this11.styleAttributeService.createAttributesAndIndices(_this11.encodedData, triangulation, styleOption, _this11),
|
|
1242
|
+
attributes = _this11$styleAttribut.attributes,
|
|
1243
|
+
elements = _this11$styleAttribut.elements,
|
|
1244
|
+
count = _this11$styleAttribut.count;
|
|
1245
|
+
var uniformBuffers = [].concat((0, _toConsumableArray2.default)(_this11.layerModel.uniformBuffers), (0, _toConsumableArray2.default)(_this11.rendererService.uniformBuffers), [_this11.getLayerUniformBuffer()]);
|
|
1239
1246
|
if (pickingEnabled) {
|
|
1240
|
-
uniformBuffers.push(
|
|
1247
|
+
uniformBuffers.push(_this11.getPickingUniformBuffer());
|
|
1241
1248
|
}
|
|
1242
1249
|
var modelOptions = (0, _objectSpread2.default)({
|
|
1243
1250
|
attributes: attributes,
|
|
@@ -1247,7 +1254,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
1247
1254
|
elements: elements,
|
|
1248
1255
|
blend: _blend.BlendTypes[_l7Core.BlendType.normal],
|
|
1249
1256
|
uniformBuffers: uniformBuffers,
|
|
1250
|
-
textures:
|
|
1257
|
+
textures: _this11.layerModel.textures
|
|
1251
1258
|
}, rest);
|
|
1252
1259
|
if (count) {
|
|
1253
1260
|
modelOptions.count = count;
|
|
@@ -1383,7 +1390,7 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
1383
1390
|
}, {
|
|
1384
1391
|
key: "renderModels",
|
|
1385
1392
|
value: function renderModels() {
|
|
1386
|
-
var
|
|
1393
|
+
var _this12 = this;
|
|
1387
1394
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1388
1395
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1389
1396
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
@@ -1394,10 +1401,10 @@ var BaseLayer = exports.default = /*#__PURE__*/function (_ref) {
|
|
|
1394
1401
|
this.hooks.beforeRender.call();
|
|
1395
1402
|
this.models.forEach(function (model) {
|
|
1396
1403
|
model.draw({
|
|
1397
|
-
uniforms:
|
|
1398
|
-
blend:
|
|
1399
|
-
stencil:
|
|
1400
|
-
textures:
|
|
1404
|
+
uniforms: _this12.layerModel.getUninforms(),
|
|
1405
|
+
blend: _this12.layerModel.getBlend(),
|
|
1406
|
+
stencil: _this12.layerModel.getStencil(options),
|
|
1407
|
+
textures: _this12.layerModel.textures
|
|
1401
1408
|
}, (options === null || options === void 0 ? void 0 : options.ispick) || false);
|
|
1402
1409
|
});
|
|
1403
1410
|
this.hooks.afterRender.call();
|
package/lib/core/BaseModel.js
CHANGED
|
@@ -93,13 +93,11 @@ var BaseModel = exports.default = /*#__PURE__*/function () {
|
|
|
93
93
|
stencilType: _l7Core.StencilType.SINGLE
|
|
94
94
|
}); // 用于遮罩的stencil 参数
|
|
95
95
|
}
|
|
96
|
-
|
|
97
96
|
if (option.isStencil) {
|
|
98
97
|
return (0, _stencil.getStencilMask)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, option), {}, {
|
|
99
98
|
maskOperation: maskOperation
|
|
100
99
|
})); // 用于遮罩的stencil 参数
|
|
101
100
|
}
|
|
102
|
-
|
|
103
101
|
var maskflag = mask ||
|
|
104
102
|
// mask 兼容历史写法
|
|
105
103
|
enableMask && this.layer.masks.length !== 0 ||
|
|
@@ -116,7 +116,6 @@ var BaseLayerPickService = exports.default = /*#__PURE__*/function () {
|
|
|
116
116
|
// x
|
|
117
117
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
118
118
|
];
|
|
119
|
-
|
|
120
119
|
var tileWidth = rasterData.width || 1;
|
|
121
120
|
var tileHeight = rasterData.height || 1;
|
|
122
121
|
var indexX = Math.floor(pos[0] * tileWidth);
|
package/lib/core/shape/Path.js
CHANGED
|
@@ -13,7 +13,6 @@ exports.polygonPath = polygonPath;
|
|
|
13
13
|
exports.square = square;
|
|
14
14
|
exports.triangle = triangle;
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
var _geometryShape;
|
|
17
16
|
var ShapeType3D = exports.ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
|
|
18
17
|
ShapeType3D["CYLINDER"] = "cylinder";
|
|
19
18
|
ShapeType3D["SQUARECOLUMN"] = "squareColumn";
|
|
@@ -65,4 +64,4 @@ function hexagon() {
|
|
|
65
64
|
function pentagon() {
|
|
66
65
|
return polygonPath(5);
|
|
67
66
|
}
|
|
68
|
-
var geometryShape = exports.geometryShape = (
|
|
67
|
+
var geometryShape = exports.geometryShape = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, ShapeType2D.CIRCLE, circle), ShapeType2D.HEXAGON, hexagon), ShapeType2D.TRIANGLE, triangle), ShapeType2D.SQUARE, square), ShapeType2D.PENTAGON, pentagon), ShapeType3D.CYLINDER, circle), ShapeType3D.HEXAGONCOLUMN, hexagon), ShapeType3D.TRIANGLECOLUMN, triangle), ShapeType3D.SQUARECOLUMN, square), ShapeType3D.PENTAGONCOLUMN, pentagon);
|
|
@@ -383,8 +383,8 @@ function HeatmapGridTriangulation(feature) {
|
|
|
383
383
|
function RasterImageTriangulation(feature) {
|
|
384
384
|
var coordinates = feature.coordinates;
|
|
385
385
|
// [ x, y, z. uv.x, uv.y]
|
|
386
|
-
var positions = [].concat((0, _toConsumableArray2.default)(coordinates[0]), [0, 0,
|
|
387
|
-
var indexs = [0, 1, 2,
|
|
386
|
+
var positions = [].concat((0, _toConsumableArray2.default)(coordinates[0]), [0, 0, 0], (0, _toConsumableArray2.default)(coordinates[1]), [0, 1, 0], (0, _toConsumableArray2.default)(coordinates[2]), [0, 1, 1], (0, _toConsumableArray2.default)(coordinates[3]), [0, 0, 1]);
|
|
387
|
+
var indexs = [0, 1, 2, 0, 2, 3];
|
|
388
388
|
return {
|
|
389
389
|
vertices: positions,
|
|
390
390
|
indices: indexs,
|
package/lib/earth/models/base.js
CHANGED
|
@@ -68,7 +68,6 @@ var BaseEarthModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
68
68
|
u_specularRatio: (globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.specularRatio) || 0.1 // 高光反射
|
|
69
69
|
// u_texture: this.texture,
|
|
70
70
|
};
|
|
71
|
-
|
|
72
71
|
this.textures = [this.texture];
|
|
73
72
|
var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
|
|
74
73
|
return commonBufferInfo;
|
package/lib/heatmap/index.js
CHANGED
|
@@ -120,7 +120,6 @@ var Arc3DModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
120
120
|
u_time: this.layer.getLayerAnimateTime() || 0,
|
|
121
121
|
u_linearColor: useLinearColor //是否使用渐变色
|
|
122
122
|
};
|
|
123
|
-
|
|
124
123
|
var commonBufferInfo = this.getUniformsBufferInfo(commonOptions);
|
|
125
124
|
return commonBufferInfo;
|
|
126
125
|
}
|
package/lib/line/models/line.js
CHANGED
|
@@ -19,13 +19,14 @@ var _l7Core = require("@antv/l7-core");
|
|
|
19
19
|
var _l7Utils = require("@antv/l7-utils");
|
|
20
20
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
21
21
|
var _interface = require("../../core/interface");
|
|
22
|
+
var _triangulation = require("../../core/triangulation");
|
|
22
23
|
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
23
24
|
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); }; }
|
|
24
|
-
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; } }
|
|
25
|
+
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; } }
|
|
25
26
|
/* babel-plugin-inline-import '../shaders/line/line_frag.glsl' */
|
|
26
27
|
var line_frag = "// #extension GL_OES_standard_derivatives : enable\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\nin vec4 v_color;\nin vec4 v_stroke;\n// dash\nin vec4 v_dash_array;\nin float v_d_distance_ratio;\nin vec2 v_iconMapUV;\nin vec4 v_texture_data;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\n// [animate, duration, interval, trailLength],\nvoid main() {\n if(u_dash_array!=vec4(0.0)){\n float dashLength = mod(v_d_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 // \u865A\u7EBF\u90E8\u5206\n discard;\n };\n }\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_texture_data.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n if(u_linearDir < 1.0) {\n d_distance_ratio = v_texture_data.a;\n }\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\n outputColor.a *= v_color.a;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_texture_data.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_texture_data.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_texture_data.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor += pattern;\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = pattern;\n }\n } \n\n float v = v_texture_data.a;\n float strokeWidth = min(0.5, u_strokeWidth);\n // \u7ED8\u5236 border\n if(strokeWidth > 0.01) {\n float borderOuterWidth = strokeWidth / 2.0;\n\n\n if(v >= 1.0 - strokeWidth || v <= strokeWidth) {\n if(v > strokeWidth) { // \u5916\u4FA7\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - strokeWidth))/strokeWidth);\n // float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth);\n outputColor.rgb = mix(outputColor.rgb, v_stroke.rgb, linear);\n } else if(v <= strokeWidth) {\n float linear = smoothstep(0.0, 1.0, v/strokeWidth);\n outputColor.rgb = mix(v_stroke.rgb, outputColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n outputColor.a = mix(0.0, outputColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n // blur\n float blurV = v_texture_data.a;\n if(blurV < 0.5) {\n outputColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);\n } else {\n outputColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);\n }\n \n outputColor = filterColor(outputColor);\n}\n";
|
|
27
28
|
/* babel-plugin-inline-import '../shaders/line/line_vert.glsl' */
|
|
28
|
-
var line_vert = "\n#define Animate 0.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in vec3 a_DistanceAndIndexAndMiter;\nlayout(location = 13) in vec4 a_Normal_Total_Distance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\n\nout vec4 v_color;\nout vec4 v_stroke;\n//dash\nout vec4 v_dash_array;\nout float v_d_distance_ratio;\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;\n float a_Miter = a_DistanceAndIndexAndMiter.z;\n vec3 a_Normal = a_Normal_Total_Distance.xyz;\n float a_Total_Distance = a_Normal_Total_Distance.w;\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n v_color.a *= opacity;\n v_stroke = stroke;\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 v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\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 //
|
|
29
|
+
var line_vert = "\n#define Animate 0.0\n\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in vec3 a_DistanceAndIndexAndMiter;\nlayout(location = 13) in vec4 a_Normal_Total_Distance;\nlayout(location = 14) in vec2 a_iconMapUV;\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_dash_array;\n vec4 u_blur;\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed: 0.0;\n float u_vertexScale: 1.0;\n float u_raisingHeight: 0.0;\n float u_strokeWidth: 0.0;\n float u_textureBlend;\n float u_line_texture;\n float u_linearDir: 1.0;\n float u_linearColor: 0;\n float u_time;\n};\n\n\nout vec4 v_color;\nout vec4 v_stroke;\n//dash\nout vec4 v_dash_array;\nout float v_d_distance_ratio;\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nout vec2 v_iconMapUV;\nout vec4 v_texture_data;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;\n float a_Miter = a_DistanceAndIndexAndMiter.z;\n vec3 a_Normal = a_Normal_Total_Distance.xyz;\n float a_Total_Distance = a_Normal_Total_Distance.w;\n //dash\u8F93\u51FA\n v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n v_color.a *= opacity;\n v_stroke = stroke;\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 v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\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 // \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
30
|
var LineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
30
31
|
(0, _inherits2.default)(LineModel, _BaseModel);
|
|
31
32
|
var _super = _createSuper(LineModel);
|
|
@@ -191,13 +192,13 @@ var LineModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
191
192
|
case 0:
|
|
192
193
|
_ref3 = this.layer.getLayerConfig(), _ref3$depth = _ref3.depth, depth = _ref3$depth === void 0 ? false : _ref3$depth;
|
|
193
194
|
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
194
|
-
this.layer.triangulation =
|
|
195
|
+
this.layer.triangulation = _triangulation.LineTriangulation;
|
|
195
196
|
_context2.next = 5;
|
|
196
197
|
return this.layer.buildLayerModel({
|
|
197
198
|
moduleName: 'line' + type,
|
|
198
199
|
vertexShader: vert,
|
|
199
200
|
fragmentShader: frag,
|
|
200
|
-
triangulation:
|
|
201
|
+
triangulation: _triangulation.LineTriangulation,
|
|
201
202
|
inject: this.getInject(),
|
|
202
203
|
depth: {
|
|
203
204
|
enable: depth
|
package/lib/line/models/wall.js
CHANGED
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
|
|
25
25
|
var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\n\nuniform sampler2D u_texture;\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\n};\nin vec2 v_iconMapUV;\nin float v_blur;\nin float v_radio;\nin vec4 v_color;\nin vec4 v_dataset;\n\nout vec4 outputColor;\n#pragma include \"picking\"\n\nvoid main() {\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_dataset.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = v_dataset.a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n outputColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n outputColor = v_color;\n }\n\n outputColor.a *= v_color.a; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_animate.x == Animate) {\n animateSpeed = u_time / u_animate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);\n alpha = (alpha + u_animate.w -1.0) / u_animate.w;\n alpha = smoothstep(0., 1., alpha);\n outputColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_dataset.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_dataset.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_dataset.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture(SAMPLER_2D(u_texture), uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n outputColor = filterColor(outputColor + pattern);\n } else { // replace\n pattern.a *= v_color.a;\n if(outputColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n outputColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n outputColor.a = mix(0.0, outputColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n outputColor = filterColor(outputColor);\n}\n";
|
|
26
26
|
/* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
|
|
27
|
-
var line_vert = "#define Animate 0.0\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in float a_Miter;\nlayout(location = 11) in float a_Total_Distance;\nlayout(location = 12) in vec4 a_Instance;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_iconMapUV;\nlayout(location = 15) in float a_Distance;\n\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\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\nout vec2 v_iconMapUV;\nout vec4 v_color;\nout float v_blur;\nout float v_radio;\nout 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) { \n originSize = project_float_meter(a_Size.x); // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n }\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 * opacity);\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";
|
|
27
|
+
var line_vert = "#define Animate 0.0\nlayout(location = 0) in vec3 a_Position;\nlayout(location = 1) in vec4 a_Color;\nlayout(location = 9) in vec2 a_Size;\nlayout(location = 10) in float a_Miter;\nlayout(location = 11) in float a_Total_Distance;\nlayout(location = 12) in vec4 a_Instance;\nlayout(location = 13) in vec3 a_Normal;\nlayout(location = 14) in vec2 a_iconMapUV;\nlayout(location = 15) in float a_Distance;\n\n\nlayout(std140) uniform commonUniorm {\n vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n vec4 u_sourceColor;\n vec4 u_targetColor;\n vec2 u_textSize;\n float u_icon_step: 100;\n float u_heightfixed;\n float u_linearColor: 0;\n float u_line_texture;\n float u_textureBlend;\n float u_iconStepCount;\n float u_time;\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\nout vec2 v_iconMapUV;\nout vec4 v_color;\nout float v_blur;\nout float v_radio;\nout 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) { \n originSize = project_float_meter(a_Size.x); // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n }\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 * opacity);\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// \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 if(u_heightfixed > 0.0) {\n wallHeight *= mapboxZoomScale;\n }\n \n } else {\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n wallHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\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 LineWallModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
29
29
|
(0, _inherits2.default)(LineWallModel, _BaseModel);
|
|
30
30
|
var _super = _createSuper(LineWallModel);
|
|
@@ -91,8 +91,6 @@ void main() {
|
|
|
91
91
|
}
|
|
92
92
|
gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));
|
|
93
93
|
} else {
|
|
94
|
-
// mapbox - amap
|
|
95
|
-
|
|
96
94
|
// 兼容 mapbox 在线高度上的效果表现基本一致
|
|
97
95
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
98
96
|
// mapbox
|
|
@@ -78,6 +78,21 @@ void main() {
|
|
|
78
78
|
if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
|
|
79
79
|
gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));
|
|
80
80
|
} else {
|
|
81
|
+
// 兼容 mapbox 在线高度上的效果表现基本一致
|
|
82
|
+
if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
|
|
83
|
+
// mapbox
|
|
84
|
+
// 保持高度相对不变
|
|
85
|
+
float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
|
|
86
|
+
if(u_heightfixed > 0.0) {
|
|
87
|
+
wallHeight *= mapboxZoomScale;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
} else {
|
|
91
|
+
// lineHeight 顶点偏移高度
|
|
92
|
+
if(u_heightfixed < 1.0) {
|
|
93
|
+
wallHeight *= pow(2.0, 20.0 - u_Zoom);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
81
96
|
gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
|
|
82
97
|
}
|
|
83
98
|
|
|
@@ -89,7 +89,6 @@ var DataMappingPlugin = exports.default = /*#__PURE__*/function () {
|
|
|
89
89
|
return attribute.needRemapping;
|
|
90
90
|
} // 如果filter变化
|
|
91
91
|
);
|
|
92
|
-
|
|
93
92
|
var filterData = dataArray;
|
|
94
93
|
// 数据过滤完 再执行数据映射
|
|
95
94
|
if (filter !== null && filter !== void 0 && filter.needRemapping && filter !== null && filter !== void 0 && filter.scale) {
|
|
@@ -101,7 +100,6 @@ var DataMappingPlugin = exports.default = /*#__PURE__*/function () {
|
|
|
101
100
|
// 过滤数据
|
|
102
101
|
var encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData() // TODO 优化
|
|
103
102
|
);
|
|
104
|
-
|
|
105
103
|
layer.setEncodedData(encodeData);
|
|
106
104
|
}
|
|
107
105
|
|
|
@@ -25,7 +25,7 @@ var isNil = _l7Utils.lodashUtil.isNil,
|
|
|
25
25
|
isString = _l7Utils.lodashUtil.isString,
|
|
26
26
|
uniq = _l7Utils.lodashUtil.uniq;
|
|
27
27
|
var dateRegex = /^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
|
|
28
|
-
var scaleMap = (_scaleMap = {}, (0, _defineProperty2.default)(
|
|
28
|
+
var scaleMap = (_scaleMap = {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.LINEAR, d3.scaleLinear), _l7Core.ScaleTypes.POWER, d3.scalePow), _l7Core.ScaleTypes.LOG, d3.scaleLog), _l7Core.ScaleTypes.IDENTITY, _identityScale.default), _l7Core.ScaleTypes.SEQUENTIAL, d3.scaleSequential), _l7Core.ScaleTypes.TIME, d3.scaleTime), _l7Core.ScaleTypes.QUANTILE, d3.scaleQuantile), _l7Core.ScaleTypes.QUANTIZE, d3.scaleQuantize), _l7Core.ScaleTypes.THRESHOLD, d3.scaleThreshold), _l7Core.ScaleTypes.CAT, d3.scaleOrdinal), (0, _defineProperty2.default)(_scaleMap, _l7Core.ScaleTypes.DIVERGING, d3.scaleDiverging));
|
|
29
29
|
/**
|
|
30
30
|
* 根据 Source 原始数据为指定字段创建 Scale,保存在 StyleAttribute 上,供下游插件使用
|
|
31
31
|
*/
|
|
@@ -63,7 +63,7 @@ var PixelPickingPlugin = exports.default = /*#__PURE__*/function () {
|
|
|
63
63
|
value: function apply(layer, _ref) {
|
|
64
64
|
var _this2 = this;
|
|
65
65
|
var styleAttributeService = _ref.styleAttributeService;
|
|
66
|
-
this.pickingUniformMap = new Map([['u_HighlightColor', [1, 0, 0, 1]], ['u_SelectColor', [1, 0, 0, 1]], ['u_PickingColor', [0, 0, 0]], ['u_PickingStage', 0], ['u_CurrentSelectedId', [0, 0, 0]], ['u_PickingThreshold', 10], ['u_PickingBuffer', 0], ['u_shaderPick', 0], ['
|
|
66
|
+
this.pickingUniformMap = new Map([['u_HighlightColor', [1, 0, 0, 1]], ['u_SelectColor', [1, 0, 0, 1]], ['u_PickingColor', [0, 0, 0]], ['u_PickingStage', 0], ['u_CurrentSelectedId', [0, 0, 0]], ['u_PickingThreshold', 10], ['u_PickingBuffer', 0], ['u_shaderPick', 0], ['u_activeMix', 0]]);
|
|
67
67
|
|
|
68
68
|
// TODO: 由于 Shader 目前无法根据是否开启拾取进行内容修改,因此即使不开启也需要生成 a_PickingColor
|
|
69
69
|
layer.hooks.init.tapPromise('PixelPickingPlugin', function () {
|
|
@@ -160,8 +160,7 @@ var PixelPickingPlugin = exports.default = /*#__PURE__*/function () {
|
|
|
160
160
|
u_CurrentSelectedId: pickedColor,
|
|
161
161
|
u_SelectColor: highlightColorInArray.map(function (c) {
|
|
162
162
|
return c * 255;
|
|
163
|
-
})
|
|
164
|
-
u_EnableSelect: 1
|
|
163
|
+
})
|
|
165
164
|
};
|
|
166
165
|
_this2.updatePickOption(option, layer);
|
|
167
166
|
layer.models.forEach(function (model) {
|
|
@@ -145,7 +145,7 @@ var ShaderUniformPlugin = exports.default = /*#__PURE__*/function () {
|
|
|
145
145
|
0, 0, 0]);
|
|
146
146
|
return {
|
|
147
147
|
data: data,
|
|
148
|
-
uniforms: (_uniforms = {}, (0, _defineProperty2.default)(
|
|
148
|
+
uniforms: (_uniforms = {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_uniforms, _l7Core.CameraUniform.ProjectionMatrix, u_ProjectionMatrix), _l7Core.CameraUniform.ViewMatrix, u_ViewMatrix), _l7Core.CameraUniform.ViewProjectionMatrix, u_ViewProjectionMatrix), _l7Core.CameraUniform.Zoom, u_Zoom), _l7Core.CameraUniform.ZoomScale, u_ZoomScale), _l7Core.CameraUniform.FocalDistance, u_FocalDistance), _l7Core.CameraUniform.CameraPosition, u_CameraPosition), _l7Core.CoordinateUniform.CoordinateSystem, u_CoordinateSystem), _l7Core.CoordinateUniform.ViewportCenter, u_ViewportCenter), _l7Core.CoordinateUniform.ViewportCenterProjection, u_ViewportCenterProjection), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_uniforms, _l7Core.CoordinateUniform.PixelsPerDegree, u_PixelsPerDegree), _l7Core.CoordinateUniform.PixelsPerDegree2, u_PixelsPerDegree2), _l7Core.CoordinateUniform.PixelsPerMeter, u_PixelsPerMeter), _l7Core.CoordinateUniform.Mvp, u_Mvp), "u_sceneCenterMercator", sceneCenterMercator), "u_ViewportSize", u_ViewportSize), "u_ModelMatrix", u_ModelMatrix), "u_DevicePixelRatio", u_DevicePixelRatio))
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
}]);
|
package/lib/point/models/fill.js
CHANGED
|
@@ -13,7 +13,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
13
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
15
|
var _l7Core = require("@antv/l7-core");
|
|
16
|
-
var
|
|
16
|
+
var _triangulation = require("../../core/triangulation");
|
|
17
17
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
18
18
|
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
19
19
|
var _interface = require("../../core/interface");
|
|
@@ -79,7 +79,7 @@ var FillModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
79
79
|
}, {
|
|
80
80
|
key: "getAttribute",
|
|
81
81
|
value: function getAttribute() {
|
|
82
|
-
return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),
|
|
82
|
+
return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(), _triangulation.PointFillTriangulation);
|
|
83
83
|
}
|
|
84
84
|
}, {
|
|
85
85
|
key: "initModels",
|
|
@@ -109,7 +109,7 @@ var FillModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
109
109
|
while (1) switch (_context2.prev = _context2.next) {
|
|
110
110
|
case 0:
|
|
111
111
|
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
112
|
-
this.layer.triangulation =
|
|
112
|
+
this.layer.triangulation = _triangulation.PointFillTriangulation;
|
|
113
113
|
this.initUniformsBuffer();
|
|
114
114
|
_context2.next = 5;
|
|
115
115
|
return this.layer.buildLayerModel({
|
|
@@ -117,7 +117,7 @@ var FillModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
117
117
|
vertexShader: vert,
|
|
118
118
|
fragmentShader: frag,
|
|
119
119
|
inject: this.getInject(),
|
|
120
|
-
triangulation:
|
|
120
|
+
triangulation: _triangulation.PointFillTriangulation,
|
|
121
121
|
depth: {
|
|
122
122
|
enable: false
|
|
123
123
|
}
|
|
@@ -14,7 +14,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
14
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
16
|
var _l7Core = require("@antv/l7-core");
|
|
17
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
18
17
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
19
18
|
var _triangulation = require("../../core/triangulation");
|
|
20
19
|
var _CommonStyleAttribute = require("../../core/CommonStyleAttribute");
|
|
@@ -168,7 +167,7 @@ var FillModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
|
168
167
|
frag: polygon_frag,
|
|
169
168
|
vert: polygon_vert,
|
|
170
169
|
type: 'polygonFill',
|
|
171
|
-
triangulation:
|
|
170
|
+
triangulation: _triangulation.polygonTriangulation
|
|
172
171
|
};
|
|
173
172
|
}
|
|
174
173
|
}
|
|
@@ -28,7 +28,6 @@ function readRasterValue(tile, mapService, x, y) {
|
|
|
28
28
|
// x
|
|
29
29
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
30
30
|
];
|
|
31
|
-
|
|
32
31
|
var tileWidth = (tile === null || tile === void 0 || (_tile$data = tile.data) === null || _tile$data === void 0 ? void 0 : _tile$data.width) || 1;
|
|
33
32
|
var tileHeight = (tile === null || tile === void 0 || (_tile$data2 = tile.data) === null || _tile$data2 === void 0 ? void 0 : _tile$data2.height) || 1;
|
|
34
33
|
var indexX = Math.floor(pos[0] * tileWidth);
|