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

Last change on this file since 11858 was 11858, checked in by bastiK, 7 years ago

fixed #7427 - Support reprojection (warping) of imagery layer

  • Property svn:eol-style set to native
File size: 4.2 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 a box in east/north space of this projection, that fully contains an
90 * east/north box of another projection.
91 *
92 * Reprojecting a rectangular box from one projection to another may distort/rotate
93 * the shape of the box, so in general one needs to walk along the boundary
94 * in small steps to get a reliable result.
95 *
96 * This is an approximate method.
97 *
98 * @param box the east/north box given in projection <code>boxProjection</code>
99 * @param boxProjection the projection of <code>box</code>
100 * @return an east/north box in this projection, containing the given box
101 */
102 ProjectionBounds getEastNorthBoundsBox(ProjectionBounds box, Projection boxProjection);
103
104 /**
105 * Get the number of meters per unit of this projection. This more
106 * defines the scale of the map, than real conversion of unit to meters
107 * as this value is more less correct only along certain lines of true scale.
108 *
109 * Used by WMTS to properly scale tiles
110 * @return meters per unit of projection
111 */
112 double getMetersPerUnit();
113
114 /**
115 * Does this projection natural order of coordinates is North East,
116 * instead of East North
117 *
118 * @return true if natural order of coordinates is North East, false if East North
119 */
120 boolean switchXY();
121
122 /**
123 * Gets the object used as cache identifier when caching results of this projection.
124 * @return The object to use as cache key
125 * @since 10827
126 */
127 default Object getCacheKey() {
128 return this;
129 }
130}
Note: See TracBrowser for help on using the repository browser.