fix layer zoom

This commit is contained in:
thinkinggis 2019-03-01 13:09:41 +08:00
parent 918570d2f5
commit 16b5fd3a11
7 changed files with 33 additions and 33 deletions

View File

@ -29,7 +29,7 @@ const scene = new L7.Scene({
});
scene.on('loaded', () => {
$.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
})
.source(data, {
@ -59,7 +59,7 @@ scene.on('loaded', () => {
}
]
})
.shape('gird')
.shape('grid')
.style({
coverage: 0.8
})

View File

@ -27,7 +27,7 @@ const scene = new L7.Scene({
});
window.scene = scene;
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({
zIndex: 2
})

View File

@ -29,7 +29,7 @@ const scene = new L7.Scene({
});
scene.on('loaded', () => {
$.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
})
.source(data, {

View File

@ -84,8 +84,8 @@ export default class Layer extends Base {
object.onBeforeRender = () => {
const zoom = this.scene.getZoom();
// object.material.setUniformsValue('u_time', this.scene._engine.clock.getElapsedTime());
// object.material.setUniformsValue('u_zoom', zoom);
object.material.setUniformsValue('u_time', this.scene._engine.clock.getElapsedTime());
object.material.setUniformsValue('u_zoom', zoom);
this._preRender();
};

View File

@ -12,7 +12,7 @@ export default class HeatmapBuffer extends BufferBase {
// const indices = [];
// 组织顶点数据
data.forEach((d, index) => {
data.forEach(d => {
// const totalIndex = index * 4;
const coord = d.coordinates;
const weight = d.size;

View File

@ -4,14 +4,14 @@ import PointLayer from './pointLayer';
import LineLayer from './lineLayer';
import ImageLayer from './imageLayer';
import RasterLayer from './rasterLayer';
// import HeatmapLayer from './heatmapLayer';
import HeatmapLayer from './heatmapLayer';
registerLayer('PolygonLayer', PolygonLayer);
registerLayer('PointLayer', PointLayer);
registerLayer('LineLayer', LineLayer);
registerLayer('ImageLayer', ImageLayer);
registerLayer('RasterLayer', RasterLayer);
// registerLayer('HeatmapLayer', HeatmapLayer);
registerLayer('HeatmapLayer', HeatmapLayer);
export { LAYER_MAP } from './factory';

View File

@ -41,33 +41,33 @@ export default class PointLayer extends Layer {
switch (pointShapeType) {
case 'fill' :// 填充图形
{
if (fill !== 'none') { // 是否填充
const attributes = PointBuffer.FillBuffer(this.layerData, style);
const meshfill = drawPoint.DrawFill(attributes, this.get('styleOptions'));
this.add(meshfill);
{
if (fill !== 'none') { // 是否填充
const attributes = PointBuffer.FillBuffer(this.layerData, style);
const meshfill = drawPoint.DrawFill(attributes, this.get('styleOptions'));
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':// 绘制图片标注
{
const imageAttribute = PointBuffer.ImageBuffer(this.layerData, { imagePos: this.scene.image.imagePos });
const imageMesh = drawPoint.DrawImage(imageAttribute, { ...style, texture: this.scene.image.texture });
this.add(imageMesh);
break;
}
{
const imageAttribute = PointBuffer.ImageBuffer(this.layerData, { imagePos: this.scene.image.imagePos });
const imageMesh = drawPoint.DrawImage(imageAttribute, { ...style, texture: this.scene.image.texture });
this.add(imageMesh);
break;
}
case 'normal' : // 原生点
{
const normalAttribute = PointBuffer.NormalBuffer(this.layerData, style);
const normalPointMesh = drawPoint.DrawNormal(normalAttribute, style);
this.add(normalPointMesh);
break;
}
{
const normalAttribute = PointBuffer.NormalBuffer(this.layerData, style);
const normalPointMesh = drawPoint.DrawNormal(normalAttribute, style);
this.add(normalPointMesh);
break;
}
default:
return null;
}