new CameraMarker(CMOptions)
使相机可视化的标记。
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CMOptions |
object |
Properties
|
Example
let cameraMarker = new altizure.CameraMarker({
sandbox: sandbox,
camToEarth: [
-0.06275835503639593, 0.7649967940136936, 0.6409690273499146, 0,
0.9718982451244642, 0.19284429450863955, -0.1349995525898201, 0,
-0.22688144480567865, 0.6144843230093303, -0.7556016323292666, 0,
0.8430508839622491, 0.3831657154430671, -0.3743447899092847, 0.9999999999999998
]
})
Extends
Members
-
aspect
-
设置相机标记的宽高比
Example
cameraMarker.aspect = 1.2 cameraMarker.aspect = cameraMarker.aspect * 1.01
-
camToEarth
-
使用矩阵更新标记的位置和方向
Example
// this will set the position and orietation cameraMarker.camToEarth = [ -0.06275835503639593, 0.7649967940136936, 0.6409690273499146, 0, 0.9718982451244642, 0.19284429450863955, -0.1349995525898201, 0, -0.22688144480567865, 0.6144843230093303, -0.7556016323292666, 0, 0.8430508839622491, 0.3831657154430671, -0.3743447899092847, 0.9999999999999998 ]
-
color
-
改变由近平面和相机原点形成的锥体中的颜色
Example
cameraMarker.color = new THREE.Color(0x0000ff) // change the color of the cone to blue
-
euler :object
-
Eular角度表示中的方向。 {x:绕X轴以弧度为单位的旋转角度, y:弧度, z:弧度, 顺序:旋转顺序,默认'XYZ'}。 用这个代替
方向
如果你不熟悉数学。- Overrides:
- See:
Example
marker.euler = {x: Math.PI/6, y: Math.PI/4, z: Math.PI/3} // rotate around X-axis for 30 degree; Y for 45 degree; Z for 60 degree, in that order. marker.euler = {y: Math.PI/2} // rotate around Y-axis for 90 degree.
-
far
-
设置相机标记的远平面
Example
cameraMarker.far = 0.01 cameraMarker.far = cameraMarker.far / 10
-
farInMeter
-
远平面和相机标记之间的距离(以米为单位)。
Example
cameraMarker.farInMeter = 100 cameraMarker.farInMeter = cameraMarker.farInMeter / 10
-
fov
-
设置相机标记的fov
Example
cameraMarker.fov = 60 cameraMarker.fov = cameraMarker.fov + 10
-
readonly ID :string
-
获取唯一的ID。
- Inherited From:
-
interactable :bool
-
如果标记是可交互的,则设置。设置为true以响应鼠标事件。
- Overrides:
Example
marker.interactable = true // make this marker interactable marker.interactable = !marker.interactable // flip interactable status
-
name :string
-
一串名字。
- Overrides:
Example
marker.name = 'this marker' // set name as 'this marker' marker.name = marker.name + ' suffix' // extend the name
-
near
-
设置相机标记的近平面
Example
cameraMarker.near = 0.00001 cameraMarker.near = cameraMarker.near * 10
-
orientation :object
-
通过均匀四元数{x,y,z,w}设置旋转。 使用
EULAR
相反,如果你不知道如何使用这个。- Overrides:
- See:
Example
marker.orientation = {x: 0, y: 0, z: 0, w: 1}
-
position :LngLatAlt
-
改变当前位置{lng,lat,alt}。
- Overrides:
Example
marker.position = { lng: 113.93977612840078, lat: 22.5364271949327, alt: 12.3 }
-
scale :number
-
设置标记的比例。
- Overrides:
Example
marker.scale = 2.0 // set scale to 2.0 marker.scale = marker.scale * 2.0 // make it two times bigger
-
showFar
-
是否显示远程飞机
Example
cameraMarker.showFar = false // near plane not shown cameraMarker.showFar = !cameraMarker.showFar // flip status
-
showNear
-
是否显示近平面
Example
cameraMarker.showNear = false // near plane not shown cameraMarker.showNear = !cameraMarker.showNear // flip status
-
visColor
-
灯光的十六进制颜色。
Example
cameraMarker.visColor = 0xff0000
-
visDecay
-
光量沿着光线的距离变暗。缺省值是1。
Example
cameraMarker.visDecay = 0.1
-
visible :bool
-
设置标记的可见性。
- Overrides:
Example
marker.visible = false // make this marker invisible marker.visible = !marker.visible // flip visible status
-
visIntensity
-
光的强度/强度的数值。缺省值是1。 对于可见性分析用途,建议高于50。
Example
cameraMarker.visIntensity = 2
-
visPenumbra
-
由于半影而衰减的聚光锥的百分比。取值在0和1之间。默认值为0.05。
Example
cameraMarker.visPenumbra = 0.1
-
x :number
-
在x方向上设置标记的比例。
- Overrides:
Example
marker.x = 2.0 // set scale x to 2.0 marker.x = marker.x * 2.0 // make it two times bigger in x direction
-
y :number
-
在y方向上设置标记的比例。
- Overrides:
Example
marker.y = 2.0 // set scale y to 2.0 marker.y = marker.y * 2.0 // make it two times bigger in y direction
-
z :number
-
在z方向上设置标记的比例。
- Overrides:
Example
marker.z = 2.0 // set scale z to 2.0 marker.z = marker.z * 2.0 // make it two times bigger in z direction
Methods
-
abstract animate(options)
-
传播的事件,正在渲染的新帧。
Parameters:
Name Type Description options
object - Inherited From:
-
abstract destruct()
-
从沙箱中移除该标记并释放占用的资源。
- Inherited From:
Example
marker.destruct()
-
detachControl()
-
分离并隐藏标记的控件小控件
- Inherited From:
Example
marker.detachControl()
-
dim()
-
Un-highlight the marker. (hide the blue fence of the marker)
- Inherited From:
Example
marker.dim()
-
light()
-
Highlight the marker. (show the blue fence of the marker)
- Inherited From:
Example
marker.light()
-
lookAt(pose)
-
更改相机标记的目标。
Parameters:
Name Type Description pose
LngLatAlt -
off(eventType, handler)
-
从事件中取消注册处理程序。
Parameters:
Name Type Description eventType
string handler
function - Inherited From:
Example
marker.off('click') marker.off('mouseover') marker.off('mouseenter') marker.off('mouseleave')
-
on(eventType, handler)
-
用处理程序注册一个事件。 注意:一个事件只能有一个处理程序。
Parameters:
Name Type Description eventType
string 'click','mouseover','mouseenter','mouseleave'
handler
function 事件处理器
- Inherited From:
Example
marker.on('click', function (event) { console.log('click on marker ', marker, event) }) marker.on('mouseover', function (event) { console.log('mouse over marker ', marker, event) }) marker.on('mouseenter', function (event) { console.log('mouse enter marker ', marker, event) }) marker.on('mouseleave', function (event) { console.log('mouse leave marker ', marker, event) }) marker.interactable = true // the marker must be interactable for events to take effects
-
orientationByHorizontalPoints(pts, flip) → {Quaternion}
-
从水平点得到重新定位的方向
Parameters:
Name Type Default Description pts
Array.<LngLatAlt> flip
bool false Returns:
Quaternion- Inherited From:
-
abstract sceneUpdated(options)
-
传播的定期事件处理程序。当场景内容更新时触发。
Parameters:
Name Type Description options
object - Inherited From:
-
setControlMode(mode)
-
设置控件Gizmo的模式
Parameters:
Name Type Description mode
string 控件gizmo'translate','rotate'的模式
- Inherited From:
Example
marker.setControlMode('translate') marker.setControlMode('rotate')
-
shapeToEarth() → {Matrix4}
-
从shapeHolder-space到地球空间的变换矩阵
Returns:
Matrix4- Inherited From:
-
shapeToScene() → {Matrix4}
-
从shapeHolder-space到scene-root的变换矩阵
Returns:
Matrix4- Inherited From:
-
showControl(mode)
-
播放标记的{index}巡视路线
Parameters:
Name Type Description mode
string 控件gizmo的模式:'translate','rotate'
- Inherited From:
Example
marker.showControl('translate') // show control used for translate marker.showControl('rotate') // show control used for rotate
-
abstract updateVisibility(options)
-
传播事件,屏幕可见性正在更新。
Parameters:
Name Type Description options
object - Inherited From: