source: josm/trunk/src/org/openstreetmap/josm/data/projection/Projection.java@ 11747

Last change on this file since 11747 was 10829, checked in by Don-vip, 8 years ago

see #13306 - fix wrong version number

  • Property svn:eol-style set to native
File size: 3.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection;
3
4import org.openstreetmap.josm.data.Bounds;
5import org.openstreetmap.josm.data.ProjectionBounds;
6import org.openstreetmap.josm.data.coor.EastNorth;
7import 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 */
16public interface Projection extends Projecting {
17 /**
18 * The default scale factor in east/north units per pixel
19 * ({@link org.openstreetmap.josm.gui.NavigatableComponent#getState})).
20 * FIXME: misnomer
21 * @return the scale factor
22 */
23 double getDefaultZoomInPPD();
24
25 /**
26 * Convert from easting/norting to lat/lon.
27 *
28 * @param en the geographical point to convert (in projected coordinates)
29 * @return the corresponding lat/lon (WGS84)
30 */
31 LatLon eastNorth2latlon(EastNorth en);
32
33 /**
34 * Describe the projection in one or two words.
35 * @return the name / description
36 */
37 @Override
38 String toString();
39
40 /**
41 * Return projection code.
42 *
43 * This should be a unique identifier.
44 * If projection supports parameters, return a different code
45 * for each set of parameters.
46 *
47 * The EPSG code can be used (if defined for the projection).
48 *
49 * @return the projection identifier
50 */
51 String toCode();
52
53 /**
54 * Get a filename compatible string (for the cache directory).
55 * @return the cache directory name (base name)
56 */
57 String getCacheDirectoryName();
58
59 /**
60 * Get the bounds of the world.
61 * @return the supported lat/lon rectangle for this projection
62 */
63 Bounds getWorldBoundsLatLon();
64
65 /**
66 * Get an approximate EastNorth box around the lat/lon world bounds.
67 *
68 * Note: The projection is only valid within the bounds returned by
69 * {@link #getWorldBoundsLatLon()}. The lat/lon bounds need not be a
70 * rectangular shape in east/north space. This method returns a box that
71 * contains this shape.
72 *
73 * @return EastNorth box around the lat/lon world bounds
74 */
75 ProjectionBounds getWorldBoundsBoxEastNorth();
76
77 /**
78 * Find lat/lon-box containing all the area of a given rectangle in
79 * east/north space.
80 *
81 * This is an approximate method. Points outside of the world should be ignored.
82 *
83 * @param pb the rectangle in projected space
84 * @return minimum lat/lon box, that when projected, covers <code>pb</code>
85 */
86 Bounds getLatLonBoundsBox(ProjectionBounds pb);
87
88 /**
89 * Get the number of meters per unit of this projection. This more
90 * defines the scale of the map, than real conversion of unit to meters
91 * as this value is more less correct only along certain lines of true scale.
92 *
93 * Used by WMTS to properly scale tiles
94 * @return meters per unit of projection
95 */
96 double getMetersPerUnit();
97
98 /**
99 * Does this projection natural order of coordinates is North East,
100 * instead of East North
101 *
102 * @return true if natural order of coordinates is North East, false if East North
103 */
104 boolean switchXY();
105
106 /**
107 * Gets the object used as cache identifier when caching results of this projection.
108 * @return The object to use as cache key
109 * @since 10827
110 */
111 default Object getCacheKey() {
112 return this;
113 }
114}
Note: See TracBrowser for help on using the repository browser.