conversions to/from lonlat/px need to take into account
the offset of the layersContainerDiv. 


I have introduced the following functions for converting
between layer and screen pixel values:

getLayerPxFromScreenPx() and getScreenPxFromLayerPx()

they are pretty self-explanitory.


I then renamed:

getPixelFromLonLat() and getLonLatFromPixel()

to:

getScreenPxFromLonLat() and getLonLatFroScreenmPx()

and added:

getLayerPxFromLonLat() and getLonLatFromLayerPx()


updates were made throughout the code, demos, and tests
so everything should still run smoothly.

-e-

git-svn-id: http://svn.openlayers.org/trunk/openlayers@329 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-24 18:45:50 +00:00
parent e5bb6b7dbd
commit 06cbeb2f11
5 changed files with 93 additions and 21 deletions
+4 -4
View File
@@ -125,11 +125,11 @@
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
var pixel = new OpenLayers.Pixel(50,150);
var lonlat = map.getLonLatFromPixel(pixel);
t.ok( lonlat instanceof OpenLayers.LonLat, "getLonLatFromPixel returns valid OpenLayers.LonLat" );
var lonlat = map.getLonLatFromScreenPx(pixel);
t.ok( lonlat instanceof OpenLayers.LonLat, "getLonLatFromScreenPx returns valid OpenLayers.LonLat" );
var newPixel = map.getPixelFromLonLat(lonlat);
t.ok( newPixel instanceof OpenLayers.Pixel, "getPixelFromLonLat returns valid OpenLayers.Pixel" );
var newPixel = map.getScreenPxFromLonLat(lonlat);
t.ok( newPixel instanceof OpenLayers.Pixel, "getScreenPxFromLonLat returns valid OpenLayers.Pixel" );
// WARNING!!! I'm faily sure that the following test's validity
// depends highly on rounding and the resolution. For now,