@antv/l7-layers 2.9.14 → 2.9.17-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.js +12 -2
- package/es/Geometry/index.js.map +1 -1
- package/es/Geometry/models/billboard.d.ts +3 -3
- package/es/Geometry/models/billboard.js +11 -6
- package/es/Geometry/models/billboard.js.map +1 -1
- package/es/Geometry/models/plane.d.ts +3 -3
- package/es/Geometry/models/plane.js +12 -7
- package/es/Geometry/models/plane.js.map +1 -1
- package/es/Geometry/models/sprite.d.ts +3 -3
- package/es/Geometry/models/sprite.js +11 -6
- package/es/Geometry/models/sprite.js.map +1 -1
- package/es/canvas/index.js +12 -2
- package/es/canvas/index.js.map +1 -1
- package/es/citybuliding/building.js +12 -2
- package/es/citybuliding/building.js.map +1 -1
- package/es/citybuliding/models/build.d.ts +2 -1
- package/es/citybuliding/models/build.js +16 -3
- package/es/citybuliding/models/build.js.map +1 -1
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +97 -58
- package/es/core/BaseLayer.js.map +1 -1
- package/es/core/BaseModel.d.ts +2 -2
- package/es/core/BaseModel.js +2 -2
- package/es/core/BaseModel.js.map +1 -1
- package/es/core/interface.d.ts +2 -0
- package/es/core/interface.js.map +1 -1
- package/es/core/triangulation.js +1 -2
- package/es/core/triangulation.js.map +1 -1
- package/es/earth/index.js +8 -2
- package/es/earth/index.js.map +1 -1
- package/es/earth/models/atmosphere.d.ts +2 -2
- package/es/earth/models/atmosphere.js +11 -6
- package/es/earth/models/atmosphere.js.map +1 -1
- package/es/earth/models/base.d.ts +2 -2
- package/es/earth/models/base.js +11 -6
- package/es/earth/models/base.js.map +1 -1
- package/es/earth/models/bloomsphere.d.ts +2 -2
- package/es/earth/models/bloomsphere.js +11 -6
- package/es/earth/models/bloomsphere.js.map +1 -1
- package/es/heatmap/index.js +17 -5
- package/es/heatmap/index.js.map +1 -1
- package/es/heatmap/models/grid.d.ts +2 -2
- package/es/heatmap/models/grid.js +12 -8
- package/es/heatmap/models/grid.js.map +1 -1
- package/es/heatmap/models/grid3d.d.ts +2 -2
- package/es/heatmap/models/grid3d.js +12 -6
- package/es/heatmap/models/grid3d.js.map +1 -1
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +112 -62
- package/es/heatmap/models/heatmap.js.map +1 -1
- package/es/heatmap/models/hexagon.d.ts +2 -2
- package/es/heatmap/models/hexagon.js +11 -6
- package/es/heatmap/models/hexagon.js.map +1 -1
- package/es/image/index.js +12 -2
- package/es/image/index.js.map +1 -1
- package/es/image/models/image.d.ts +3 -3
- package/es/image/models/image.js +11 -7
- package/es/image/models/image.js.map +1 -1
- package/es/line/index.d.ts +0 -2
- package/es/line/index.js +12 -5
- package/es/line/index.js.map +1 -1
- package/es/line/models/arc.d.ts +2 -2
- package/es/line/models/arc.js +14 -9
- package/es/line/models/arc.js.map +1 -1
- package/es/line/models/arc_3d.d.ts +2 -2
- package/es/line/models/arc_3d.js +13 -8
- package/es/line/models/arc_3d.js.map +1 -1
- package/es/line/models/earthArc_3d.d.ts +2 -2
- package/es/line/models/earthArc_3d.js +17 -9
- package/es/line/models/earthArc_3d.js.map +1 -1
- package/es/line/models/great_circle.d.ts +2 -2
- package/es/line/models/great_circle.js +11 -6
- package/es/line/models/great_circle.js.map +1 -1
- package/es/line/models/half.d.ts +2 -2
- package/es/line/models/half.js +46 -29
- package/es/line/models/half.js.map +1 -1
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +0 -2
- package/es/line/models/index.js.map +1 -1
- package/es/line/models/line.d.ts +2 -2
- package/es/line/models/line.js +27 -15
- package/es/line/models/line.js.map +1 -1
- package/es/line/models/linearline.d.ts +2 -11
- package/es/line/models/linearline.js +14 -24
- package/es/line/models/linearline.js.map +1 -1
- package/es/line/models/simpleLine.d.ts +2 -2
- package/es/line/models/simpleLine.js +13 -8
- package/es/line/models/simpleLine.js.map +1 -1
- package/es/line/models/tile.d.ts +2 -11
- package/es/line/models/tile.js +45 -39
- package/es/line/models/tile.js.map +1 -1
- package/es/line/models/wall.d.ts +2 -2
- package/es/line/models/wall.js +13 -9
- package/es/line/models/wall.js.map +1 -1
- package/es/mask/index.js +12 -2
- package/es/mask/index.js.map +1 -1
- package/es/mask/models/fill.d.ts +2 -2
- package/es/mask/models/fill.js +53 -27
- package/es/mask/models/fill.js.map +1 -1
- package/es/plugins/DataMappingPlugin.js +29 -8
- package/es/plugins/DataMappingPlugin.js.map +1 -1
- package/es/plugins/DataSourcePlugin.js +14 -5
- package/es/plugins/DataSourcePlugin.js.map +1 -1
- package/es/plugins/LayerModelPlugin.d.ts +2 -0
- package/es/plugins/LayerModelPlugin.js +33 -7
- package/es/plugins/LayerModelPlugin.js.map +1 -1
- package/es/plugins/PixelPickingPlugin.js +16 -13
- package/es/plugins/PixelPickingPlugin.js.map +1 -1
- package/es/point/index.d.ts +1 -1
- package/es/point/index.js +15 -8
- package/es/point/index.js.map +1 -1
- package/es/point/models/earthExtrude.d.ts +2 -2
- package/es/point/models/earthExtrude.js +16 -14
- package/es/point/models/earthExtrude.js.map +1 -1
- package/es/point/models/earthFill.d.ts +2 -11
- package/es/point/models/earthFill.js +13 -22
- package/es/point/models/earthFill.js.map +1 -1
- package/es/point/models/extrude.d.ts +2 -2
- package/es/point/models/extrude.js +49 -27
- package/es/point/models/extrude.js.map +1 -1
- package/es/point/models/fill.d.ts +2 -2
- package/es/point/models/fill.js +59 -41
- package/es/point/models/fill.js.map +1 -1
- package/es/point/models/fillmage.d.ts +2 -7
- package/es/point/models/fillmage.js +13 -22
- package/es/point/models/fillmage.js.map +1 -1
- package/es/point/models/image.d.ts +2 -2
- package/es/point/models/image.js +11 -6
- package/es/point/models/image.js.map +1 -1
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +0 -2
- package/es/point/models/index.js.map +1 -1
- package/es/point/models/normal.d.ts +2 -2
- package/es/point/models/normal.js +11 -6
- package/es/point/models/normal.js.map +1 -1
- package/es/point/models/radar.d.ts +2 -11
- package/es/point/models/radar.js +13 -22
- package/es/point/models/radar.js.map +1 -1
- package/es/point/models/simplePoint.d.ts +2 -2
- package/es/point/models/simplePoint.js +11 -6
- package/es/point/models/simplePoint.js.map +1 -1
- package/es/point/models/text.d.ts +3 -2
- package/es/point/models/text.js +108 -75
- package/es/point/models/text.js.map +1 -1
- package/es/point/models/tile.d.ts +2 -11
- package/es/point/models/tile.js +22 -25
- package/es/point/models/tile.js.map +1 -1
- package/es/polygon/index.js +12 -2
- package/es/polygon/index.js.map +1 -1
- package/es/polygon/models/extrude.d.ts +2 -2
- package/es/polygon/models/extrude.js +10 -5
- package/es/polygon/models/extrude.js.map +1 -1
- package/es/polygon/models/fill.d.ts +2 -2
- package/es/polygon/models/fill.js +27 -13
- package/es/polygon/models/fill.js.map +1 -1
- package/es/polygon/models/ocean.d.ts +2 -2
- package/es/polygon/models/ocean.js +12 -6
- package/es/polygon/models/ocean.js.map +1 -1
- package/es/polygon/models/tile.d.ts +2 -3
- package/es/polygon/models/tile.js +17 -27
- package/es/polygon/models/tile.js.map +1 -1
- package/es/polygon/models/water.d.ts +2 -2
- package/es/polygon/models/water.js +12 -6
- package/es/polygon/models/water.js.map +1 -1
- package/es/raster/index.js +12 -2
- package/es/raster/index.js.map +1 -1
- package/es/raster/models/raster.d.ts +3 -3
- package/es/raster/models/raster.js +11 -7
- package/es/raster/models/raster.js.map +1 -1
- package/es/tile/manager/tileLayerManager.js +4 -1
- package/es/tile/manager/tileLayerManager.js.map +1 -1
- package/es/tile/manager/tilePickerManager.js +1 -0
- package/es/tile/manager/tilePickerManager.js.map +1 -1
- package/es/tile/tileFactory/base.js.map +1 -1
- package/es/tile/tileFactory/point.js.map +1 -1
- package/es/tile/tileFactory/rasterDataLayer.js +12 -2
- package/es/tile/tileFactory/rasterDataLayer.js.map +1 -1
- package/es/tile/tileFactory/vectorLayer.js +12 -2
- package/es/tile/tileFactory/vectorLayer.js.map +1 -1
- package/es/wind/index.js +12 -2
- package/es/wind/index.js.map +1 -1
- package/es/wind/models/wind.d.ts +2 -2
- package/es/wind/models/wind.js +14 -7
- package/es/wind/models/wind.js.map +1 -1
- package/lib/Geometry/index.js +12 -2
- package/lib/Geometry/index.js.map +1 -1
- package/lib/Geometry/models/billboard.js +11 -6
- package/lib/Geometry/models/billboard.js.map +1 -1
- package/lib/Geometry/models/plane.js +12 -7
- package/lib/Geometry/models/plane.js.map +1 -1
- package/lib/Geometry/models/sprite.js +11 -6
- package/lib/Geometry/models/sprite.js.map +1 -1
- package/lib/canvas/index.js +12 -2
- package/lib/canvas/index.js.map +1 -1
- package/lib/citybuliding/building.js +12 -2
- package/lib/citybuliding/building.js.map +1 -1
- package/lib/citybuliding/models/build.js +16 -3
- package/lib/citybuliding/models/build.js.map +1 -1
- package/lib/core/BaseLayer.js +96 -57
- package/lib/core/BaseLayer.js.map +1 -1
- package/lib/core/BaseModel.js +2 -2
- package/lib/core/BaseModel.js.map +1 -1
- package/lib/core/interface.js.map +1 -1
- package/lib/core/triangulation.js +4 -6
- package/lib/core/triangulation.js.map +1 -1
- package/lib/earth/index.js +8 -2
- package/lib/earth/index.js.map +1 -1
- package/lib/earth/models/atmosphere.js +11 -6
- package/lib/earth/models/atmosphere.js.map +1 -1
- package/lib/earth/models/base.js +11 -6
- package/lib/earth/models/base.js.map +1 -1
- package/lib/earth/models/bloomsphere.js +11 -6
- package/lib/earth/models/bloomsphere.js.map +1 -1
- package/lib/heatmap/index.js +17 -5
- package/lib/heatmap/index.js.map +1 -1
- package/lib/heatmap/models/grid.js +12 -8
- package/lib/heatmap/models/grid.js.map +1 -1
- package/lib/heatmap/models/grid3d.js +12 -6
- package/lib/heatmap/models/grid3d.js.map +1 -1
- package/lib/heatmap/models/heatmap.js +113 -62
- package/lib/heatmap/models/heatmap.js.map +1 -1
- package/lib/heatmap/models/hexagon.js +11 -6
- package/lib/heatmap/models/hexagon.js.map +1 -1
- package/lib/image/index.js +12 -2
- package/lib/image/index.js.map +1 -1
- package/lib/image/models/image.js +11 -7
- package/lib/image/models/image.js.map +1 -1
- package/lib/line/index.js +12 -5
- package/lib/line/index.js.map +1 -1
- package/lib/line/models/arc.js +14 -9
- package/lib/line/models/arc.js.map +1 -1
- package/lib/line/models/arc_3d.js +13 -8
- package/lib/line/models/arc_3d.js.map +1 -1
- package/lib/line/models/earthArc_3d.js +17 -9
- package/lib/line/models/earthArc_3d.js.map +1 -1
- package/lib/line/models/great_circle.js +11 -6
- package/lib/line/models/great_circle.js.map +1 -1
- package/lib/line/models/half.js +48 -29
- package/lib/line/models/half.js.map +1 -1
- package/lib/line/models/index.js +0 -3
- package/lib/line/models/index.js.map +1 -1
- package/lib/line/models/line.js +28 -17
- package/lib/line/models/line.js.map +1 -1
- package/lib/line/models/linearline.js +14 -24
- package/lib/line/models/linearline.js.map +1 -1
- package/lib/line/models/simpleLine.js +13 -8
- package/lib/line/models/simpleLine.js.map +1 -1
- package/lib/line/models/tile.js +47 -39
- package/lib/line/models/tile.js.map +1 -1
- package/lib/line/models/wall.js +13 -9
- package/lib/line/models/wall.js.map +1 -1
- package/lib/mask/index.js +12 -2
- package/lib/mask/index.js.map +1 -1
- package/lib/mask/models/fill.js +55 -27
- package/lib/mask/models/fill.js.map +1 -1
- package/lib/plugins/DataMappingPlugin.js +29 -8
- package/lib/plugins/DataMappingPlugin.js.map +1 -1
- package/lib/plugins/DataSourcePlugin.js +13 -4
- package/lib/plugins/DataSourcePlugin.js.map +1 -1
- package/lib/plugins/LayerModelPlugin.js +33 -7
- package/lib/plugins/LayerModelPlugin.js.map +1 -1
- package/lib/plugins/PixelPickingPlugin.js +16 -13
- package/lib/plugins/PixelPickingPlugin.js.map +1 -1
- package/lib/point/index.js +15 -8
- package/lib/point/index.js.map +1 -1
- package/lib/point/models/earthExtrude.js +16 -15
- package/lib/point/models/earthExtrude.js.map +1 -1
- package/lib/point/models/earthFill.js +13 -22
- package/lib/point/models/earthFill.js.map +1 -1
- package/lib/point/models/extrude.js +51 -28
- package/lib/point/models/extrude.js.map +1 -1
- package/lib/point/models/fill.js +61 -42
- package/lib/point/models/fill.js.map +1 -1
- package/lib/point/models/fillmage.js +13 -22
- package/lib/point/models/fillmage.js.map +1 -1
- package/lib/point/models/image.js +11 -6
- package/lib/point/models/image.js.map +1 -1
- package/lib/point/models/index.js +0 -3
- package/lib/point/models/index.js.map +1 -1
- package/lib/point/models/normal.js +11 -6
- package/lib/point/models/normal.js.map +1 -1
- package/lib/point/models/radar.js +13 -22
- package/lib/point/models/radar.js.map +1 -1
- package/lib/point/models/simplePoint.js +11 -6
- package/lib/point/models/simplePoint.js.map +1 -1
- package/lib/point/models/text.js +110 -78
- package/lib/point/models/text.js.map +1 -1
- package/lib/point/models/tile.js +22 -25
- package/lib/point/models/tile.js.map +1 -1
- package/lib/polygon/index.js +12 -2
- package/lib/polygon/index.js.map +1 -1
- package/lib/polygon/models/extrude.js +10 -5
- package/lib/polygon/models/extrude.js.map +1 -1
- package/lib/polygon/models/fill.js +25 -11
- package/lib/polygon/models/fill.js.map +1 -1
- package/lib/polygon/models/ocean.js +12 -6
- package/lib/polygon/models/ocean.js.map +1 -1
- package/lib/polygon/models/tile.js +17 -27
- package/lib/polygon/models/tile.js.map +1 -1
- package/lib/polygon/models/water.js +12 -6
- package/lib/polygon/models/water.js.map +1 -1
- package/lib/raster/index.js +12 -2
- package/lib/raster/index.js.map +1 -1
- package/lib/raster/models/raster.js +11 -7
- package/lib/raster/models/raster.js.map +1 -1
- package/lib/tile/manager/tileLayerManager.js +4 -1
- package/lib/tile/manager/tileLayerManager.js.map +1 -1
- package/lib/tile/manager/tilePickerManager.js +1 -0
- package/lib/tile/manager/tilePickerManager.js.map +1 -1
- package/lib/tile/tileFactory/base.js.map +1 -1
- package/lib/tile/tileFactory/point.js.map +1 -1
- package/lib/tile/tileFactory/rasterDataLayer.js +12 -2
- package/lib/tile/tileFactory/rasterDataLayer.js.map +1 -1
- package/lib/tile/tileFactory/vectorLayer.js +12 -2
- package/lib/tile/tileFactory/vectorLayer.js.map +1 -1
- package/lib/wind/index.js +12 -2
- package/lib/wind/index.js.map +1 -1
- package/lib/wind/models/wind.js +14 -7
- package/lib/wind/models/wind.js.map +1 -1
- package/package.json +10 -9
- package/es/line/models/arcmini.d.ts +0 -9
- package/es/line/models/arcmini.js +0 -145
- package/es/line/models/arcmini.js.map +0 -1
- package/es/point/models/icon-font.d.ts +0 -11
- package/es/point/models/icon-font.js +0 -181
- package/es/point/models/icon-font.js.map +0 -1
- package/es/raster/image.d.ts +0 -0
- package/es/raster/image.js +0 -2
- package/es/raster/image.js.map +0 -1
- package/es/raster/raster2d.d.ts +0 -27
- package/es/raster/raster2d.js +0 -158
- package/es/raster/raster2d.js.map +0 -1
- package/es/utils/geo.d.ts +0 -12
- package/es/utils/geo.js +0 -53
- package/es/utils/geo.js.map +0 -1
- package/lib/line/models/arcmini.js +0 -161
- package/lib/line/models/arcmini.js.map +0 -1
- package/lib/point/models/icon-font.js +0 -196
- package/lib/point/models/icon-font.js.map +0 -1
- package/lib/raster/image.js +0 -2
- package/lib/raster/image.js.map +0 -1
- package/lib/raster/raster2d.js +0 -172
- package/lib/raster/raster2d.js.map +0 -1
- package/lib/utils/geo.js +0 -65
- package/lib/utils/geo.js.map +0 -1
|
@@ -142,7 +142,7 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
return {
|
|
145
|
-
u_globel:
|
|
145
|
+
u_globel: 1,
|
|
146
146
|
u_globel_radius: EARTH_RADIUS,
|
|
147
147
|
u_global_height: globalArcHeight,
|
|
148
148
|
u_dataTexture: this.dataTexture,
|
|
@@ -174,10 +174,10 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
174
174
|
}
|
|
175
175
|
}, {
|
|
176
176
|
key: "initModels",
|
|
177
|
-
value: function initModels() {
|
|
177
|
+
value: function initModels(callbackModel) {
|
|
178
178
|
this.updateTexture();
|
|
179
179
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
180
|
-
|
|
180
|
+
this.buildModels(callbackModel);
|
|
181
181
|
}
|
|
182
182
|
}, {
|
|
183
183
|
key: "clearModels",
|
|
@@ -199,19 +199,19 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
199
199
|
return {
|
|
200
200
|
frag: arc3d_linear_frag,
|
|
201
201
|
vert: arc3d_linear_vert,
|
|
202
|
-
type: '
|
|
202
|
+
type: 'Linear'
|
|
203
203
|
};
|
|
204
204
|
} else {
|
|
205
205
|
return {
|
|
206
206
|
frag: arc3d_line_frag,
|
|
207
207
|
vert: arc3d_line_vert,
|
|
208
|
-
type: '
|
|
208
|
+
type: ''
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
}, {
|
|
213
213
|
key: "buildModels",
|
|
214
|
-
value: function buildModels() {
|
|
214
|
+
value: function buildModels(callbackModel) {
|
|
215
215
|
var _ref4 = this.layer.getLayerConfig(),
|
|
216
216
|
_ref4$segmentNumber = _ref4.segmentNumber,
|
|
217
217
|
segmentNumber = _ref4$segmentNumber === void 0 ? 30 : _ref4$segmentNumber,
|
|
@@ -225,15 +225,23 @@ var Arc3DModel = function (_BaseModel) {
|
|
|
225
225
|
vert = _this$getShaders.vert,
|
|
226
226
|
type = _this$getShaders.type;
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
moduleName: '
|
|
228
|
+
this.layer.buildLayerModel({
|
|
229
|
+
moduleName: 'lineEarthArc3d' + type,
|
|
230
230
|
vertexShader: vert,
|
|
231
231
|
fragmentShader: frag,
|
|
232
232
|
triangulation: LineArcTriangulation,
|
|
233
|
+
depth: {
|
|
234
|
+
enable: true
|
|
235
|
+
},
|
|
233
236
|
blend: this.getBlend(),
|
|
234
237
|
segmentNumber: segmentNumber,
|
|
235
238
|
stencil: getMask(mask, maskInside)
|
|
236
|
-
})
|
|
239
|
+
}).then(function (model) {
|
|
240
|
+
callbackModel([model]);
|
|
241
|
+
}).catch(function (err) {
|
|
242
|
+
console.warn(err);
|
|
243
|
+
callbackModel([]);
|
|
244
|
+
});
|
|
237
245
|
}
|
|
238
246
|
}, {
|
|
239
247
|
key: "registerBuiltinAttributes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/earthArc_3d.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineArcTriangulation","EARTH_RADIUS","lineStyleObj","solid","dash","Arc3DModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","segmentNumber","globalArcHeight","length","push","useLinearColor","sourceColorArr","targetColorArr","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_globel","mapService","version","u_globel_radius","u_global_height","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","frag","arc3d_linear_frag","vert","arc3d_linear_vert","arc3d_line_frag","arc3d_line_vert","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","blend","getBlend","stencil","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW","iconMap","getIconMap","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QASO,eATP;AAUA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,oBAAT,QAAq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AHA;AAIN2C,YAAAA,IAAI,EAAEzD,EAAE,CAAC0D;AAJH,WAFE;AAQVuD,UAAAA,IAAI,EAAE,CARI;AASVpG,UAAAA,MAAM,EAAE,gBACNqG,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMI,OAAO,GAAG,MAAI,CAAC1G,WAAL,CAAiB2G,UAAjB,EAAhB;;AACA,gBAAQ9G,OAAR,GAAoBsG,OAApB,CAAQtG,OAAR;;AACA,wBAAiB6G,OAAO,CAAC7G,OAAD,CAAP,IAA8B;AAAE+G,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EAlOqCzH,S;;SAAnBM,U","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\nimport { EARTH_RADIUS } from '../../earth/utils';\n// arc3d line layer\nimport arc3d_line_frag from '../shaders/line_arc_3d_frag.glsl';\nimport arc3d_line_vert from '../shaders/line_arc_3d_vert.glsl';\n// arc3d linear layer\nimport arc3d_linear_frag from '../shaders/linear/arc3d_linear_frag.glsl';\nimport arc3d_linear_vert from '../shaders/linear/arc3d_linear_vert.glsl';\n\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class Arc3DModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5],\n lineTexture = false,\n iconStep = 100,\n segmentNumber = 30,\n globalArcHeight = 10,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_globel: this.mapService.version === 'GLOBEL' ? 1 : 0,\n u_globel_radius: EARTH_RADIUS, // 地球半径\n u_global_height: globalArcHeight,\n\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n segmentNumber,\n u_line_type: lineStyleObj[lineType as string] || 0.0,\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\n\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: arc3d_linear_frag,\n vert: arc3d_linear_vert,\n type: 'linear',\n };\n } else {\n return {\n frag: arc3d_line_frag,\n vert: arc3d_line_vert,\n type: 'normal',\n };\n }\n }\n\n public buildModels(): IModel[] {\n const {\n segmentNumber = 30,\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n return [\n this.layer.buildLayerModel({\n moduleName: 'arc3Dline' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineArcTriangulation,\n blend: this.getBlend(),\n segmentNumber,\n // primitive: gl.POINTS,\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"earthArc_3d.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/earthArc_3d.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineArcTriangulation","EARTH_RADIUS","lineStyleObj","solid","dash","Arc3DModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","segmentNumber","globalArcHeight","length","push","useLinearColor","sourceColorArr","targetColorArr","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_globel","u_globel_radius","u_global_height","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","callbackModel","updateTexture","on","buildModels","destroy","off","frag","arc3d_linear_frag","vert","arc3d_linear_vert","arc3d_line_frag","arc3d_line_vert","mask","maskInside","getShaders","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","enable","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW","iconMap","getIconMap","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QASO,eATP;AAUA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,oBAAT,QAAqC,0BAArC;AACA,SAASC,YAAT,QAA6B,mBAA7B;;;;;AAQA,IAAMC,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAIqBC,U;;;;;;;;;;;;;;;;;;oEA0OK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,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H,gBAAMI,OAAO,GAAG,MAAI,CAACjH,WAAL,CAAiBkH,UAAjB,EAAhB;;AACA,gBAAQrH,OAAR,GAAoB6G,OAApB,CAAQ7G,OAAR;;AACA,wBAAiBoH,OAAO,CAACpH,OAAD,CAAP,IAA8B;AAAEsH,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EAxOqChI,S;;SAAnBM,U","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\nimport { EARTH_RADIUS } from '../../earth/utils';\n// arc3d line layer\nimport arc3d_line_frag from '../shaders/line_arc_3d_frag.glsl';\nimport arc3d_line_vert from '../shaders/line_arc_3d_vert.glsl';\n// arc3d linear layer\nimport arc3d_linear_frag from '../shaders/linear/arc3d_linear_frag.glsl';\nimport arc3d_linear_vert from '../shaders/linear/arc3d_linear_vert.glsl';\n\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\nexport default class Arc3DModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5],\n lineTexture = false,\n iconStep = 100,\n segmentNumber = 30,\n globalArcHeight = 10,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_globel: 1,\n u_globel_radius: EARTH_RADIUS, // 地球半径\n u_global_height: globalArcHeight,\n\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n segmentNumber,\n u_line_type: lineStyleObj[lineType as string] || 0.0,\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\n\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public getShaders(): { frag: string; vert: string; type: string } {\n const {\n sourceColor,\n targetColor,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (sourceColor && targetColor) {\n // 分离 linear 功能\n return {\n frag: arc3d_linear_frag,\n vert: arc3d_linear_vert,\n type: 'Linear',\n };\n } else {\n return {\n frag: arc3d_line_frag,\n vert: arc3d_line_vert,\n type: '',\n };\n }\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n segmentNumber = 30,\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer\n .buildLayerModel({\n moduleName: 'lineEarthArc3d' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineArcTriangulation,\n depth: { enable: true },\n blend: this.getBlend(),\n segmentNumber,\n stencil: getMask(mask, maskInside),\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"earthArc_3d.js"}
|
|
@@ -4,9 +4,9 @@ export default class GreatCircleModel extends BaseModel {
|
|
|
4
4
|
protected texture: ITexture2D;
|
|
5
5
|
getUninforms(): IModelUniform;
|
|
6
6
|
getAnimateUniforms(): IModelUniform;
|
|
7
|
-
initModels(
|
|
7
|
+
initModels(callbackModel: (models: IModel[]) => void): void;
|
|
8
8
|
clearModels(): void;
|
|
9
|
-
buildModels(
|
|
9
|
+
buildModels(callbackModel: (models: IModel[]) => void): void;
|
|
10
10
|
protected registerBuiltinAttributes(): void;
|
|
11
11
|
private updateTexture;
|
|
12
12
|
}
|
|
@@ -166,10 +166,10 @@ var GreatCircleModel = function (_BaseModel) {
|
|
|
166
166
|
}
|
|
167
167
|
}, {
|
|
168
168
|
key: "initModels",
|
|
169
|
-
value: function initModels() {
|
|
169
|
+
value: function initModels(callbackModel) {
|
|
170
170
|
this.updateTexture();
|
|
171
171
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
172
|
-
|
|
172
|
+
this.buildModels(callbackModel);
|
|
173
173
|
}
|
|
174
174
|
}, {
|
|
175
175
|
key: "clearModels",
|
|
@@ -182,15 +182,15 @@ var GreatCircleModel = function (_BaseModel) {
|
|
|
182
182
|
}
|
|
183
183
|
}, {
|
|
184
184
|
key: "buildModels",
|
|
185
|
-
value: function buildModels() {
|
|
185
|
+
value: function buildModels(callbackModel) {
|
|
186
186
|
var _ref3 = this.layer.getLayerConfig(),
|
|
187
187
|
_ref3$mask = _ref3.mask,
|
|
188
188
|
mask = _ref3$mask === void 0 ? false : _ref3$mask,
|
|
189
189
|
_ref3$maskInside = _ref3.maskInside,
|
|
190
190
|
maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside;
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
moduleName: '
|
|
192
|
+
this.layer.buildLayerModel({
|
|
193
|
+
moduleName: 'lineGreatCircle',
|
|
194
194
|
vertexShader: line_arc2d_vert,
|
|
195
195
|
fragmentShader: line_arc_frag,
|
|
196
196
|
triangulation: LineArcTriangulation,
|
|
@@ -199,7 +199,12 @@ var GreatCircleModel = function (_BaseModel) {
|
|
|
199
199
|
},
|
|
200
200
|
blend: this.getBlend(),
|
|
201
201
|
stencil: getMask(mask, maskInside)
|
|
202
|
-
})
|
|
202
|
+
}).then(function (model) {
|
|
203
|
+
callbackModel([model]);
|
|
204
|
+
}).catch(function (err) {
|
|
205
|
+
console.warn(err);
|
|
206
|
+
callbackModel([]);
|
|
207
|
+
});
|
|
203
208
|
}
|
|
204
209
|
}, {
|
|
205
210
|
key: "registerBuiltinAttributes",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/great_circle.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineArcTriangulation","lineStyleObj","solid","dash","GreatCircleModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","segmentNumber","length","push","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","mask","maskInside","buildLayerModel","moduleName","vertexShader","line_arc2d_vert","fragmentShader","line_arc_frag","triangulation","depth","enable","blend","getBlend","stencil","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW","iconMap","getIconMap","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QASO,eATP;AAUA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,oBAAT,QAAqC,0BAArC;;;AAGA,IAAMC,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAKqBC,gB;;;;;;;;;;;;;;;;;;oEAqMK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,M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YAAAA,KAAK,EAAErG,EAAE,CAACsG,YAFJ;AAGNzF,YAAAA,IAAI,EAAE,EAHA;AAIN0C,YAAAA,IAAI,EAAEvD,EAAE,CAACwD;AAJH,WAFE;AAQV+C,UAAAA,IAAI,EAAE,CARI;AASV3F,UAAAA,MAAM,EAAE,gBACN4F,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMI,OAAO,GAAG,MAAI,CAACjG,WAAL,CAAiBkG,UAAjB,EAAhB;;AACA,gBAAQrG,OAAR,GAAoB6F,OAApB,CAAQ7F,OAAR;;AAEA,wBAAiBoG,OAAO,CAACpG,OAAD,CAAP,IAA8B;AAAEsG,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AApBS;AAHoC,OAAlD;AA0BD;;;;EAnM2C/G,S;;SAAzBK,gB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions, lineStyleType } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\nimport line_arc_frag from '../shaders/line_arc_great_circle_frag.glsl';\nimport line_arc2d_vert from '../shaders/line_arc_great_circle_vert.glsl';\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\n\nexport default class GreatCircleModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5],\n lineTexture = false,\n iconStep = 100,\n segmentNumber = 30,\n } = this.layer.getLayerConfig() as Partial<ILineLayerStyleOptions>;\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n segmentNumber,\n u_line_type: lineStyleObj[lineType as string] || 0.0,\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n return [\n this.layer.buildLayerModel({\n moduleName: 'greatcircleline',\n vertexShader: line_arc2d_vert,\n fragmentShader: line_arc_frag,\n triangulation: LineArcTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n // console.log('icon feature', feature)\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"great_circle.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/great_circle.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineArcTriangulation","lineStyleObj","solid","dash","GreatCircleModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","lineType","dashArray","lineTexture","iconStep","segmentNumber","length","push","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_line_type","u_dash_array","u_texture","u_line_texture","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","callbackModel","updateTexture","on","buildModels","destroy","off","mask","maskInside","buildLayerModel","moduleName","vertexShader","line_arc2d_vert","fragmentShader","line_arc_frag","triangulation","depth","enable","blend","getBlend","stencil","then","model","catch","err","console","warn","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","Array","isArray","STATIC_DRAW","iconMap","getIconMap","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QASO,eATP;AAUA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,oBAAT,QAAqC,0BAArC;;;AAGA,IAAMC,YAAuC,GAAG;AAC9CC,EAAAA,KAAK,EAAE,GADuC;AAE9CC,EAAAA,IAAI,EAAE;AAFwC,CAAhD;;IAKqBC,gB;;;;;;;;;;;;;;;;;;oEA2MK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,CAAWC,MAAX;;AACA;AACD;;AACD,YAAKN,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BG,QAAAA,GAAG,EAAElB,EAAE,CAACmB,OAFqB;AAG7BC,QAAAA,GAAG,EAAEpB,EAAE,CAACmB,OAHqB;AAI7BE,QAAAA,gBAAgB,EAAE,KAJW;AAK7BC,QAAAA,KAAK,EAAE,IALsB;AAM7BC,QAAAA,MAAM,EAAE,MAAKT,WAAL,CAAiBU,YAAjB,IAAiC;AANZ,OAAD,CAA9B;AAQD,K;;;;;;;WA1ND,wBAAqC;AACnC,iBAUI,KAAKR,KAAL,CAAWS,cAAX,EAVJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,mCAIEC,YAJF;AAAA,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CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AApBS;AAHoC,OAAlD;AA0BD;;;;EAzM2CtH,S;;SAAzBK,gB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions, lineStyleType } from '../../core/interface';\nimport { LineArcTriangulation } from '../../core/triangulation';\nimport line_arc_frag from '../shaders/line_arc_great_circle_frag.glsl';\nimport line_arc2d_vert from '../shaders/line_arc_great_circle_vert.glsl';\nconst lineStyleObj: { [key: string]: number } = {\n solid: 0.0,\n dash: 1.0,\n};\n\nexport default class GreatCircleModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n lineType = 'solid',\n dashArray = [10, 5],\n lineTexture = false,\n iconStep = 100,\n segmentNumber = 30,\n } = this.layer.getLayerConfig() as Partial<ILineLayerStyleOptions>;\n if (dashArray.length === 2) {\n dashArray.push(0, 0);\n }\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n segmentNumber,\n u_line_type: lineStyleObj[lineType as string] || 0.0,\n u_dash_array: dashArray,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n this.layer\n .buildLayerModel({\n moduleName: 'lineGreatCircle',\n vertexShader: line_arc2d_vert,\n fragmentShader: line_arc_frag,\n triangulation: LineArcTriangulation,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'instance', // 弧线起始点信息\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Instance',\n buffer: {\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4], vertex[5], vertex[6]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n // console.log('icon feature', feature)\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"great_circle.js"}
|
package/es/line/models/half.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { IModel, IModelUniform } from '@antv/l7-core';
|
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class LineModel extends BaseModel {
|
|
4
4
|
getUninforms(): IModelUniform;
|
|
5
|
-
initModels(
|
|
5
|
+
initModels(callbackModel: (models: IModel[]) => void): void;
|
|
6
6
|
clearModels(): void;
|
|
7
|
-
buildModels(
|
|
7
|
+
buildModels(callbackModel: (models: IModel[]) => void): Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* 根据参数获取不同的 shader 代码
|
|
10
10
|
* @returns
|
package/es/line/models/half.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
7
|
import _isNumber from "lodash/isNumber";
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
9
|
|
|
8
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
11
|
|
|
@@ -99,8 +101,8 @@ var LineModel = function (_BaseModel) {
|
|
|
99
101
|
}
|
|
100
102
|
}, {
|
|
101
103
|
key: "initModels",
|
|
102
|
-
value: function initModels() {
|
|
103
|
-
|
|
104
|
+
value: function initModels(callbackModel) {
|
|
105
|
+
this.buildModels(callbackModel);
|
|
104
106
|
}
|
|
105
107
|
}, {
|
|
106
108
|
key: "clearModels",
|
|
@@ -111,33 +113,48 @@ var LineModel = function (_BaseModel) {
|
|
|
111
113
|
}
|
|
112
114
|
}, {
|
|
113
115
|
key: "buildModels",
|
|
114
|
-
value: function
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
116
|
+
value: function () {
|
|
117
|
+
var _buildModels = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(callbackModel) {
|
|
118
|
+
var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, _ref2$depth, depth, _this$getShaders, frag, vert;
|
|
119
|
+
|
|
120
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
121
|
+
while (1) {
|
|
122
|
+
switch (_context.prev = _context.next) {
|
|
123
|
+
case 0:
|
|
124
|
+
_ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside, _ref2$depth = _ref2.depth, depth = _ref2$depth === void 0 ? false : _ref2$depth;
|
|
125
|
+
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert;
|
|
126
|
+
this.layer.triangulation = LineTriangulation;
|
|
127
|
+
this.layer.buildLayerModel({
|
|
128
|
+
moduleName: 'lineHalf',
|
|
129
|
+
vertexShader: vert,
|
|
130
|
+
fragmentShader: frag,
|
|
131
|
+
triangulation: LineTriangulation,
|
|
132
|
+
depth: {
|
|
133
|
+
enable: depth
|
|
134
|
+
},
|
|
135
|
+
blend: this.getBlend(),
|
|
136
|
+
stencil: getMask(mask, maskInside)
|
|
137
|
+
}).then(function (model) {
|
|
138
|
+
callbackModel([model]);
|
|
139
|
+
}).catch(function (err) {
|
|
140
|
+
console.warn(err);
|
|
141
|
+
callbackModel([]);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
case 4:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context.stop();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, _callee, this);
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
function buildModels(_x) {
|
|
153
|
+
return _buildModels.apply(this, arguments);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return buildModels;
|
|
157
|
+
}()
|
|
141
158
|
}, {
|
|
142
159
|
key: "getShaders",
|
|
143
160
|
value: function getShaders() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/half.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineTriangulation","LineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","arrow","enable","arrowWidth","arrowHeight","tailWidth","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_arrow","Number","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","buildModels","destroy","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_half_frag","line_half_vert","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","startPoint","coordinates","endPoint","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAMO,eANP;AAOA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,iBAAT,QAAkC,0BAAlC;;;;IAIqBC,S;;;;;;;;;;;;;WACnB,wBAAqC;AACnC,iBAUI,KAAKC,KAAL,CAAWC,cAAX,EAVJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,4BAIEC,KAJF;AAAA,UAIEA,KAJF,2BAIU;AACNC,QAAAA,MAAM,EAAE,KADF;AAENC,QAAAA,UAAU,EAAE,CAFN;AAGNC,QAAAA,WAAW,EAAE,CAHP;AAINC,QAAAA,SAAS,EAAE;AAJL,OAJV;;AAaA,UAAIC,cAAc,GAAG,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;;AACA,UAAIT,WAAW,IAAIC,WAAnB,EAAgC;AAC9BO,QAAAA,cAAc,GAAGf,OAAO,CAACO,WAAD,CAAxB;AACAS,QAAAA,cAAc,GAAGhB,OAAO,CAACQ,WAAD,CAAxB;AACAM,QAAAA,cAAc,GAAG,CAAjB;AACD;;AAED,UAAI,KAAKG,eAAL,IAAwB,KAAKC,qBAAL,CAA2B;AAAEZ,QAAAA,OAAO,EAAPA;AAAF,OAA3B,CAA5B,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\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_half_frag from '../shaders/half/line_half_frag.glsl';\nimport line_half_vert from '../shaders/half/line_half_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n\n public initModels(): IModel[] {\n return this.buildModels();\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'line_half',\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: line_half_frag,\n vert: line_half_vert,\n type: 'normal',\n };\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10, vertex[5]]\n : [vertex[3], vertexIndex, vertex[5]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'dirPoints',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_dirPoints',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n // console.log(feature)\n const startPoint = (feature.coordinates[0] || [0, 0]) as number[];\n const endPoint = (feature.coordinates[3] || [0, 0]) as number[];\n\n return [startPoint[0], startPoint[1], endPoint[0], endPoint[1]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n }\n}\n"],"file":"half.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/half.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineTriangulation","LineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","arrow","enable","arrowWidth","arrowHeight","tailWidth","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_arrow","Number","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","callbackModel","buildModels","destroy","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","blend","getBlend","stencil","then","model","catch","err","console","warn","line_half_frag","line_half_vert","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","startPoint","coordinates","endPoint","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAMO,eANP;AAOA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,iBAAT,QAAkC,0BAAlC;;;;IAIqBC,S;;;;;;;;;;;;;WACnB,wBAAqC;AACnC,iBAUI,KAAKC,KAAL,CAAWC,cAAX,EAVJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,4BAIEC,KAJF;AAAA,UAIEA,KAJF,2BAIU;AACNC,QAAAA,MAAM,EAAE,KADF;AAENC,QAAAA,UAAU,EAAE,CAFN;AAGNC,QAAAA,WAAW,EAAE,CAHP;AAINC,QAAAA,SAAS,EAAE;AAJL,OAJV;;AAaA,UAAIC,cAAc,GAAG,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArB;;AACA,UAAIT,WAAW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AAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEnF,EAAE,CAACoF,WAFJ;AAGNzD,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAErC,EAAE,CAACsC;AAJH,WAFE;AAQV+C,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EApPoCtF,S;;SAAlBE,S","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_half_frag from '../shaders/half/line_half_frag.glsl';\nimport line_half_vert from '../shaders/half/line_half_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\n };\n }\n\n public initModels(callbackModel: (models: IModel[]) => void) {\n this.buildModels(callbackModel);\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n public async buildModels(callbackModel: (models: IModel[]) => void) {\n const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n\n this.layer\n .buildLayerModel({\n moduleName: 'lineHalf',\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n depth: { enable: depth },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n })\n .then((model) => {\n callbackModel([model]);\n })\n .catch((err) => {\n console.warn(err);\n callbackModel([]);\n });\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: line_half_frag,\n vert: line_half_vert,\n type: 'normal',\n };\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10, vertex[5]]\n : [vertex[3], vertexIndex, vertex[5]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'dirPoints',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_dirPoints',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n // console.log(feature)\n const startPoint = (feature.coordinates[0] || [0, 0]) as number[];\n const endPoint = (feature.coordinates[3] || [0, 0]) as number[];\n\n return [startPoint[0], startPoint[1], endPoint[0], endPoint[1]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n }\n}\n"],"file":"half.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare type LineModelType = 'arc' | '
|
|
1
|
+
export declare type LineModelType = 'arc' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'halfLine' | 'linearline' | 'vectorline' | 'tileLine' | 'earthArc3d';
|
|
2
2
|
declare const LineModels: {
|
|
3
3
|
[key in LineModelType]: any;
|
|
4
4
|
};
|
package/es/line/models/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import LineTileModel from '../../tile/models/tileModel';
|
|
2
2
|
import ArcModel from './arc';
|
|
3
3
|
import Arc3DModel from './arc_3d';
|
|
4
|
-
import ArcMiniModel from './arcmini';
|
|
5
4
|
import EarthArc3DModel from './earthArc_3d';
|
|
6
5
|
import GreatCircleModel from './great_circle';
|
|
7
6
|
import LineHalfModel from './half';
|
|
@@ -12,7 +11,6 @@ import TileLineModel from './tile';
|
|
|
12
11
|
import LineWallModel from './wall';
|
|
13
12
|
var LineModels = {
|
|
14
13
|
arc: ArcModel,
|
|
15
|
-
arcmini: ArcMiniModel,
|
|
16
14
|
arc3d: Arc3DModel,
|
|
17
15
|
greatcircle: GreatCircleModel,
|
|
18
16
|
wall: LineWallModel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineTileModel","ArcModel","Arc3DModel","
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineTileModel","ArcModel","Arc3DModel","EarthArc3DModel","GreatCircleModel","LineHalfModel","LineModel","LinearLine","SimpleLineModel","TileLineModel","LineWallModel","LineModels","arc","arc3d","greatcircle","wall","line","halfLine","simple","linearline","vectorline","tileLine","earthArc3d"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,eAAP,MAA4B,eAA5B;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,eAAP,MAA4B,cAA5B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AAeA,IAAMC,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEX,QAD6C;AAElDY,EAAAA,KAAK,EAAEX,UAF2C;AAGlDY,EAAAA,WAAW,EAAEV,gBAHqC;AAIlDW,EAAAA,IAAI,EAAEL,aAJ4C;AAKlDM,EAAAA,IAAI,EAAEV,SAL4C;AAMlDW,EAAAA,QAAQ,EAAEZ,aANwC;AAOlDa,EAAAA,MAAM,EAAEV,eAP0C;AAQlDW,EAAAA,UAAU,EAAEZ,UARsC;AASlDa,EAAAA,UAAU,EAAEpB,aATsC;AAUlDqB,EAAAA,QAAQ,EAAEZ,aAVwC;AAWlDa,EAAAA,UAAU,EAAEnB;AAXsC,CAApD;AAcA,eAAeQ,UAAf","sourcesContent":["import LineTileModel from '../../tile/models/tileModel';\nimport ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport EarthArc3DModel from './earthArc_3d';\nimport GreatCircleModel from './great_circle';\nimport LineHalfModel from './half';\nimport LineModel from './line';\nimport LinearLine from './linearline';\nimport SimpleLineModel from './simpleLine';\nimport TileLineModel from './tile';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'simple'\n | 'line'\n | 'halfLine'\n | 'linearline'\n | 'vectorline'\n | 'tileLine'\n | 'earthArc3d';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n halfLine: LineHalfModel,\n simple: SimpleLineModel,\n linearline: LinearLine,\n vectorline: LineTileModel,\n tileLine: TileLineModel,\n earthArc3d: EarthArc3DModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
|
package/es/line/models/line.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export default class LineModel extends BaseModel {
|
|
|
4
4
|
protected texture: ITexture2D;
|
|
5
5
|
getUninforms(): IModelUniform;
|
|
6
6
|
getAnimateUniforms(): IModelUniform;
|
|
7
|
-
initModels(
|
|
7
|
+
initModels(callbackModel: (models: IModel[]) => void): void;
|
|
8
8
|
clearModels(): void;
|
|
9
|
-
buildModels(
|
|
9
|
+
buildModels(callbackModel: (models: IModel[]) => void): void;
|
|
10
10
|
/**
|
|
11
11
|
* 根据参数获取不同的 shader 代码
|
|
12
12
|
* @returns
|