Rename ol.View2D to ol.View
This commit is contained in:
@@ -16,16 +16,16 @@ The core component of OpenLayers 3 is the map (`ol.Map`). It is rendered to a `t
|
||||
```
|
||||
|
||||
## View
|
||||
`ol.Map` is not responsible for things like center, zoom level and projection of the map. Instead, these are properties of an `ol.View` instance - typically an `ol.View2D` for 2D maps. The reason for this abstraction is the idea of instantly switching e.g. between a 2D and a tilted 3D view, without the need to maintain two copies of the `layers`.
|
||||
`ol.Map` is not responsible for things like center, zoom level and projection of the map. Instead, these are properties of an `ol.View` instance.
|
||||
|
||||
```js
|
||||
map.setView(new ol.View2D({
|
||||
map.setView(new ol.View({
|
||||
center: [0, 0],
|
||||
zoom: 2
|
||||
}));
|
||||
```
|
||||
|
||||
An `ol.View2D` also has a `projection`. The projection determines the coordinate system of the `center` and the units for map resolution calculations. If not specified (like in the above snippet), the default projection is Spherical Mercator (EPSG:3857), with meters as map units.
|
||||
An `ol.View` also has a `projection`. The projection determines the coordinate system of the `center` and the units for map resolution calculations. If not specified (like in the above snippet), the default projection is Spherical Mercator (EPSG:3857), with meters as map units.
|
||||
|
||||
The `zoom` option is a convenient way to specify the map resolution. The available zoom levels are determined by `maxZoom` (default: 28), `zoomFactor` (default: 2) and `maxResolution` (default is calculated in such a way that the projection's validity extent fits in a 256x256 pixel tile). Starting at zoom level 0 with a resolution of `maxResolution` units per pixel, subsequent zoom levels are calculated by dividing the previous zoom level's resolution by `zoomFactor`, until zoom level `maxZoom` is reached.
|
||||
|
||||
@@ -63,7 +63,7 @@ The above snippets can be conflated to a self contained map configuration with v
|
||||
layers: [
|
||||
new ol.layer.Tile({source: new ol.source.OSM()})
|
||||
],
|
||||
view: new ol.View2D({
|
||||
view: new ol.View({
|
||||
center: [0, 0],
|
||||
zoom: 2
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user