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

Last change on this file since 9579 was 9419, checked in by bastiK, 8 years ago

add Albers Equal Area Projection and Polar Stereographic Projection (see #12186)
(imports pieces of code from the Geotools project)

  • Property svn:eol-style set to native
File size: 3.4 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 {
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 * Find lat/lon-box containing all the area of a given rectangle in
86 * east/north space.
87 *
88 * This is an approximate method. Points outside of the world should be ignored.
89 *
90 * @param pb the rectangle in projected space
91 * @return minimum lat/lon box, that when projected, covers <code>pb</code>
92 */
93 Bounds getLatLonBoundsBox(ProjectionBounds pb);
94
95 /**
96 * Get the number of meters per unit of this projection. This more
97 * defines the scale of the map, than real conversion of unit to meters
98 * as this value is more less correct only along great circles.
99 *
100 * Used by WMTS to properly scale tiles
101 * @return meters per unit of projection
102 *
103 */
104 double getMetersPerUnit();
105
106 /**
107 * Does this projection natural order of coordinates is North East,
108 * instead of East North
109 *
110 * @return true if natural order of coordinates is North East, false if East North
111 */
112 boolean switchXY();
113}
Note: See TracBrowser for help on using the repository browser.