Class Item3D
Hierarchy
- Evented
- Item3D
Index
Constructors
Properties
Methods
Properties
_eventedParent
_eventedParentData
_listeners
_oneTimeListeners
additionalTransformationMatrix
altitude
The altitude of the item, altitude is the height of the model above the ground
altitudeReference
The altitude reference of the item, can be "ground" or "sea"
animationClips
The animation clips of the item
animationMode
The animation mode of the item, can be "continuous" or "manual"
if "continuous", the animation will play continuously
if "manual", the animation needs to be manually updated by calling the updateAnimation method
elevation
Elevation is the height of the model at ground level, this is used to calculate the altitude / transform of the item
heading
The heading of the item, in degrees
Readonlyid
The id of the item, this is used to identify the item in the layer and set in the constructor when the item is created in the Layer3D class
lngLat
The lngLat of the item
Readonlymesh
| null
| Object3D<Object3DEventMap>
| Mesh<
BufferGeometry<NormalBufferAttributes>,
Material | Material[],
Object3DEventMap,
>
| Group<Object3DEventMap> = null
The Three.js mesh, group or object3d that is being rendered
opacity
The opacity of the item
pointSize
The point size of the item (if drawing points)
scale
The scale of the item [x, y, z].
sourceOrientation
The source orientation of the item, can be "y-up" or "z-up"
transform
The default state of the item, used for UI states
Readonlyurl
The url of the item, if the item is a model, this is the url of the model
userData
Custom user data of the item This can be used to store any custom data that the user wants
wireframe
Whether the item is rendering as a wireframe
Methods
addState
Add a state to the item.
Parameters
- name: Item3DMeshUIStateName
The name of the state to add
- state: Item3DMeshUIStateProperties
The state to add
Returns Item3D
The item
- name: Item3DMeshUIStateName
fire
Parameters
- event: string | Event$1
Optionalproperties: any
Returns this
getAnimation
Get an animation by name
Parameters
- animationName: string
The name of the animation to get
Returns null | AnimationAction
The animation action or null if not found
- animationName: string
getAnimationNames
Get the names of the animations of a mesh
Returns string[]
The names of all the animations of the mesh
listens
Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.
Parameters
- type: string
The event type
Returns boolean
trueif there is at least one registered listener for specified event type,falseotherwise- type: string
modify
Modify the item with a set of options
Parameters
- options: Omit<Partial<MeshOptions>, "states" | "userData">
The options to modify the item with
Returns Item3D
The item
- options: Omit<Partial<MeshOptions>, "states" | "userData">
off
Unregister an event listener for the item
Parameters
- event: Item3DEventTypes
The event to unregister
- callback: (event: any) => void
The callback to unregister
Returns Item3D
The item
- event: Item3DEventTypes
on
Register an event listener for the item
Parameters
- event: Item3DEventTypes
The event to listen for
- callback: (event: any) => void
The callback to call when the event is triggered
Returns Subscription
The item
- event: Item3DEventTypes
once
Adds a listener that will be called only once to a specified event type.
The listener will be called first time the event fires after the listener is registered.
Parameters
- type: string
The event type to listen for.
Optionallistener: ListenerThe function to be called when the event is fired the first time.
Returns Promise<any> | Item3D
thisor a promise if a listener is not provided- type: string
pauseAnimation
Pause an animation
Parameters
- animationName: string
The name of the animation to pause
Returns undefined | Item3D
- animationName: string
playAnimation
Play an animation
Parameters
- animationName: string
The name of the animation to play
Optionalloop: "once" | "loop" | "pingPong"The loop type of the animation, can either be "loop", "once" or "pingPong"
Returns undefined | Item3D
- animationName: string
removeState
Remove a state from the item and calls the cleanup function.
Parameters
- name: Item3DMeshUIStateName
The name of the state to remove
Returns Item3D
The item
- name: Item3DMeshUIStateName
setAltitude
Set the altitude of the item
Parameters
- altitude: number
The altitude to set
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The item
- altitude: number
setAltitudeReference
Set the altitude reference of the item
Parameters
- altitudeReference: AltitudeReference
The altitude reference to set
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The item
- altitudeReference: AltitudeReference
setAnimationTime
Set the time of an animation to a specific time
Parameters
- time: number
The time to set the animation to
Returns void
- time: number
setElevation
Set the elevation of the item
Parameters
- elevation: number
The elevation to set
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The item
- elevation: number
setEventedParent
Bubble all events fired by this instance of Evented to this parent instance of Evented.
Parameters
Optionalparent: null | EventedOptionaldata: any
Returns this
setHeading
Set the heading of the item
Parameters
- heading: number
The heading to set
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The item
- heading: number
setLngLat
Set the lngLat of the item
Parameters
- lngLat: LngLat
The lngLat to set
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered when only the map is updated
Returns Item3D
The item
- lngLat: LngLat
setOpacity
Traverse a Mesh/Group/Object3D to modify the opacities of the all the materials it finds
Parameters
- opacity: number
The opacity to set
- cueRepaint: boolean = true
whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The layer
- opacity: number
setPointSize
If a mesh is a point cloud, it defines the size of the points
Parameters
- size: number
The size to set
- cueRepaint: boolean = true
whether to cue a repaint, if false, the repaint will be triggered when only the map is updated
Returns Item3D
The layer
- size: number
setRelativeScale
Set the relative scale of the item. The relative scale is the scale of the item relative to it's original scale. This is used internally to scale the item up or down from a state, but can also be called publicly to scale the item.
Parameters
- scale: number | [number, number, number]
The scale to set
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The item
- scale: number | [number, number, number]
setScale
Set the absolute scale of the item. The absolute scale is the scale of the item relative to the map.
Parameters
- scale: number | [number, number, number]
The scale to set
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The item
- scale: number | [number, number, number]
setSourceOrientation
Set the source orientation of the item
Parameters
- sourceOrientation: SourceOrientation
The source orientation to set
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The item
- sourceOrientation: SourceOrientation
setStates
- setStates(
stateUpdate:
| Item3DMeshUIStates
| ((currentState: Item3DMeshUIStates) => Item3DMeshUIStates),
): Item3DMaps the state config to the internal state Map, set up handlers and store the state and cleanup function. This is only used on Item3D construction to set the initial states but can be called publicly.
Parameters
- stateUpdate: Item3DMeshUIStates | ((currentState: Item3DMeshUIStates) => Item3DMeshUIStates)
The states to set
Returns Item3D
The item
- stateUpdate: Item3DMeshUIStates | ((currentState: Item3DMeshUIStates) => Item3DMeshUIStates)
setTransform
Set the transform of the item
Parameters
Optionaltransform: Partial<Item3DTransform>The transform to set
Returns Item3D
The item
setWireframe
Set the wireframe of the item
Parameters
Optionalwireframe: booleanwhether to set the wireframe of the item
- cueRepaint: boolean = true
Whether to cue a repaint, if false, the repaint will be triggered only when the map is updated
Returns Item3D
The item
stopAnimation
Stop an animation
Parameters
- animationName: string
The name of the animation to stop
Returns undefined | Item3D
- animationName: string
updateAnimation
Update the animation of a mesh by a delta time
Parameters
- delta: number = 0.02
The delta time to update the animation by
Returns void
- delta: number = 0.02
The additional transformation matrix of the item, this is used to apply additional transformations to the item