Last change
on this file since 40 was 39, checked in by imi, 18 years ago |
- Select objects via overview (middle mouse button)
- bugfix in deleted objects showing in overview
- Error message when saving unknown extension
- bugfix when reading osm files with new elements referenced
|
File size:
825 bytes
|
Line | |
---|
1 | package org.openstreetmap.josm.data.projection;
|
---|
2 |
|
---|
3 | import javax.swing.JComponent;
|
---|
4 |
|
---|
5 | import org.openstreetmap.josm.data.GeoPoint;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Implement Mercator Projection code, coded after documentation
|
---|
9 | * from wikipedia.
|
---|
10 | *
|
---|
11 | * The center of the mercator projection is always the 0 grad
|
---|
12 | * coordinate.
|
---|
13 | *
|
---|
14 | * @author imi
|
---|
15 | */
|
---|
16 | public class Mercator extends Projection {
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | public void latlon2xy(GeoPoint p) {
|
---|
20 | p.x = p.lon*Math.PI/180;
|
---|
21 | p.y = Math.log(Math.tan(Math.PI/4+p.lat*Math.PI/360));
|
---|
22 | }
|
---|
23 |
|
---|
24 | @Override
|
---|
25 | public void xy2latlon(GeoPoint p) {
|
---|
26 | p.lon = p.x*180/Math.PI;
|
---|
27 | p.lat = Math.atan(Math.sinh(p.y))*180/Math.PI;
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public String toString() {
|
---|
32 | return "Mercator";
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public JComponent getConfigurationPanel() {
|
---|
37 | return null;
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public void commitConfigurationPanel() {
|
---|
42 | }
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.