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

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

fix #13287 - Projection updates to support multiple projections (patch by michael2402) - gsoc-core

  • Property svn:eol-style set to native
File size: 3.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection.proj;
3
4import org.openstreetmap.josm.data.Bounds;
5import org.openstreetmap.josm.data.projection.ProjectionConfigurationException;
6
7/**
8 * A projection (in the narrow sense).
9 *
10 * Converts lat/lon the east/north and the other way around.
11 *
12 * Datum conversion, false easting / northing, origin of longitude
13 * and general scale factor is already applied when the projection is invoked.
14 *
15 * Lat/lon is not in degrees, but in radians (unlike other parts of JOSM).
16 * Additional parameters in the constructor arguments are usually still in
17 * degrees. So to avoid confusion, you can follow the convention, that
18 * coordinates in radians are called lat_rad/lon_rad or phi/lambda.
19 *
20 * East/north values are not in meters, but in meters divided by the semi major
21 * axis of the ellipsoid (earth radius). (Usually this is what you get anyway,
22 * unless you multiply by 'a' somehow implicitly or explicitly.)
23 *
24 */
25public interface Proj {
26
27 /**
28 * Replies a human readable name of this projection.
29 * @return The projection name. must not be null.
30 */
31 String getName();
32
33 /**
34 * Replies the Proj.4 identifier.
35 *
36 * @return The Proj.4 identifier (as reported by cs2cs -lp).
37 * If no id exists, return {@code null}.
38 */
39 String getProj4Id();
40
41 /**
42 * Initialize the projection using the provided parameters.
43 * @param params The projection parameters
44 *
45 * @throws ProjectionConfigurationException in case parameters are not suitable
46 */
47 void initialize(ProjParameters params) throws ProjectionConfigurationException;
48
49 /**
50 * Convert lat/lon to east/north.
51 *
52 * @param latRad the latitude in radians
53 * @param lonRad the longitude in radians
54 * @return array of length 2, containing east and north value in meters,
55 * divided by the semi major axis of the ellipsoid.
56 */
57 double[] project(double latRad, double lonRad);
58
59 /**
60 * Convert east/north to lat/lon.
61 *
62 * @param east east value in meters, divided by the semi major axis of the ellipsoid
63 * @param north north value in meters, divided by the semi major axis of the ellipsoid
64 * @return array of length 2, containing lat and lon in radians.
65 */
66 double[] invproject(double east, double north);
67
68 /**
69 * Return the bounds where this projection is applicable.
70 *
71 * This is a fallback for when the projection bounds are not specified
72 * explicitly.
73 *
74 * In this area, the round trip lat/lon -> east/north -> lat/lon should
75 * return the starting value with small error. In addition, regions with
76 * extreme distortions should be excluded, if possible.
77 *
78 * It need not be the absolute maximum, but rather an area that is safe to
79 * display in JOSM and contain everything that one would expect to use.
80 *
81 * @return the bounds where this projection is applicable, null if unknown
82 */
83 Bounds getAlgorithmBounds();
84
85 /**
86 * Return true, if a geographic coordinate reference system is represented.
87 *
88 * I.e. if it returns latitude/longitude values rather than Cartesian
89 * east/north coordinates on a flat surface.
90 * @return true, if it is geographic
91 */
92 boolean isGeographic();
93
94 /**
95 * Checks wether the result of projecting a lon coordinate only has a linear relation to the east coordinate and
96 * is not related to lat/north at all.
97 * @return <code>true</code> if lon has a linear relationship to east only.
98 * @since 10805
99 */
100 default boolean lonIsLinearToEast() {
101 return false;
102 }
103}
Note: See TracBrowser for help on using the repository browser.