new InfoWindow(object, param) → {InfoWindow}
构造函数
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object |
Object | 需要标注的地理对象 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
param |
Object | 参数列表
Properties
|
Returns:
InfoWindow - InfoWindow对象Extends
- THING.BaseObject
Members
-
customHtml :String
自定义信息框的html文本,仅当 type='custom'时生效
-
Example
//设置自定义信息框的html文本为 注{{}}包住的是需要标注对象的userData中的属性名称 //比如被标注物体的userData.name='花家地南街' 该例子信息框的html文本为'<div>站名:花家地南街</div>' infoWindow.customHtml = '<div>站名:{{name}}</div>';
-
displayMode :THING.EARTH.DisplayMode
信息框的显示方式,有包括DisplayMode.MouseEnter(悬浮显示)、DisplayMode.Click(点击显示)、DisplayMode.Always(一直显示) DisplayMode.None(不显示)四种类型
-
Example
infoWindow.displayMode = THING.EARTH.DisplayMode.Click; //设置信息框的显示方式为点击显示
-
fieldData :Array
信息框中显示的信息
-
Example
//设置信息框的显示'OBJECTID'、'NAME'两个字段的信息,字段别名分别为'编号'、'姓名',点击姓名字段,在当前页面弹出400*300大小的页面 infoWindow.fieldData = [ {field:'OBJECTID',alias:'编号' }, {field:'NAME',alias:'姓名',url:'https://www.baidu.com', target:'current' ,width:400,height:300} ]; //fieldData中每一项都是一个对象 //例如 {field:'OBJECTID',alias:'编号',url:'https://www.baidu.com', target:'current' ,width:400,height:300 }, //field代表需要标注的字段名 可以在被标注物体的userData中找到 //alias代表在标注中显示该字段名的别名,该例子中,显示'编号' //url 如果设置url,则点击标注中这一条记录会跳转到该url地址 //target 在设置url的情况下,代表跳转到新页面还是在当前页打开 target取值有两种 一种是current代表当前页 一种是new代表新页面 //width 在设置url并且target为current时,代表在当前页弹出口的宽度 默认800 //height 在设置url并且target为current时,代表在当前页弹出口的高度 默认600
-
style :THING.EARTH.InfoWindowStyle
信息框的样式,有Default(默认)、Blue(蓝色) 和 White(白色)
-
- Default Value:
- Default
Example
infoWindow.style = THING.EARTH.InfoWindowStyle.Blue; //设置信息框的样式是蓝色
-
title :String
信息框的标题
-
- Default Value:
- 详细信息
Example
infoWindow.title = '基本信息'; //设置信息框的标题是'基本信息'
-
type :THING.EARTH.InfoWindowType
信息框的类型,有 Standard(标准) 和 Custom(自定义) 两种类型, type为Standard会读取fieldData中的信息设置弹窗内容 type为Custom 会根据customHtml设置弹窗内容
-
- Default Value:
- THING.EARTH.InfoWindowType.Standard
Example
infoWindow.type = THING.EARTH.InfoWindowType.Custom; //设置信息框的类型为“自定义类型”