LayerListLayers hold all the information displayed by the WorldWindow. Each WorldWindow holds one layer list that contains all the layers to display in that WorldWindow. Each layer contains either imagery, shapes or decorations such as a compass. During rendering, layers are displayed in the order they’re defined in the layer list. (3D shapes within layers, however, are displayed in far-to-near order, as described in the Shapes section.) The adjacent illustration depicts six layers. The first two are image layers. The second two hold shapes. And the bottom two hold decorations.
The above layer list is defined and the layers added to the WorldWindow by the following code:
// Create the WorldWindow. var wwd = new WorldWind.WorldWindow("canvasOne"); // Create and add imagery layers. wwd.addLayer(new WorldWind.BMNGLayer()); wwd.addLayer(new WorldWind.BingAerialWithLabelsLayer(null)); // Create and add layers for shapes, but don't add any shapes yet. wwd.addLayer(new RenderableLayer()); wwd.addLayer(new RenderableLayer()); // Create and add a compass and view controls. wwd.addLayer(new WorldWind.CompassLayer()); wwd.addLayer(new WorldWind.ViewControlsLayer(wwd)); // Update the display. wwd.redraw();
Layers have the following properties:
See the API doc for Layer for more details.
There are several types of layers. Each defines additional properties that you can use to control the layer’s behavior. See the API doc for the particular layer to discover those properties. The layer type you’re likely to use most is RenderableLayer, which you use to hold shapes. It’s described below. Apps typically create several of these.
Image layers hold imagery that is drawn on the surface of the globe. This is typically global-coverage imagery but need not be. Web WorldWind provides the following image layers:
You can create your own image layers using TiledImageLayer. The imagery need not span the entire globe.
You use the RenderableLayer class when you want to display shapes. The layer can hold any number of shapes. Apps typically use renderable layers to group shapes logically. To display a shape, you simply create it using its constructor and add it to a renderable layer:
var placemarkLayer = new WorldWind.RenderableLayer("Placemarks"); var placemark = new WorldWind.Placemark(new WorldWind.Position(latitude, longitude, altitude)); placemarkLayer.addRenderable(placemark);
Here the layer is given the display name “Placemarks”.
You must also add the renderable layer to the WorldWindow’s layer list:
Renderable layers hold any kind of shape.