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

    • options: MapViewOption

    Returns MapView

Properties

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.

heightProvider: MapProvider = null

Map height (terrain elevation) layer provider.

Only used for HEIGHT, HEIGHT_SHADER and MARTINI map modes.

isClip?: boolean
lod: LODControl = null

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

onBeforeRender: ((renderer, scene, camera, geometry, material, group) => void) = ...

Ajust node configuration depending on the camera distance.

Called everytime automatically before render by the renderer.

Type declaration

    • (renderer, scene, camera, geometry, material, 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<NormalBufferAttributes>
      • material: Material
      • group: Group<Object3DEventMap>

      Returns void

options: MapViewOption
provider: MapProvider = null

Map tile color layer provider.

root: MapNode = null

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

Should only be set on creation.

scheduler: Scheduler
useScheduler: boolean = true
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.

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

Map of the map node types available.

Methods

  • 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

  • Returns void

  • Returns [number, number, number, number]

  • 是否为互联网地图底图 (选项中设置了mapBounds的为cad底图,没设置mapBounds的为互联网底图)

    Returns boolean

  • 经纬度转局部世界坐标

    Parameters

    • lngLat: [number, number]

    Returns Vector3

  • 经纬度转归一化的坐标, 先会把经纬度转墨卡托,然后根据最开始的[瓦片缩级别,行,列]rootTile的范围,归一化到0-1范围区间

    Parameters

    • lngLat: [number, number]

    Returns [number, number]

  • 经纬度转世界坐标

    Parameters

    • lngLat: [number, number]

    Returns Vector3

  • 局部世界坐标转经纬度

    Parameters

    • world: [number, number, number] | Vector3 | [number, number]

    Returns [number, number]

  • 局部世界坐标转地图坐标

    Parameters

    • world: [number, number, number] | Vector3 | [number, number]

    Returns [number, number]

  • 地图坐标转局部世界坐标

    Parameters

    • point: [number, number]

    Returns Vector3

  • 地图坐标转世界坐标

    Parameters

    • lngLat: [number, number]

    Returns Vector3

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

    Returns number

    Maximum zoom level available.

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

    Returns number

    Minimum zoom level available.

  • 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

  • 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

  • Returns number

  • 世界坐标转经纬度

    Parameters

    • world: [number, number, number] | Vector3 | [number, number]

    Returns [number, number]

  • 世界坐标转地图坐标

    Parameters

    • world: [number, number, number] | Vector3 | [number, number]

    Returns [number, number]