control~MiniMap(layer, options)

鹰眼地图控件,提供比主地图更大的视野范围。地图缩放、平移、旋转时鹰眼的范围随之更改,但鹰眼图本身不会旋转和倾斜。

Summary

Methods:
activate

激活鹰眼地图控件

deactivate

禁用鹰眼地图控件

destroy

销毁控件,释放占用的内存。

getControlType

返回控件的类型

setClassName

设置控件面板样式类名

setPosition

设置控件面板在地图右下角的边界距离

setStyle

设置控件面板样式

Constructor

new MiniMap(layer, options)

Parameters:
Name Type Default Description
layer module:layer~Layer null

在鹰眼地图控件中展示的图层

options Object

可选项

Name Type Description
miniMapMiniLevel Number

鹰眼地图的默认最小缩放级别,建议取一个合适的数值使miniMap的最小级别范围是你所感兴趣的范围,默认为0级

containerDomStyle String

鹰眼地图控件CSS样式,优先级高于containerDomClass。containerDomStyle和containerDomClass均不指定,
则使用默认值:320*180 2px红色实线矩形框,绝对定位右下角。

containerDomClass String

鹰眼地图控件CSS样式类名,例:"minimap-container",优先级低于containerDomStyle。如果css属性需要高于style,对具体属性使用 !important 提升优先级

extentStyle module:style~Style

鹰眼地图控件内部extent矩形样式,默认紫色 1px实线框

showBtnStyle String

展开鹰眼地图控件的按钮样式,优先级高于showBtnClass。showBtnStyle和showBtnClass均不指定,
则使用默认值:20*20绝对定位右下角。

showBtnClass String

展开鹰眼地图控件的按钮样式类名,例:"minimap-show-btn",优先级低于showBtnStyle。如果css属性需要高于style,对具体属性使用 !important 提升优先级

hideBtnStyle String

隐藏鹰眼地图控件的按钮样式,优先级高于hideBtnClass。hideBtnStyle和hideBtnClass均不指定,
则使用默认值:20*20绝对定位左上角。

hideBtnClass String

隐藏鹰眼地图控件的按钮样式类名,例:"minimap-hide-btn",优先级低于hideBtnStyle。如果css属性需要高于style,对具体属性使用 !important 提升优先级

showBtnText String | HTMLElement

展开鹰眼地图控件的文字,默认为‘+’

hideBtnText String | HTMLElement

隐藏鹰眼地图控件的文字,默认为‘-’

offsetZoom Number

主地图比鹰眼地图大的级别数,默认为4

hidden Boolean

是否隐藏鹰眼。默认为false,不隐藏鹰眼。

Example
const tmsLayer = new hmap.layer.TMS("TMS", tmsURL, tmsOptions);
const miniMap = new hmap.control.MiniMap(tmsLayer);
map.addControl(miniMap);

Methods

activate()

激活鹰眼地图控件

deactivate()

禁用鹰眼地图控件

destroy()

销毁控件,释放占用的内存。

Example
miniMap.destroy();

getControlType() → {String}

返回控件的类型

Returns:
String -

控件类型的名称。

setClassName(className)

设置控件面板样式类名

Parameters:
Name Type Description
className String

要设置的样式类名

setPosition(position)

设置控件面板在地图右下角的边界距离

Parameters:
Name Type Description
position module:basetype~Pixel

像素坐标

Throws:

当参数position类型不对时,抛出异常

Example
MiniMap.setPosition(new hmap.basetype.Pixel(50,50))

setStyle(style)

设置控件面板样式

Parameters:
Name Type Description
style String

要设置的css样式字符串