Chore tile (#1409)

* fix: 拾取操作

* fix: 文件大小写

* fix: mask map async

* fix: remove cancleExtent
This commit is contained in:
@thinkinggis 2022-10-19 17:56:09 +08:00 committed by GitHub
parent 4a565962eb
commit 2c42dfe166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 17 additions and 37 deletions

View File

@ -35,7 +35,6 @@ export default () => {
type: 'mvt',
tileSize: 256,
// extent: [-180, -85.051129, 179, 85.051129],
cancelExtent: true,
},
});
/**

View File

@ -6,7 +6,6 @@ import React, { useEffect } from 'react';
export default () => {
useEffect(() => {
const SOC = 'CHN';
const colors = {};
const GDPSpeed = {
'520000': 10, //贵州

View File

@ -1,7 +1,7 @@
// @ts-ignore
import { Scene, TileDebugLayer } from '@antv/l7';
// @ts-ignore
import { Map } from '@antv/l7-maps';
import { GaodeMapV2 } from '@antv/l7-maps';
import React, { useEffect } from 'react';
export default () => {
@ -9,8 +9,8 @@ export default () => {
const scene = new Scene({
id: 'map',
stencil: true,
map: new Map({
center: [60, 30],
map: new GaodeMapV2({
center: [120, 30],
// zoom: 12,
zoom: 12,
}),

View File

@ -7,7 +7,7 @@ import {
TileDebugLayer,
} from '@antv/l7';
// @ts-ignore
import { Map } from '@antv/l7-maps';
import { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react';
import { data } from './data';
@ -18,7 +18,7 @@ export default () => {
const scene = new Scene({
id: 'map',
stencil: true,
map: new Map({
map: new GaodeMap({
center: [60, 30],
// zoom: 12,
minZoom: 0,

View File

@ -276,7 +276,7 @@ export function createSceneContainer() {
export function createLayerContainer(sceneContainer: Container) {
const layerContainer = new Container();
layerContainer.parent = sceneContainer;
layerContainer
.bind<IStyleAttributeService>(TYPES.IStyleAttributeService)
.to(StyleAttributeService)

View File

@ -59,25 +59,13 @@ export class TileLayerService {
}
render() {
// this.rendererService.clear({
// stencil: 0,
// depth: 1,
// framebuffer: null,
// });
// this.parent.masks.map( async(mask) =>{
// await mask.hooks.beforeRenderData.promise();
// mask.hooks.beforeRender.call();
// mask.render();
// mask.hooks.afterRender.call();
// })
// TODO 渲染排序
this._tiles.filter((t)=>t.visible && t.isLoaded)
.map((tile: Tile) => {
const layers = tile.getLayers();
layers.forEach(async (layer: ILayer) => {
Promise.all(layers.map(async (layer: ILayer) => {
await layer.hooks.beforeRenderData.promise();
layer.hooks.beforeRender.call();
if (layer.masks.length > 0) {
// 清除上一次的模版缓存
this.rendererService.clear({
@ -85,7 +73,7 @@ export class TileLayerService {
depth: 1,
framebuffer: null,
});
this.layerService.renderMask(layer.masks)
await this.layerService.renderMask(layer.masks)
}
if (layer.getLayerConfig().enableMultiPassRenderer) {
// multiPassRender 不是同步渲染完成的
@ -94,7 +82,7 @@ export class TileLayerService {
layer.render();
}
layer.hooks.afterRender.call();
});
}));
});
}
destroy() {

View File

@ -3,20 +3,20 @@ import { LineLayer,PointLayer } from '@antv/l7-layers';
export default class DebugTile extends Tile {
public async initTileLayer(): Promise<void> {
const sourceOptions = this.getSourceOption();
const pointData = sourceOptions.data.features[0].properties;
const lineLayer = new LineLayer()
.source(sourceOptions.data, sourceOptions.options)
.size(1)
.shape('line')
.color('red');
console.log(lineLayer)
const pointLayer = new PointLayer()
.source([pointData],{
parser: {
type: 'json',
x: 'textLng',
y: 'textLat',
cancelExtent: true,
}
})
@ -46,7 +46,6 @@ export default class DebugTile extends Tile {
options: {
parser: {
type: 'geojson',
cancelExtent: true,
},
transforms: rawSource.transforms,
},

View File

@ -31,7 +31,6 @@ export default class ImageTile extends Tile {
parser: {
type: 'image',
extent: this.sourceTile.bounds,
cancelExtent: true,
},
transforms: rawSource.transforms,
},

View File

@ -34,7 +34,6 @@ export default class RasterTile extends Tile {
parser: {
type: 'raster',
extent: this.sourceTile.bounds,
cancelExtent: true,
width: this.sourceTile.data.width,
height: this.sourceTile.data.height,
},

View File

@ -37,7 +37,6 @@ export default class VectorTile extends Tile {
parser: {
type: 'geojson',
featureId,
cancelExtent: true,
},
transforms: rawSource.transforms,
},

View File

@ -41,7 +41,6 @@ export default class TestTile extends TileFactory {
type: 'json',
x: 'textLng',
y: 'textLat',
cancelExtent: true,
}
})
.shape(`${tile.x}/${tile.y}/${tile.z}`)
@ -59,7 +58,6 @@ export default class TestTile extends TileFactory {
}, {
parser: {
type: 'geojson',
cancelExtent: true,
}
})
.shape('simple')

View File

@ -10,7 +10,6 @@ export default class TileDebugLayer extends BaseLayer<IBaseLayerStyleOptions> {
options: {
parser: {
type: 'testTile',
cancelExtent: true,
},
},
};

View File

@ -141,7 +141,7 @@ export class Base {
if (!this.tilesetManager) {
return;
}
this.tilesetManager.tiles
await Promise.all(this.tilesetManager.tiles
.filter((tile: SourceTile) => tile.isLoaded) // 过滤未加载完成的
.filter((tile: SourceTile) => tile.isVisibleChange) // 过滤未发生变化的
.filter((tile: SourceTile) => this.isTileReady(tile)) // 过滤未发生变化的
@ -157,7 +157,7 @@ export class Base {
this.tileLayerService.updateTileVisible(tile);
this.layerService.reRender()
}
});
}));
if (this.tilesetManager.isLoaded) {
// 将事件抛出,图层上可以使用瓦片

View File

@ -20,6 +20,7 @@ import './logo.css';
import { MapTheme } from './theme';
import Viewport from './Viewport';
import AMapBaseService from '../utils/amap/AMapBaseService';
const DEFAULTMAPCENTER = [108.92361, 34.54083];
// @ts-ignore
window.forceWebGL = true;
@ -99,8 +100,8 @@ export default class AMapService extends AMapBaseService {
public setCoordCenter(center: [number, number]) {
// @ts-ignore
this.map.customCoords.setCenter(center);
this.setCustomCoordCenter(center);
this.map.customCoords.setCenter(center || DEFAULTMAPCENTER);
this.setCustomCoordCenter(center || DEFAULTMAPCENTER);
}
/**