chore: 删除无用 Example

This commit is contained in:
yanxiong 2022-08-22 20:16:36 +08:00
parent 42f3ceae1c
commit 2c0b518c7e
8 changed files with 5 additions and 216 deletions

View File

@ -95,7 +95,7 @@ const Demo: FunctionComponent = () => {
}), }),
]).then(() => { ]).then(() => {
const newControl = new LayerControl({ const newControl = new LayerControl({
layers, // layers,
}); });
newScene.addControl(newControl); newScene.addControl(newControl);
}); });

View File

@ -1,4 +1,4 @@
import { GaodeMapV2, Scene, MapStyle } from '@antv/l7'; import { GaodeMapV2, Scene } from '@antv/l7';
import React, { useState } from 'react'; import React, { useState } from 'react';
// tslint:disable-next-line:no-duplicate-imports // tslint:disable-next-line:no-duplicate-imports
import { FunctionComponent, useEffect } from 'react'; import { FunctionComponent, useEffect } from 'react';
@ -23,9 +23,9 @@ const Demo: FunctionComponent = () => {
}); });
newScene.on('loaded', () => { newScene.on('loaded', () => {
const newControl = new MapStyle({}); // const newControl = new MapStyle({});
console.log(newScene); // console.log(newScene);
newScene.addControl(newControl); // newScene.addControl(newControl);
}); });
}, []); }, []);

View File

@ -1,6 +0,0 @@
---
title: 地图类型
order: 11
---
<code src="./mapType.tsx" compact defaultShowCode></code>

View File

@ -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;

View File

@ -1,6 +0,0 @@
---
title: 选择框实例
order: 9
---
<code src="./select.tsx" compact defaultShowCode></code>

View File

@ -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;

View File

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

View File

@ -14,7 +14,6 @@ export * from './control/logo';
export * from './control/fullscreen'; export * from './control/fullscreen';
export * from './control/exportImage'; export * from './control/exportImage';
export * from './control/navigation'; export * from './control/navigation';
export * from './control/mapType';
export * from './control/mapStyleControl'; export * from './control/mapStyleControl';
export * from './control/layerControl'; export * from './control/layerControl';