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 ({@link #NavigatableComponent#scale})).
|
---|
18 | * FIXME: misnomer
|
---|
19 | * @return the scale factor
|
---|
20 | */
|
---|
21 | double getDefaultZoomInPPD();
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Convert from lat/lon to easting/northing.
|
---|
25 | *
|
---|
26 | * @param ll the geographical point to convert (in WGS84 lat/lon)
|
---|
27 | * @return the corresponding east/north coordinates
|
---|
28 | */
|
---|
29 | EastNorth latlon2eastNorth(LatLon ll);
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Convert from easting/norting to lat/lon.
|
---|
33 | *
|
---|
34 | * @param en the geographical point to convert (in projected coordinates)
|
---|
35 | * @return the corresponding lat/lon (WGS84)
|
---|
36 | */
|
---|
37 | LatLon eastNorth2latlon(EastNorth en);
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Describe the projection in one or two words.
|
---|
41 | * @return the name / description
|
---|
42 | */
|
---|
43 | String toString();
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Return projection code.
|
---|
47 | *
|
---|
48 | * This should be a unique identifier.
|
---|
49 | * If projection supports parameters, return a different code
|
---|
50 | * for each set of parameters.
|
---|
51 | *
|
---|
52 | * The EPSG code can be used (if defined for the projection).
|
---|
53 | *
|
---|
54 | * @return the projection identifier
|
---|
55 | */
|
---|
56 | String toCode();
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Get a filename compatible string (for the cache directory).
|
---|
60 | * @return the cache directory name (base name)
|
---|
61 | */
|
---|
62 | String getCacheDirectoryName();
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Get the bounds of the world.
|
---|
66 | * @return the supported lat/lon rectangle for this projection
|
---|
67 | */
|
---|
68 | Bounds getWorldBoundsLatLon();
|
---|
69 | }
|
---|