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);
});
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);
});
}

View File

@ -81,7 +81,7 @@ export default class ScaleComponent extends React.Component {
pointLayer.on('mouseout', (e) => {
console.log(2, e);
});
// const scaleControl = new Scale();
const scaleControl = new Scale();
const layers = {
点图层: pointLayer,
面图层: layer,
@ -91,37 +91,12 @@ export default class ScaleComponent extends React.Component {
position: 'bottomright',
});
// scene.addControl(scaleControl);
scene.addControl(scaleControl);
scene.addControl(layerControl);
// const zoomControl = new Zoom({
// position: 'bottomright',
// });
// 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);
const zoomControl = new Zoom({
position: 'bottomright',
});
scene.addControl(zoomControl);
}
public render() {

View File

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