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

Last change on this file since 13632 was 13173, checked in by Don-vip, 6 years ago

see #15310 - remove most of deprecated APIs

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection;
3
4import java.util.function.Consumer;
5
6import org.openstreetmap.josm.data.Bounds;
7import org.openstreetmap.josm.data.ProjectionBounds;
8import org.openstreetmap.josm.data.coor.EastNorth;
9import org.openstreetmap.josm.data.coor.LatLon;
10
11/**
12 * A projection, i.e. a class that supports conversion from lat/lon
13 * to east/north and back.
14 *
15 * The conversion from east/north to the screen coordinates is simply a scale
16 * factor and x/y offset.
17 */
18public interface Projection extends Projecting {
19 /**
20 * The default scale factor in east/north units per pixel
21 * ({@link org.openstreetmap.josm.gui.NavigatableComponent#getState})).
22 * FIXME: misnomer
23 * @return the scale factor
24 */
25 double getDefaultZoomInPPD();
26
27 /**
28 * Convert from easting/norting to lat/lon.
29 *
30 * @param en the geographical point to convert (in projected coordinates)
31 * @return the corresponding lat/lon (WGS84)
32 */
33 LatLon eastNorth2latlon(EastNorth en);
34
35 /**
36 * Describe the projection in one or two words.
37 * @return the name / description
38 */
39 @Override
40 String toString();
41
42 /**
43 * Return projection code.
44 *
45 * This should be a unique identifier.
46 * If projection supports parameters, return a different code
47 * for each set of parameters.
48 *
49 * The EPSG code can be used (if defined for the projection).
50 *
51 * @return the projection identifier
52 */
53 String toCode();
54
55 /**
56 * Get the bounds of the world.
57 * @return the supported lat/lon rectangle for this projection
58 */
59 Bounds getWorldBoundsLatLon();
60
61 /**
62 * Get an approximate EastNorth box around the lat/lon world bounds.
63 *
64 * Note: The projection is only valid within the bounds returned by
65 * {@link #getWorldBoundsLatLon()}. The lat/lon bounds need not be a
66 * rectangular shape in east/north space. This method returns a box that
67 * contains this shape.
68 *
69 * @return EastNorth box around the lat/lon world bounds
70 */
71 ProjectionBounds getWorldBoundsBoxEastNorth();
72
73 /**
74 * Find lat/lon-box containing all the area of a given rectangle in
75 * east/north space.
76 *
77 * This is an approximate method. Points outside of the world should be ignored.
78 *
79 * @param pb the rectangle in projected space
80 * @return minimum lat/lon box, that when projected, covers <code>pb</code>
81 */
82 Bounds getLatLonBoundsBox(ProjectionBounds pb);
83
84 /**
85 * Get a box in east/north space of this projection, that fully contains an
86 * east/north box of another projection.
87 *
88 * Reprojecting a rectangular box from one projection to another may distort/rotate
89 * the shape of the box, so in general one needs to walk along the boundary
90 * in small steps to get a reliable result.
91 *
92 * This is an approximate method.
93 *
94 * @param box the east/north box given in projection <code>boxProjection</code>
95 * @param boxProjection the projection of <code>box</code>
96 * @return an east/north box in this projection, containing the given box
97 */
98 ProjectionBounds getEastNorthBoundsBox(ProjectionBounds box, Projection boxProjection);
99
100 /**
101 * Get the number of meters per unit of this projection. This more
102 * defines the scale of the map, than real conversion of unit to meters
103 * as this value is more less correct only along certain lines of true scale.
104 *
105 * Used by WMTS to properly scale tiles
106 * @return meters per unit of projection
107 */
108 double getMetersPerUnit();
109
110 /**
111 * Does this projection natural order of coordinates is North East,
112 * instead of East North
113 *
114 * @return true if natural order of coordinates is North East, false if East North
115 */
116 boolean switchXY();
117
118 /**
119 * Visit points along the edge of this bounds instance.
120 * <p>
121 * Depending on the shape in east/north space, it may simply visit the 4 corners
122 * or (more generally) several points along the curved edges.
123 * @param bounds the lat/lon rectangle to trace
124 * @param visitor a function to call for the points on the edge.
125 * @since 12818
126 */
127 void visitOutline(Bounds bounds, Consumer<EastNorth> visitor);
128}
Note: See TracBrowser for help on using the repository browser.