Last change
on this file since 8378 was 6362, checked in by Don-vip, 10 years ago |
Checkstyle:
- private constructors for util classes
- final classes
- missing "else" statements
- import cleanup
|
-
Property svn:eol-style
set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.projection.proj;
|
---|
3 |
|
---|
4 | import static java.lang.Math.PI;
|
---|
5 | import static java.lang.Math.atan;
|
---|
6 | import static java.lang.Math.log;
|
---|
7 | import static java.lang.Math.sinh;
|
---|
8 | import static java.lang.Math.tan;
|
---|
9 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
10 |
|
---|
11 | import org.openstreetmap.josm.data.projection.ProjectionConfigurationException;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Mercator Projection.
|
---|
15 | */
|
---|
16 | public class Mercator implements Proj {
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | public String getName() {
|
---|
20 | return tr("Mercator");
|
---|
21 | }
|
---|
22 |
|
---|
23 | @Override
|
---|
24 | public String getProj4Id() {
|
---|
25 | return "josm:smerc"; // "merc" is ellipsoidal Mercator projection in PROJ.4
|
---|
26 | }
|
---|
27 |
|
---|
28 | @Override
|
---|
29 | public void initialize(ProjParameters params) throws ProjectionConfigurationException {
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | public double[] project(double lat_rad, double lon_rad) {
|
---|
34 | return new double[] { lon_rad, log(tan(PI/4 + lat_rad/2)) };
|
---|
35 | }
|
---|
36 |
|
---|
37 | @Override
|
---|
38 | public double[] invproject(double east, double north) {
|
---|
39 | return new double[] { atan(sinh(north)), east };
|
---|
40 | }
|
---|
41 |
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.