1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.data.projection;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.data.coor.EastNorth;
|
---|
5 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Classes implementing this are able to convert lat/lon values to
|
---|
9 | * planar screen coordinates.
|
---|
10 | *
|
---|
11 | * @author imi
|
---|
12 | */
|
---|
13 | public interface Projection {
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Maximum latitude representable.
|
---|
17 | */
|
---|
18 | public static final double MAX_LAT = 85.05112877980659; // Mercator squares the world
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Maximum longditude representable.
|
---|
22 | */
|
---|
23 | public static final double MAX_LON = 180;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Minimum difference in location to not be represented as the same position.
|
---|
27 | */
|
---|
28 | public static final double MAX_SERVER_PRECISION = 1e12;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * List of all available projections.
|
---|
32 | */
|
---|
33 | public static Projection[] allProjections = new Projection[]{
|
---|
34 | new Epsg4326(),
|
---|
35 | new Mercator(),
|
---|
36 | new Lambert(),
|
---|
37 | new LambertEST()
|
---|
38 | };
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Convert from lat/lon to northing/easting.
|
---|
42 | *
|
---|
43 | * @param p The geo point to convert. x/y members of the point are filled.
|
---|
44 | */
|
---|
45 | EastNorth latlon2eastNorth(LatLon p);
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Convert from norting/easting to lat/lon.
|
---|
49 | *
|
---|
50 | * @param p The geo point to convert. lat/lon members of the point are filled.
|
---|
51 | */
|
---|
52 | LatLon eastNorth2latlon(EastNorth p);
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Describe the projection converter in one or two words.
|
---|
56 | */
|
---|
57 | String toString();
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Return projection code.
|
---|
61 | */
|
---|
62 | String toCode();
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Get a filename compatible string (for the cache directory)
|
---|
66 | */
|
---|
67 | String getCacheDirectoryName();
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * The factor to multiply with an easting coordinate to get from "easting
|
---|
71 | * units per pixel" to "meters per pixel"
|
---|
72 | */
|
---|
73 | double scaleFactor();
|
---|
74 | }
|
---|