actually don't have to use hacked functions afterall :-)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@948 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-16 15:34:08 +00:00
parent f013e9c2e5
commit 460446f558

View File

@@ -4,52 +4,6 @@
// @require: OpenLayers/Layer.js
if (typeof VEMap != "undefined") {
/** Hack-on function because VE does not give it to us
*
* @param {VELatLong} veLatLng
*
* @returns A Pixel specifying veLatLong translated into "Container" coords
* @type Pixel
*/
VEMap.prototype.fromLatLngToContainerPixel = function(veLatLong) {
// first we translate into "DivPixel"
var pixel = this.LatLongToPixel(veLatLong);
// locate the upper-left tile
var tile = this.mapelement.firstChild.childNodes[2];
// adjust by the offset of tile
pixel.x += tile.offsetLeft;
pixel.y += tile.offsetTop;
return pixel;
};
/** Hack-on function because VE does not give it to us
*
* @param {Pixel} pixel
*
* @returns A VELatLong specifying "Container" pixel translated to lonlat
* @type VELatLong
*/
VEMap.prototype.fromContainerPixelToLatLng = function(pixel) {
// locate the upper-left tile
var tile = this.mapelement.firstChild.childNodes[2];
// adjust by the offset of tile
pixel.x -= tile.offsetLeft;
pixel.y -= tile.offsetTop;
// first we translate into "DivPixel"
return this.PixelToLatLong(pixel);
};
}
/**
* @class
*/
@@ -218,10 +172,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
var lonlat = null;
if (this.vemap != null) {
var pixel = this.getPixelFromOLPixel(viewPortPx);
// note we use special hacked function here
var veLatLong = this.vemap.fromContainerPixelToLatLng(pixel)
var veLatLong = this.vemap.PixelToLatLong(pixel)
lonlat = this.getOLLonLatFromVELatLong(veLatLong);
}
return lonlat;
@@ -240,10 +191,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
var viewPortPx = null;
if (this.vemap != null) {
var veLatLong = this.getVELatLongFromOLLonLat(lonlat);
// note we use special hacked function here
var pixel = this.vemap.fromLatLngToContainerPixel(veLatLong);
var pixel = this.vemap.LatLongToPixel(veLatLong);
viewPortPx = this.getOLPixelFromPixel(pixel);
}
return viewPortPx;