Change "OpenLayers.Point" to OpenLayers.Pixel, so there's no confusion between LatLon and Point (a problem that has

and still does afflict the Google Maps API).


git-svn-id: http://svn.openlayers.org/trunk/openlayers@19 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-05-12 22:59:47 +00:00
parent 05d213a806
commit f2fa6622f1
7 changed files with 28 additions and 28 deletions

View File

@@ -22,8 +22,8 @@ OpenLayers.Control.PanZoom.prototype =
this.buttons = new Array();
var sz = new OpenLayers.Size(18,18);
var xy = new OpenLayers.Point(4,4);
var centered = new OpenLayers.Point(xy.x+sz.w/2, xy.y);
var xy = new OpenLayers.Pixel(4,4);
var centered = new OpenLayers.Pixel(xy.x+sz.w/2, xy.y);
this._addButton("panup", "north-mini.png", centered, sz);
xy.y = centered.y+sz.h;

View File

@@ -48,7 +48,7 @@ OpenLayers.Events.prototype = {
getMousePosition: function (evt) {
var offsets = Position.page(this.div);
return new OpenLayers.Point(
return new OpenLayers.Pixel(
evt.clientX - offsets[0],
evt.clientY - offsets[1]);
},

View File

@@ -82,7 +82,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
tileoffsetx = Math.round(tileoffsetx); // heaven help us
tileoffsety = Math.round(tileoffsety);
this.origin = new OpenLayers.Point(tileoffsetx,tileoffsety);
this.origin = new OpenLayers.Pixel(tileoffsetx,tileoffsety);
this.grid = new Array();
var startX = tileoffsetx;
@@ -101,7 +101,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
tileoffsetlon+tilelon
);
var tile = this.addTile(tileBounds,
new OpenLayers.Point(tileoffsetx,
new OpenLayers.Pixel(tileoffsetx,
tileoffsety
)
);

View File

@@ -45,7 +45,7 @@ OpenLayers.Map.prototype = {
// OpenLayers.Events
events: null,
// OpenLayers.Point
// OpenLayers.Pixel
mouseDragStart: null,
/**
@@ -185,11 +185,11 @@ OpenLayers.Map.prototype = {
},
/**
* @param {OpenLayers.Point} point
* @param {OpenLayers.Pixel} point
*
* @return {OpenLayers.LatLon}
*/
getLatLonFromPoint: function (point) {
getLatLonFromPixel: function (point) {
var center = this.getCenter(); //map center lat/lon
var res = this.getResolution();
var size = this.getSize();
@@ -290,7 +290,7 @@ OpenLayers.Map.prototype = {
* @param {Event} evt
*/
defaultDblClick: function (evt) {
var newCenter = this.getLatLonFromPoint( evt.xy );
var newCenter = this.getLatLonFromPixel( evt.xy );
this.zoomIn();
this.setCenter(newCenter);
},
@@ -312,9 +312,9 @@ OpenLayers.Map.prototype = {
var deltaX = this.mouseDragStart.x - evt.xy.x;
var deltaY = this.mouseDragStart.y - evt.xy.y
var size = this.getSize();
var newXY = new OpenLayers.Point(size.w / 2 + deltaX,
var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX,
size.h / 2 + deltaY);
var newCenter = this.getLatLonFromPoint( newXY );
var newCenter = this.getLatLonFromPixel( newXY );
this.setCenter(newCenter);
this.mouseDragStart = evt.xy.copyOf();
}

View File

@@ -17,7 +17,7 @@ OpenLayers.Tile.prototype = {
// OpenLayers.Size
size:null,
// OpenLayers.Point Bottom Left pixel of the tile
// OpenLayers.Pixel Top Left pixel of the tile
position:null,
/**

View File

@@ -15,7 +15,7 @@ OpenLayers.Tile.Image.prototype =
this.size);
},
/*
* @param OpenLayers.Point
* @param OpenLayers.Pixel
*/
setPosition:function(point) {
this.img.style.top = point.y+"px";

View File

@@ -3,8 +3,8 @@
*/
OpenLayers.Util=new Object();
OpenLayers.Point = Class.create();
OpenLayers.Point.prototype = {
OpenLayers.Pixel = Class.create();
OpenLayers.Pixel.prototype = {
initialize: function(x,y) {
this.x=x;
this.y=y;
@@ -13,7 +13,7 @@ OpenLayers.Point.prototype = {
return ("x="+this.x+",y="+this.y);
},
copyOf:function() {
return new OpenLayers.Point(this.x, this.y);
return new OpenLayers.Pixel(this.x, this.y);
},
diff:function(pt){ // subtract pt from this
return new OpenLayers.Size(this.x - pt.x, this.y - pt.y);
@@ -23,20 +23,20 @@ OpenLayers.Point.prototype = {
},
diffPt:function(pt){
sz=this.diff(pt);
return new OpenLayers.Point(sz.w,sz.h);
return new OpenLayers.Pixel(sz.w,sz.h);
},
equal:function(pt){
d = this.diff(pt);
return (d.w==0&&d.h==0);
},
addSize:function(sz){
return new OpenLayers.Point(this.x+sz.w, this.y+sz.h);
return new OpenLayers.Pixel(this.x+sz.w, this.y+sz.h);
},
addX:function(w){
return new OpenLayers.Point(this.x+w, this.y);
return new OpenLayers.Pixel(this.x+w, this.y);
},
addY:function(h){
return new OpenLayers.Point(this.x, this.y+h);
return new OpenLayers.Pixel(this.x, this.y+h);
},
samePT:function(pt){
return (this.x==pt.x && this.y==pt.y);
@@ -128,23 +128,23 @@ OpenLayers.Bounds.fromString=function(str){
OpenLayers.Box = Class.create();
OpenLayers.Box.prototype = {
initialize: function(x,y,w,h){
this.xy=new OpenLayers.Point(x,y);
this.xy=new OpenLayers.Pixel(x,y);
this.sz=new OpenLayers.Size(w,h);
this.c = new OpenLayers.Point(x+(w/2), y+(h/2));
this.br = new OpenLayers.Point(x+w-1,y+h-1);
this.c = new OpenLayers.Pixel(x+(w/2), y+(h/2));
this.br = new OpenLayers.Pixel(x+w-1,y+h-1);
},
/* offset box by df
* @df(OpenLayers.Size)
*/
offset:function(df){
this.xy=new OpenLayers.Point(this.xy.x+df.w,this.xy.y+df.h);
this.c = new OpenLayers.Point(this.xy.x+(this.sz.w/2), this.xy.y+(this.sz.h/2));
this.xy=new OpenLayers.Pixel(this.xy.x+df.w,this.xy.y+df.h);
this.c = new OpenLayers.Pixel(this.xy.x+(this.sz.w/2), this.xy.y+(this.sz.h/2));
var x=this.xy.x;
var y=this.xy.y;
var w=this.sz.w;
var h=this.sz.h;
this.br = new OpenLayers.Point(x+w-1,y+h-1);
this.br = new OpenLayers.Pixel(x+w-1,y+h-1);
},
getOrigin:function(){return this.xy;},
@@ -268,7 +268,7 @@ Array.prototype.clear=function() {this.length=0;};
* zIndex is NOT set
*
* @param {str} id - HTML ID of new element, if empty something is made up
* @param {OpenLayers.Point} pt - x,y point if missing 0,0 is used
* @param {OpenLayers.Pixel} pt - x,y point if missing 0,0 is used
* @param {OpenLayers.Size} sz - size else size of parent is used
* @param {str} overflow - behavior of clipped/overflow content
* @param {str} img - background image url
@@ -325,7 +325,7 @@ OpenLayers.Util.ImageHTML=function(img,sz,alt){
/**
* @param {str} img - src URL
* @param {OpenLayers.Size} sz
* @param {OpenLayers.Point} xy
* @param {OpenLayers.Pixel} xy
* @param {str} position
* @param {str} id
* @param {int} border