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.ProjectionBounds;
|
---|
6 | import org.openstreetmap.josm.data.coor.EastNorth;
|
---|
7 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * A projection, i.e. a class that supports conversion from lat/lon
|
---|
11 | * to east/north and back.
|
---|
12 | *
|
---|
13 | * The conversion from east/north to the screen coordinates is simply a scale
|
---|
14 | * factor and x/y offset.
|
---|
15 | */
|
---|
16 | public interface Projection {
|
---|
17 | /**
|
---|
18 | * The default scale factor in east/north units per pixel
|
---|
19 | * ({@link org.openstreetmap.josm.gui.NavigatableComponent#scale})).
|
---|
20 | * FIXME: misnomer
|
---|
21 | * @return the scale factor
|
---|
22 | */
|
---|
23 | double getDefaultZoomInPPD();
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Convert from lat/lon to easting/northing.
|
---|
27 | *
|
---|
28 | * @param ll the geographical point to convert (in WGS84 lat/lon)
|
---|
29 | * @return the corresponding east/north coordinates
|
---|
30 | */
|
---|
31 | EastNorth latlon2eastNorth(LatLon ll);
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Convert from easting/norting to lat/lon.
|
---|
35 | *
|
---|
36 | * @param en the geographical point to convert (in projected coordinates)
|
---|
37 | * @return the corresponding lat/lon (WGS84)
|
---|
38 | */
|
---|
39 | LatLon eastNorth2latlon(EastNorth en);
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Describe the projection in one or two words.
|
---|
43 | * @return the name / description
|
---|
44 | */
|
---|
45 | String toString();
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Return projection code.
|
---|
49 | *
|
---|
50 | * This should be a unique identifier.
|
---|
51 | * If projection supports parameters, return a different code
|
---|
52 | * for each set of parameters.
|
---|
53 | *
|
---|
54 | * The EPSG code can be used (if defined for the projection).
|
---|
55 | *
|
---|
56 | * @return the projection identifier
|
---|
57 | */
|
---|
58 | String toCode();
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * Get a filename compatible string (for the cache directory).
|
---|
62 | * @return the cache directory name (base name)
|
---|
63 | */
|
---|
64 | String getCacheDirectoryName();
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Get the bounds of the world.
|
---|
68 | * @return the supported lat/lon rectangle for this projection
|
---|
69 | */
|
---|
70 | Bounds getWorldBoundsLatLon();
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Get an approximate EastNorth box around the lat/lon world bounds.
|
---|
74 | *
|
---|
75 | * Note: The projection is only valid within the bounds returned by
|
---|
76 | * {@link #getWorldBoundsLatLon()}. The lat/lon bounds need not be a
|
---|
77 | * rectangular shape in east/north space. This method returns a box that
|
---|
78 | * contains this shape.
|
---|
79 | *
|
---|
80 | * @return EastNorth box around the lat/lon world bounds
|
---|
81 | */
|
---|
82 | ProjectionBounds getWorldBoundsBoxEastNorth();
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * Get the number of meters per unit of this projection. This more
|
---|
86 | * defines the scale of the map, than real conversion of unit to meters
|
---|
87 | * as this value is more less correct only along great circles.
|
---|
88 | *
|
---|
89 | * Used by WMTS to properly scale tiles
|
---|
90 | * @return meters per unit of projection
|
---|
91 | *
|
---|
92 | */
|
---|
93 | double getMetersPerUnit();
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Does this projection natural order of coordinates is North East,
|
---|
97 | * instead of East North
|
---|
98 | *
|
---|
99 | * @return true if natural order of coordinates is North East, false if East North
|
---|
100 | */
|
---|
101 | boolean switchXY();
|
---|
102 | }
|
---|