001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.coor.conversion;
003
004import static org.openstreetmap.josm.tools.I18n.tr;
005
006import org.openstreetmap.josm.data.coor.ILatLon;
007import org.openstreetmap.josm.data.projection.ProjectionRegistry;
008
009/**
010 * Coordinate format that projects a coordinate and returns northing and easting in
011 * decimal format.
012 * @since 12735
013 */
014public class ProjectedCoordinateFormat extends AbstractCoordinateFormat {
015
016    /**
017     * The unique instance.
018     */
019    public static final ProjectedCoordinateFormat INSTANCE = new ProjectedCoordinateFormat();
020
021    protected ProjectedCoordinateFormat() {
022        super("EAST_NORTH", tr("Projected Coordinates"));
023    }
024
025    @Override
026    public String latToString(ILatLon ll) {
027        return cDdFormatter.format(ll.getEastNorth(ProjectionRegistry.getProjection()).north());
028    }
029
030    @Override
031    public String lonToString(ILatLon ll) {
032        return cDdFormatter.format(ll.getEastNorth(ProjectionRegistry.getProjection()).east());
033    }
034}