Constructor
new WorldWindow(canvasElem, elevationModel)
Constructs a WorldWind window for an HTML canvas.
Parameters:
Name | Type | Description |
---|---|---|
canvasElem |
String | HTMLCanvasElement | The ID assigned to the HTML canvas in the document or the canvas element itself. |
elevationModel |
ElevationModel | An optional argument indicating the elevation model to use for the World Window. If missing or null, a default elevation model is used. |
- Source:
Throws:
-
If there is no HTML element with the specified ID in the document, or if the HTML canvas does not support WebGL.
- Type
- ArgumentError
Members
(readonly) canvas :HTMLElement
The HTML canvas associated with this WorldWindow.
Type:
- HTMLElement
- Source:
deepPicking :boolean
Indicates that picking will return all objects at the pick point, if any. The top-most object will have
its isOnTop flag set to true.
If deep picking is false, the default, only the top-most object is returned, plus
the picked-terrain object if the pick point is over the terrain.
Type:
- boolean
- Default Value:
- false
- Source:
(readonly) depthBits :number
The number of bits in the depth buffer associated with this WorldWindow.
Type:
- number
- Source:
frameStatistics :FrameStatistics
Performance statistics for this WorldWindow.
Type:
- Source:
globe :Globe
The globe displayed.
Type:
- Source:
goToAnimator :GoToAnimator
The GoToAnimator used by this WorldWindow to respond to its goTo method.
Type:
- Source:
(readonly) layers :Array.<Layer>
The layers to display in this WorldWindow.
This property is read-only. Use addLayer or
insertLayer to add layers to this WorldWindow.
Use removeLayer to remove layers from this WorldWindow.
Type:
- Array.<Layer>
- Source:
navigator :Navigator
The navigator used to manipulate the globe.
Type:
- Default Value:
- Source:
(readonly) orderedRenderingFilters :Array.<function()>
An array of functions to call during ordered rendering prior to rendering the ordered renderables.
Each function is passed one argument, the current draw context. The function may modify the
ordered renderables in the draw context's ordered renderable list, which has been sorted from front
to back when the filter function is called. Ordered rendering filters are typically used to apply
decluttering. The default set of filter functions contains one function that declutters shapes with
declutter group ID of 1 (GeographicText by default) and one function that declutters shapes
with declutter group ID 2 (Placemark by default). Applications can add functions to this
array or remove them.
Type:
- Array.<function()>
- Default Value:
- WorldWindow.declutter with a group ID of 1
- Source:
(readonly) redrawCallbacks :Array.<function()>
The list of callbacks to call immediately before and immediately after performing a redraw. The callbacks
have two arguments: this WorldWindow and the redraw stage, e.g.,
redrawCallback(worldWindow, stage);
.
The stage will be either WorldWind.BEFORE_REDRAW or WorldWind.AFTER_REDRAW indicating whether the
callback has been called either immediately before or immediately after a redraw, respectively.
Applications may add functions to this array or remove them.
Type:
- Array.<function()>
- Source:
subsurfaceMode :boolean
Indicates whether this WorldWindow should be configured for sub-surface rendering. If true, shapes
below the terrain can be seen when the terrain is made transparent. If false, sub-surface shapes are
not visible, however, performance is slightly increased.
Type:
- boolean
- Default Value:
- false
- Source:
surfaceOpacity :Number
The opacity to apply to terrain and surface shapes. This property is typically used when viewing
the sub-surface. It modifies the opacity of the terrain and surface shapes as a whole. It should be
a number between 0 and 1. It is compounded with the individual opacities of the image layers and
surface shapes on the terrain.
Type:
- Number
- Default Value:
- 1
- Source:
verticalExaggeration :Number
The vertical exaggeration to apply to the terrain.
Type:
- Number
- Source:
(readonly) viewport :Rectangle
The current viewport of this WorldWindow.
Type:
- Source:
worldWindowController :WorldWindowController
The controller used to manipulate the globe.
Type:
- Default Value:
- Source:
Methods
addEventListener(type, listener)
Registers an event listener for the specified event type on this WorldWindow's canvas. This function
delegates the processing of events to the WorldWindow's canvas. For details on this function and its
arguments, see the W3C EventTarget
documentation.
Registering event listeners using this function enables applications to prevent the WorldWindow's default
navigation behavior. To prevent default navigation behavior, call the Event's
preventDefault method from within an event listener for any events the navigator should not respond to.
When an event occurs, this calls the registered event listeners in order of reverse registration. Since the
WorldWindow registers its navigator event listeners first, application event listeners are called before
navigator event listeners.
Parameters:
Name | Type | Description |
---|---|---|
type |
The event type to listen for. | |
listener |
The function to call when the event occurs. |
- Source:
Throws:
-
If any argument is null or undefined.
- Type
- ArgumentError
addLayer(layer)
Adds a specified layer to the end of this WorldWindow.
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer | The layer to add. May be null or undefined, in which case this WorldWindow is not modified. |
- Source:
canvasCoordinates(x, y) → {Vec2}
Converts window coordinates to coordinates relative to this WorldWindow's canvas.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | The X coordinate to convert. |
y |
Number | The Y coordinate to convert. |
- Source:
Returns:
The converted coordinates.
- Type
- Vec2
declutter(dc, groupId)
Declutters the current ordered renderables with a specified group ID. This function is not called by
applications directly. It's meant to be invoked as an ordered rendering filter in this WorldWindow's
orderedRenderingFilters property.
The function operates by setting the target visibility of occluded shapes to 0 and unoccluded shapes to 1.
Parameters:
Name | Type | Description |
---|---|---|
dc |
DrawContext | The current draw context. |
groupId |
Number | The ID of the group to declutter. Must not be null, undefined or 0. |
- Source:
Throws:
-
If the specified group ID is null, undefined or 0.
- Type
- ArgumentError
goTo(position, completionCallback)
Moves this WorldWindow's navigator to a specified location or position.
Parameters:
Name | Type | Description |
---|---|---|
position |
Location | Position | The location or position to move the navigator to. If this argument contains an "altitude" property, as Position does, the end point of the navigation is at the specified altitude. Otherwise the end point is at the current altitude of the navigator. This function uses this WorldWindow's GoToAnimator property to perform the move. That object's properties can be specified by the application to modify its behavior during calls to this function. It's cancel method can also be used to cancel the move initiated by this function. |
completionCallback |
function | If not null or undefined, specifies a function to call when the animation completes. The completion callback is called with a single argument, this animator. |
- Source:
Throws:
-
If the specified location or position is null or undefined.
- Type
- ArgumentError
indexOfLayer(layer) → {Number}
Returns the index of a specified layer in this WorldWindow.
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer | The layer to search for. |
- Source:
Returns:
The index of the specified layer or -1 if it doesn't exist in this WorldWindow.
- Type
- Number
insertLayer(index, layer)
Inserts a specified layer at a specified position in this WorldWindow.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | The index at which to insert the layer. May be negative to specify the position from the end of the array. |
layer |
Layer | The layer to insert. May be null or undefined, in which case this WorldWindow is not modified. |
- Source:
pick(pickPoint) → {PickedObjectList}
Requests the WorldWind objects displayed at a specified screen-coordinate point.
If the point intersects the terrain, the returned list contains an object identifying the associated geographic
position. This returns an empty list when nothing in the WorldWind scene intersects the specified point.
Parameters:
Name | Type | Description |
---|---|---|
pickPoint |
The point to examine in this WorldWindow's screen coordinates. |
- Source:
Throws:
-
If the specified pick point is null or undefined.
- Type
- ArgumentError
Returns:
A list of picked WorldWind objects at the specified pick point.
- Type
- PickedObjectList
pickShapesInRegion(rectangle) → {PickedObjectList}
Requests the WorldWind objects displayed within a specified screen-coordinate region. This returns all
objects that intersect the specified region, regardless of whether or not an object is actually visible, and
marks objects that are visible as on top.
Parameters:
Name | Type | Description |
---|---|---|
rectangle |
Rectangle | The screen coordinate rectangle identifying the region to search. |
- Source:
Throws:
-
If the specified rectangle is null or undefined.
- Type
- ArgumentError
Returns:
A list of visible WorldWind objects within the specified region.
- Type
- PickedObjectList
pickTerrain(pickPoint) → {PickedObjectList}
Requests the position of the WorldWind terrain at a specified screen-coordinate point. If the point
intersects the terrain, the returned list contains a single object identifying the associated geographic
position. Otherwise this returns an empty list.
Parameters:
Name | Type | Description |
---|---|---|
pickPoint |
The point to examine in this WorldWindow's screen coordinates. |
- Source:
Throws:
-
If the specified pick point is null or undefined.
- Type
- ArgumentError
Returns:
A list containing the picked WorldWind terrain position at the specified point,
or an empty list if the point does not intersect the terrain.
- Type
- PickedObjectList
pixelSizeAtDistance(distance) → {Number}
Computes the approximate size of a pixel at a specified distance from the eye point.
This method assumes rectangular pixels, where pixel coordinates denote infinitely thin spaces between pixels. The units of the returned size are in model coordinates per pixel (usually meters per pixel). This returns 0 if the specified distance is zero. The returned size is undefined if the distance is less than zero.
Parameters:
Name | Type | Description |
---|---|---|
distance |
Number | The distance from the eye point at which to determine pixel size, in model coordinates. |
- Source:
Returns:
The approximate pixel size at the specified distance from the eye point, in model
coordinates per pixel.
- Type
- Number
rayThroughScreenPoint(point) → {Line}
Computes a ray originating at the eyePoint and extending through the specified point in window
coordinates.
The specified point is understood to be in the window coordinate system of the WorldWindow, with the origin in the top-left corner and axes that extend down and to the right from the origin point.
The results of this method are undefined if the specified point is outside of the WorldWindow's bounds.
Parameters:
Name | Type | Description |
---|---|---|
point |
Vec2 | The window coordinates point to compute a ray for. |
- Source:
Returns:
A new Line initialized to the origin and direction of the computed ray, or null if the
ray could not be computed.
- Type
- Line
redraw()
Causes this WorldWindow to redraw itself at the next available opportunity. The redraw occurs on the main
thread at a time of the browser's discretion. Applications should call redraw after changing the World
Window's state, but should not expect that change to be reflected on screen immediately after this function
returns. This is the preferred method for requesting a redraw of the WorldWindow.
- Source:
removeEventListener(type, listener)
Removes an event listener for the specified event type from this WorldWindow's canvas. The listener must be
the same object passed to addEventListener. Calling removeEventListener with arguments that do not identify a
currently registered listener has no effect.
Parameters:
Name | Type | Description |
---|---|---|
type |
Indicates the event type the listener registered for. | |
listener |
The listener to remove. Must be the same function object passed to addEventListener. |
- Source:
Throws:
-
If any argument is null or undefined.
- Type
- ArgumentError
removeLayer(layer)
Removes the first instance of a specified layer from this WorldWindow.
Parameters:
Name | Type | Description |
---|---|---|
layer |
Layer | The layer to remove. May be null or undefined, in which case this WorldWindow is not modified. This WorldWindow is also not modified if the specified layer does not exist in this WorldWindow's layer list. |
- Source: