Changeset 864 in josm


Ignore:
Timestamp:
Aug 24, 2008 9:14:42 PM (5 years ago)
Author:
framm
Message:
  • fix for Lambert projection by Pieren <pieren3@…>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/Lambert.java

    r810 r864  
    6666        public static int layoutZone = -1; 
    6767 
     68        private static int currentZone = 0; 
     69 
     70        private static boolean dontDisplayErrors = false; 
     71 
    6872        /** 
    6973         * @param p  WGS84 lat/lon (ellipsoid GRS80) (in degree) 
     
    7781 
    7882                // check if longitude and latitude are inside the french Lambert zones 
    79                 int currentZone = 0; 
     83                currentZone = 0; 
    8084                boolean outOfLambertZones = false; 
    8185                if (lt >= zoneLimits[3] && lt <= cMaxLatZone1 && lg >= cMinLonZones && lg <= cMaxLonZones) { 
     
    100104                } else { 
    101105                        outOfLambertZones = true; // possible when MAX_LAT is used 
     106                        if (p.lat() != 0 && Math.abs(p.lat()) != Projection.MAX_LAT 
     107                                        && p.lon() != 0 && Math.abs(p.lon()) != Projection.MAX_LON 
     108                                && dontDisplayErrors == false) { 
     109                                JOptionPane.showMessageDialog(Main.parent,  
     110                                                tr("The projection \"" + this.toString() + "\" is designed for\n"  
     111                                        + "latitudes between 46.1 and 57 degrees only.\n" 
     112                                        + "Use another projection system if you are not using\n" 
     113                                        + "a french WMS server.\n" 
     114                                        + "Do not upload any data after this message.")); 
     115                                dontDisplayErrors = true; 
     116                        } 
    102117                } 
    103118                if (!outOfLambertZones) { 
    104                         if (layoutZone == -1) 
     119                        if (layoutZone == -1) { 
    105120                                layoutZone = currentZone; 
    106                         else if (layoutZone != currentZone) { 
     121                                dontDisplayErrors = false; 
     122                        } else if (layoutZone != currentZone) { 
    107123                                if ((currentZone < layoutZone && Math.abs(zoneLimits[currentZone] - lt) > cMaxOverlappingZones) 
    108124                                                || (currentZone > layoutZone && Math.abs(zoneLimits[layoutZone] - lt) > cMaxOverlappingZones)) { 
     
    110126                                                                        tr("IMPORTANT : data positionned far away from\n" 
    111127                                                                                        + "the current Lambert zone limits.\n" 
     128                                                                                + "Do not upload any data after this message.\n" 
    112129                                                                                        + "Undo your last action, Save your work \n" 
    113130                                                                                        + "and Start a new layer on the new zone.")); 
    114131                                        layoutZone = -1; 
     132                                        dontDisplayErrors = true; 
    115133                                } else { 
    116                                         System.out.println("temporarily extends Lambert zone " 
    117                                                         + layoutZone + " projection at lat,lon:" + lt + "," 
    118                                                         + lg); 
     134                                        System.out.println("temporarily extends Lambert zone " + layoutZone + " projection at lat,lon:" 
     135                                                + lt + "," + lg); 
    119136                                } 
    120137                        } 
     
    127144 
    128145        public LatLon eastNorth2latlon(EastNorth p) { 
    129                 LatLon geo = Geographic(p, Xs[layoutZone], Ys[layoutZone], c[layoutZone], n[layoutZone]); 
     146                LatLon geo; 
     147                if (layoutZone == -1) 
     148                        // possible until the Lambert zone is determined by latlon2eastNorth() with a valid LatLon 
     149                        geo = Geographic(p, Xs[currentZone], Ys[currentZone], c[currentZone], n[currentZone]); 
     150                else 
     151                        geo = Geographic(p, Xs[layoutZone], Ys[layoutZone], c[layoutZone], n[layoutZone]); 
    130152                // translate ellipsoid Clark => GRS80 (WGS83) 
    131153                LatLon wgs = Clark2GRS80(geo); 
     
    133155        } 
    134156 
    135         @Override 
    136         public String toString() { 
    137                 return "Lambert"; 
     157        @Override public String toString() { 
     158                return "Lambert Zone (France)"; 
    138159        } 
    139160 
Note: See TracChangeset for help on using the changeset viewer.