Class MapView

Map viewer is used to read and display map tiles from a server.

It was designed to work with a OpenMapTiles but can also be used with another map tiles.

The map is drawn in plane map nodes using a quad tree that is subdivided as necessary to guaratee good map quality.

Hierarchy

  • Mesh
    • MapView

Constructors

  • Constructor for the map view objects.

    Parameters

    • root: number | MapNode = MapView.PLANAR

      Map view node modes can be SPHERICAL, HEIGHT or PLANAR. PLANAR is used by default. Can also be a custom MapNode instance.

    • provider: MapProvider = ...

      Map color tile provider by default a OSM maps provider is used if none specified.

    • heightProvider: MapProvider = null

      Map height tile provider, by default no height provider is used.

    Returns MapView

Properties

animations: AnimationClip[]

Array with animation clips.

Default

[]

cacheTiles: boolean = false

Indicate if the nodes should cache its children when it is simplified. Nodes that are no longer in use should be kept in memory.

Usefull for fast moving scenarios to prevent reparsing data in fast moving scenes.

Should only be used if the child generation process is time consuming. Should be kept off unless required.

castShadow: boolean

Gets rendered into shadow map.

Default

false

children: Object3D<Event>[]

Array with object's children.

Default

[]

customDepthMaterial: Material

Custom depth material to be used when rendering to the depth map. Can only be used in context of meshes. When shadow-casting with a DirectionalLight or SpotLight, if you are (a) modifying vertex positions in the vertex shader, (b) using a displacement map, (c) using an alpha map with alphaTest, or (d) using a transparent texture with alphaTest, you must specify a customDepthMaterial for proper shadows.

customDistanceMaterial: Material

Same as customDepthMaterial, but used with PointLight.

frustumCulled: boolean

When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object. If set to false the object gets rendered every frame even if it is not in the frustum of the camera.

Default

true

geometry: BufferGeometry
heightProvider: MapProvider = null

Map height (terrain elevation) layer provider.

Only used for HEIGHT, HEIGHT_SHADER and MARTINI map modes.

id: number

Unique number of this object instance.

isMesh: true
isObject3D: true

Used to check whether this or derived classes are Object3Ds. Default is true. You should not change this, as it is used internally for optimisation.

layers: Layers

Default

new THREE.Layers()

lod: LODControl = null

LOD control object used to defined how tiles are loaded in and out of memory.

material: Material | Material[]
matrix: Matrix4

Local transform.

Default

new THREE.Matrix4()

matrixAutoUpdate: boolean

When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property.

Default

THREE.Object3D.DefaultMatrixAutoUpdate

matrixWorld: Matrix4

The global transform of the object. If the Object3d has no parent, then it's identical to the local transform.

Default

new THREE.Matrix4()

matrixWorldAutoUpdate: boolean

When this is set, the renderer checks every frame if the object and its children need matrix updates. Otherwise, you have to maintain all matrices in the object and its children yourself.

Default

THREE.Object3D.DefaultMatrixWorldAutoUpdate

matrixWorldNeedsUpdate: boolean

When this is set, it calculates the matrixWorld in that frame and resets this property to false.

Default

false

modelViewMatrix: Matrix4

Default

new THREE.Matrix4()

morphTargetDictionary?: {
    [key: string]: number;
}

Type declaration

  • [key: string]: number
morphTargetInfluences?: number[]
name: string

Optional name of the object (doesn't need to be unique).

Default

''

normalMatrix: Matrix3

Default

new THREE.Matrix3()

onAfterRender: ((renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group) => void)

Type declaration

    • (renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group): void
    • Calls after rendering object

      Parameters

      • renderer: WebGLRenderer
      • scene: Scene
      • camera: Camera
      • geometry: BufferGeometry
      • material: Material
      • group: Group

      Returns void

onBeforeRender: ((renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group) => void) = ...

Type declaration

    • (renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group): void
    • Ajust node configuration depending on the camera distance.

      Called everytime automatically before render by the renderer.

      Parameters

      • renderer: WebGLRenderer
      • scene: Scene
      • camera: Camera
      • geometry: BufferGeometry
      • material: Material
      • group: Group

      Returns void

parent: Object3D<Event>

Object's parent in the scene graph.

Default

null

position: Vector3

Object's local position.

Default

new THREE.Vector3()

provider: MapProvider = null

Map tile color layer provider.

quaternion: Quaternion

Object's local rotation as a Quaternion.

Default

new THREE.Quaternion()

receiveShadow: boolean

Material gets baked in shadow receiving.

Default

false

renderOrder: number

Overrides the default rendering order of scene graph objects, from lowest to highest renderOrder. Opaque and transparent objects remain sorted independently though. When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.

Default

0

root: MapNode = null

Define the type of map node in use, defined how the map is presented.

Should only be set on creation.

rotation: Euler

Object's local rotation (Euler angles), in radians.

Default

new THREE.Euler()

scale: Vector3

Object's local scale.

Default

new THREE.Vector3()

type: string
up: Vector3

Up direction.

Default

THREE.Object3D.DefaultUp.clone()

userData: {
    [key: string]: any;
}

An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned.

Default

Type declaration

  • [key: string]: any
uuid: string
visible: boolean

Object gets rendered if true.

Default

true

DefaultMatrixAutoUpdate: boolean
DefaultMatrixWorldAutoUpdate: boolean
DefaultUp: Vector3
HEIGHT: number = 202

Planar map projection with height deformation.

HEIGHT_SHADER: number = 203

Planar map projection with height deformation using the GPU for height generation.

MARTINI: number = 204

RTIN map mode.

PLANAR: number = 200

Planar map projection.

SPHERICAL: number = 201

Spherical map projection.

mapModes: Map<number, any> = ...

Map of the map node types available.

Methods

  • Adds object as child of this object.

    Parameters

    • Rest ...object: Object3D<Event>[]

    Returns MapView

  • Adds a listener to an event type.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<Event, T, MapView>

      The function that gets called when the event is fired.

    Returns void

  • Applies the matrix transform to the object and updates the object's position, rotation and scale.

    Parameters

    • matrix: Matrix4

    Returns void

  • Applies the rotation represented by the quaternion to the object.

    Parameters

    • quaternion: Quaternion

    Returns MapView

  • Adds object as a child of this, while maintaining the object's world transform.

    Parameters

    • object: Object3D<Event>

    Returns MapView

  • Clears all tiles from memory and reloads data. Used when changing the provider.

    Should be called manually if any changed to the provider are made without setting the provider.

    Returns any

  • Parameters

    • Optional recursive: boolean

    Returns MapView

  • Parameters

    • source: MapView
    • Optional recursive: boolean

    Returns MapView

  • Fire an event type.

    Parameters

    • event: Event

    Returns void

  • Get map meta data from server if supported.

    Returns void

  • Searches through the object's children and returns the first with a matching id.

    Parameters

    • id: number

      Unique number of the object instance

    Returns Object3D<Event>

  • Searches through the object's children and returns the first with a matching name.

    Parameters

    • name: string

      String to match to the children's Object3d.name property.

    Returns Object3D<Event>

  • Parameters

    • name: string
    • value: any

    Returns Object3D<Event>

  • Parameters

    • target: Vector3

    Returns Vector3

  • Parameters

    • target: Vector3

    Returns Vector3

  • Parameters

    • target: Quaternion

    Returns Quaternion

  • Parameters

    • target: Vector3

    Returns Vector3

  • Checks if listener is added to an event type.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<Event, T, MapView>

      The function that gets called when the event is fired.

    Returns boolean

  • Updates the vector from local space to world space.

    Parameters

    • vector: Vector3

      A local vector.

    Returns Vector3

  • Optionally, the x, y and z components of the world space position. Rotates the object to face a point in world space. This method does not support objects having non-uniformly-scaled parent(s).

    Parameters

    • vector: Vector3

      A world vector to look at.

    Returns void

  • Parameters

    • x: number
    • y: number
    • z: number

    Returns void

  • Get the maximum zoom level available in the providers attached to the map view.

    Returns

    Maximum zoom level available.

    Returns number

  • Get the minimum zoom level available in the providers attached to the map view.

    Returns

    Minimum zoom level available.

    Returns number

  • Pre-subdivide map tree to create nodes of levels not available in the provider.

    Checks for the minimum zoom level in the providers attached to the map view.

    Returns void

  • Parameters

    • raycaster: Raycaster
    • intersects: any[]

    Returns boolean

  • Removes object as child of this object.

    Parameters

    • Rest ...object: Object3D<Event>[]

    Returns MapView

  • Removes a listener from an event type.

    Type Parameters

    • T extends string

    Parameters

    • type: T

      The type of the listener that gets removed.

    • listener: EventListener<Event, T, MapView>

      The listener function that gets removed.

    Returns void

  • Removes this object from its current parent.

    Returns MapView

  • Rotate an object along an axis in object space. The axis is assumed to be normalized.

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • angle: number

      The angle in radians.

    Returns MapView

  • Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent.

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • angle: number

      The angle in radians.

    Returns MapView

  • Rotates the object around x axis in local space.

    Parameters

    • angle: number

      the angle to rotate in radians.

    Returns MapView

  • Rotates the object around y axis in local space.

    Parameters

    • angle: number

      the angle to rotate in radians.

    Returns MapView

  • Rotates the object around z axis in local space.

    Parameters

    • angle: number

      the angle to rotate in radians.

    Returns MapView

  • Change the map height provider of this map view.

    Will discard all the tiles already loaded using the old provider.

    Parameters

    Returns void

  • Change the map provider of this map view.

    Will discard all the tiles already loaded using the old provider.

    Parameters

    Returns void

  • Set the root of the map view.

    Is set by the constructor by default, can be changed in runtime.

    Parameters

    • root: number | MapNode

      Map node to be used as root.

    Returns void

  • axis -- A normalized vector in object space. angle -- angle in radians

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • angle: number

      angle in radians

    Returns void

  • Calls setRotationFromEuler(euler) on the .quaternion.

    Parameters

    • euler: Euler

      Euler angle specifying rotation amount.

    Returns void

  • Calls setFromRotationMatrix(m) on the .quaternion.

    Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).

    Parameters

    • m: Matrix4

      rotate the quaternion by the rotation component of the matrix.

    Returns void

  • Copy the given quaternion into .quaternion.

    Parameters

    • q: Quaternion

      normalized Quaternion

    Returns void

  • Parameters

    • Optional meta: {
          geometries: any;
          images: any;
          materials: any;
          textures: any;
      }
      • geometries: any
      • images: any
      • materials: any
      • textures: any

    Returns any

  • Translate an object by distance along an axis in object space. The axis is assumed to be normalized.

    Parameters

    • axis: Vector3

      A normalized vector in object space.

    • distance: number

      The distance to translate.

    Returns MapView

  • Translates object along x axis by distance.

    Parameters

    • distance: number

      Distance.

    Returns MapView

  • Translates object along y axis by distance.

    Parameters

    • distance: number

      Distance.

    Returns MapView

  • Translates object along z axis by distance.

    Parameters

    • distance: number

      Distance.

    Returns MapView

  • Parameters

    • callback: ((object: Object3D<Event>) => any)
        • (object: Object3D<Event>): any
        • Parameters

          • object: Object3D<Event>

          Returns any

    Returns void

  • Parameters

    • callback: ((object: Object3D<Event>) => any)
        • (object: Object3D<Event>): any
        • Parameters

          • object: Object3D<Event>

          Returns any

    Returns void

  • Parameters

    • callback: ((object: Object3D<Event>) => any)
        • (object: Object3D<Event>): any
        • Parameters

          • object: Object3D<Event>

          Returns any

    Returns void

  • Updates local transform.

    Returns void

  • Updates global transform of the object and its children.

    Parameters

    • Optional force: boolean

    Returns void

  • Returns void

  • Updates the global transform of the object.

    Parameters

    • updateParents: boolean

      recursively updates global transform of ancestors.

    • updateChildren: boolean

      recursively updates global transform of descendants.

    Returns void

  • Updates the vector from world space to local space.

    Parameters

    • vector: Vector3

      A world vector.

    Returns Vector3

Generated using TypeDoc