fix(lint):eslint

This commit is contained in:
李正学 2018-11-20 20:07:22 +08:00
parent 46a1f8bc89
commit e722dc0dd9
16 changed files with 52 additions and 91 deletions

View File

@ -15,29 +15,6 @@
<body>
<div id="map"></div>
<div class='info-panel top-right'>
<h4>杭州市微博签到数据</h4>
<p>
<label>min</label><input name="minaqi" type="range" step="1" min="0" max="30000" value=500> <label>500</label>
</p>
<p>
<label>max</label><input name="maxaqi" type="range" step="1" min="0" max="30000" value=30000><label>30000</label>
</p>
<p><label>color</label><select>
<option value ="blue">blue</option>
<option value ="red">red</option>
<option value="orange">orange</option>
<option value="green">green</option>
<option value="yellow">yellow</option>
<option value="purple">purple</option>
</select> </p>
<p><label>shape</label><select>
<option value ="circle">circle</option>
<option value ="triangle">triangle</option>
<option value="hexagon">hexagon</option>
<option value="square">square</option>
</select> </p>
<div>
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
@ -58,7 +35,7 @@ const scene = new L7.Scene({
mapStyle: 'light', // 样式URL
center: [ 120.19382669582967, 30.258134 ],
pitch: 0,
zoom: 11.6
zoom: 12
});
window.scene = scene;
scene.on('loaded', () => {
@ -74,7 +51,7 @@ scene.on('loaded', () => {
}
})
.shape('2d:circle')
.size('value', [ 0, 60]) // default 1
.size('value', [ 2, 80]) // default 1
//.size('value', [ 10, 300]) // default 1
.active(true)
.filter('value', field_8 => {
@ -87,20 +64,7 @@ scene.on('loaded', () => {
opacity: 0.9
})
.render();
$('.info-panel input').change(function(){
$(this).next().text($(this).val());
const min = $('.info-panel input').val();
const max = $($('.info-panel input')[1]).val();
circleLayer.filter('value',(value)=>{
return (value>=min && value<=max)
}).render();
})
$('.info-panel select').change(function(){
const color = $(this).val();
console.time('color');
circleLayer.color('type',colorObj[color]).render();
console.timeEnd('color')
})
});

View File

@ -23,13 +23,13 @@
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 120.037828998113099, 30.086317611850635 ],
pitch: 36.002858,
zoom: 5.44
center: [104.838088,34.075889 ],
pitch: 35,
zoom: 4.88,
rotation:4.183582
});
window.scene = scene;
scene.on('loaded', () => {
$.get('./data/rainfall.json', data => {
$.get('https://gw.alipayobjects.com/os/rmsportal/oVTMqfzuuRFKiDwhPSFL.json', data => {
scene.PointLayer({
zIndex: 2
})
@ -40,14 +40,13 @@ scene.on('loaded', () => {
})
.shape('3d:circle')
.size('t',(level)=> {
return [4,4,(level+40)];
return [2,2,(level*3+20)];
})
.active(true)
.color('t', ["#002466","#105CB3","#2894E0","#CFF6FF","#FFF5B8","#FFAB5C","#F27049","#730D1C"])
.render();
});
});
</script>
</body>
</html>

View File

@ -80,7 +80,7 @@ scene.on('loaded', () => {
.size(8)
.shape('2d:circle')
.style({
opacity:1.0
opacity:0.7
})
.render();

View File

@ -25,9 +25,9 @@ const color1 = [ 'rgba(37, 140, 249, 0.8)', 'rgba(14, 241, 242, 0.8)', 'rgba(255
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 102.615023, 23.107799],
center: [ 102.602992, 23.107329],
pitch: 15,
zoom: 14,
zoom: 14.82,
});
scene.on('loaded', () => {
$.get('./data/contour.geojson', data => {

View File

@ -28,11 +28,10 @@ const scene = new L7.Scene({
});
scene.on('loaded', () => {
scene.image.addImage('marker', './data/onebelt/marker.png');
scene.image.addImage('local', './image/local.png');
scene.image.addImage('local', 'https://gw.alipayobjects.com/zos/rmsportal/xZXhTxbglnuTmZEwqQrE.png');
$.getJSON('./data/onebelt/regions.json', region => {
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/UpapMomPYUeiBjbHNAma.json', region => {
const color = [ 'rgb(22,32,101)', 'rgb(28,43,127)', 'rgb(36,68,142)', 'rgb(45,94,158)', 'rgb(53,119,174)', 'rgb(61,145,190)', 'rgb(70,170,206)', 'rgb(98,190,210)', 'rgb(138,205,206)', 'rgb(179,221,204)', 'rgb(220,236,201)' ];
var points = region.features.map((feature)=>{
return feature.properties;
@ -48,7 +47,7 @@ $.getJSON('./data/onebelt/regions.json', region => {
.shape('fill')
.render();
});
$.getJSON('./data/onebelt/seaway.geojson', contourData => {
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/kwUdcXnxQtexeGRvTGtA.json', contourData => {
const layer = scene.LineLayer({
zIndex:2}
@ -62,7 +61,7 @@ $.getJSON('./data/onebelt/seaway.geojson', contourData => {
})
.render();
});
$.getJSON('./data/onebelt/landway.json', contourData => {
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/dzpMOiLYBKxpdmsgBLoE.json', contourData => {
const landlayer = scene.LineLayer(
{zIndex:2}
)
@ -75,7 +74,7 @@ $.getJSON('./data/onebelt/landway.json', contourData => {
})
.render();
});
$.getJSON('./data/onebelt/city.geojson', city => {
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/opYqFyDGyGUAUXkLUhBV.json', city => {
var makerLayer = scene.PointLayer({
zIndex: 4
})

View File

@ -24,20 +24,22 @@
const scene = new L7.Scene({
id: 'map',
mapStyle: 'dark', // 样式URL
center: [ 120.4047, 30.0679 ],
pitch: 35,
zoom: 4
center: [104.838088,34.075889 ],
pitch: 27,
zoom: 4.5,
rotation:4.183582
});
window.scene = scene;
scene.on('loaded', () => {
$.getJSON('./data/chinandvohexagon.geojson', city => {
$.getJSON('https://gw.alipayobjects.com/os/rmsportal/xxvoBnsYNEPiAXGRmlPD.json', city => {
citylayer = scene.PolygonLayer()
.source(city)
.color('sum', ["#FAFFF0", "#EBF7D2", "#C8E695", "#A5D660", "#7DC238", "#59A616", "#3F8C0B", "#237804", "#125200", "#082B00"])
.shape('extrude')
.size('max',(value)=>{
if(value<0)value =0;
return value * 1000;
})
.active(true)

View File

@ -36,9 +36,9 @@ const colorObj ={
const scene = new L7.Scene({
id: 'map',
mapStyle: 'light', // 样式URL
center: [ 120.4047, 30.0679 ],
center: [104.838088,34.075889 ],
pitch: 0,
zoom: 4
zoom: 4.5,
});
window.scene = scene;

View File

@ -31,10 +31,8 @@ const scene = new L7.Scene({
});
scene.on('loaded', () => {
// https://gw.alipayobjects.com/zos/rmsportal/wAQqmdcWOPdomuKUyHDF.png
//
const imageLayer = scene.ImageLayer().
source('./image/hangzhoubay.jpg',{
source('https://gw.alipayobjects.com/zos/rmsportal/FnHFeFklTzKDdUESRNDv.jpg',{
extent: [ 121.1680, 30.2828, 121.3840, 30.4219 ]
})

View File

@ -32,7 +32,7 @@ const scene = new L7.Scene({
});
window.scene = scene;
scene.on('loaded', () => {
$.get('./data/water.geojson', data => {
$.get('https://gw.alipayobjects.com/os/rmsportal/XHMbjQwrSrajvLLvMPbK.json', data => {
scene.PolygonLayer({
zIndex: 0
})
@ -41,7 +41,7 @@ scene.on('loaded', () => {
.color('rgb(79,174,234)')
.render();
});
$.get('./data/land.geojson', data => {
$.get('https://gw.alipayobjects.com/os/rmsportal/VifgwJEyBIXnDrjCwWdK.json', data => {
scene.PolygonLayer({
zIndex: 0
})
@ -50,7 +50,7 @@ scene.on('loaded', () => {
.color('rgb(156,194,116)')
.render();
});
$.get('./data/river.geojson', data => {
$.get('https://gw.alipayobjects.com/os/rmsportal/ZseLNWMOPGrgqQYfvtli.json', data => {
scene.LineLayer({
zIndex: 2
})
@ -61,7 +61,7 @@ scene.on('loaded', () => {
.render();
});
$.get('./data/build.geojson', data => {
$.get('https://gw.alipayobjects.com/os/rmsportal/ggFwDClGjjvpSMBIrcEx.json', data => {
citylayer = scene.PolygonLayer({
zIndex: 2
})

View File

@ -418,11 +418,6 @@ export default class Layer extends Base {
});
}
}
/**
*
* @param {*} overwrite
* @param {*} callback
*/
on(type, callback) {
this._addPickingEvents();
@ -448,7 +443,7 @@ export default class Layer extends Base {
const pickmaterial = new PickingMaterial({
u_zoom: this.scene.getZoom()
});
const pickingMesh = new THREE[mesh.type](mesh.geometry, pickmaterial);
pickmaterial.setDefinesvalue(this.type, true);
pickingMesh.onBeforeRender = () => {
@ -464,7 +459,7 @@ export default class Layer extends Base {
// TODO: Find a way to properly remove this listener on destroy
this.scene.on('pick', e => {
// Re-emit click event from the layer
const { featureId, point2d, point3d, intersects } = e;
const { featureId, point2d, intersects } = e;
if (intersects.length === 0) { return; }
const source = this.layerSource.get('data');
const feature = source.features[featureId];
@ -493,7 +488,7 @@ export default class Layer extends Base {
const colorAttr = this.layerMesh.geometry.attributes.a_color;
const firstId = pickingId.indexOf(featureStyleId[0] + 1);
for (let i = firstId; i < pickingId.length; i++) {
if (pickingId[i] == featureStyleId[0] + 1) {
if (pickingId[i] === featureStyleId[0] + 1) {
colorAttr.array[i * 4 + 0] = color[0];
colorAttr.array[i * 4 + 1] = color[1];
colorAttr.array[i * 4 + 2] = color[2];
@ -556,7 +551,7 @@ export default class Layer extends Base {
} else if (this.type === 'polyline') {
offset = 2;
}
this._object3D.position.z = offset * Math.pow(2, 20 - zoom);
this._object3D.position.z = offset * Math.pow(2, 20 - zoom);
if (zoom < minZoom || zoom > maxZoom) {
this._object3D.visible = false;
} else if (this.get('visible')) {
@ -569,11 +564,11 @@ export default class Layer extends Base {
resetStyle() {
const pickingId = this.layerMesh.geometry.attributes.pickingId.array;
const colorAttr = this.layerMesh.geometry.attributes.a_color;
this._activeIds.forEach((index, value) => {
this._activeIds.forEach(index => {
const color = this.StyleData[index].color;
const firstId = pickingId.indexOf(index + 1);
for (let i = firstId; i < pickingId.length; i++) {
if (pickingId[i] == index + 1) {
if (pickingId[i] === index + 1) {
colorAttr.array[i * 4 + 0] = color[0];
colorAttr.array[i * 4 + 1] = color[1];
colorAttr.array[i * 4 + 2] = color[2];

View File

@ -35,6 +35,7 @@ export default class Scene extends Base {
const sceneMap = new GaodeMap(Map.map);
// eslint-disable-next-line
Object.getOwnPropertyNames(sceneMap.__proto__).forEach((key)=>{
// eslint-disable-next-line
if ('key' !== 'constructor') { this.__proto__[key] = sceneMap.__proto__[key]; }
});
this.map = Map.map;

View File

@ -1,7 +1,6 @@
import BufferBase from './bufferBase';
import { regularShape } from '../shape/index';
import Util from '../../util';
import * as THREE from '../../core/three';
export default class PointBuffer extends BufferBase {
geometryBuffer() {
const type = this.get('type');

View File

@ -1,5 +1,5 @@
import BufferBase from './bufferBase';
import { getJSON, getImage } from '../../util/ajax';
import { getJSON } from '../../util/ajax';
import * as THREE from '../../core/three';
import Global from '../../global';
const Space = 1;
@ -68,12 +68,17 @@ export default class TextBuffer extends BufferBase {
});
}
_loadTextTexture(url) {
getImage({
url: `${Global.sdfHomeUrl}${url}`
}, (e, image) => {
this.bufferStruct.textTexture = this._creatTexture(image);
const img = new Image();
img.crossOrigin = 'anonymous';
img.onload = () => {
this.bufferStruct.textTexture = this._creatTexture(img);
this.emit('SourceLoaded');
});
};
img.src = url;
}
/**
* 计算每个标注词语的位置

View File

@ -22,7 +22,7 @@ const Global = {
// 指定固定 tick 数的逼近值
snapCountArray: [ 0, 1, 1.2, 1.5, 1.6, 2, 2.2, 2.4, 2.5, 3, 4, 5, 6, 7.5, 8, 10 ],
size: 10000,
sdfHomeUrl: 'http://visualtest.amap.com',
sdfHomeUrl: 'https://sdf.amap.com',
scales: {
}
};

View File

@ -7,7 +7,7 @@ import TextBuffer from '../geom/buffer/text';
import TextMaterial from '../geom/material/textMaterial';
import radar from '../geom/shader/radar_frag.glsl';
import warn from '../geom/shader/warn_frag.glsl';
import pickingMaterial from '../core/engine/picking/pickingMaterial';
/**
* point shape 2d circle, traingle text,image
@ -58,7 +58,7 @@ export default class PointLayer extends Layer {
// u_zoom: this.scene.getZoom()
// })
// mtl.setDefinesvalue('point', true);
mtl.setDefinesvalue('SHAPE', true);
mtl.setDefinesvalue('SHAPE', true);
if (shape === 'radar') {
mtl.fragmentShader = radar;

View File

@ -21,8 +21,7 @@ export default class CSVSource extends Source {
if (col.coordinates) {
coordinates = col.coordinates;
}
if(x && y)
coordinates = [ col[x], col[y] ];
if (x && y) { coordinates = [ col[x], col[y] ]; }
if (x1 && y1) {
coordinates = [[ col[x], col[y] ], [ col[x1], col[y1] ]];
}