Changeset 2114 in josm for trunk/src/org
- Timestamp:
- 2009-09-13T13:12:14+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/Epsg4326.java
r2017 r2114 38 38 { 39 39 return new Bounds( 40 new LatLon(-90.0, -180.0), 41 new LatLon(90.0, 180.0)); 40 new LatLon(-90.0, -180.0), 41 new LatLon(90.0, 180.0)); 42 } 43 44 public double getDefaultZoomInPPD() { 45 // This will set the scale bar to about 100 km 46 return 0.009; 42 47 } 43 48 } -
trunk/src/org/openstreetmap/josm/data/projection/GaussLaborde_Reunion.java
r1929 r2114 216 216 } 217 217 218 public double getDefaultZoomInPPD() { 219 // this will set the map scaler to about 1000 m 220 return 10.02; 221 } 218 222 } -
trunk/src/org/openstreetmap/josm/data/projection/Lambert.java
r2017 r2114 289 289 new LatLon(57.0, 10.2));*/ 290 290 } 291 292 public double getDefaultZoomInPPD() { 293 // TODO FIXME 294 return 0; 295 } 291 296 } -
trunk/src/org/openstreetmap/josm/data/projection/LambertEST.java
r2017 r2114 48 48 double t = Math.tan(Math.PI / 4.0 - Math.toRadians(p.lat()) / 2.0) 49 49 / Math.pow(( (1.0 - ee * Math.sin(Math.toRadians(p.lat()))) / (1.0 50 + ee * Math.sin(Math.toRadians(p.lat())))) ,(ee / 2.0));50 + ee * Math.sin(Math.toRadians(p.lat())))) ,(ee / 2.0)); 51 51 double r = a * f * Math.pow(t, n); 52 52 double theta = n * (Math.toRadians(p.lon()) - lonf); … … 64 64 double a = 1.5707963267948966; 65 65 double b = 1.5707963267948966 - (2.0 * Math.atan(t * Math.pow((1.0 66 - (e * Math.sin(a))) / (1.0 + (e * Math.sin(a))), e / 2.0)));66 - (e * Math.sin(a))) / (1.0 + (e * Math.sin(a))), e / 2.0))); 67 67 while (Math.abs(a-b) > epsilon) 68 68 { 69 69 a = a1 + ((a2 - a1) / 2.0); 70 70 b = 1.5707963267948966 - (2.0 * Math.atan(t * Math.pow((1.0 71 - (e * Math.sin(a))) / (1.0 + (e * Math.sin(a))), e / 2.0)));71 - (e * Math.sin(a))) / (1.0 + (e * Math.sin(a))), e / 2.0))); 72 72 if (a1 == a2) 73 {74 73 return 0.0; 74 if (b > a) { 75 a1 = a; 76 } else { 77 a2 = a; 75 78 } 76 if (b > a)77 a1 = a;78 else79 a2 = a;80 79 } 81 80 return b; … … 85 84 { 86 85 double r = Math.sqrt(Math.pow((p.getX() - ef), 2.0) + Math.pow((rf 87 - p.getY() + nf), 2.0) ) * Math.signum(n);86 - p.getY() + nf), 2.0) ) * Math.signum(n); 88 87 double T = Math.pow((r / (a * f)), (1.0/ n)) ; 89 88 double theta = Math.atan((p.getX() - ef) / (rf - p.getY() + nf)); … … 109 108 { 110 109 return new Bounds( 111 new LatLon(-90.0, -180.0), 112 new LatLon(90.0, 180.0)); 110 new LatLon(-90.0, -180.0), 111 new LatLon(90.0, 180.0)); 112 } 113 114 public double getDefaultZoomInPPD() { 115 // TODO FIXME 116 return 0; 113 117 } 114 118 } -
trunk/src/org/openstreetmap/josm/data/projection/Mercator.java
r2017 r2114 24 24 public EastNorth latlon2eastNorth(LatLon p) { 25 25 return new EastNorth( 26 p.lon()*Math.PI/180,27 Math.log(Math.tan(Math.PI/4+p.lat()*Math.PI/360)));26 p.lon()*Math.PI/180, 27 Math.log(Math.tan(Math.PI/4+p.lat()*Math.PI/360))); 28 28 } 29 29 30 30 public LatLon eastNorth2latlon(EastNorth p) { 31 31 return new LatLon( 32 Math.atan(Math.sinh(p.north()))*180/Math.PI,33 p.east()*180/Math.PI);32 Math.atan(Math.sinh(p.north()))*180/Math.PI, 33 p.east()*180/Math.PI); 34 34 } 35 35 … … 49 49 { 50 50 return new Bounds( 51 new LatLon(-85.05112877980659, -180.0), 52 new LatLon(85.05112877980659, 180.0)); 51 new LatLon(-85.05112877980659, -180.0), 52 new LatLon(85.05112877980659, 180.0)); 53 } 54 55 public double getDefaultZoomInPPD() { 56 // This will set the scale bar to about 100 km 57 return 0.000158; 53 58 } 54 59 } -
trunk/src/org/openstreetmap/josm/data/projection/Projection.java
r2017 r2114 24 24 new Epsg4326(), 25 25 new Mercator(), 26 new LambertEST(), 27 new Lambert(), 26 new LambertEST(), // Still needs proper default zoom 27 new Lambert(), // Still needs proper default zoom 28 28 new SwissGrid(), 29 29 new UTM(), … … 33 33 new GaussLaborde_Reunion() 34 34 }; 35 36 /** 37 * Returns the default zoom scale in pixel per degree ({@see #NavigatableComponent#scale})) 38 */ 39 double getDefaultZoomInPPD(); 35 40 36 41 /** -
trunk/src/org/openstreetmap/josm/data/projection/SwissGrid.java
r2017 r2114 102 102 { 103 103 return new Bounds( 104 new LatLon(45.7, 5.7), 105 new LatLon(47.9, 10.6)); 104 new LatLon(45.7, 5.7), 105 new LatLon(47.9, 10.6)); 106 } 107 108 public double getDefaultZoomInPPD() { 109 // This will set the scale bar to about 100 m 110 return 1.01; 106 111 } 107 112 } -
trunk/src/org/openstreetmap/josm/data/projection/UTM.java
r2017 r2114 342 342 public int getzone() 343 343 { 344 return 33;344 return 33; 345 345 } 346 346 … … 356 356 { 357 357 return new Bounds( 358 new LatLon(-85.0, UTMCentralMeridianDeg(getzone())-5.0), 359 new LatLon(85.0, UTMCentralMeridianDeg(getzone())+5.0)); 358 new LatLon(-85.0, UTMCentralMeridianDeg(getzone())-5.0), 359 new LatLon(85.0, UTMCentralMeridianDeg(getzone())+5.0)); 360 } 361 362 public double getDefaultZoomInPPD() { 363 // this will set the map scaler to about 1000 m 364 return 10; 360 365 } 361 366 } -
trunk/src/org/openstreetmap/josm/data/projection/UTM_20N_Guadeloupe_Fort_Marigot.java
r1929 r2114 36 36 } 37 37 38 public double getDefaultZoomInPPD() { 39 // this will set the map scaler to about 1000 m 40 return 10; 41 } 38 42 } -
trunk/src/org/openstreetmap/josm/data/projection/UTM_20N_Guadeloupe_Ste_Anne.java
r1977 r2114 36 36 } 37 37 38 public double getDefaultZoomInPPD() { 39 // this will set the map scaler to about 1000 m 40 return 10.01; 41 } 38 42 } -
trunk/src/org/openstreetmap/josm/data/projection/UTM_20N_Martinique_Fort_Desaix.java
r1929 r2114 35 35 return tr("UTM20N Martinique Fort Desaix 1952"); 36 36 } 37 38 public double getDefaultZoomInPPD() { 39 // this will set the map scaler to about 1000 m 40 return 10.01; 41 } 37 42 } -
trunk/src/org/openstreetmap/josm/gui/MapSlider.java
r2017 r2114 23 23 mv.addPropertyChangeListener("scale", this); 24 24 addChangeListener(this); 25 // Call this manually once so it gets setup correctly 26 propertyChange(null); 25 27 } 26 28 … … 40 42 e /= 1.1; 41 43 n /= 1.1; 42 if(e < cur_e && n < cur_n) 44 if(e < cur_e && n < cur_n) { 43 45 break; 46 } 44 47 ++zoom; 45 48 } -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r2025 r2114 44 44 * northing/easting space of the projection. 45 45 */ 46 private double scale ;46 private double scale = Main.proj.getDefaultZoomInPPD(); 47 47 /** 48 48 * Center n/e coordinate of the desired screen center. 49 49 */ 50 protected EastNorth center = new EastNorth(0, 0);50 protected EastNorth center = calculateDefaultCenter(); 51 51 52 52 public NavigatableComponent() { … … 56 56 protected DataSet getCurrentDataSet() { 57 57 return Main.main.getCurrentDataSet(); 58 } 59 60 private EastNorth calculateDefaultCenter() { 61 Bounds b = Main.proj.getWorldBoundsLatLon(); 62 double lat = (b.max.lat() + b.min.lat())/2; 63 double lon = (b.max.lon() + b.min.lon())/2; 64 65 return Main.proj.latlon2eastNorth(new LatLon(lat, lon)); 58 66 } 59 67 … … 115 123 center.east() + getWidth()/2.0*scale, 116 124 center.north() + getHeight()/2.0*scale)); 117 } ;125 } 118 126 119 127 /* FIXME: replace with better method - used by MapSlider */ … … 122 130 return new ProjectionBounds(getProjection().latlon2eastNorth(b.min), 123 131 getProjection().latlon2eastNorth(b.max)); 124 } ;132 } 125 133 126 134 /* FIXME: replace with better method - used by Main to reset Bounds when projection changes, don't use otherwise */ … … 133 141 center.east() + getWidth()/2.0*scale, 134 142 center.north() + getHeight()/2.0*scale))); 135 } ;143 } 136 144 137 145 /** … … 182 190 Bounds b = getProjection().getWorldBoundsLatLon(); 183 191 CachedLatLon cl = new CachedLatLon(newCenter); 184 boolean changed = false; ;192 boolean changed = false; 185 193 double lat = cl.lat(); 186 194 double lon = cl.lon();
Note:
See TracChangeset
for help on using the changeset viewer.