mirror of https://gitee.com/antv-l7/antv-l7
fix layer zoom
This commit is contained in:
parent
4483968e91
commit
be7a4208af
|
@ -29,7 +29,7 @@ const scene = new L7.Scene({
|
||||||
});
|
});
|
||||||
scene.on('loaded', () => {
|
scene.on('loaded', () => {
|
||||||
$.get('https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv', data => {
|
$.get('https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv', data => {
|
||||||
var layer = scene.HeatMapLayer({
|
var layer = scene.HeatmapLayer({
|
||||||
zIndex: 2
|
zIndex: 2
|
||||||
})
|
})
|
||||||
.source(data, {
|
.source(data, {
|
||||||
|
@ -59,7 +59,7 @@ scene.on('loaded', () => {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
.shape('gird')
|
.shape('grid')
|
||||||
.style({
|
.style({
|
||||||
coverage: 0.8
|
coverage: 0.8
|
||||||
})
|
})
|
||||||
|
|
|
@ -27,7 +27,7 @@ const scene = new L7.Scene({
|
||||||
});
|
});
|
||||||
window.scene = scene;
|
window.scene = scene;
|
||||||
scene.on('loaded', () => {
|
scene.on('loaded', () => {
|
||||||
$.get('./data/earthquakes.geojson', data => {
|
$.get('https://gw.alipayobjects.com/os/basement_prod/08c6ea00-dc5f-4bb0-b0b5-52bde5edf0a3.json', data => {
|
||||||
scene.HeatmapLayer({
|
scene.HeatmapLayer({
|
||||||
zIndex: 2
|
zIndex: 2
|
||||||
})
|
})
|
||||||
|
|
|
@ -29,7 +29,7 @@ const scene = new L7.Scene({
|
||||||
});
|
});
|
||||||
scene.on('loaded', () => {
|
scene.on('loaded', () => {
|
||||||
$.get('https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv', data => {
|
$.get('https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv', data => {
|
||||||
var layer = scene.HeatMapLayer({
|
var layer = scene.HeatmapLayer({
|
||||||
zIndex: 2
|
zIndex: 2
|
||||||
})
|
})
|
||||||
.source(data, {
|
.source(data, {
|
||||||
|
|
|
@ -84,8 +84,8 @@ export default class Layer extends Base {
|
||||||
|
|
||||||
object.onBeforeRender = () => {
|
object.onBeforeRender = () => {
|
||||||
const zoom = this.scene.getZoom();
|
const zoom = this.scene.getZoom();
|
||||||
// object.material.setUniformsValue('u_time', this.scene._engine.clock.getElapsedTime());
|
object.material.setUniformsValue('u_time', this.scene._engine.clock.getElapsedTime());
|
||||||
// object.material.setUniformsValue('u_zoom', zoom);
|
object.material.setUniformsValue('u_zoom', zoom);
|
||||||
this._preRender();
|
this._preRender();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default class HeatmapBuffer extends BufferBase {
|
||||||
// const indices = [];
|
// const indices = [];
|
||||||
|
|
||||||
// 组织顶点数据
|
// 组织顶点数据
|
||||||
data.forEach((d, index) => {
|
data.forEach(d => {
|
||||||
// const totalIndex = index * 4;
|
// const totalIndex = index * 4;
|
||||||
const coord = d.coordinates;
|
const coord = d.coordinates;
|
||||||
const weight = d.size;
|
const weight = d.size;
|
||||||
|
|
|
@ -4,14 +4,14 @@ import PointLayer from './pointLayer';
|
||||||
import LineLayer from './lineLayer';
|
import LineLayer from './lineLayer';
|
||||||
import ImageLayer from './imageLayer';
|
import ImageLayer from './imageLayer';
|
||||||
import RasterLayer from './rasterLayer';
|
import RasterLayer from './rasterLayer';
|
||||||
// import HeatmapLayer from './heatmapLayer';
|
import HeatmapLayer from './heatmapLayer';
|
||||||
|
|
||||||
registerLayer('PolygonLayer', PolygonLayer);
|
registerLayer('PolygonLayer', PolygonLayer);
|
||||||
registerLayer('PointLayer', PointLayer);
|
registerLayer('PointLayer', PointLayer);
|
||||||
registerLayer('LineLayer', LineLayer);
|
registerLayer('LineLayer', LineLayer);
|
||||||
registerLayer('ImageLayer', ImageLayer);
|
registerLayer('ImageLayer', ImageLayer);
|
||||||
registerLayer('RasterLayer', RasterLayer);
|
registerLayer('RasterLayer', RasterLayer);
|
||||||
// registerLayer('HeatmapLayer', HeatmapLayer);
|
registerLayer('HeatmapLayer', HeatmapLayer);
|
||||||
|
|
||||||
export { LAYER_MAP } from './factory';
|
export { LAYER_MAP } from './factory';
|
||||||
|
|
||||||
|
|
|
@ -41,33 +41,33 @@ export default class PointLayer extends Layer {
|
||||||
|
|
||||||
switch (pointShapeType) {
|
switch (pointShapeType) {
|
||||||
case 'fill' :// 填充图形
|
case 'fill' :// 填充图形
|
||||||
{
|
{
|
||||||
if (fill !== 'none') { // 是否填充
|
if (fill !== 'none') { // 是否填充
|
||||||
const attributes = PointBuffer.FillBuffer(this.layerData, style);
|
const attributes = PointBuffer.FillBuffer(this.layerData, style);
|
||||||
const meshfill = drawPoint.DrawFill(attributes, this.get('styleOptions'));
|
const meshfill = drawPoint.DrawFill(attributes, this.get('styleOptions'));
|
||||||
this.add(meshfill);
|
this.add(meshfill);
|
||||||
|
}
|
||||||
|
if (stroke !== 'none') { // 是否绘制边界
|
||||||
|
const lineAttribute = PointBuffer.StrokeBuffer(this.layerData, style);
|
||||||
|
const meshStroke = drawPoint.DrawStroke(lineAttribute, this.get('styleOptions'));
|
||||||
|
this.add(meshStroke, 'line');
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (stroke !== 'none') { // 是否绘制边界
|
|
||||||
const lineAttribute = PointBuffer.StrokeBuffer(this.layerData, style);
|
|
||||||
const meshStroke = drawPoint.DrawStroke(lineAttribute, this.get('styleOptions'));
|
|
||||||
this.add(meshStroke, 'line');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'image':// 绘制图片标注
|
case 'image':// 绘制图片标注
|
||||||
{
|
{
|
||||||
const imageAttribute = PointBuffer.ImageBuffer(this.layerData, { imagePos: this.scene.image.imagePos });
|
const imageAttribute = PointBuffer.ImageBuffer(this.layerData, { imagePos: this.scene.image.imagePos });
|
||||||
const imageMesh = drawPoint.DrawImage(imageAttribute, { ...style, texture: this.scene.image.texture });
|
const imageMesh = drawPoint.DrawImage(imageAttribute, { ...style, texture: this.scene.image.texture });
|
||||||
this.add(imageMesh);
|
this.add(imageMesh);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'normal' : // 原生点
|
case 'normal' : // 原生点
|
||||||
{
|
{
|
||||||
const normalAttribute = PointBuffer.NormalBuffer(this.layerData, style);
|
const normalAttribute = PointBuffer.NormalBuffer(this.layerData, style);
|
||||||
const normalPointMesh = drawPoint.DrawNormal(normalAttribute, style);
|
const normalPointMesh = drawPoint.DrawNormal(normalAttribute, style);
|
||||||
this.add(normalPointMesh);
|
this.add(normalPointMesh);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue