1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.projection;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.data.Bounds;
|
---|
5 | import org.openstreetmap.josm.data.coor.EastNorth;
|
---|
6 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * A projection, i.e. a class that supports conversion from lat/lon
|
---|
10 | * to east/north and back.
|
---|
11 | *
|
---|
12 | * The conversion from east/north to the screen coordinates is simply a scale
|
---|
13 | * factor and x/y offset.
|
---|
14 | */
|
---|
15 | public interface Projection {
|
---|
16 | /**
|
---|
17 | * The default scale factor in east/north units per pixel
|
---|
18 | * ({@link org.openstreetmap.josm.gui.NavigatableComponent#scale})).
|
---|
19 | * FIXME: misnomer
|
---|
20 | * @return the scale factor
|
---|
21 | */
|
---|
22 | double getDefaultZoomInPPD();
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Convert from lat/lon to easting/northing.
|
---|
26 | *
|
---|
27 | * @param ll the geographical point to convert (in WGS84 lat/lon)
|
---|
28 | * @return the corresponding east/north coordinates
|
---|
29 | */
|
---|
30 | EastNorth latlon2eastNorth(LatLon ll);
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Convert from easting/norting to lat/lon.
|
---|
34 | *
|
---|
35 | * @param en the geographical point to convert (in projected coordinates)
|
---|
36 | * @return the corresponding lat/lon (WGS84)
|
---|
37 | */
|
---|
38 | LatLon eastNorth2latlon(EastNorth en);
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Describe the projection in one or two words.
|
---|
42 | * @return the name / description
|
---|
43 | */
|
---|
44 | String toString();
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Return projection code.
|
---|
48 | *
|
---|
49 | * This should be a unique identifier.
|
---|
50 | * If projection supports parameters, return a different code
|
---|
51 | * for each set of parameters.
|
---|
52 | *
|
---|
53 | * The EPSG code can be used (if defined for the projection).
|
---|
54 | *
|
---|
55 | * @return the projection identifier
|
---|
56 | */
|
---|
57 | String toCode();
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Get a filename compatible string (for the cache directory).
|
---|
61 | * @return the cache directory name (base name)
|
---|
62 | */
|
---|
63 | String getCacheDirectoryName();
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Get the bounds of the world.
|
---|
67 | * @return the supported lat/lon rectangle for this projection
|
---|
68 | */
|
---|
69 | Bounds getWorldBoundsLatLon();
|
---|
70 | }
|
---|