From f2fa6622f184fa4c7a3c2ef0033a8cdcdaedc1eb Mon Sep 17 00:00:00 2001 From: crschmidt Date: Fri, 12 May 2006 22:59:47 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Control/PanZoom.js | 4 ++-- lib/OpenLayers/Events.js | 2 +- lib/OpenLayers/Layer/Grid.js | 4 ++-- lib/OpenLayers/Map.js | 12 ++++++------ lib/OpenLayers/Tile.js | 2 +- lib/OpenLayers/Tile/Image.js | 2 +- lib/OpenLayers/Util.js | 30 +++++++++++++++--------------- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/OpenLayers/Control/PanZoom.js b/lib/OpenLayers/Control/PanZoom.js index c8943cba8b..b94d15d76f 100644 --- a/lib/OpenLayers/Control/PanZoom.js +++ b/lib/OpenLayers/Control/PanZoom.js @@ -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; diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index 84793932d6..e27395f8a5 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -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]); }, diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 581958e1d1..a90721bd75 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -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 ) ); diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index eec40185e8..2f6a44d377 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -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(); } diff --git a/lib/OpenLayers/Tile.js b/lib/OpenLayers/Tile.js index 9c2bfb14ec..8c7f0cb8c8 100644 --- a/lib/OpenLayers/Tile.js +++ b/lib/OpenLayers/Tile.js @@ -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, /** diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 892392f4ca..6b958d2cfb 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -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"; diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 7377a88488..45d8947192 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -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