mirror of https://gitee.com/antv-l7/antv-l7
chore: 删除无用 Example
This commit is contained in:
parent
42f3ceae1c
commit
2c0b518c7e
|
@ -95,7 +95,7 @@ const Demo: FunctionComponent = () => {
|
|||
}),
|
||||
]).then(() => {
|
||||
const newControl = new LayerControl({
|
||||
layers,
|
||||
// layers,
|
||||
});
|
||||
newScene.addControl(newControl);
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { GaodeMapV2, Scene, MapStyle } from '@antv/l7';
|
||||
import { GaodeMapV2, Scene } from '@antv/l7';
|
||||
import React, { useState } from 'react';
|
||||
// tslint:disable-next-line:no-duplicate-imports
|
||||
import { FunctionComponent, useEffect } from 'react';
|
||||
|
@ -23,9 +23,9 @@ const Demo: FunctionComponent = () => {
|
|||
});
|
||||
|
||||
newScene.on('loaded', () => {
|
||||
const newControl = new MapStyle({});
|
||||
console.log(newScene);
|
||||
newScene.addControl(newControl);
|
||||
// const newControl = new MapStyle({});
|
||||
// console.log(newScene);
|
||||
// newScene.addControl(newControl);
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
title: 地图类型
|
||||
order: 11
|
||||
---
|
||||
|
||||
<code src="./mapType.tsx" compact defaultShowCode></code>
|
|
@ -1,44 +0,0 @@
|
|||
import { GaodeMapV2, Scene, MapType } from '@antv/l7';
|
||||
import React, { useState } from 'react';
|
||||
// tslint:disable-next-line:no-duplicate-imports
|
||||
import { FunctionComponent, useEffect } from 'react';
|
||||
|
||||
const Demo: FunctionComponent = () => {
|
||||
const [scene, setScene] = useState<Scene | undefined>();
|
||||
|
||||
useEffect(() => {
|
||||
const newScene = new Scene({
|
||||
id: 'map',
|
||||
map: new GaodeMapV2({
|
||||
style: 'normal',
|
||||
center: [120, 30],
|
||||
pitch: 0,
|
||||
zoom: 6.45,
|
||||
preserveDrawingBuffer: true,
|
||||
// WebGLParams: {
|
||||
// preserveDrawingBuffer: true,
|
||||
// },
|
||||
}),
|
||||
// logoVisible: false,
|
||||
});
|
||||
|
||||
newScene.on('loaded', () => {
|
||||
const newControl = new MapType({});
|
||||
newScene.addControl(newControl);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
id="map"
|
||||
style={{
|
||||
height: '500px',
|
||||
position: 'relative',
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Demo;
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
title: 选择框实例
|
||||
order: 9
|
||||
---
|
||||
|
||||
<code src="./select.tsx" compact defaultShowCode></code>
|
|
@ -1,110 +0,0 @@
|
|||
import { GaodeMap, Scene, SelectControl } from '@antv/l7';
|
||||
import React, { FunctionComponent, useEffect, useState } from 'react';
|
||||
|
||||
class SelectDemo extends SelectControl {
|
||||
protected isMultiple = false;
|
||||
}
|
||||
|
||||
const options = [
|
||||
{
|
||||
img:
|
||||
'https://gw.alipayobjects.com/mdn/rms_58ab56/afts/img/A*vky9QKrWjlwAAAAAAAAAAAAAARQnAQ',
|
||||
value: 'normal',
|
||||
text: 'normal',
|
||||
},
|
||||
{
|
||||
img:
|
||||
'https://gw.alipayobjects.com/mdn/rms_58ab56/afts/img/A*UlP0Qp9Zwx0AAAAAAAAAAAAAARQnAQ',
|
||||
value: 'light',
|
||||
text: 'light',
|
||||
},
|
||||
{
|
||||
img:
|
||||
'https://gw.alipayobjects.com/mdn/rms_58ab56/afts/img/A*UitzS5mxpSwAAAAAAAAAAAAAARQnAQ',
|
||||
value: 'dark',
|
||||
text: 'dark',
|
||||
},
|
||||
{
|
||||
img:
|
||||
'https://gw.alipayobjects.com/mdn/rms_58ab56/afts/img/A*UitzS5mxpSwAAAAAAAAAAAAAARQnAQ',
|
||||
value: 'dark1',
|
||||
text: 'dark1',
|
||||
},
|
||||
];
|
||||
|
||||
const Demo: FunctionComponent = () => {
|
||||
const [control, setControl] = useState<SelectDemo | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const scene = new Scene({
|
||||
id: 'map',
|
||||
map: new GaodeMap({
|
||||
style: 'dark',
|
||||
center: [120, 30],
|
||||
pitch: 0,
|
||||
zoom: 6.45,
|
||||
}),
|
||||
// logoVisible: false,
|
||||
});
|
||||
|
||||
scene.on('loaded', () => {
|
||||
// const layer = new RasterLayer({}).source(
|
||||
// 'http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
|
||||
// {
|
||||
// parser: {
|
||||
// type: 'rasterTile',
|
||||
// tileSize: 256,
|
||||
//
|
||||
// zoomOffset: 0,
|
||||
// updateStrategy: 'overlap',
|
||||
// },
|
||||
// },
|
||||
// );
|
||||
//
|
||||
// scene.addLayer(layer);
|
||||
const newControl = new SelectDemo({
|
||||
position: 'topcenter',
|
||||
popperTrigger: 'hover',
|
||||
options,
|
||||
// .map((item) => {
|
||||
// const { img, ...option } = item;
|
||||
// return option;
|
||||
// })
|
||||
defaultValue: 'normal',
|
||||
});
|
||||
|
||||
newControl.on('selectChange', (e) => {
|
||||
console.log(e);
|
||||
});
|
||||
|
||||
setControl(newControl);
|
||||
scene.addControl(newControl);
|
||||
});
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<button
|
||||
onClick={() => {
|
||||
control?.setOptions({
|
||||
popperPlacement: 'right-start',
|
||||
options: options.slice(0, 3),
|
||||
options: options.slice(0, 3),
|
||||
});
|
||||
}}
|
||||
>
|
||||
变更配置
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
id="map"
|
||||
style={{
|
||||
height: '500px',
|
||||
position: 'relative',
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Demo;
|
|
@ -1,44 +0,0 @@
|
|||
import { createL7Icon } from '../utils/icon';
|
||||
import SelectControl, {
|
||||
ISelectControlOption,
|
||||
} from './baseControl/selectControl';
|
||||
|
||||
export interface MapTypeControlOption extends ISelectControlOption {
|
||||
mapType: string;
|
||||
}
|
||||
|
||||
export { MapType };
|
||||
|
||||
export default class MapType extends SelectControl<MapTypeControlOption> {
|
||||
public getIsMultiple(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public getDefault(
|
||||
option?: Partial<MapTypeControlOption>,
|
||||
): MapTypeControlOption {
|
||||
return {
|
||||
...super.getDefault(option),
|
||||
title: '地图类型',
|
||||
btnIcon: createL7Icon('l7-icon-ditu'),
|
||||
options: [
|
||||
{
|
||||
text: '高德地图',
|
||||
value: 'gaode',
|
||||
},
|
||||
{
|
||||
text: 'Mapbox',
|
||||
value: 'mapbox',
|
||||
},
|
||||
],
|
||||
defaultValue: 'gaode',
|
||||
};
|
||||
}
|
||||
|
||||
public onAdd(): any {
|
||||
const layers = this.layerService.getLayers();
|
||||
|
||||
const button = super.onAdd();
|
||||
return button;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ export * from './control/logo';
|
|||
export * from './control/fullscreen';
|
||||
export * from './control/exportImage';
|
||||
export * from './control/navigation';
|
||||
export * from './control/mapType';
|
||||
export * from './control/mapStyleControl';
|
||||
export * from './control/layerControl';
|
||||
|
||||
|
|
Loading…
Reference in New Issue