feat: 恢复 province/layer control

This commit is contained in:
2912401452 2021-09-16 20:46:34 +08:00
parent 94b68c7725
commit d14b4788a1
3 changed files with 10 additions and 39 deletions

View File

@ -135,7 +135,7 @@ export default class Layers extends Control {
this.addLayer(baseLayers[name], name, false); this.addLayer(baseLayers[name], name, false);
}); });
Object.keys(overlayers).forEach((name: any, index: number) => { Object.keys(overlayers).forEach((name: any, index: number) => {
overlayers[name].once('inited', this.update); // overlayers[name].once('inited', this.update);
this.addLayer(overlayers[name], name, true); this.addLayer(overlayers[name], name, true);
}); });
} }

View File

@ -81,7 +81,7 @@ export default class ScaleComponent extends React.Component {
pointLayer.on('mouseout', (e) => { pointLayer.on('mouseout', (e) => {
console.log(2, e); console.log(2, e);
}); });
// const scaleControl = new Scale(); const scaleControl = new Scale();
const layers = { const layers = {
点图层: pointLayer, 点图层: pointLayer,
面图层: layer, 面图层: layer,
@ -91,37 +91,12 @@ export default class ScaleComponent extends React.Component {
position: 'bottomright', position: 'bottomright',
}); });
// scene.addControl(scaleControl); scene.addControl(scaleControl);
scene.addControl(layerControl); scene.addControl(layerControl);
// const zoomControl = new Zoom({ const zoomControl = new Zoom({
// position: 'bottomright', position: 'bottomright',
// }); });
// scene.addControl(zoomControl); scene.addControl(zoomControl);
setTimeout(() => {
const pointLayer3 = new PointLayer({
name: '02',
enablePropagation: true,
})
.source(pointsData, {
cluster: true,
})
.shape('circle')
.scale('point_count', {
type: 'quantile',
})
.size('point_count', [3])
.animate(false)
.active(false)
.color('red')
.style({
opacity: 0.5,
strokeWidth: 1,
});
scene.addLayer(pointLayer3);
layerControl.addVisualLayer(pointLayer3, 'pointLayer3');
}, 2000);
} }
public render() { public render() {

View File

@ -219,7 +219,7 @@ export default class Country extends React.Component {
data, data,
geoDataLevel: 1, geoDataLevel: 1,
joinBy: ['adcode', 'code'], joinBy: ['adcode', 'code'],
adcode: [province], adcode: [],
stroke: '#7096B3', stroke: '#7096B3',
depth: 2, depth: 2,
showBorder: false, showBorder: false,
@ -244,7 +244,7 @@ export default class Country extends React.Component {
return ( return (
<> <>
<Select <Select
defaultValue="黑龙江省" defaultValue="北京市"
style={{ style={{
width: 120, width: 120,
zIndex: 2, zIndex: 2,
@ -252,10 +252,7 @@ export default class Country extends React.Component {
right: '10px', right: '10px',
top: '10px', top: '10px',
}} }}
// onChange={this.handleProvinceChange} onChange={this.handleProvinceChange}
onChange={() => {
console.log('change');
}}
> >
{ProvinceData.map((province, i) => { {ProvinceData.map((province, i) => {
return ( return (
@ -283,7 +280,6 @@ export default class Country extends React.Component {
this.setState({ this.setState({
province: value, province: value,
}); });
console.log('value', value);
this.provinceLayer.updateDistrict([value]); this.provinceLayer.updateDistrict([value]);
}; };
} }