Class Item3D

Hierarchy

  • Evented
    • Item3D
Index

Constructors

  • Parameters

    • parentLayer: Layer3D
    • __namedParameters: Item3DConstructorOptions

    Returns Item3D

Properties

_eventedParent: Evented
_eventedParentData: any
_listeners: Listeners
_oneTimeListeners: Listeners
additionalTransformationMatrix: Matrix4

The additional transformation matrix of the item, this is used to apply additional transformations to the item

altitude: number = 0

The altitude of the item, altitude is the height of the model above the ground

altitudeReference: AltitudeReference = AltitudeReference.GROUND

The altitude reference of the item, can be "ground" or "sea"

animationClips: null | AnimationClip[] = null

The animation clips of the item

animationMode: AnimationMode = "continuous"

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: number = 0

Elevation is the height of the model at ground level, this is used to calculate the altitude / transform of the item

heading: number = 0

The heading of the item, in degrees

id: string

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: LngLat

The lngLat of the item

mesh:
    | null
    | Object3D<Object3DEventMap>
    | Mesh<
        BufferGeometry<NormalBufferAttributes>,
        Material | Material[],
        Object3DEventMap,
    >
    | Group<Object3DEventMap> = null

The Three.js mesh, group or object3d that is being rendered

opacity: number = 1

The opacity of the item

pointSize: number = 1

The point size of the item (if drawing points)

scale: [number, number, number] = ...

The scale of the item [x, y, z].

sourceOrientation: SourceOrientation = SourceOrientation.Y_UP

The source orientation of the item, can be "y-up" or "z-up"

transform: Item3DTransform = ...

The default state of the item, used for UI states

url: null | string

The url of the item, if the item is a model, this is the url of the model

userData: Record<string, any> = {}

Custom user data of the item This can be used to store any custom data that the user wants

wireframe: boolean = false

Whether the item is rendering as a wireframe

Methods

  • Parameters

    • event: string | Event$1
    • Optionalproperties: any

    Returns this

  • 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

  • Get the names of the animations of a mesh

    Returns string[]

    The names of all the animations of the mesh

  • 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

    true if there is at least one registered listener for specified event type, false otherwise

  • 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

  • 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

  • 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: Listener

      The function to be called when the event is fired the first time.

    Returns Promise<any> | Item3D

    this or a promise if a listener is not provided

  • Pause an animation

    Parameters

    • animationName: string

      The name of the animation to pause

    Returns undefined | Item3D

  • 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

  • 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

  • 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

  • Set the time of an animation to a specific time

    Parameters

    • time: number

      The time to set the animation to

    Returns void

  • 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

  • Bubble all events fired by this instance of Evented to this parent instance of Evented.

    Parameters

    • Optionalparent: null | Evented
    • Optionaldata: any

    Returns this

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Set the wireframe of the item

    Parameters

    • Optionalwireframe: boolean

      whether 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

  • Stop an animation

    Parameters

    • animationName: string

      The name of the animation to stop

    Returns undefined | Item3D

  • 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

Was this helpful?