Rename projection functions for a friendlier API
The following functions are renamed: getTransform -> getTransformForProjections getTransformFromCodes -> getTransform transform -> transformWithProjections transformWithCodes -> transform With this change, the faster functions that avoid projection look-up have longer names and are used internally, whereas the slower but friendlier short name functions are available for users.
This commit is contained in:
@@ -25,7 +25,7 @@ var map = new ol.Map({
|
||||
// Vienna label
|
||||
var vienna = new ol.AnchoredElement({
|
||||
map: map,
|
||||
position: ol.projection.transformWithCodes(
|
||||
position: ol.projection.transform(
|
||||
new ol.Coordinate(16.3725, 48.208889), 'EPSG:4326', 'EPSG:3857'),
|
||||
element: document.getElementById('vienna')
|
||||
});
|
||||
@@ -39,7 +39,7 @@ map.addEventListener('click', function(evt) {
|
||||
var coordinate = evt.getCoordinate();
|
||||
popup.getElement().innerHTML =
|
||||
'Welcome to ol3. The location you clicked was<br>' +
|
||||
ol.Coordinate.toStringHDMS(ol.projection.transformWithCodes(
|
||||
ol.Coordinate.toStringHDMS(ol.projection.transform(
|
||||
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
||||
popup.setPosition(coordinate);
|
||||
});
|
||||
|
||||
@@ -9,15 +9,15 @@ goog.require('ol.projection');
|
||||
goog.require('ol.source.OpenStreetMap');
|
||||
|
||||
|
||||
var london = ol.projection.transformWithCodes(
|
||||
var london = ol.projection.transform(
|
||||
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
|
||||
var moscow = ol.projection.transformWithCodes(
|
||||
var moscow = ol.projection.transform(
|
||||
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
|
||||
var instanbul = ol.projection.transformWithCodes(
|
||||
var instanbul = ol.projection.transform(
|
||||
new ol.Coordinate(28.9744, 41.0128), 'EPSG:4326', 'EPSG:3857');
|
||||
var rome = ol.projection.transformWithCodes(
|
||||
var rome = ol.projection.transform(
|
||||
new ol.Coordinate(12.5, 41.9), 'EPSG:4326', 'EPSG:3857');
|
||||
var bern = ol.projection.transformWithCodes(
|
||||
var bern = ol.projection.transform(
|
||||
new ol.Coordinate(7.4458, 46.95), 'EPSG:4326', 'EPSG:3857');
|
||||
|
||||
var map = new ol.Map({
|
||||
|
||||
@@ -19,7 +19,7 @@ var map = new ol.Map({
|
||||
renderers: ol.RendererHints.createFromQueryData(),
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
center: ol.projection.transformWithCodes(
|
||||
center: ol.projection.transform(
|
||||
new ol.Coordinate(-123.1, 49.25), 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 8
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ var layers = [
|
||||
|
||||
var webglMap = new ol.Map({
|
||||
view: new ol.View2D({
|
||||
center: ol.projection.transformWithCodes(
|
||||
center: ol.projection.transform(
|
||||
new ol.Coordinate(-0.1275, 51.507222), 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 10
|
||||
}),
|
||||
|
||||
@@ -16,7 +16,7 @@ var map = new ol.Map({
|
||||
renderers: ol.RendererHints.createFromQueryData(),
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
center: ol.projection.transformWithCodes(
|
||||
center: ol.projection.transform(
|
||||
new ol.Coordinate(139.6917, 35.689506), 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 9
|
||||
})
|
||||
|
||||
@@ -11,9 +11,9 @@ goog.require('ol.projection');
|
||||
goog.require('ol.source.MapQuestOpenAerial');
|
||||
|
||||
|
||||
var LONDON = ol.projection.transformWithCodes(
|
||||
var LONDON = ol.projection.transform(
|
||||
new ol.Coordinate(-0.12755, 51.507222), 'EPSG:4326', 'EPSG:3857');
|
||||
var MOSCOW = ol.projection.transformWithCodes(
|
||||
var MOSCOW = ol.projection.transform(
|
||||
new ol.Coordinate(37.6178, 55.7517), 'EPSG:4326', 'EPSG:3857');
|
||||
|
||||
var layer = new ol.layer.TileLayer({
|
||||
|
||||
@@ -23,7 +23,7 @@ var map = new ol.Map({
|
||||
renderers: ol.RendererHints.createFromQueryData(),
|
||||
target: 'map',
|
||||
view: new ol.View2D({
|
||||
center: ol.projection.transformWithCodes(
|
||||
center: ol.projection.transform(
|
||||
new ol.Coordinate(-122.416667, 37.783333), 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: 12
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user