source: josm/trunk/src/org/openstreetmap/josm/data/projection/proj/LonLat.java@ 10938

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

findbugs - UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection.proj;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import org.openstreetmap.josm.data.Bounds;
7import org.openstreetmap.josm.data.projection.ProjectionConfigurationException;
8import org.openstreetmap.josm.tools.CheckParameterUtil;
9
10/**
11 * Simple Lat/Lon (pseudo-)projection.
12 */
13public class LonLat implements Proj {
14
15 private double a;
16
17 @Override
18 public String getName() {
19 return tr("Lat/lon (Geodetic)");
20 }
21
22 @Override
23 public String getProj4Id() {
24 return "lonlat";
25 }
26
27 @Override
28 public void initialize(ProjParameters params) throws ProjectionConfigurationException {
29 CheckParameterUtil.ensureParameterNotNull(params, "params");
30 CheckParameterUtil.ensureParameterNotNull(params.ellps, "params.ellps");
31 a = params.ellps.a;
32 }
33
34 @Override
35 public double[] project(double latRad, double lonRad) {
36 return new double[] {Math.toDegrees(lonRad) / a, Math.toDegrees(latRad) / a};
37 }
38
39 @Override
40 public double[] invproject(double east, double north) {
41 return new double[] {Math.toRadians(north * a), Math.toRadians(east * a)};
42 }
43
44 @Override
45 public Bounds getAlgorithmBounds() {
46 return new Bounds(-90, -180, 90, 180, false);
47 }
48
49 @Override
50 public boolean isGeographic() {
51 return true;
52 }
53}
Note: See TracBrowser for help on using the repository browser.