Changeset 9370 in josm for trunk/src


Ignore:
Timestamp:
2016-01-09T22:33:40+01:00 (9 years ago)
Author:
bastiK
Message:

unit test & javadoc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r9240 r9370  
    4444
    4545/**
    46  * Class to handle projections
     46 * Class to manage projections.
    4747 *
     48 * Use this class to query available projection or register new projections
     49 * from a plugin.
    4850 */
    4951public final class Projections {
     
    157159    }
    158160
     161    /**
     162     * Convert from lat/lon to easting/northing using the current projection.
     163     *
     164     * @param ll the geographical point to convert (in WGS84 lat/lon)
     165     * @return the corresponding east/north coordinates
     166     */
    159167    public static EastNorth project(LatLon ll) {
    160168        if (ll == null) return null;
     
    162170    }
    163171
     172    /**
     173     * Convert from easting/norting to lat/lon using the current projection.
     174     *
     175     * @param en the geographical point to convert (in projected coordinates)
     176     * @return the corresponding lat/lon (WGS84)
     177     */
    164178    public static LatLon inverseProject(EastNorth en) {
    165179        if (en == null) return null;
     
    184198    }
    185199
     200    /**
     201     * Get a base projection by id.
     202     *
     203     * @param id the id, for example "lonlat" or "tmerc"
     204     * @return the corresponding base projection if the id is known, null otherwise
     205     */
    186206    public static Proj getBaseProjection(String id) {
    187207        ProjFactory fac = projs.get(id);
     
    190210    }
    191211
     212    /**
     213     * Get an ellipsoid by id.
     214     *
     215     * @param id the id, for example "bessel" or "WGS84"
     216     * @return the corresponding ellipsoid if the id is known, null otherwise
     217     */
    192218    public static Ellipsoid getEllipsoid(String id) {
    193219        return ellipsoids.get(id);
    194220    }
    195221
     222    /**
     223     * Get a geodetic datum by id.
     224     *
     225     * @param id the id, for example "potsdam" or "WGS84"
     226     * @return the corresponding datum if the id is known, null otherwise
     227     */
    196228    public static Datum getDatum(String id) {
    197229        return datums.get(id);
    198230    }
    199231
     232    /**
     233     * Get a NTV2 grid database by id.
     234     * @param id the id
     235     * @return the corresponding NTV2 grid if the id is known, null otherwise
     236     */
    200237    public static NTV2GridShiftFileWrapper getNTV2Grid(String id) {
    201238        return nadgrids.get(id);
     
    203240
    204241    /**
    205      * Get the projection definition string for the given id.
    206      * @param id the id
     242     * Get the projection definition string for the given code.
     243     * @param code the code
    207244     * @return the string that can be processed by #{link CustomProjection}.
    208      * Null, if the id isn't supported.
    209      */
    210     public static String getInit(String id) {
    211         ProjectionDefinition pd = inits.get(id.toUpperCase(Locale.ENGLISH));
     245     * Null, if the code isn't supported.
     246     */
     247    public static String getInit(String code) {
     248        ProjectionDefinition pd = inits.get(code.toUpperCase(Locale.ENGLISH));
    212249        if (pd == null) return null;
    213250        return pd.definition;
     
    260297    }
    261298
     299    /**
     300     * Get a projection by code.
     301     * @param code the code, e.g. "EPSG:2026"
     302     * @return the corresponding projection, if the code is known, null otherwise
     303     */
    262304    public static Projection getProjectionByCode(String code) {
    263305        Projection proj = projectionsByCode_cache.get(code);
     
    293335    }
    294336
     337    /**
     338     * Get a list of ids of all registered base projections.
     339     *
     340     * @return all registered base projection ids
     341     * @see #getBaseProjection(java.lang.String)
     342     */
     343    public static Collection<String> getAllBaseProjectionIds() {
     344        return projs.keySet();
     345    }
     346
    295347    private static String listKeys(Map<String, ?> map) {
    296348        List<String> keys = new ArrayList<>(map.keySet());
Note: See TracChangeset for help on using the changeset viewer.