Replace all instances and usages of LatLon to LonLat

git-svn-id: http://svn.openlayers.org/trunk/openlayers@99 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-17 15:51:37 +00:00
parent 3d1b137009
commit 6f242f5746
12 changed files with 105 additions and 104 deletions

View File

@@ -45,7 +45,7 @@ OpenLayers.Map.prototype = {
// Array(OpenLayers.Control)
controls: null,
// OpenLayers.LatLon
// OpenLayers.LonLat
center: null,
// int
@@ -172,7 +172,7 @@ OpenLayers.Map.prototype = {
},
/**
* @return {OpenLayers.LatLon}
* @return {OpenLayers.LonLat}
*/
getCenter: function () {
return this.center;
@@ -219,9 +219,9 @@ OpenLayers.Map.prototype = {
/**
* @param {OpenLayers.Pixel} point
*
* @return {OpenLayers.LatLon}
* @return {OpenLayers.LonLat}
*/
getLatLonFromPixel: function (point) {
getLonLatFromPixel: function (point) {
var center = this.getCenter(); //map center lat/lon
var res = this.getResolution();
var size = this.getSize();
@@ -229,20 +229,19 @@ OpenLayers.Map.prototype = {
var delta_x = point.x - (size.w / 2);
var delta_y = point.y - (size.h / 2);
return new OpenLayers.LatLon(
center.lat - delta_y * res,
center.lon + delta_x * res );
return new OpenLayers.LonLat(center.lon + delta_x * res ,
center.lat - delta_y * res);
},
/**
* @param {OpenLayers.LatLon} latlon
* @param {OpenLayers.LonLat} lonlat
* @param {int} zoom
*/
setCenter: function (latlon, zoom) {
setCenter: function (lonlat, zoom) {
if (this.center) { // otherwise there's nothing to move yet
this.moveLayerContainer(latlon);
this.moveLayerContainer(lonlat);
}
this.center = latlon.copyOf();
this.center = lonlat.copyOf();
var zoomChanged = null;
if (zoom != null && zoom != this.zoom
&& zoom >= 0 && zoom <= this.getZoomLevels()) {
@@ -308,22 +307,20 @@ OpenLayers.Map.prototype = {
var oldZoom = this.zoom;
this.zoom = this.getZoomForExtent( fullExtent );
this.setCenter(
new OpenLayers.LatLon(
(fullExtent.minlat+fullExtent.maxlat)/2,
(fullExtent.minlon+fullExtent.maxlon)/2
)
);
new OpenLayers.LonLat((fullExtent.minlon+fullExtent.maxlon)/2,
(fullExtent.minlat+fullExtent.maxlat)/2)
);
},
/**
* @param {OpenLayers.LatLon} latlon
* @param {OpenLayers.LonLat} lonlat
*/
moveLayerContainer: function (latlon) {
moveLayerContainer: function (lonlat) {
var container = this.layerContainerDiv;
var resolution = this.getResolution();
var deltaX = Math.round((this.center.lon - latlon.lon) / resolution);
var deltaY = Math.round((this.center.lat - latlon.lat) / resolution);
var deltaX = Math.round((this.center.lon - lonlat.lon) / resolution);
var deltaY = Math.round((this.center.lat - lonlat.lat) / resolution);
var offsetLeft = parseInt(container.style.left);
var offsetTop = parseInt(container.style.top);
@@ -336,7 +333,7 @@ OpenLayers.Map.prototype = {
* @param {Event} evt
*/
defaultDblClick: function (evt) {
var newCenter = this.getLatLonFromPixel( evt.xy );
var newCenter = this.getLonLatFromPixel( evt.xy );
this.setCenter(newCenter, this.zoom + 1);
},
@@ -359,7 +356,7 @@ OpenLayers.Map.prototype = {
var size = this.getSize();
var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX,
size.h / 2 + deltaY);
var newCenter = this.getLatLonFromPixel( newXY );
var newCenter = this.getLonLatFromPixel( newXY );
this.setCenter(newCenter);
this.mouseDragStart = evt.xy.copyOf();
}