new fengmap.FMMap(options)
构造FMMap类
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
FMMap可配置参数
|
Members
-
readonlybound
-
Properties:
Name Type Description boundfengmap.FMBound 边界
Methods
-
adjustRenderOrder(array)
-
调整渲染顺序,只调整参数中传入的图层顺序,将他们的渲染顺序按照参数传入顺序调换,不影响其他。DOM_MARKE始终在最上层不支持调整顺序。
Name Type Description arrayArray [fengmap.FMType]
-
autoRotate(){fengmap.FMAnimation}
-
地图围绕视图中心自动旋转
Name Type Description options.durationnumber 地图旋转一周所需时间 默认 5.0 秒
options.directionnumber 旋转方向, 0: 逆时针; 1:顺时针,默认0逆时针
Returns:
Type Description fengmap.FMAnimation 动画单元 Example
let animation = map.autoRotate(); animation.finish(); // 强制完成 animation.pause(); // 暂停 animation.play(); // 播放 animation.resume(); // 重置 animation.stop(); // 停止 -
changeOverviewMode(options)
-
切换全览模式
Name Type Description optionsjson 参数集合
Name Type Description overviewModefengmap.FMOverviewMode 参数集合
buildingIDsArray 建筑ID集合
-
clearThemeExtension()
-
清空主题扩展
-
dispose()
-
废置地图对象
-
enterBuilding(options)
-
进入建筑
Name Type Description optionsjson 参数集合
Name Type Description buildingIDString 建筑ID
finishfunction 完成回调函数
-
exitBuilding(options)
-
退出建筑
Name Type Description optionsjson 参数集合
Name Type Description finishfunction 完成回调函数
-
getBound(){Object}
-
获取地图界限
- Deprecated
- 3.1.5 版本及以后版本将不可用
Returns:
Name Type Description boundObject 界限 Name Type Description maxObject 最大坐标 Name Type Description xnumber 最大x坐标 ynumber 最大y坐标 minObject 最小坐标 Name Type Description xnumber 最小x坐标 ynumber 最小y坐标 centerObject 中心坐标 Name Type Description xnumber 中心x坐标 ynumber 中心y坐标 sizeObject 尺寸 Name Type Description xnumber x方向尺寸 ynumber y方向尺寸 -
getBuilding(buildingID){FMBuilding|null}
-
获取建筑
Name Type Description buildingIDstring 建筑ID
Returns:
Type Description FMBuilding | null building 返回指定buildingID的建筑 -
getBuildings()
-
获取所有建筑
-
getCenter(){Object}
-
获取视图中心的地图坐标
Returns:
Type Description Object 地图坐标 -
getCollisionOrder()
-
获取部分覆盖物避让排序
Returns:
避让排序分组 -
getFloor(level){fengmap.FMFloor}
-
获取楼层
Name Type Description levelint 楼层等级
Returns:
Type Description fengmap.FMFloor 楼层 -
getFloorInfos(){Array}
-
获取所有楼层的信息
Returns:
Type Description Array -
getFloorSpace(){number}
-
获取楼层间距
Returns:
Type Description number 楼层间距 -
getInteracations(){fengmap.FMInteracations}
-
获取地图交互控制器
Returns:
Type Description fengmap.FMInteracations interacations 交互控制器 Example
let interacation = map.getInteracations(); interacation.enableDrag = true; interacation.enableRotate= true; interacation.enableTilt = true; interacation.enableZoom = true; -
getLevel(){number}
-
获取地图聚焦楼层等级
Returns:
Type Description number level 楼层等级 -
getLevels(){Array}
-
获取地图所有楼层等级
Returns:
Type Description Array 楼层等级 -
getMarkerGroup(){Object}
-
获取地图覆盖物组
Returns:
Type Description Object 地图覆盖物组 -
getNodes(results){Array}
-
获取地图节点, 如果查询内容不存在FMNode, 返回空数组
Name Type Description resultsArray 搜索查询的结果
Returns:
Type Description Array nodes 地图节点集合 -
getRenderOrder(){Array}
-
获取部分覆盖物的渲染顺序
Returns:
Type Description Array [fengmap.FMType] 渲染顺序 -
getRotation(){int}
-
获取视图旋转角度
Returns:
Type Description int 地图旋转角度 -
getState(){Object}
-
获取视图状态
Returns:
Type Description Object state 地图状态码 -
getTilt(){int}
-
获取视图倾斜角度
Returns:
Type Description int 地图倾斜角度 -
getViewMode(){int}
-
获取视图模式
Returns:
Type Description int 视图模式 -
getVisibleLevels(){Array}
-
获取显示楼层
Returns:
Type Description Array arr 显示楼层数组 -
getZoom(){number}
-
获取地图当前缩放级别
Returns:
Type Description number 缩放级别 -
getZoomRange(){Array}
-
获取地图缩放级别范围
Returns:
Type Description Array 缩放级别范围 -
off(type, callback)
-
地图事件注销
Name Type Description typestring 事件类型
callbackfunction 回调函数
-
on(type, callback)
-
地图事件注册
Name Type Description typestring 事件类型
callbackfunction 回调函数
-
pickFilterFunction(){boolean}
-
过滤设置可点击拾取函数。可通过过滤设置模型的可点击拾取和不可点击拾取。
Returns:
Type Description boolean 该方法返回true表示支持点击拾取,false表示不可点击拾取 Example
//过滤不允许点击的地图元素,设置为true为允许点击,设置为false为不允许点击 map.pickFilterFunction = function (event) { return event.type !== fengmap.FMType.MODEL; } -
setBackgroundColor(color, alpha)
-
设置地图背景颜色
Name Type Description colorint | string 颜色值0xFF0000 | '#FF0000'
alphanumber 透明度,取值范围:0.0 - 1.0
-
setCenter(options)
-
设置视图中心的地图坐标
Name Type Description optionsObject 地图移动参数
Name Type Description xnumber 地图x坐标
ynumber 地图y坐标
animateboolean true:开启动画;false:不开启动画. 默认false
durationnumber 动画持续时间
finishfunction 动画完成回调函数
-
setCollisionOrder(collisionOrder)
-
设置部分覆盖物避让排序
Name Type Description collisionOrderArray 不同marker类避让排序分组, 默认值: [TEXT_MARKER, IMAGE_MARKER]
1. 内侧数组每组组成一套避让检查, 外侧数组进行分组; 2. 组与组之间避让关系互不影响; 不支持重复设置同一个marker类, 如果重复设置, 仅保留第一个, 后面设置的marker类将会被滤掉; 3. 仅支持传入TEXT_MARKER, IMAGE_MARKERmarker类, 如果传入其他类, 则无效果, 也无报错; -
setFitView(bound, options)
-
设置合适的视图
Name Type Description boundObject optionsjson 参数集合
Name Type Description animateBoolean true 动画执行 false 不带动画执行 默认 true
finishfunction 动画执行完成回调函数
-
setFloorSpace(value)
-
楼层间距
Name Type Description valuenumber 间距
-
setHighlightColor(color)
-
设置高亮颜色
Name Type Description color -
setLabelField(labelField)
-
设置label显示的字段
Name Type Description labelFieldfengmap.FMLabelField label显示的字段,默认 fengmap.FMLabelField.NAME
-
setLevel(options)
-
设置地图聚焦楼层等级,如果聚焦楼层不在显示楼层范围内,则修改显示楼层,修改规则:1. 显示单楼层时,则切换显示楼层为聚焦楼层 2. 显示楼层为多层时,则把聚焦楼层添加到显示楼层中
Name Type Description optionsObject 设置聚焦楼层参数
Name Type Description levelint 楼层等级
animateboolean 是否开启动画,true:开启;false:不开启.默认开启
durationnumber 动画持续时间
callbackfunction 开启动画时,该函数返回当前执行的动画单元,动画单元可以对当前动画进行基本操作,详细 { @link fengmap.FMAnimation }
finishfunction 动画完成回调函数
-
setRenderOrder(array)
-
设置渲染顺序 默认顺序为:[EXTENT,EXTERNAL_MODEL,MODEL,DYNAMIC_MODEL_MARKER,EXTRUDE_MARKER,POLYGON_MARKER,HEAT_MAP_MARKER,LINE_MARKER,FACILITY,LABEL,IMAGE_MARKER,TEXT_MARKER,LOCATION_MARKER],DOM_MARKE始终在最上层不支持调整顺序。 (在深度检测开启后无效,如FMExtrudeMarker、FMLineMarker、FMDynamicModel。一般作用于覆盖物layer之间的显示顺序)
Name Type Description arrayArray [fengmap.FMType]
-
setRotation(options)
-
旋转视图到指定角度
Name Type Description optionsObject 旋转参数
Name Type Description rotationint 旋转角度
animateboolean 是否开启动画,true:开启;false:不开启. 默认 true
durationnumber 动画持续时间
finishfunction 动画完成回调函数
-
setState(state, options)
-
设置视图状态
Name Type Description stateObject 地图状态码
optionsObject 参数
Name Type Description animateBoolean true 动画执行 false 不带动画执行 默认 true
finishfunction 动画执行完成回调函数
-
setTheme(themeID)
-
设置主题
Name Type Description themeIDstring -
setThemeExtension(data)
-
设置主题扩展
Name Type Description datajson 主题数据
-
setTilt(options)
-
倾斜视图到指定角度
Name Type Description optionsObject 倾斜参数
Name Type Description tiltint 倾斜角度
animateboolean 是否开启动画,true:开启;false:不开启. true
durationnumber 动画持续时间
finishfunction 动画完成回调函数
-
setViewMode(options)
-
设置视图模式
Name Type Description optionsObject Name Type Description modeint 视图模式
animateint 是否开启动画,默认 true
finishint 完成回调
Example
setViewMode({mode:fengmap.FMViewMode.MODE_3D}) -
setVisibleLevels(levels, callback)
-
设置显示楼层
Name Type Description levelsArray 楼层id数组
callbackfunction 回调函数
Example
setVisibleLevels([1,2]); -
setZoom(options)
-
缩放地图到指定级别
Name Type Description optionsObject 地图缩放参数
Name Type Description zoomnumber 地图缩放级别
animateboolean 是否开启动画,true:开启;false:不开启.默认不开启
durationnumber 动画持续时间
finishfunction 动画完成回调函数
-
setZoomRange(range)
-
设置地图缩放级别范围
Name Type Description rangeArray 缩放级别范围
-
zoomIn()
-
放大地图
-
zoomOut()
-
缩小地图
Events
-
buildingEntered
-
进入建筑事件
-
buildingExited
-
退出建筑事件
-
buildingLoaded
-
建筑加载完成事件
-
click
-
鼠标点击事件
Example
{ type:'click', // 事件类型 level:1,楼层 buildingID:"1",建筑ID,园区为null coords:{x:12619616.66,y:2621878.60}, // 点击到的地图坐标 mouseEvent:{}, // MouseEvent 鼠标事件 targets:[], // 所有点击到的地图节点(按距离排序) level: 1, // 所在的楼层 } -
externalFirstLoaded
-
外部模型首次加载完成事件
-
hover
-
鼠标悬停事件
-
info
-
地图运行信息
Name Type Description eventObject 事件返回参数
Name Type Description typestring 事件类型
InfoMode信息内容,信息内容请参照 fengmap.FMInfoMode
Example
map.on("info", function(event){ if (fengmap.FMInfoMode.THEME_DATA_ERROR === event.InfoMode) { console.log("主题数据加载错误"); } }); -
levelChanged
-
聚焦楼层改变事件,含子聚焦楼层改变
-
loaded
-
地图加载完成事件
-
move
-
地图移动事件
-
progress
-
显示进度条
Name Type Description eventObject 事件返回参数
Name Type Description typestring 事件类型
progressBarnumber 进度值
-
update
-
地图更新事件
-
viewChanged
-
视图改变事件
-
viewModeChanged
-
视图模式改变事件
-
visibleLevelsLoaded
-
地图可见楼层加载完成事件,含子建筑楼层加载完成
-
zoom
-
地图缩放事件