001    // License: GPL. For details, see LICENSE file.
002    package org.openstreetmap.josm.data.projection;
003    
004    import static org.openstreetmap.josm.tools.I18n.tr;
005    
006    import org.openstreetmap.josm.data.Bounds;
007    import org.openstreetmap.josm.data.coor.LatLon;
008    import org.openstreetmap.josm.data.projection.datum.GRS80Datum;
009    import org.openstreetmap.josm.data.projection.proj.ProjParameters;
010    
011    /**
012     * LKS-92/ Latvia TM projection. Based on data from spatialreference.org.
013     * http://spatialreference.org/ref/epsg/3059/
014     *
015     * @author Viesturs Zarins
016     */
017    public class TransverseMercatorLV extends AbstractProjection {
018    
019        public TransverseMercatorLV() {
020            ellps = Ellipsoid.GRS80;
021            proj = new org.openstreetmap.josm.data.projection.proj.TransverseMercator();
022            try {
023                proj.initialize(new ProjParameters() {{ ellps = TransverseMercatorLV.this.ellps; }});
024            } catch (ProjectionConfigurationException e) {
025                throw new RuntimeException(e);
026            }
027            datum = GRS80Datum.INSTANCE;
028            lon_0 = 24;
029            x_0 = 500000;
030            y_0 = -6000000;
031            k_0 = 0.9996;
032        }
033    
034        @Override
035        public String toString() {
036            return tr("LKS-92 (Latvia TM)");
037        }
038    
039        @Override
040        public Integer getEpsgCode() {
041            return 3059;
042        }
043    
044        @Override
045        public int hashCode() {
046            return toCode().hashCode();
047        }
048    
049        @Override
050        public String getCacheDirectoryName() {
051            return "epsg"+ getEpsgCode();
052        }
053    
054        @Override
055        public Bounds getWorldBoundsLatLon() {
056            return new Bounds(
057                    new LatLon(-90.0, -180.0),
058                    new LatLon(90.0, 180.0), false);
059        }
060    }