Ignore:
Timestamp:
2009-07-03T12:33:32+02:00 (15 years ago)
Author:
stoecker
Message:

Large rework in projection handling - now allows only switching and more specific projections
TODO:

  • allow subprojections (i.e. settings for projections)
  • setup preferences for subprojections
  • better support of the new projection depending world bounds (how to handle valid data outside of world)
  • do not allow to zoom out of the world - zoom should stop when whole world is displayed
  • fix Lambert and SwissGrid to handle new OutOfWorld style and subprojections
  • fix new UTM projection
  • handle layers with fixed projection on projection change
  • allow easier projection switching (e.g. in menu)

NOTE:
This checkin very likely will cause problems. Please report or fix them. Older plugins may have trouble. The SVN plugins
have been fixed but may have problems nevertheless. This is a BIG change, but will make JOSMs internal structure much cleaner
and reduce lots of projection related problems.

File:
1 edited

Legend:

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

    r1583 r1722  
    1212import org.openstreetmap.josm.data.coor.EastNorth;
    1313import org.openstreetmap.josm.data.coor.LatLon;
     14import org.openstreetmap.josm.data.Bounds;
     15import org.openstreetmap.josm.data.ProjectionBounds;
    1416
    1517public class Lambert implements Projection {
     
    104106        } else {
    105107            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 \"{0}\" is designed for\n"
    111                         + "latitudes between 46.1\u00b0 and 57\u00b0 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.", this.toString()));
    115                 dontDisplayErrors = true;
    116             }
    117108        }
    118109        if (!outOfLambertZones) {
     
    167158    }
    168159
    169     public double scaleFactor() {
    170         return 1.0 / 360;
    171     }
    172 
    173160    @Override
    174161    public boolean equals(Object o) {
    175162        return o instanceof Lambert;
    176     }
    177 
    178     @Override
    179     public int hashCode() {
    180         return Lambert.class.hashCode();
    181163    }
    182164
     
    300282    }
    301283
     284    public ProjectionBounds getWorldBounds()
     285    {
     286        Bounds b = getWorldBoundsLatLon();
     287        return new ProjectionBounds(latlon2eastNorth(b.min), latlon2eastNorth(b.max));
     288    }
     289
     290    public Bounds getWorldBoundsLatLon()
     291    {
     292        return new Bounds(
     293        new LatLon(-90.0, -180.0),
     294        new LatLon(90.0, 180.0));
     295    }
    302296}
Note: See TracChangeset for help on using the changeset viewer.