This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map.once('postrender', function() { | |
map.once('moveend', function(evt) { | |
zoomend(evt) | |
}) | |
}) | |
function zoomend(evt) { | |
const zoom = evt.map.getView().getZoom() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
veclayer.getSource().getFeatures().forEach(function(item){ | |
if (showFeature) { | |
item.setStyle(style); | |
} else { | |
item.setStyle(null); | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Iconstyle: function(feature, resolution) { | |
var style = new ol.style.Style({ | |
fill : new ol.style.Fill({ | |
color : 'rgba(241,242,236,0.8)', | |
}), | |
stroke : new ol.style.Stroke({ | |
color : 'red', | |
width : 2 | |
}), | |
image : new ol.style.Icon(({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const path = require('path') | |
function resolve(dir) { | |
return path.join(__dirname, '.', dir) | |
} | |
module.exports = { | |
context : path.resolve(__dirname, './'), | |
resolve : { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map.getView().once('change:resolution', (evt) => { | |
map.once('moveend', (evt) => { | |
zoomend(evt) | |
}) | |
}) | |
function zoomend(evt) { | |
console.log('current zoom: ' + evt.map.getView().getZoom()) | |
evt.map.once('moveend', (evt) => { | |
this.zoomend(evt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hello = { | |
hello : 'world', | |
foo : 'bar' | |
}; | |
var qaz = { | |
hello : 'stevie', | |
foo : 'baz' | |
} | |
var myArray = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 将obj. hasOwnProperty(key) 改写成 | |
Object.prototype.hasOwnProperty.call(obj, key) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = {a:1,b:2} | |
Object.keys(obj).forEach((key, index) => { | |
console.log(key,index,obj[key]) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************************************** | |
* 生成从minNum到maxNum的随机数。 | |
* 如果指定decimalNum个数,则生成指定小数位数的随机数 | |
* 如果不指定任何参数,则生成0-1之间的随机数。 | |
* | |
* @minNum:[数据类型是Integer]生成的随机数的最小值(minNum和maxNum可以调换位置) | |
* @maxNum:[数据类型是Integer]生成的随机数的最大值 | |
* @decimalNum:[数据类型是Integer]如果生成的是带有小数的随机数,则指定随机数的小数点后的位数 | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 区间[min,max]的随机整数 | |
* @param {*} min | |
* @param {*} max | |
*/ | |
getRandomIntegerInRange (min, max) { | |
return Math.floor((max + 1 - min) * Math.random() + min) | |
} |
OlderNewer