Ignore:
Timestamp:
2006-03-25T16:21:09+01:00 (18 years ago)
Author:
imi
Message:
  • refactored GpsPoint to be immutable and added LatLon and NorthEast
  • refactored Bounding Box calculations
  • various other renames
File:
1 edited

Legend:

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

    r52 r71  
    11package org.openstreetmap.josm.data.projection;
    22
    3 import org.openstreetmap.josm.data.GeoPoint;
     3import org.openstreetmap.josm.data.coor.LatLon;
     4import org.openstreetmap.josm.data.coor.EastNorth;
    45
    56/**
     
    1415public class Mercator implements Projection {
    1516
    16         public void latlon2xy(GeoPoint p) {
    17                 p.x = p.lon*Math.PI/180;
    18                 p.y = Math.log(Math.tan(Math.PI/4+p.lat*Math.PI/360));
     17        public EastNorth latlon2eastNorth(LatLon p) {
     18                return new EastNorth(
     19                        p.lon()*Math.PI/180,
     20                        Math.log(Math.tan(Math.PI/4+p.lat()*Math.PI/360)));
    1921        }
    2022
    21         public void xy2latlon(GeoPoint p) {
    22                 p.lon = p.x*180/Math.PI;
    23                 p.lat = Math.atan(Math.sinh(p.y))*180/Math.PI;
     23        public LatLon eastNorth2latlon(EastNorth p) {
     24                return new LatLon(
     25                        p.east()*180/Math.PI,
     26                        Math.atan(Math.sinh(p.north()))*180/Math.PI);
    2427        }
    2528
Note: See TracChangeset for help on using the changeset viewer.