Merge pull request #2840 from tschaub/point-resolution
Fewer point resolution tests.
This commit is contained in:
+5
-5
@@ -252,7 +252,8 @@ ol.proj.Projection.prototype.setWorldExtent = function(worldExtent) {
|
||||
* @return {number} Point resolution.
|
||||
*/
|
||||
ol.proj.Projection.prototype.getPointResolution = function(resolution, point) {
|
||||
if (this.getUnits() == ol.proj.Units.DEGREES) {
|
||||
var units = this.getUnits();
|
||||
if (units == ol.proj.Units.DEGREES) {
|
||||
return resolution;
|
||||
} else {
|
||||
// Estimate point resolution by transforming the center pixel to EPSG:4326,
|
||||
@@ -272,10 +273,9 @@ ol.proj.Projection.prototype.getPointResolution = function(resolution, point) {
|
||||
var height = ol.sphere.NORMAL.haversineDistance(
|
||||
vertices.slice(4, 6), vertices.slice(6, 8));
|
||||
var pointResolution = (width + height) / 2;
|
||||
if (this.getUnits() == ol.proj.Units.FEET) {
|
||||
// The radius of the normal sphere is defined in meters, so we must
|
||||
// convert back to feet.
|
||||
pointResolution /= 0.3048;
|
||||
var metersPerUnit = this.getMetersPerUnit();
|
||||
if (goog.isDef(metersPerUnit)) {
|
||||
pointResolution /= metersPerUnit;
|
||||
}
|
||||
return pointResolution;
|
||||
}
|
||||
|
||||
@@ -175,8 +175,8 @@ describe('ol.proj', function() {
|
||||
var epsg3857Projection = ol.proj.get('EPSG:3857');
|
||||
var googleProjection = ol.proj.get('GOOGLE');
|
||||
var point, x, y;
|
||||
for (x = -20; x <= 20; ++x) {
|
||||
for (y = -20; y <= 20; ++y) {
|
||||
for (x = -20; x <= 20; x += 2) {
|
||||
for (y = -20; y <= 20; y += 2) {
|
||||
point = [1000000 * x, 1000000 * y];
|
||||
expect(googleProjection.getPointResolution(1, point)).to.roughlyEqual(
|
||||
epsg3857Projection.getPointResolution(1, point), 1e-1);
|
||||
|
||||
Reference in New Issue
Block a user