Commit 5c0ff280 authored by 郭铭瑶's avatar 郭铭瑶 🤘

my-map提取默认数据

parent 02f564cd
...@@ -10,15 +10,7 @@ import { ...@@ -10,15 +10,7 @@ import {
LayerOption, LayerOption,
} from './types' } from './types'
export default abstract class MyMap { const defaultListeners = {
protected map
protected _listeners: Listeners
protected _controls: Controls
protected _layers: Layers
constructor(instance: any) {
this.map = instance
this._listeners = {
load: (cb: CallBack) => { load: (cb: CallBack) => {
console.error('on:此地图不存在 load 监听事件!') console.error('on:此地图不存在 load 监听事件!')
}, },
...@@ -49,8 +41,9 @@ export default abstract class MyMap { ...@@ -49,8 +41,9 @@ export default abstract class MyMap {
mousewheel: (cb: CallBack) => { mousewheel: (cb: CallBack) => {
console.error('on:此地图不存在 mousewheel 监听事件!') console.error('on:此地图不存在 mousewheel 监听事件!')
}, },
} }
this._controls = {
const defaultControls = {
home: () => { home: () => {
console.error('set:此地图不存在 home 控件!') console.error('set:此地图不存在 home 控件!')
}, },
...@@ -87,11 +80,22 @@ export default abstract class MyMap { ...@@ -87,11 +80,22 @@ export default abstract class MyMap {
bMapGalleryexpand: () => { bMapGalleryexpand: () => {
console.error('set:此地图不存在 bMapGalleryexpand 控件!') console.error('set:此地图不存在 bMapGalleryexpand 控件!')
}, },
} }
this._layers = {
const defaultLayers = {
point: () => console.error('add:此地图不存在 point 覆盖物!'), point: () => console.error('add:此地图不存在 point 覆盖物!'),
line: () => console.error('add:此地图不存在 line 覆盖物!'), line: () => console.error('add:此地图不存在 line 覆盖物!'),
} polygon: () => console.error('add:此地图不存在 polygon 覆盖物!'),
}
export default abstract class MyMap {
protected map
protected _listeners: Listeners = defaultListeners
protected _controls: Controls = defaultControls
protected _layers: Layers = defaultLayers
constructor(instance: any) {
this.map = instance
} }
/** /**
...@@ -137,24 +141,24 @@ export default abstract class MyMap { ...@@ -137,24 +141,24 @@ export default abstract class MyMap {
* zoom in * zoom in
* @param options 参数 * @param options 参数
*/ */
abstract zoomIn(options?: ZoomOptions): unknown abstract zoomIn(options?: ZoomOptions): void
/** /**
* zoom out * zoom out
* @param options 参数 * @param options 参数
*/ */
abstract zoomOut(options?: ZoomOptions): unknown abstract zoomOut(options?: ZoomOptions): void
/** /**
* zoom to * zoom to
* @param level 等级 * @param level 等级
* @param options 参数 * @param options 参数
*/ */
abstract zoomTo(level: number, options?: ZoomOptions): unknown abstract zoomTo(level: number, options?: ZoomOptions): void
/** /**
* 聚焦 * 聚焦
* @param location 坐标 * @param location 坐标
* @param options 参数 * @param options 参数
*/ */
abstract focus(location: Location, options?: FocusOptions): unknown abstract focus(location: Location, options?: FocusOptions): void
/** /**
* 移除覆盖物 * 移除覆盖物
......
...@@ -143,6 +143,10 @@ export interface Controls { ...@@ -143,6 +143,10 @@ export interface Controls {
bMapGallery: (options?: ControlOptions) => void bMapGallery: (options?: ControlOptions) => void
bMapGalleryexpand: (options?: ControlOptions) => void bMapGalleryexpand: (options?: ControlOptions) => void
} }
/**
* zoom配置参数(维智地图用)
*/
export interface ZoomOptions { export interface ZoomOptions {
/** 如果 false ,则没有动画效果(默认true) */ /** 如果 false ,则没有动画效果(默认true) */
animate?: boolean animate?: boolean
...@@ -154,6 +158,9 @@ export interface ZoomOptions { ...@@ -154,6 +158,9 @@ export interface ZoomOptions {
offset?: [number, number] offset?: [number, number]
} }
/**
* focus配置参数(测绘院地图只有zoom有用)
*/
export interface FocusOptions { export interface FocusOptions {
/**地图缩放等级(默认当前等级) */ /**地图缩放等级(默认当前等级) */
zoom?: number zoom?: number
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment