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:
@@ -22,8 +22,8 @@ OpenLayers.Control.PanZoom.prototype =
|
|||||||
this.buttons = new Array();
|
this.buttons = new Array();
|
||||||
|
|
||||||
var sz = new OpenLayers.Size(18,18);
|
var sz = new OpenLayers.Size(18,18);
|
||||||
var xy = new OpenLayers.Point(4,4);
|
var xy = new OpenLayers.Pixel(4,4);
|
||||||
var centered = new OpenLayers.Point(xy.x+sz.w/2, xy.y);
|
var centered = new OpenLayers.Pixel(xy.x+sz.w/2, xy.y);
|
||||||
|
|
||||||
this._addButton("panup", "north-mini.png", centered, sz);
|
this._addButton("panup", "north-mini.png", centered, sz);
|
||||||
xy.y = centered.y+sz.h;
|
xy.y = centered.y+sz.h;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ OpenLayers.Events.prototype = {
|
|||||||
|
|
||||||
getMousePosition: function (evt) {
|
getMousePosition: function (evt) {
|
||||||
var offsets = Position.page(this.div);
|
var offsets = Position.page(this.div);
|
||||||
return new OpenLayers.Point(
|
return new OpenLayers.Pixel(
|
||||||
evt.clientX - offsets[0],
|
evt.clientX - offsets[0],
|
||||||
evt.clientY - offsets[1]);
|
evt.clientY - offsets[1]);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
|||||||
tileoffsetx = Math.round(tileoffsetx); // heaven help us
|
tileoffsetx = Math.round(tileoffsetx); // heaven help us
|
||||||
tileoffsety = Math.round(tileoffsety);
|
tileoffsety = Math.round(tileoffsety);
|
||||||
|
|
||||||
this.origin = new OpenLayers.Point(tileoffsetx,tileoffsety);
|
this.origin = new OpenLayers.Pixel(tileoffsetx,tileoffsety);
|
||||||
this.grid = new Array();
|
this.grid = new Array();
|
||||||
|
|
||||||
var startX = tileoffsetx;
|
var startX = tileoffsetx;
|
||||||
@@ -101,7 +101,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
|||||||
tileoffsetlon+tilelon
|
tileoffsetlon+tilelon
|
||||||
);
|
);
|
||||||
var tile = this.addTile(tileBounds,
|
var tile = this.addTile(tileBounds,
|
||||||
new OpenLayers.Point(tileoffsetx,
|
new OpenLayers.Pixel(tileoffsetx,
|
||||||
tileoffsety
|
tileoffsety
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ OpenLayers.Map.prototype = {
|
|||||||
// OpenLayers.Events
|
// OpenLayers.Events
|
||||||
events: null,
|
events: null,
|
||||||
|
|
||||||
// OpenLayers.Point
|
// OpenLayers.Pixel
|
||||||
mouseDragStart: null,
|
mouseDragStart: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -185,11 +185,11 @@ OpenLayers.Map.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Point} point
|
* @param {OpenLayers.Pixel} point
|
||||||
*
|
*
|
||||||
* @return {OpenLayers.LatLon}
|
* @return {OpenLayers.LatLon}
|
||||||
*/
|
*/
|
||||||
getLatLonFromPoint: function (point) {
|
getLatLonFromPixel: function (point) {
|
||||||
var center = this.getCenter(); //map center lat/lon
|
var center = this.getCenter(); //map center lat/lon
|
||||||
var res = this.getResolution();
|
var res = this.getResolution();
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
@@ -290,7 +290,7 @@ OpenLayers.Map.prototype = {
|
|||||||
* @param {Event} evt
|
* @param {Event} evt
|
||||||
*/
|
*/
|
||||||
defaultDblClick: function (evt) {
|
defaultDblClick: function (evt) {
|
||||||
var newCenter = this.getLatLonFromPoint( evt.xy );
|
var newCenter = this.getLatLonFromPixel( evt.xy );
|
||||||
this.zoomIn();
|
this.zoomIn();
|
||||||
this.setCenter(newCenter);
|
this.setCenter(newCenter);
|
||||||
},
|
},
|
||||||
@@ -312,9 +312,9 @@ OpenLayers.Map.prototype = {
|
|||||||
var deltaX = this.mouseDragStart.x - evt.xy.x;
|
var deltaX = this.mouseDragStart.x - evt.xy.x;
|
||||||
var deltaY = this.mouseDragStart.y - evt.xy.y
|
var deltaY = this.mouseDragStart.y - evt.xy.y
|
||||||
var size = this.getSize();
|
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);
|
size.h / 2 + deltaY);
|
||||||
var newCenter = this.getLatLonFromPoint( newXY );
|
var newCenter = this.getLatLonFromPixel( newXY );
|
||||||
this.setCenter(newCenter);
|
this.setCenter(newCenter);
|
||||||
this.mouseDragStart = evt.xy.copyOf();
|
this.mouseDragStart = evt.xy.copyOf();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ OpenLayers.Tile.prototype = {
|
|||||||
// OpenLayers.Size
|
// OpenLayers.Size
|
||||||
size:null,
|
size:null,
|
||||||
|
|
||||||
// OpenLayers.Point Bottom Left pixel of the tile
|
// OpenLayers.Pixel Top Left pixel of the tile
|
||||||
position:null,
|
position:null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ OpenLayers.Tile.Image.prototype =
|
|||||||
this.size);
|
this.size);
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
* @param OpenLayers.Point
|
* @param OpenLayers.Pixel
|
||||||
*/
|
*/
|
||||||
setPosition:function(point) {
|
setPosition:function(point) {
|
||||||
this.img.style.top = point.y+"px";
|
this.img.style.top = point.y+"px";
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
OpenLayers.Util=new Object();
|
OpenLayers.Util=new Object();
|
||||||
|
|
||||||
OpenLayers.Point = Class.create();
|
OpenLayers.Pixel = Class.create();
|
||||||
OpenLayers.Point.prototype = {
|
OpenLayers.Pixel.prototype = {
|
||||||
initialize: function(x,y) {
|
initialize: function(x,y) {
|
||||||
this.x=x;
|
this.x=x;
|
||||||
this.y=y;
|
this.y=y;
|
||||||
@@ -13,7 +13,7 @@ OpenLayers.Point.prototype = {
|
|||||||
return ("x="+this.x+",y="+this.y);
|
return ("x="+this.x+",y="+this.y);
|
||||||
},
|
},
|
||||||
copyOf:function() {
|
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
|
diff:function(pt){ // subtract pt from this
|
||||||
return new OpenLayers.Size(this.x - pt.x, this.y - pt.y);
|
return new OpenLayers.Size(this.x - pt.x, this.y - pt.y);
|
||||||
@@ -23,20 +23,20 @@ OpenLayers.Point.prototype = {
|
|||||||
},
|
},
|
||||||
diffPt:function(pt){
|
diffPt:function(pt){
|
||||||
sz=this.diff(pt);
|
sz=this.diff(pt);
|
||||||
return new OpenLayers.Point(sz.w,sz.h);
|
return new OpenLayers.Pixel(sz.w,sz.h);
|
||||||
},
|
},
|
||||||
equal:function(pt){
|
equal:function(pt){
|
||||||
d = this.diff(pt);
|
d = this.diff(pt);
|
||||||
return (d.w==0&&d.h==0);
|
return (d.w==0&&d.h==0);
|
||||||
},
|
},
|
||||||
addSize:function(sz){
|
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){
|
addX:function(w){
|
||||||
return new OpenLayers.Point(this.x+w, this.y);
|
return new OpenLayers.Pixel(this.x+w, this.y);
|
||||||
},
|
},
|
||||||
addY:function(h){
|
addY:function(h){
|
||||||
return new OpenLayers.Point(this.x, this.y+h);
|
return new OpenLayers.Pixel(this.x, this.y+h);
|
||||||
},
|
},
|
||||||
samePT:function(pt){
|
samePT:function(pt){
|
||||||
return (this.x==pt.x && this.y==pt.y);
|
return (this.x==pt.x && this.y==pt.y);
|
||||||
@@ -128,23 +128,23 @@ OpenLayers.Bounds.fromString=function(str){
|
|||||||
OpenLayers.Box = Class.create();
|
OpenLayers.Box = Class.create();
|
||||||
OpenLayers.Box.prototype = {
|
OpenLayers.Box.prototype = {
|
||||||
initialize: function(x,y,w,h){
|
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.sz=new OpenLayers.Size(w,h);
|
||||||
this.c = new OpenLayers.Point(x+(w/2), y+(h/2));
|
this.c = new OpenLayers.Pixel(x+(w/2), y+(h/2));
|
||||||
this.br = new OpenLayers.Point(x+w-1,y+h-1);
|
this.br = new OpenLayers.Pixel(x+w-1,y+h-1);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* offset box by df
|
/* offset box by df
|
||||||
* @df(OpenLayers.Size)
|
* @df(OpenLayers.Size)
|
||||||
*/
|
*/
|
||||||
offset:function(df){
|
offset:function(df){
|
||||||
this.xy=new OpenLayers.Point(this.xy.x+df.w,this.xy.y+df.h);
|
this.xy=new OpenLayers.Pixel(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.c = new OpenLayers.Pixel(this.xy.x+(this.sz.w/2), this.xy.y+(this.sz.h/2));
|
||||||
var x=this.xy.x;
|
var x=this.xy.x;
|
||||||
var y=this.xy.y;
|
var y=this.xy.y;
|
||||||
var w=this.sz.w;
|
var w=this.sz.w;
|
||||||
var h=this.sz.h;
|
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;},
|
getOrigin:function(){return this.xy;},
|
||||||
@@ -268,7 +268,7 @@ Array.prototype.clear=function() {this.length=0;};
|
|||||||
* zIndex is NOT set
|
* zIndex is NOT set
|
||||||
*
|
*
|
||||||
* @param {str} id - HTML ID of new element, if empty something is made up
|
* @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 {OpenLayers.Size} sz - size else size of parent is used
|
||||||
* @param {str} overflow - behavior of clipped/overflow content
|
* @param {str} overflow - behavior of clipped/overflow content
|
||||||
* @param {str} img - background image url
|
* @param {str} img - background image url
|
||||||
@@ -325,7 +325,7 @@ OpenLayers.Util.ImageHTML=function(img,sz,alt){
|
|||||||
/**
|
/**
|
||||||
* @param {str} img - src URL
|
* @param {str} img - src URL
|
||||||
* @param {OpenLayers.Size} sz
|
* @param {OpenLayers.Size} sz
|
||||||
* @param {OpenLayers.Point} xy
|
* @param {OpenLayers.Pixel} xy
|
||||||
* @param {str} position
|
* @param {str} position
|
||||||
* @param {str} id
|
* @param {str} id
|
||||||
* @param {int} border
|
* @param {int} border
|
||||||
|
|||||||
Reference in New Issue
Block a user