source: josm/trunk/src/org/openstreetmap/josm/data/projection/Projecting.java@ 12161

Last change on this file since 12161 was 12161, checked in by michael2402, 7 years ago

See #13415: Add the ILatLon interface, unify handling of Nodes and CachedLatLon

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection;
3
4import java.util.Map;
5
6import org.openstreetmap.josm.data.ProjectionBounds;
7import org.openstreetmap.josm.data.coor.EastNorth;
8import org.openstreetmap.josm.data.coor.ILatLon;
9import org.openstreetmap.josm.data.coor.LatLon;
10
11/**
12 * Classes implementing this are able to project between screen (east/north) and {@link LatLon} coordinates.
13 * <p>
14 * Each instance is backed by a base projection but may e.g. offset the resulting position.
15 * @author Michael Zangl
16 * @since 10805
17 */
18public interface Projecting {
19
20 /**
21 * Convert from lat/lon to easting/northing.
22 * <p>
23 * This method exists to not break binary compatibility with old plugins
24 *
25 * @param ll the geographical point to convert (in WGS84 lat/lon)
26 * @return the corresponding east/north coordinates
27 */
28 default EastNorth latlon2eastNorth(LatLon ll) {
29 return latlon2eastNorth((ILatLon) ll);
30 }
31
32 /**
33 * Convert from lat/lon to easting/northing. This method uses the newer {@link ILatLon} interface.
34 *
35 * @param ll the geographical point to convert (in WGS84 lat/lon)
36 * @return the corresponding east/north coordinates
37 * @since xxx
38 */
39 EastNorth latlon2eastNorth(ILatLon ll);
40
41 /**
42 * Convert a east/north coordinate to the {@link LatLon} coordinate.
43 * This method clamps the lat/lon coordinate to the nearest point in the world bounds.
44 * @param en east/north
45 * @return The lat/lon coordinate.
46 */
47 LatLon eastNorth2latlonClamped(EastNorth en);
48
49 /**
50 * Gets the base projection instance used.
51 * @return The projection.
52 */
53 Projection getBaseProjection();
54
55 /**
56 * Returns an map or (subarea, projecting) paris that contains projecting instances to convert the coordinates inside the given area.
57 * This can be used by projections to support continuous projections.
58 *
59 * It is possible that the area covered by the map is bigger than the one given as area. There may be holes.
60 * @param area The base area
61 * @return a map of non-overlapping {@link ProjectionBounds} instances mapped to the {@link Projecting} object to use for that area.
62 */
63 Map<ProjectionBounds, Projecting> getProjectingsForArea(ProjectionBounds area);
64
65 /**
66 * Gets the object used as cache identifier when caching results of this projection.
67 * @return The object to use as cache key
68 * @since 10827
69 */
70 default Object getCacheKey() {
71 return this;
72 }
73}
Note: See TracBrowser for help on using the repository browser.