Class Globe
Create a virtual globe in a HTML canvas element, passed in options parameter.
The virtual globe data is set using setBaseImage/addLayer methods.
Defined in: Globe.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Globe(options)
|
Method Attributes | Method Name and Description |
---|---|
addAnimation(anim)
Add an animation
|
|
addLayer(layer)
Add a layer to the globe.
|
|
dispose()
Dispose the globe and all its ressources
|
|
getElevation(lon, lat)
Get the elevation at a geo position
|
|
getLonLatFromPixel(x, y)
Get the lon-lat from a pixel.
|
|
getPixelFromLonLat(lon, lat)
Get pixel from lon-lat
The pixel is expressed in the canvas frame, i.e.
|
|
Get the viewport geo bound
|
|
refresh()
Refresh rendering, must be called when canvas size is modified
|
|
removeAnimation(anim)
Remove an animation
|
|
removeLayer(layer)
Remove a layer
|
|
setBaseElevation(layer)
Set the base elevation layer for the globe
|
|
setBaseImagery(layer)
Set the base imagery layer for the globe
|
|
subscribe(name, callback)
Subscribe to an event
|
|
unsubscribe(name, callback)
Unsubscribe to an event
|
Class Detail
Globe(options)
- Parameters:
- options
- Configuration properties for the Globe :
- canvas : the canvas for WebGL, can be string (id) or a canvas element
- contextAttribs : the attributes when creating WebGL context, see WebGL specification
- backgroundColor : the background color of the canvas (an array of 4 floats)
- shadersPath : the path to shaders file
- continuousRendering: if true rendering is done continuously, otherwise it is done only if needed
Method Detail
addAnimation(anim)
Add an animation
- Parameters:
- anim
- the animation to add
addLayer(layer)
Add a layer to the globe.
A layer must be added to be visualized on the globe.
- Parameters:
- layer
- the layer to add
dispose()
Dispose the globe and all its ressources
getElevation(lon, lat)
Get the elevation at a geo position
- Parameters:
- lon
- the longitude in degree
- lat
- the latitude in degree
- Returns:
- the elevation in meter at the position [lon,lat]
getLonLatFromPixel(x, y)
Get the lon-lat from a pixel.
The pixel is expressed in the canvas frame, i.e. (0,0) corresponds to the lower-left corner of the pixel
- Parameters:
- x
- the pixel x coordinate
- y
- the pixel y coordinate
- Returns:
- an array of two numbers [lon,lat] or null if the pixel is not on the globe
getPixelFromLonLat(lon, lat)
Get pixel from lon-lat
The pixel is expressed in the canvas frame, i.e. (0,0) corresponds to the lower-left corner of the pixel
- Parameters:
- lon
- the longitude
- lat
- the latitude
- Returns:
- an array of two numbers [x,y] or null if the pixel is not on the globe
getViewportGeoBound()
Get the viewport geo bound
- Returns:
- the geo bound of the viewport
refresh()
Refresh rendering, must be called when canvas size is modified
removeAnimation(anim)
Remove an animation
- Parameters:
- anim
- the animation to remove
removeLayer(layer)
Remove a layer
- Parameters:
- layer
- the layer to remove
setBaseElevation(layer)
Set the base elevation layer for the globe
- Parameters:
- {RasterLayer} layer
- the layer to use, must be an elevation RasterLayer
setBaseImagery(layer)
Set the base imagery layer for the globe
- Parameters:
- {RasterLayer} layer
- the layer to use, must be an imagery RasterLayer
subscribe(name, callback)
Subscribe to an event
- Parameters:
- name
- Event name
- startNavigation : called when navigation is started (by the user or through animation)
- endNavigation : called when navigation is ended (by the user or through animation)t
- baseLayersReady : called when the base layers are ready to be displayed
- baseLayersError : called when the base layers are not valid, or not accessible, in that case nothing is displayed so this event is useful to provide an error message to the user
- startBackgroundLoad : called when background layers (imagery and/or elevation) start to be loaded by GlobWeb
- endBackgroundLoad : called when background layers (imagery and/or elevation) end loadinh by GlobWeb
- callback
- Callback function
unsubscribe(name, callback)
Unsubscribe to an event
- Parameters:
- name
- Event name Globe#subscribe
- callback
- Callback function