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:
@@ -4,52 +4,6 @@
|
|||||||
|
|
||||||
// @require: OpenLayers/Layer.js
|
// @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
|
* @class
|
||||||
*/
|
*/
|
||||||
@@ -218,10 +172,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
|||||||
var lonlat = null;
|
var lonlat = null;
|
||||||
if (this.vemap != null) {
|
if (this.vemap != null) {
|
||||||
var pixel = this.getPixelFromOLPixel(viewPortPx);
|
var pixel = this.getPixelFromOLPixel(viewPortPx);
|
||||||
|
var veLatLong = this.vemap.PixelToLatLong(pixel)
|
||||||
// note we use special hacked function here
|
|
||||||
var veLatLong = this.vemap.fromContainerPixelToLatLng(pixel)
|
|
||||||
|
|
||||||
lonlat = this.getOLLonLatFromVELatLong(veLatLong);
|
lonlat = this.getOLLonLatFromVELatLong(veLatLong);
|
||||||
}
|
}
|
||||||
return lonlat;
|
return lonlat;
|
||||||
@@ -240,10 +191,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
|||||||
var viewPortPx = null;
|
var viewPortPx = null;
|
||||||
if (this.vemap != null) {
|
if (this.vemap != null) {
|
||||||
var veLatLong = this.getVELatLongFromOLLonLat(lonlat);
|
var veLatLong = this.getVELatLongFromOLLonLat(lonlat);
|
||||||
|
var pixel = this.vemap.LatLongToPixel(veLatLong);
|
||||||
// note we use special hacked function here
|
|
||||||
var pixel = this.vemap.fromLatLngToContainerPixel(veLatLong);
|
|
||||||
|
|
||||||
viewPortPx = this.getOLPixelFromPixel(pixel);
|
viewPortPx = this.getOLPixelFromPixel(pixel);
|
||||||
}
|
}
|
||||||
return viewPortPx;
|
return viewPortPx;
|
||||||
|
|||||||
Reference in New Issue
Block a user