CameraMarker(CMOptions)

new CameraMarker(CMOptions)

a marker which visualizes a camera.

Parameters:
Name Type Description
CMOptions object
Properties
Name Type Attributes Default Description
camToEarth Array.<number>

the marker to earth matrix, specify the position and orientation. Length 16.

sandbox Sandbox

the scene

showNear bool <optional>
true

whether to show near plane

showFar bool <optional>
false

whether to show far plane

color any <optional>
new THREE.Color(0xff0000)

the color of the cone, defaultly red

fov number <optional>
45

the fov of the camera

near number <optional>
0.00001

the near plane of the camera

far number <optional>
0.01

the far plane of the camera

aspect number <optional>
1

the aspect ratio of the camera

See:
Example

construction

 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

set the aspect ratio of the camera marker

Example

set the aspect

 cameraMarker.aspect = 1.2
 cameraMarker.aspect = cameraMarker.aspect * 1.01

camToEarth

update the marker's position and orientation using matrix

Example

set camToEarth

 // 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

change the color in the cone formed by near plane and camera's origin

Example

change the color

 cameraMarker.color = new THREE.Color(0x0000ff) // change the color of the cone to blue

euler :object

The orientation in Eular angle representation. { x: rotation angle around X axis in radian, y: radian, z: radian, order: rotation order, default 'XYZ'}. Use this instead of orientation if you are not familar with the math.

Overrides:
See:
Example

Set orientation by Eular angles

 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

Set the far plane of the camera marker

Example

change far

 cameraMarker.far = 0.01
 cameraMarker.far = cameraMarker.far / 10

farInMeter

The distance (in meter) between the far plane and the camera marker.

Example

change far plane (in meter)

 cameraMarker.farInMeter = 100
 cameraMarker.farInMeter = cameraMarker.farInMeter / 10

fov

set the fov of the camera marker

Example

set the fov

 cameraMarker.fov = 60
 cameraMarker.fov = cameraMarker.fov + 10

readonly ID :string

Get the unique id.

Inherited From:

interactable :bool

Set if the marker is interactable. Set to true to respond to mouse events.

Overrides:
Example

Set interactable

 marker.interactable = true // make this marker interactable
 marker.interactable = !marker.interactable // flip interactable status

name :string

A string of name.

Overrides:
Example

Set name

 marker.name = 'this marker' // set name as 'this marker'
 marker.name = marker.name + ' suffix' // extend the name

near

set the near plane of the camera marker

Example

change near

 cameraMarker.near = 0.00001
 cameraMarker.near = cameraMarker.near * 10

orientation :object

Set the rotation by an uniform quaternion {x, y, z, w}. Use eular instead if you are not sure how to use this.

Overrides:
See:
Example

Set orientation

 marker.orientation = {x: 0, y: 0, z: 0, w: 1}

position :LngLatAlt

Change the current position {lng, lat, alt}.

Overrides:
Example

Set position

 marker.position = {
   lng: 113.93977612840078,
   lat: 22.5364271949327,
   alt: 12.3
 }

scale :number

Set the scale of the marker.

Overrides:
Example

Set scale

 marker.scale = 2.0 // set scale to 2.0
 marker.scale = marker.scale * 2.0 // make it two times bigger

showFar

whether to show far plane

Example

change showFar

 cameraMarker.showFar = false // near plane not shown
 cameraMarker.showFar = !cameraMarker.showFar // flip status

showNear

whether to show near plane

Example

change showNear

 cameraMarker.showNear = false // near plane not shown
 cameraMarker.showNear = !cameraMarker.showNear // flip status

visColor

Hexadecimal color of the light.

Example

change the light color

 cameraMarker.visColor = 0xff0000

visDecay

The amount the light dims along the distance of the light. Default is 1.

Example

change the light decay

 cameraMarker.visDecay = 0.1

visible :bool

Set the visibility of the marker.

Overrides:
Example

Set visible

 marker.visible = false // make this marker invisible
 marker.visible = !marker.visible // flip visible status

visIntensity

Numeric value of the light's strength/intensity. Default is 1. For visibility analysis uses, it is recommended to be above 50.

Example

change the light intensity

 cameraMarker.visIntensity = 2

visPenumbra

Percent of the spotlight cone that is attenuated due to penumbra. Takes values between zero and 1. Default is 0.05.

Example

change the light penumbra

 cameraMarker.visPenumbra = 0.1

x :number

Set the scale of the marker in x direction.

Overrides:
Example

Set scale x

 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

Set the scale of the marker in y direction.

Overrides:
Example

Set scale y

 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

Set the scale of the marker in z direction.

Overrides:
Example

Set scale z

 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)

Propagated event, new frame being rendered.

Parameters:
Name Type Description
options object
Inherited From:

abstract destruct()

Remove this marker from the sandbox and release resources occupied by it.

Inherited From:
Example

Destruct a marker

 marker.destruct()

detachControl()

Detach and hide the control gizmo of the marker

Inherited From:
Example

Detach control

 marker.detachControl()

dim()

Un-highlight the marker. (hide the blue fence of the marker)

Inherited From:
Example

Un-highlight

 marker.dim()

light()

Highlight the marker. (show the blue fence of the marker)

Inherited From:
Example

Highlight

 marker.light()

lookAt(pose)

Change the target of the camera marker.

Parameters:
Name Type Description
pose LngLatAlt

off(eventType, handler)

Un-register the handler from an event.

Parameters:
Name Type Description
eventType string
handler function
Inherited From:
Example

Un-register interaction events

 marker.off('click')
 marker.off('mouseover')
 marker.off('mouseenter')
 marker.off('mouseleave')

on(eventType, handler)

Register an event with a handler. Note: an event can only has one handler.

Parameters:
Name Type Description
eventType string

'click', 'mouseover', 'mouseenter', 'mouseleave'

handler function

event handler

Inherited From:
Example

Register interaction events

 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}

get the realigned orientation from horizontal points

Parameters:
Name Type Default Description
pts Array.<LngLatAlt>
flip bool false
Returns:
Quaternion
Inherited From:

abstract sceneUpdated(options)

Propagated periodic event handler. Triggered when scene content is updated.

Parameters:
Name Type Description
options object
Inherited From:

setControlMode(mode)

Set the mode of control gizmo

Parameters:
Name Type Description
mode string

the mode of the control gizmo 'translate', 'rotate'

Inherited From:
Example

Set the mode of the control

 marker.setControlMode('translate')
 marker.setControlMode('rotate')

shapeToEarth() → {Matrix4}

Transformation matrix from shapeHolder-space to earth-space

Returns:
Matrix4
Inherited From:

shapeToScene() → {Matrix4}

Transformation matrix from shapeHolder-space to scene-root

Returns:
Matrix4
Inherited From:

showControl(mode)

Play the {index} patrol route of the marker

Parameters:
Name Type Description
mode string

the mode of the control gizmo: 'translate', 'rotate'

Inherited From:
Example

Show control

 marker.showControl('translate') // show control used for translate
 marker.showControl('rotate') // show control used for rotate

abstract updateVisibility(options)

Propagated event, screen visibility is being updated.

Parameters:
Name Type Description
options object
Inherited From: