new Map(divid, options)
构造一个场景对象
Parameter | Type | Description | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
divid
|
String | 一个div元素id的属性值,该div元素将作为场景容器。 | ||||||||||||||||||||||||||||||||||||||||||
options
|
Object | 场景构造选项
Properties
|
Methods
showFloorsByNum(num)
显示某一楼层的图层
Parameter | Type | Description |
---|---|---|
num
|
Number | 楼层数 |
focusFloorById(id)
根据楼层id聚焦到楼层
Parameter | Type | Description |
---|---|---|
id
|
String | 楼层id |
getLayers()
获取所有的图层
Returns:
Array.<evomap.layer.Layer>: 图层数组animate(options, duration)
场景视角动画
Parameter | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
|
Properties
|
||||||||||||||||
duration
|
Number | 时间 毫秒ms |
resize()
更新渲染器的高度和宽度以及相机的纵横比
mapTo2D()
从3d视图切换为2d视图
mapTo3D()
从2d视图切换到3d视图
setCenter(center, animate)
设置中心点
Parameter | Type | Default | Description |
---|---|---|---|
center
|
Array.<Number> | 中心点 | |
animate
|
Boolean | false | 是否动画过渡,默认为false |
flyTo(des, options)
场景飞行
Parameter | Type | Description |
---|---|---|
des
|
Array.<Number> | 目的地坐标数组 |
options
|
getPixelAtCoordinate(positin)
获取某一个三维坐标对应的容器像素坐标
Parameter | Type | Description |
---|---|---|
positin
|
THREE.Vector3 |
getObjectsAtPixel(pixel, objects)
获取指定像素处,相交的物体
Parameter | Type | Description |
---|---|---|
pixel
|
||
objects
|
Returns:
*|Array:getControls()
获取所有的控件
Returns:
Array:getScene()
获取场景对象
getCamera()
获取相机对象
getRenderer()
获取渲染器对象
getResolution()
获取场景分辨率
Returns:
*|undefined:getZoom()
获取场景级别
Returns:
number|*:getCenter()
获取场景中心点
Returns:
Array:getPitch()
获取俯仰角
Returns:
Object.pitch|number:getRoll()
获取方位角
Returns:
Object.roll|number:on(type, func)
监听事件
Parameter | Type | Description |
---|---|---|
type
|
||
func
|
un(type, func)
取消监听
Parameter | Type | Description |
---|---|---|
type
|
||
func
|
addEffect()
添加后期效果
removeEffect(effect)
移除后期效果
Parameter | Type | Description |
---|---|---|
effect
|
addOverlay()
添加叠加物,添加之后叠加物会显示在场景上。
addMarker(marker, detectConflict)
添加图标、文字等
Parameter | Type | Default | Description |
---|---|---|---|
marker
|
evomap.marker.Marker | 图标类 | |
detectConflict
|
Boolean | true | 是否检测标注冲突 |
addLine(line)
添加线类型
Parameter | Type | Description |
---|---|---|
line
|
evomap.line.Line | 线对象类 |
addMesh(mesh)
添加面网格类型
Parameter | Type | Description |
---|---|---|
mesh
|
evomap.mesh.Mesh | 网格对象类 |
addLayer(图层对象类)
添加图层
Parameter | Type | Description |
---|---|---|
图层对象类
|
evomap.layer.Layer |
addObject()
往场景中添加物体,通用方法
addModel()
往场景中添加模型
getOverlays()
获取所有的overlay
Returns:
Array:removeOverlay()
从map中移除叠加物
removeAllOverlays()
移除所有叠加物。
addControl()
添加一个场景控件
removeControl(control)
移除场景控件。
Parameter | Type | Description |
---|---|---|
control
|
evomap.control.Control | 场景控件 |
clearObjects()
清空
setNightMode(callback)
设置为夜晚模式
Parameter | Type | Description |
---|---|---|
callback
|
setLightIntensity(intensity, speed)
全局设置场景相对的光照强度
Parameter | Type | Default | Description |
---|---|---|---|
intensity
|
Number | 光照强度 | |
speed
|
Number | 1 | 变化速度 |