Ignore:
Timestamp:
2006-03-25T16:21:09+01:00 (14 years ago)
Author:
imi
Message:
  • refactored GpsPoint to be immutable and added LatLon and NorthEast
  • refactored Bounding Box calculations
  • various other renames
Location:
src/org/openstreetmap/josm/data/projection
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/data/projection/Epsg4263.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/**
     
    1011public class Epsg4263 implements Projection {
    1112
    12         public void latlon2xy(GeoPoint p) {
    13                 p.x = p.lon;
    14                 p.y = p.lat;
     13        public EastNorth latlon2eastNorth(LatLon p) {
     14                return new EastNorth(p.lon(), p.lat());
    1515        }
    1616
    17         public void xy2latlon(GeoPoint p) {
    18                 p.lat = p.y;
    19                 p.lon = p.x;
     17        public LatLon eastNorth2latlon(EastNorth p) {
     18                return new LatLon(p.north(), p.east());
    2019        }
    2120
  • 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
  • src/org/openstreetmap/josm/data/projection/Projection.java

    r58 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/**
     
    2021         * @param p             The geo point to convert. x/y members of the point are filled.
    2122         */
    22         void latlon2xy(GeoPoint p);
     23        EastNorth latlon2eastNorth(LatLon p);
    2324       
    2425        /**
     
    2728         * @param p             The geo point to convert. lat/lon members of the point are filled.
    2829         */
    29         void xy2latlon(GeoPoint p);
     30        LatLon eastNorth2latlon(EastNorth p);
    3031
    3132        /**
Note: See TracChangeset for help on using the changeset viewer.