@antv/l7-layers 2.13.6 → 2.13.8
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/Geometry/models/billboard.js +2 -6
- package/es/Geometry/models/plane.js +2 -6
- package/es/Geometry/models/sprite.js +2 -6
- package/es/citybuliding/models/build.js +2 -6
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +18 -11
- package/es/earth/models/atmosphere.js +2 -6
- package/es/earth/models/base.js +2 -6
- package/es/earth/models/bloomsphere.js +2 -6
- package/es/heatmap/models/grid.js +2 -6
- package/es/heatmap/models/grid3d.js +2 -6
- package/es/heatmap/models/heatmap.js +2 -6
- package/es/heatmap/models/hexagon.js +2 -6
- package/es/image/models/image.js +2 -6
- package/es/index.d.ts +1 -1
- package/es/index.js +2 -2
- package/es/line/models/arc.js +2 -6
- package/es/line/models/arc_3d.js +2 -6
- package/es/line/models/earthArc_3d.js +2 -6
- package/es/line/models/great_circle.js +2 -6
- package/es/line/models/half.js +2 -6
- package/es/line/models/line.js +2 -2
- package/es/line/models/linearline.js +2 -6
- package/es/line/models/simpleLine.js +2 -6
- package/es/line/models/wall.js +2 -6
- package/es/mask/models/fill.js +6 -7
- package/es/plugins/DataMappingPlugin.js +10 -6
- package/es/plugins/DataSourcePlugin.js +4 -4
- package/es/plugins/FeatureScalePlugin.js +8 -6
- package/es/plugins/LayerModelPlugin.js +8 -6
- package/es/point/models/earthExtrude.js +2 -6
- package/es/point/models/earthFill.js +2 -6
- package/es/point/models/extrude.js +2 -6
- package/es/point/models/normal.js +5 -7
- package/es/point/models/radar.js +3 -7
- package/es/point/models/simplePoint.js +2 -6
- package/es/polygon/models/extrude.js +4 -8
- package/es/polygon/models/fill.js +2 -6
- package/es/polygon/models/ocean.js +2 -6
- package/es/polygon/models/water.js +2 -6
- package/es/raster/models/raster.js +3 -7
- package/es/raster/models/rasterRgb.js +5 -9
- package/es/raster/models/rasterTerrainRgb.js +3 -7
- package/es/tile/manager/base.d.ts +1 -1
- package/es/tile/manager/base.js +16 -4
- package/es/tile/service/TileLayerService.d.ts +3 -3
- package/es/tile/service/TileLayerService.js +16 -18
- package/es/tile/service/TileSourceService.js +1 -1
- package/es/tile/tileFactory/DebugTile.js +3 -3
- package/es/tile/tileFactory/ImageTile.js +1 -0
- package/es/tile/tileFactory/MaskTile.js +5 -1
- package/es/tile/tileFactory/RasterRGBTile.js +1 -0
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +1 -0
- package/es/tile/tileFactory/RasterTile.js +3 -2
- package/es/tile/tileFactory/Tile.js +5 -3
- package/es/tile/tileFactory/VectorTile.js +0 -1
- package/es/tile/tileFactory/index.d.ts +4 -4
- package/es/tile/tileFactory/index.js +4 -4
- package/es/tile/tileFactory/layers/TileDebugLayer.js +3 -0
- package/es/tile/tileFactory/util.d.ts +1 -1
- package/es/tile/tileFactory/util.js +1 -1
- package/es/tile/tileLayer/BaseLayer.d.ts +1 -1
- package/es/tile/tileLayer/BaseLayer.js +6 -4
- package/es/wind/models/wind.js +2 -6
- package/lib/Geometry/models/billboard.js +2 -6
- package/lib/Geometry/models/plane.js +2 -6
- package/lib/Geometry/models/sprite.js +2 -6
- package/lib/citybuliding/models/build.js +2 -6
- package/lib/core/BaseLayer.js +17 -10
- package/lib/earth/models/atmosphere.js +2 -6
- package/lib/earth/models/base.js +2 -6
- package/lib/earth/models/bloomsphere.js +2 -6
- package/lib/heatmap/models/grid.js +2 -6
- package/lib/heatmap/models/grid3d.js +2 -6
- package/lib/heatmap/models/heatmap.js +2 -6
- package/lib/heatmap/models/hexagon.js +2 -6
- package/lib/image/models/image.js +2 -6
- package/lib/line/models/arc.js +2 -6
- package/lib/line/models/arc_3d.js +2 -6
- package/lib/line/models/earthArc_3d.js +2 -6
- package/lib/line/models/great_circle.js +2 -6
- package/lib/line/models/half.js +2 -6
- package/lib/line/models/line.js +2 -2
- package/lib/line/models/linearline.js +2 -6
- package/lib/line/models/simpleLine.js +2 -6
- package/lib/line/models/wall.js +2 -6
- package/lib/mask/models/fill.js +6 -7
- package/lib/plugins/DataMappingPlugin.js +9 -5
- package/lib/plugins/DataSourcePlugin.js +3 -3
- package/lib/plugins/FeatureScalePlugin.js +7 -5
- package/lib/plugins/LayerModelPlugin.js +7 -5
- package/lib/point/models/earthExtrude.js +2 -6
- package/lib/point/models/earthFill.js +2 -6
- package/lib/point/models/extrude.js +2 -6
- package/lib/point/models/normal.js +5 -7
- package/lib/point/models/radar.js +4 -8
- package/lib/point/models/simplePoint.js +2 -6
- package/lib/polygon/models/extrude.js +4 -8
- package/lib/polygon/models/fill.js +2 -6
- package/lib/polygon/models/ocean.js +2 -6
- package/lib/polygon/models/water.js +2 -6
- package/lib/raster/models/raster.js +2 -6
- package/lib/raster/models/rasterRgb.js +5 -9
- package/lib/raster/models/rasterTerrainRgb.js +2 -6
- package/lib/tile/manager/base.js +16 -4
- package/lib/tile/service/TileLayerService.js +16 -18
- package/lib/tile/service/TileSourceService.js +1 -1
- package/lib/tile/tileFactory/DebugTile.js +3 -3
- package/lib/tile/tileFactory/ImageTile.js +1 -0
- package/lib/tile/tileFactory/MaskTile.js +5 -1
- package/lib/tile/tileFactory/RasterRGBTile.js +1 -0
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +1 -0
- package/lib/tile/tileFactory/RasterTile.js +4 -3
- package/lib/tile/tileFactory/Tile.js +5 -3
- package/lib/tile/tileFactory/VectorTile.js +0 -1
- package/lib/tile/tileFactory/index.js +5 -5
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +3 -0
- package/lib/tile/tileFactory/util.js +2 -2
- package/lib/tile/tileLayer/BaseLayer.js +7 -5
- package/lib/wind/models/wind.js +2 -6
- package/package.json +7 -6
|
@@ -57,13 +57,13 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
57
57
|
while (1) {
|
|
58
58
|
switch (_context.prev = _context.next) {
|
|
59
59
|
case 0:
|
|
60
|
-
layer.log(_l7Core.IDebugLog.MappingStart); // 初始化重新生成 map
|
|
60
|
+
layer.log(_l7Core.IDebugLog.MappingStart, _l7Core.ILayerStage.INIT); // 初始化重新生成 map
|
|
61
61
|
|
|
62
62
|
_this.generateMaping(layer, {
|
|
63
63
|
styleAttributeService: styleAttributeService
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
layer.log(_l7Core.IDebugLog.MappingEnd);
|
|
66
|
+
layer.log(_l7Core.IDebugLog.MappingEnd, _l7Core.ILayerStage.INIT);
|
|
67
67
|
|
|
68
68
|
case 3:
|
|
69
69
|
case "end":
|
|
@@ -74,6 +74,7 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
74
74
|
})));
|
|
75
75
|
layer.hooks.beforeRenderData.tapPromise('DataMappingPlugin', /*#__PURE__*/function () {
|
|
76
76
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(flag) {
|
|
77
|
+
var mappingResult;
|
|
77
78
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
78
79
|
while (1) {
|
|
79
80
|
switch (_context2.prev = _context2.next) {
|
|
@@ -87,11 +88,14 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
87
88
|
|
|
88
89
|
case 2:
|
|
89
90
|
layer.dataState.dataMappingNeedUpdate = false;
|
|
90
|
-
|
|
91
|
+
layer.log(_l7Core.IDebugLog.MappingStart, _l7Core.ILayerStage.UPDATE);
|
|
92
|
+
mappingResult = _this.generateMaping(layer, {
|
|
91
93
|
styleAttributeService: styleAttributeService
|
|
92
|
-
})
|
|
94
|
+
});
|
|
95
|
+
layer.log(_l7Core.IDebugLog.MappingEnd, _l7Core.ILayerStage.UPDATE);
|
|
96
|
+
return _context2.abrupt("return", mappingResult);
|
|
93
97
|
|
|
94
|
-
case
|
|
98
|
+
case 7:
|
|
95
99
|
case "end":
|
|
96
100
|
return _context2.stop();
|
|
97
101
|
}
|
|
@@ -43,7 +43,7 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
|
|
|
43
43
|
while (1) {
|
|
44
44
|
switch (_context.prev = _context.next) {
|
|
45
45
|
case 0:
|
|
46
|
-
layer.log(_l7Core.IDebugLog.SourceInitStart);
|
|
46
|
+
layer.log(_l7Core.IDebugLog.SourceInitStart, _l7Core.ILayerStage.INIT);
|
|
47
47
|
source = layer.getSource();
|
|
48
48
|
|
|
49
49
|
if (!source) {
|
|
@@ -60,7 +60,7 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
|
|
|
60
60
|
|
|
61
61
|
_this.updateClusterData(layer);
|
|
62
62
|
|
|
63
|
-
layer.log(_l7Core.IDebugLog.SourceInitEnd);
|
|
63
|
+
layer.log(_l7Core.IDebugLog.SourceInitEnd, _l7Core.ILayerStage.INIT);
|
|
64
64
|
_context.next = 10;
|
|
65
65
|
break;
|
|
66
66
|
|
|
@@ -71,7 +71,7 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__
|
|
|
71
71
|
if (e.type === 'inited') {
|
|
72
72
|
_this.updateClusterData(layer);
|
|
73
73
|
|
|
74
|
-
layer.log(_l7Core.IDebugLog.SourceInitEnd);
|
|
74
|
+
layer.log(_l7Core.IDebugLog.SourceInitEnd, _l7Core.ILayerStage.INIT);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
resolve(null);
|
|
@@ -69,7 +69,7 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
69
69
|
while (1) {
|
|
70
70
|
switch (_context.prev = _context.next) {
|
|
71
71
|
case 0:
|
|
72
|
-
layer.log(_l7Core.IDebugLog.ScaleInitStart);
|
|
72
|
+
layer.log(_l7Core.IDebugLog.ScaleInitStart, _l7Core.ILayerStage.INIT);
|
|
73
73
|
_this.scaleOptions = layer.getScaleOptions();
|
|
74
74
|
attributes = styleAttributeService.getLayerStyleAttributes();
|
|
75
75
|
dataArray = (_layer$getSource = layer.getSource()) === null || _layer$getSource === void 0 ? void 0 : _layer$getSource.data.dataArray;
|
|
@@ -85,7 +85,7 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
85
85
|
_this.caculateScalesForAttributes(attributes || [], dataArray);
|
|
86
86
|
|
|
87
87
|
case 9:
|
|
88
|
-
layer.log(_l7Core.IDebugLog.ScaleInitEnd);
|
|
88
|
+
layer.log(_l7Core.IDebugLog.ScaleInitEnd, _l7Core.ILayerStage.INIT);
|
|
89
89
|
|
|
90
90
|
case 10:
|
|
91
91
|
case "end":
|
|
@@ -110,24 +110,26 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
110
110
|
return _context2.abrupt("return", flag);
|
|
111
111
|
|
|
112
112
|
case 2:
|
|
113
|
+
layer.log(_l7Core.IDebugLog.ScaleInitStart, _l7Core.ILayerStage.UPDATE);
|
|
113
114
|
_this.scaleOptions = layer.getScaleOptions();
|
|
114
115
|
attributes = styleAttributeService.getLayerStyleAttributes();
|
|
115
116
|
dataArray = layer.getSource().data.dataArray;
|
|
116
117
|
|
|
117
118
|
if (!(Array.isArray(dataArray) && dataArray.length === 0)) {
|
|
118
|
-
_context2.next =
|
|
119
|
+
_context2.next = 8;
|
|
119
120
|
break;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
return _context2.abrupt("return", true);
|
|
123
124
|
|
|
124
|
-
case
|
|
125
|
+
case 8:
|
|
125
126
|
_this.caculateScalesForAttributes(attributes || [], dataArray);
|
|
126
127
|
|
|
128
|
+
layer.log(_l7Core.IDebugLog.ScaleInitEnd, _l7Core.ILayerStage.UPDATE);
|
|
127
129
|
layer.layerModelNeedUpdate = true;
|
|
128
130
|
return _context2.abrupt("return", true);
|
|
129
131
|
|
|
130
|
-
case
|
|
132
|
+
case 12:
|
|
131
133
|
case "end":
|
|
132
134
|
return _context2.stop();
|
|
133
135
|
}
|
|
@@ -135,12 +135,12 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
135
135
|
return _context4.abrupt("return");
|
|
136
136
|
|
|
137
137
|
case 4:
|
|
138
|
-
layer.log(_l7Core.IDebugLog.BuildModelStart);
|
|
138
|
+
layer.log(_l7Core.IDebugLog.BuildModelStart, _l7Core.ILayerStage.INIT);
|
|
139
139
|
_context4.next = 7;
|
|
140
140
|
return _this.initLayerModel(layer);
|
|
141
141
|
|
|
142
142
|
case 7:
|
|
143
|
-
layer.log(_l7Core.IDebugLog.BuildModelEnd);
|
|
143
|
+
layer.log(_l7Core.IDebugLog.BuildModelEnd, _l7Core.ILayerStage.INIT);
|
|
144
144
|
|
|
145
145
|
case 8:
|
|
146
146
|
case "end":
|
|
@@ -172,13 +172,15 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
172
172
|
return _context5.abrupt("return", false);
|
|
173
173
|
|
|
174
174
|
case 5:
|
|
175
|
-
|
|
175
|
+
layer.log(_l7Core.IDebugLog.BuildModelStart, _l7Core.ILayerStage.UPDATE);
|
|
176
|
+
_context5.next = 8;
|
|
176
177
|
return _this.prepareLayerModel(layer);
|
|
177
178
|
|
|
178
|
-
case
|
|
179
|
+
case 8:
|
|
180
|
+
layer.log(_l7Core.IDebugLog.BuildModelEnd, _l7Core.ILayerStage.UPDATE);
|
|
179
181
|
return _context5.abrupt("return", true);
|
|
180
182
|
|
|
181
|
-
case
|
|
183
|
+
case 10:
|
|
182
184
|
case "end":
|
|
183
185
|
return _context5.stop();
|
|
184
186
|
}
|
|
@@ -183,13 +183,9 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
183
183
|
while (1) {
|
|
184
184
|
switch (_context.prev = _context.next) {
|
|
185
185
|
case 0:
|
|
186
|
-
_context.
|
|
187
|
-
return this.buildModels();
|
|
186
|
+
return _context.abrupt("return", this.buildModels());
|
|
188
187
|
|
|
189
|
-
case
|
|
190
|
-
return _context.abrupt("return", _context.sent);
|
|
191
|
-
|
|
192
|
-
case 3:
|
|
188
|
+
case 1:
|
|
193
189
|
case "end":
|
|
194
190
|
return _context.stop();
|
|
195
191
|
}
|
|
@@ -149,13 +149,9 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
149
149
|
while (1) {
|
|
150
150
|
switch (_context.prev = _context.next) {
|
|
151
151
|
case 0:
|
|
152
|
-
_context.
|
|
153
|
-
return this.buildModels();
|
|
152
|
+
return _context.abrupt("return", this.buildModels());
|
|
154
153
|
|
|
155
|
-
case
|
|
156
|
-
return _context.abrupt("return", _context.sent);
|
|
157
|
-
|
|
158
|
-
case 3:
|
|
154
|
+
case 1:
|
|
159
155
|
case "end":
|
|
160
156
|
return _context.stop();
|
|
161
157
|
}
|
|
@@ -181,13 +181,9 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
181
181
|
while (1) {
|
|
182
182
|
switch (_context.prev = _context.next) {
|
|
183
183
|
case 0:
|
|
184
|
-
_context.
|
|
185
|
-
return this.buildModels();
|
|
184
|
+
return _context.abrupt("return", this.buildModels());
|
|
186
185
|
|
|
187
|
-
case
|
|
188
|
-
return _context.abrupt("return", _context.sent);
|
|
189
|
-
|
|
190
|
-
case 3:
|
|
186
|
+
case 1:
|
|
191
187
|
case "end":
|
|
192
188
|
return _context.stop();
|
|
193
189
|
}
|
|
@@ -87,13 +87,9 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
87
87
|
while (1) {
|
|
88
88
|
switch (_context.prev = _context.next) {
|
|
89
89
|
case 0:
|
|
90
|
-
_context.
|
|
91
|
-
return this.buildModels();
|
|
90
|
+
return _context.abrupt("return", this.buildModels());
|
|
92
91
|
|
|
93
|
-
case
|
|
94
|
-
return _context.abrupt("return", _context.sent);
|
|
95
|
-
|
|
96
|
-
case 3:
|
|
92
|
+
case 1:
|
|
97
93
|
case "end":
|
|
98
94
|
return _context.stop();
|
|
99
95
|
}
|
|
@@ -154,7 +150,9 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
154
150
|
}()
|
|
155
151
|
}, {
|
|
156
152
|
key: "clearModels",
|
|
157
|
-
value: function clearModels() {
|
|
153
|
+
value: function clearModels() {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
158
156
|
}, {
|
|
159
157
|
key: "registerBuiltinAttributes",
|
|
160
158
|
value: function registerBuiltinAttributes() {
|
|
@@ -29,10 +29,10 @@ var _lodash = require("lodash");
|
|
|
29
29
|
|
|
30
30
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
31
31
|
|
|
32
|
-
var _triangulation = require("../../core/triangulation");
|
|
33
|
-
|
|
34
32
|
var _interface = require("../../core/interface");
|
|
35
33
|
|
|
34
|
+
var _triangulation = require("../../core/triangulation");
|
|
35
|
+
|
|
36
36
|
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); }; }
|
|
37
37
|
|
|
38
38
|
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; } }
|
|
@@ -99,13 +99,9 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
99
99
|
while (1) {
|
|
100
100
|
switch (_context.prev = _context.next) {
|
|
101
101
|
case 0:
|
|
102
|
-
_context.
|
|
103
|
-
return this.buildModels();
|
|
104
|
-
|
|
105
|
-
case 2:
|
|
106
|
-
return _context.abrupt("return", _context.sent);
|
|
102
|
+
return _context.abrupt("return", this.buildModels());
|
|
107
103
|
|
|
108
|
-
case
|
|
104
|
+
case 1:
|
|
109
105
|
case "end":
|
|
110
106
|
return _context.stop();
|
|
111
107
|
}
|
|
@@ -139,13 +139,9 @@ var SimplePointModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
139
139
|
while (1) {
|
|
140
140
|
switch (_context.prev = _context.next) {
|
|
141
141
|
case 0:
|
|
142
|
-
_context.
|
|
143
|
-
return this.buildModels();
|
|
142
|
+
return _context.abrupt("return", this.buildModels());
|
|
144
143
|
|
|
145
|
-
case
|
|
146
|
-
return _context.abrupt("return", _context.sent);
|
|
147
|
-
|
|
148
|
-
case 3:
|
|
144
|
+
case 1:
|
|
149
145
|
case "end":
|
|
150
146
|
return _context.stop();
|
|
151
147
|
}
|
|
@@ -38,10 +38,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
38
38
|
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; } }
|
|
39
39
|
|
|
40
40
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
|
|
41
|
-
var polygonExtrudeFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0]; \n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
41
|
+
var polygonExtrudeFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0]; \n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
42
42
|
|
|
43
43
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
|
|
44
|
-
var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[3][0] = a_uvs[2];\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
44
|
+
var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[3][0] = a_uvs[2];\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude
|
|
45
45
|
|
|
46
46
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
|
|
47
47
|
var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\nuniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float isSide = styleMappingMat[0][3];\n float lightWeight = styleMappingMat[3][1];\n float topU = styleMappingMat[2][2];\n float topV = styleMappingMat[2][3];\n\n float sidey = styleMappingMat[3][0];\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n } else {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = texture2D(u_texture, vec2(topU, topV));\n }\n \n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // texture
|
|
@@ -152,13 +152,9 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
152
152
|
switch (_context.prev = _context.next) {
|
|
153
153
|
case 0:
|
|
154
154
|
this.loadTexture();
|
|
155
|
-
_context.
|
|
156
|
-
return this.buildModels();
|
|
155
|
+
return _context.abrupt("return", this.buildModels());
|
|
157
156
|
|
|
158
|
-
case
|
|
159
|
-
return _context.abrupt("return", _context.sent);
|
|
160
|
-
|
|
161
|
-
case 4:
|
|
157
|
+
case 2:
|
|
162
158
|
case "end":
|
|
163
159
|
return _context.stop();
|
|
164
160
|
}
|
|
@@ -121,13 +121,9 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
121
121
|
while (1) {
|
|
122
122
|
switch (_context.prev = _context.next) {
|
|
123
123
|
case 0:
|
|
124
|
-
_context.
|
|
125
|
-
return this.buildModels();
|
|
124
|
+
return _context.abrupt("return", this.buildModels());
|
|
126
125
|
|
|
127
|
-
case
|
|
128
|
-
return _context.abrupt("return", _context.sent);
|
|
129
|
-
|
|
130
|
-
case 3:
|
|
126
|
+
case 1:
|
|
131
127
|
case "end":
|
|
132
128
|
return _context.stop();
|
|
133
129
|
}
|
|
@@ -91,13 +91,9 @@ var OceanModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
91
91
|
switch (_context.prev = _context.next) {
|
|
92
92
|
case 0:
|
|
93
93
|
this.loadTexture();
|
|
94
|
-
_context.
|
|
95
|
-
return this.buildModels();
|
|
94
|
+
return _context.abrupt("return", this.buildModels());
|
|
96
95
|
|
|
97
|
-
case
|
|
98
|
-
return _context.abrupt("return", _context.sent);
|
|
99
|
-
|
|
100
|
-
case 4:
|
|
96
|
+
case 2:
|
|
101
97
|
case "end":
|
|
102
98
|
return _context.stop();
|
|
103
99
|
}
|
|
@@ -86,13 +86,9 @@ var WaterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
86
86
|
switch (_context.prev = _context.next) {
|
|
87
87
|
case 0:
|
|
88
88
|
this.loadTexture();
|
|
89
|
-
_context.
|
|
90
|
-
return this.buildModels();
|
|
89
|
+
return _context.abrupt("return", this.buildModels());
|
|
91
90
|
|
|
92
|
-
case
|
|
93
|
-
return _context.abrupt("return", _context.sent);
|
|
94
|
-
|
|
95
|
-
case 4:
|
|
91
|
+
case 2:
|
|
96
92
|
case "end":
|
|
97
93
|
return _context.stop();
|
|
98
94
|
}
|
|
@@ -195,13 +195,9 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
195
195
|
while (1) {
|
|
196
196
|
switch (_context3.prev = _context3.next) {
|
|
197
197
|
case 0:
|
|
198
|
-
_context3.
|
|
199
|
-
return this.initModels();
|
|
198
|
+
return _context3.abrupt("return", this.initModels());
|
|
200
199
|
|
|
201
|
-
case
|
|
202
|
-
return _context3.abrupt("return", _context3.sent);
|
|
203
|
-
|
|
204
|
-
case 3:
|
|
200
|
+
case 1:
|
|
205
201
|
case "end":
|
|
206
202
|
return _context3.stop();
|
|
207
203
|
}
|
|
@@ -44,12 +44,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
44
44
|
|
|
45
45
|
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; } }
|
|
46
46
|
|
|
47
|
-
/* babel-plugin-inline-import '../shaders/raster_rgb_frag.glsl' */
|
|
48
|
-
var rasterFrag = "precision mediump float;\nuniform vec2 u_rminmax: vec2(0,255); \nuniform vec2 u_gminmax: vec2(0,255);\nuniform vec2 u_bminmax: vec2(0,255);\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform float u_noDataValue : 0.0;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec3 rgb = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).rgb;\n if(rgb == vec3(u_noDataValue)) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n gl_FragColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);\n }\n \n}";
|
|
49
|
-
|
|
50
47
|
/* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
|
|
51
48
|
var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\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\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
|
|
52
49
|
|
|
50
|
+
/* babel-plugin-inline-import '../shaders/raster_rgb_frag.glsl' */
|
|
51
|
+
var rasterFrag = "precision mediump float;\nuniform vec2 u_rminmax: vec2(0,255); \nuniform vec2 u_gminmax: vec2(0,255);\nuniform vec2 u_bminmax: vec2(0,255);\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform float u_noDataValue : 0.0;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec3 rgb = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).rgb;\n if(rgb == vec3(u_noDataValue)) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n gl_FragColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);\n }\n \n}";
|
|
52
|
+
|
|
53
53
|
var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
54
54
|
(0, _inherits2.default)(RasterModel, _BaseModel);
|
|
55
55
|
|
|
@@ -219,13 +219,9 @@ var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
219
219
|
while (1) {
|
|
220
220
|
switch (_context3.prev = _context3.next) {
|
|
221
221
|
case 0:
|
|
222
|
-
_context3.
|
|
223
|
-
return this.initModels();
|
|
224
|
-
|
|
225
|
-
case 2:
|
|
226
|
-
return _context3.abrupt("return", _context3.sent);
|
|
222
|
+
return _context3.abrupt("return", this.initModels());
|
|
227
223
|
|
|
228
|
-
case
|
|
224
|
+
case 1:
|
|
229
225
|
case "end":
|
|
230
226
|
return _context3.stop();
|
|
231
227
|
}
|
|
@@ -153,13 +153,9 @@ var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
|
|
|
153
153
|
while (1) {
|
|
154
154
|
switch (_context2.prev = _context2.next) {
|
|
155
155
|
case 0:
|
|
156
|
-
_context2.
|
|
157
|
-
return this.initModels();
|
|
156
|
+
return _context2.abrupt("return", this.initModels());
|
|
158
157
|
|
|
159
|
-
case
|
|
160
|
-
return _context2.abrupt("return", _context2.sent);
|
|
161
|
-
|
|
162
|
-
case 3:
|
|
158
|
+
case 1:
|
|
163
159
|
case "end":
|
|
164
160
|
return _context2.stop();
|
|
165
161
|
}
|
package/lib/tile/manager/base.js
CHANGED
|
@@ -192,7 +192,10 @@ var Base = /*#__PURE__*/function () {
|
|
|
192
192
|
}, {
|
|
193
193
|
key: "getLayers",
|
|
194
194
|
value: function getLayers(tile) {
|
|
195
|
-
if (!tile)
|
|
195
|
+
if (!tile) {
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
|
|
196
199
|
return this.tileLayerCache.get(tile.key) || [];
|
|
197
200
|
}
|
|
198
201
|
}, {
|
|
@@ -238,7 +241,10 @@ var Base = /*#__PURE__*/function () {
|
|
|
238
241
|
key: "updateTileVisible",
|
|
239
242
|
value: function updateTileVisible(tile, layerService) {
|
|
240
243
|
var layers = this.getLayers(tile);
|
|
241
|
-
|
|
244
|
+
|
|
245
|
+
if (layers.length === 0) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
242
248
|
|
|
243
249
|
if (tile.isVisible) {
|
|
244
250
|
// 如果可见直接进行渲染,父级发
|
|
@@ -277,7 +283,10 @@ var Base = /*#__PURE__*/function () {
|
|
|
277
283
|
}, {
|
|
278
284
|
key: "isTileLoaded",
|
|
279
285
|
value: function isTileLoaded(tile) {
|
|
280
|
-
if (tile.isLoad)
|
|
286
|
+
if (tile.isLoad) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
|
|
281
290
|
var isLoad = this.getLayers(tile).length === tile.loadedLayers;
|
|
282
291
|
tile.isLoad = isLoad;
|
|
283
292
|
return isLoad;
|
|
@@ -287,7 +296,10 @@ var Base = /*#__PURE__*/function () {
|
|
|
287
296
|
value: function isTileChildLoaded(tile) {
|
|
288
297
|
var _this2 = this;
|
|
289
298
|
|
|
290
|
-
if (tile.isChildLoad)
|
|
299
|
+
if (tile.isChildLoad) {
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
|
|
291
303
|
var children = tile.children;
|
|
292
304
|
var isLoad = children.filter(function (child) {
|
|
293
305
|
return _this2.isTileLoaded(child);
|
|
@@ -31,7 +31,7 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
31
31
|
parent = _ref.parent;
|
|
32
32
|
(0, _classCallCheck2.default)(this, TileLayerService);
|
|
33
33
|
(0, _defineProperty2.default)(this, "tileResource", new Map());
|
|
34
|
-
(0, _defineProperty2.default)(this, "
|
|
34
|
+
(0, _defineProperty2.default)(this, "layerTiles", []);
|
|
35
35
|
this.rendererService = rendererService;
|
|
36
36
|
this.layerService = layerService;
|
|
37
37
|
this.parent = parent;
|
|
@@ -40,24 +40,24 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
40
40
|
(0, _createClass2.default)(TileLayerService, [{
|
|
41
41
|
key: "tiles",
|
|
42
42
|
get: function get() {
|
|
43
|
-
return this.
|
|
43
|
+
return this.layerTiles;
|
|
44
44
|
}
|
|
45
45
|
}, {
|
|
46
46
|
key: "hasTile",
|
|
47
47
|
value: function hasTile(tileKey) {
|
|
48
|
-
return this.
|
|
48
|
+
return this.layerTiles.some(function (tile) {
|
|
49
49
|
return tile.key === tileKey;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}, {
|
|
53
53
|
key: "addTile",
|
|
54
54
|
value: function addTile(tile) {
|
|
55
|
-
this.
|
|
55
|
+
this.layerTiles.push(tile);
|
|
56
56
|
}
|
|
57
57
|
}, {
|
|
58
58
|
key: "getTile",
|
|
59
59
|
value: function getTile(tileKey) {
|
|
60
|
-
return this.
|
|
60
|
+
return this.layerTiles.find(function (tile) {
|
|
61
61
|
return tile.key === tileKey;
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -65,20 +65,21 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
65
65
|
key: "getVisibleTileBylngLat",
|
|
66
66
|
value: function getVisibleTileBylngLat(lngLat) {
|
|
67
67
|
// 加载完成 & 可见 & 鼠标选中
|
|
68
|
-
return this.
|
|
68
|
+
return this.layerTiles.find(function (tile) {
|
|
69
69
|
return tile.isLoaded && tile.visible && tile.lnglatInBounds(lngLat);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
}, {
|
|
73
73
|
key: "removeTile",
|
|
74
74
|
value: function removeTile(tileKey) {
|
|
75
|
-
var index = this.
|
|
76
|
-
return
|
|
75
|
+
var index = this.layerTiles.findIndex(function (t) {
|
|
76
|
+
return t.key === tileKey;
|
|
77
77
|
});
|
|
78
|
+
var tile = this.layerTiles.splice(index, 1);
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
if (tile[0]) {
|
|
81
|
+
tile[0].destroy();
|
|
82
|
+
}
|
|
82
83
|
}
|
|
83
84
|
}, {
|
|
84
85
|
key: "updateTileVisible",
|
|
@@ -189,10 +190,9 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
189
190
|
}, {
|
|
190
191
|
key: "getRenderLayers",
|
|
191
192
|
value: function getRenderLayers() {
|
|
192
|
-
var tileList = this.
|
|
193
|
+
var tileList = this.layerTiles.filter(function (t) {
|
|
193
194
|
return t.visible && t.isLoaded;
|
|
194
195
|
});
|
|
195
|
-
|
|
196
196
|
var layers = [];
|
|
197
197
|
tileList.map(function (tile) {
|
|
198
198
|
return layers.push.apply(layers, (0, _toConsumableArray2.default)(tile.getLayers()));
|
|
@@ -202,10 +202,9 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
202
202
|
}, {
|
|
203
203
|
key: "getLayers",
|
|
204
204
|
value: function getLayers() {
|
|
205
|
-
var tileList = this.
|
|
205
|
+
var tileList = this.layerTiles.filter(function (t) {
|
|
206
206
|
return t.isLoaded;
|
|
207
207
|
});
|
|
208
|
-
|
|
209
208
|
var layers = [];
|
|
210
209
|
tileList.map(function (tile) {
|
|
211
210
|
return layers.push.apply(layers, (0, _toConsumableArray2.default)(tile.getLayers()));
|
|
@@ -215,15 +214,14 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
215
214
|
}, {
|
|
216
215
|
key: "getTiles",
|
|
217
216
|
value: function getTiles() {
|
|
218
|
-
return this.
|
|
217
|
+
return this.layerTiles;
|
|
219
218
|
}
|
|
220
219
|
}, {
|
|
221
220
|
key: "destroy",
|
|
222
221
|
value: function destroy() {
|
|
223
|
-
this.
|
|
222
|
+
this.layerTiles.forEach(function (t) {
|
|
224
223
|
return t.destroy();
|
|
225
224
|
});
|
|
226
|
-
|
|
227
225
|
this.tileResource.clear();
|
|
228
226
|
}
|
|
229
227
|
}]);
|
|
@@ -37,7 +37,7 @@ var TileSourceService = /*#__PURE__*/function () {
|
|
|
37
37
|
var p = null;
|
|
38
38
|
var properties = features[0];
|
|
39
39
|
features.map(function (feature) {
|
|
40
|
-
var polygon = turf.polygon(feature.coordinates);
|
|
40
|
+
var polygon = turf.polygon(feature.coordinates); // tslint:disable-next-line: prefer-conditional-expression
|
|
41
41
|
|
|
42
42
|
if (p === null) {
|
|
43
43
|
p = polygon;
|
|
@@ -21,11 +21,11 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
21
21
|
|
|
22
22
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _line = _interopRequireDefault(require("../../line"));
|
|
25
25
|
|
|
26
26
|
var _point = _interopRequireDefault(require("../../point"));
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _Tile2 = _interopRequireDefault(require("./Tile"));
|
|
29
29
|
|
|
30
30
|
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); }; }
|
|
31
31
|
|
|
@@ -94,7 +94,7 @@ var DebugTile = /*#__PURE__*/function (_Tile) {
|
|
|
94
94
|
key: "getSourceOption",
|
|
95
95
|
value: function getSourceOption() {
|
|
96
96
|
var rawSource = this.parent.getSource();
|
|
97
|
-
var features = this.sourceTile.data.layers
|
|
97
|
+
var features = this.sourceTile.data.layers.testTile.features;
|
|
98
98
|
return {
|
|
99
99
|
data: {
|
|
100
100
|
type: 'FeatureCollection',
|
|
@@ -54,6 +54,7 @@ var ImageTile = /*#__PURE__*/function (_Tile) {
|
|
|
54
54
|
layerOptions = this.getLayerOptions();
|
|
55
55
|
sourceOptions = this.getSourceOption();
|
|
56
56
|
layer = new _image.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
|
|
57
|
+
// tslint:disable-next-line: no-unused-expression
|
|
57
58
|
|
|
58
59
|
attributes && Object.keys(attributes).forEach(function (type) {
|
|
59
60
|
var _attributes$attr, _attributes$attr2;
|