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

my-map提取默认数据

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