replace Pixel argument with simple object (Pixel.offset)
This commit is contained in:
@@ -234,8 +234,8 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
|
||||
for (var i=0; i<this.intervals.length; ++i) {
|
||||
llInterval = this.intervals[i]; //could do this for both x and y??
|
||||
var delta = llInterval/2;
|
||||
var p1 = mapCenterLL.offset(new OpenLayers.Pixel(-delta, -delta)); //test coords in EPSG:4326 space
|
||||
var p2 = mapCenterLL.offset(new OpenLayers.Pixel( delta, delta));
|
||||
var p1 = mapCenterLL.offset({x: -delta, y: -delta}); //test coords in EPSG:4326 space
|
||||
var p2 = mapCenterLL.offset({x: delta, y: delta});
|
||||
OpenLayers.Projection.transform(p1, llProj, mapProj); // convert them back to map projection
|
||||
OpenLayers.Projection.transform(p2, llProj, mapProj);
|
||||
var distSq = (p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y);
|
||||
@@ -261,13 +261,13 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
|
||||
var newPoint = mapCenterLL.clone();
|
||||
var mapXY;
|
||||
do {
|
||||
newPoint = newPoint.offset(new OpenLayers.Pixel(0,llInterval));
|
||||
newPoint = newPoint.offset({x: 0, y: llInterval});
|
||||
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);
|
||||
centerLonPoints.unshift(newPoint);
|
||||
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);
|
||||
newPoint = mapCenterLL.clone();
|
||||
do {
|
||||
newPoint = newPoint.offset(new OpenLayers.Pixel(0,-llInterval));
|
||||
newPoint = newPoint.offset({x: 0, y: -llInterval});
|
||||
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);
|
||||
centerLonPoints.push(newPoint);
|
||||
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);
|
||||
@@ -277,13 +277,13 @@ OpenLayers.Control.Graticule = OpenLayers.Class(OpenLayers.Control, {
|
||||
var centerLatPoints = [mapCenterLL.clone()];
|
||||
newPoint = mapCenterLL.clone();
|
||||
do {
|
||||
newPoint = newPoint.offset(new OpenLayers.Pixel(-llInterval, 0));
|
||||
newPoint = newPoint.offset({x: -llInterval, y: 0});
|
||||
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);
|
||||
centerLatPoints.unshift(newPoint);
|
||||
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);
|
||||
newPoint = mapCenterLL.clone();
|
||||
do {
|
||||
newPoint = newPoint.offset(new OpenLayers.Pixel(llInterval, 0));
|
||||
newPoint = newPoint.offset({x: llInterval, y: 0});
|
||||
mapXY = OpenLayers.Projection.transform(newPoint.clone(), llProj, mapProj);
|
||||
centerLatPoints.push(newPoint);
|
||||
} while (mapBounds.containsPixel(mapXY) && ++iter<1000);
|
||||
|
||||
Reference in New Issue
Block a user