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

my-map提取默认数据

parent 02f564cd
......@@ -10,88 +10,92 @@ import {
LayerOption,
} from './types'
const defaultListeners = {
load: (cb: CallBack) => {
console.error('on:此地图不存在 load 监听事件!')
},
zoom: (cb: CallBack) => {
console.error('on:此地图不存在 zoom 监听事件!')
},
move: (cb: CallBack) => {
console.error('on:此地图不存在 move 监听事件!')
},
blur: (cb: CallBack) => {
console.error('on:此地图不存在 blur 监听事件!')
},
focus: (cb: CallBack) => {
console.error('on:此地图不存在 focus 监听事件!')
},
drag: (cb: CallBack) => {
console.error('on:此地图不存在 drag 监听事件!')
},
resize: (cb: CallBack) => {
console.error('on:此地图不存在 resize 监听事件!')
},
click: (cb: CallBack) => {
console.error('on:此地图不存在 click 监听事件!')
},
dblclick: (cb: CallBack) => {
console.error('on:此地图不存在 dblclick 监听事件!')
},
mousewheel: (cb: CallBack) => {
console.error('on:此地图不存在 mousewheel 监听事件!')
},
}
const defaultControls = {
home: () => {
console.error('set:此地图不存在 home 控件!')
},
zoom: () => {
console.error('set:此地图不存在 home 控件!')
},
compass: () => {
console.error('set:此地图不存在 home 控件!')
},
scale: () => {
console.error('set:此地图不存在 scale 控件!')
},
fullScreen: () => {
console.error('set:此地图不存在 fullScreen 控件!')
},
layerList: () => {
console.error('set:此地图不存在 layerList 控件!')
},
measureLine: () => {
console.error('set:此地图不存在 measureLine 控件!')
},
measureArea: () => {
console.error('set:此地图不存在 measureArea 控件!')
},
basemapToggle: () => {
console.error('set:此地图不存在 basemapToggle 控件!')
},
underguroundSwitch: () => {
console.error('set:此地图不存在 underguroundSwitch 控件!')
},
bMapGallery: () => {
console.error('set:此地图不存在 bMapGallery 控件!')
},
bMapGalleryexpand: () => {
console.error('set:此地图不存在 bMapGalleryexpand 控件!')
},
}
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
protected _controls: Controls
protected _layers: Layers
protected _listeners: Listeners = defaultListeners
protected _controls: Controls = defaultControls
protected _layers: Layers = defaultLayers
constructor(instance: any) {
this.map = instance
this._listeners = {
load: (cb: CallBack) => {
console.error('on:此地图不存在 load 监听事件!')
},
zoom: (cb: CallBack) => {
console.error('on:此地图不存在 zoom 监听事件!')
},
move: (cb: CallBack) => {
console.error('on:此地图不存在 move 监听事件!')
},
blur: (cb: CallBack) => {
console.error('on:此地图不存在 blur 监听事件!')
},
focus: (cb: CallBack) => {
console.error('on:此地图不存在 focus 监听事件!')
},
drag: (cb: CallBack) => {
console.error('on:此地图不存在 drag 监听事件!')
},
resize: (cb: CallBack) => {
console.error('on:此地图不存在 resize 监听事件!')
},
click: (cb: CallBack) => {
console.error('on:此地图不存在 click 监听事件!')
},
dblclick: (cb: CallBack) => {
console.error('on:此地图不存在 dblclick 监听事件!')
},
mousewheel: (cb: CallBack) => {
console.error('on:此地图不存在 mousewheel 监听事件!')
},
}
this._controls = {
home: () => {
console.error('set:此地图不存在 home 控件!')
},
zoom: () => {
console.error('set:此地图不存在 home 控件!')
},
compass: () => {
console.error('set:此地图不存在 home 控件!')
},
scale: () => {
console.error('set:此地图不存在 scale 控件!')
},
fullScreen: () => {
console.error('set:此地图不存在 fullScreen 控件!')
},
layerList: () => {
console.error('set:此地图不存在 layerList 控件!')
},
measureLine: () => {
console.error('set:此地图不存在 measureLine 控件!')
},
measureArea: () => {
console.error('set:此地图不存在 measureArea 控件!')
},
basemapToggle: () => {
console.error('set:此地图不存在 basemapToggle 控件!')
},
underguroundSwitch: () => {
console.error('set:此地图不存在 underguroundSwitch 控件!')
},
bMapGallery: () => {
console.error('set:此地图不存在 bMapGallery 控件!')
},
bMapGalleryexpand: () => {
console.error('set:此地图不存在 bMapGalleryexpand 控件!')
},
}
this._layers = {
point: () => console.error('add:此地图不存在 point 覆盖物!'),
line: () => console.error('add:此地图不存在 line 覆盖物!'),
}
}
/**
......@@ -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