diff --git a/demos/03_choropleths_polygon.html b/demos/03_choropleths_polygon.html index 73455cdba3..59af236ebf 100644 --- a/demos/03_choropleths_polygon.html +++ b/demos/03_choropleths_polygon.html @@ -71,6 +71,10 @@ scene.on('loaded', () => { opacity: 1 }) .render(); + var highlight = scene.LineLayer().source(city).color('red').filter('name',(name)=>{ + return name === '上海' + + }).shape('line').size(2).render(); /** const colorsEnum = ['blue','red','orange','green','purple','purple'] diff --git a/demos/markertest.html b/demos/markertest.html new file mode 100644 index 0000000000..576dc9bb93 --- /dev/null +++ b/demos/markertest.html @@ -0,0 +1,106 @@ + + + + + + 绘制动效Marker + + + +
+ + + + +\ + + + diff --git a/package.json b/package.json index 193c47b3bf..c4f487c482 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7", - "version": "1.3.3-beta.1", + "version": "1.3.3-beta.2", "description": "Large-scale WebGL-powered Geospatial Data Visualization", "main": "build/L7.js", "homepage": "https://github.com/antvis/l7", diff --git a/src/core/layer.js b/src/core/layer.js index fbcf9d53d8..99b18beb18 100644 --- a/src/core/layer.js +++ b/src/core/layer.js @@ -423,7 +423,6 @@ export default class Layer extends Base { !Util.isEqual(preAttrs.shape, nextAttrs.shape) ) { this.repaint(); - this._setPreOption(); } if (!Util.isEqual(preStyle, nextStyle)) { // 判断新增,修改,删除 @@ -434,6 +433,7 @@ export default class Layer extends Base { }); this._updateStyle(newStyle); } + this._setPreOption(); } _updateSize(zoom) { @@ -470,7 +470,6 @@ export default class Layer extends Base { } getSelectFeature(featureId, lnglat) { - // return {}; if (this.get('layerType') === 'tile') { const sourceCache = this.getSourceCache(this.get('sourceOption').id); const feature = sourceCache.getSelectFeature(featureId, this.layerId, lnglat); @@ -488,27 +487,6 @@ export default class Layer extends Base { _updateFilter() { this.get('mappingController').reMapping(); } - /** - * 用于过滤数据 - * @param {*} object 更新颜色和数据过滤 - */ - _updateAttributes(object) { - this.get('mappingController').update(); - this._activeIds = null; // 清空选中元素 - const colorAttr = object.geometry.attributes.a_color; - const pickAttr = object.geometry.attributes.pickingId; - pickAttr.array.forEach((id, index) => { - id = Math.abs(id); - const color = [ ...this.layerData[ id - 1 ].color ]; - id = Math.abs(id); - colorAttr.array[index * 4 + 0] = color[0]; - colorAttr.array[index * 4 + 1] = color[1]; - colorAttr.array[index * 4 + 2] = color[2]; - colorAttr.array[index * 4 + 3] = color[3]; - // pickAttr.array[index] = id; - }); - colorAttr.needsUpdate = true; - } _visibleWithZoom() { if (this._object3D === null) return; const zoom = this.scene.getZoom(); diff --git a/src/layer/render/text/drawText.js b/src/layer/render/text/drawText.js index 0f3b40cdcb..d9a1df9c7f 100644 --- a/src/layer/render/text/drawText.js +++ b/src/layer/render/text/drawText.js @@ -3,8 +3,22 @@ import TextMaterial from '../../../geom/material/textMaterial'; import TextBuffer from '../../../geom/buffer/point/text'; import ColorUtil from '../../../attr/color-util'; import CollisionIndex from '../../../util/collision-index'; +const defaultTextStyle = { + fontWeight: 500, + textAnchor: 'center', + textOffset: [ 0, 0 ], + spacing: 2, + padding: [ 4, 4 ], + strokeColor: 'white', + strokeWidth: 2, + strokeOpacity: 1.0 +}; export default function DrawText(layerData, layer) { - const style = layer.get('styleOptions'); + const style = { + ...defaultTextStyle, + ...layer.get('styleOptions') + }; + layer.set('styleOptions', style); const activeOption = layer.get('activedOptions'); const { strokeWidth, strokeColor, opacity } = style; diff --git a/src/map/AMap.js b/src/map/AMap.js index adb045cd86..0f06ad1700 100644 --- a/src/map/AMap.js +++ b/src/map/AMap.js @@ -3,6 +3,7 @@ import Global from '../global'; import * as Theme from '../theme/index'; import Util from '../util'; const DEG2RAD = Math.PI / 180; +const defaultMapFeatures = ['bg', 'point', 'road', 'building' ]; export default class GaodeMap extends Base { getDefaultCfg() { return Util.assign(Global.scene, { @@ -57,6 +58,8 @@ export default class GaodeMap extends Base { this.get('mapStyle') && this.map.setMapStyle(this.get('mapStyle')); if (this.get('mapStyle') === 'blank') { map.setFeatures([]); + } else { + map.setFeatures(defaultMapFeatures); } this.addOverLayer(); setTimeout(() => { this.emit('mapLoad'); }, 50); @@ -65,6 +68,8 @@ export default class GaodeMap extends Base { this.map.on('complete', () => { if (this.get('mapStyle') === 'blank') { this.map.setFeatures([]); + } else { + this.map.setFeatures(defaultMapFeatures); } this.addOverLayer(); this.emit('mapLoad'); @@ -224,5 +229,9 @@ export default class GaodeMap extends Base { const ll = new AMap.LngLat(lnglat[0], lnglat[1]); return map.lngLatToContainer(ll); }; + scene.lngLatToGeodeticCoord = lnglat => { + const ll = new AMap.LngLat(lnglat[0], lnglat[1]); + return map.lngLatToGeodeticCoord(ll); + }; } }