openlayers/openlayers — pull request #42 by tschaub (2011-11-08 15:59:52+00:00)
Title: extent, location, and projection convenience

These changes add convenience when dealing with bounds, lonlats, and projection objects.

Instead of this

location.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326");

we can now write

location.transform("EPSG:900913", "EPSG:4326");

Instead of this

map.setCenter(new OpenLayers.LonLat(12345, 67890));

we can now write

map.setCenter([12345, 67890]);

Instead of configuring a map like this

var map = new OpenLayers.Map({
div: "map",
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
projection: new OpenLayers.Projection("foo"),
displayProjection: new OpenLayers.Projection("bar"),
center: new OpenLayers.LonLat(0, 0)
});

we can now write

var map = new OpenLayers.Map({
div: "map",
maxExtent: [-180, -90, 180, 90],
restrictedExtent: [-180, -90, 180, 90],
projection: "foo",
displayProjection: "bar",
center: [0, 0]
});