Ignore:
Timestamp:
2016-03-23T21:52:44+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #12632 - Use WGS84 Ellipsoid constant instead of fixed value for R

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r9239 r10033  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
     3
     4import static org.openstreetmap.josm.data.projection.Ellipsoid.WGS84;
    35
    46import java.util.Collection;
     
    637639        }
    638640
    639         private static final double R = 6378135;
    640 
    641641        public static double level2scale(int lvl) {
    642642            if (lvl < 0)
     
    644644            // preliminary formula - map such that mapnik imagery tiles of the same
    645645            // or similar level are displayed at the given scale
    646             return 2.0 * Math.PI * R / Math.pow(2.0, lvl) / 2.56;
     646            return 2.0 * Math.PI * WGS84.a / Math.pow(2.0, lvl) / 2.56;
    647647        }
    648648
     
    650650            if (scale < 0)
    651651                throw new IllegalArgumentException("scale must be >= 0 but is "+scale);
    652             return (int) Math.floor(Math.log(2 * Math.PI * R / 2.56 / scale) / Math.log(2));
     652            return (int) Math.floor(Math.log(2 * Math.PI * WGS84.a / 2.56 / scale) / Math.log(2));
    653653        }
    654654
Note: See TracChangeset for help on using the changeset viewer.