Changeset 13167 in josm
- Timestamp:
- 2017-11-25T23:49:23+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/proj/TransverseMercator.java
r12013 r13167 5 5 6 6 import org.openstreetmap.josm.data.Bounds; 7 import org.openstreetmap.josm.data.coor.LatLon; 7 8 import org.openstreetmap.josm.data.projection.ProjectionConfigurationException; 8 9 import org.openstreetmap.josm.tools.CheckParameterUtil; 10 import org.openstreetmap.josm.tools.Pair; 9 11 import org.openstreetmap.josm.tools.Utils; 10 12 … … 70 72 */ 71 73 public class TransverseMercator extends AbstractProj { 74 75 /** Earth emispheres **/ 76 public enum Hemisphere { 77 /** North emisphere */ 78 North, 79 /** South emisphere */ 80 South 81 } 72 82 73 83 /** … … 223 233 return new Bounds(-89, -7, 89, 7, false); 224 234 } 235 236 /** 237 * Determines the UTM zone of a given lat/lon. 238 * @param ll lat/lon to locate in the UTM grid. 239 * @return the UTM zone of {@code ll} 240 * @since 13167 241 */ 242 public static Pair<Integer, Hemisphere> locateUtmZone(LatLon ll) { 243 return new Pair<>((int) Math.floor((ll.lon() + 180d) / 6d) + 1, 244 ll.lat() > 0 ? Hemisphere.North : Hemisphere.South); 245 } 225 246 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java
r12745 r13167 20 20 import org.openstreetmap.josm.data.osm.RelationMember; 21 21 import org.openstreetmap.josm.data.osm.Way; 22 import org.openstreetmap.josm.data.projection.proj.TransverseMercator; 23 import org.openstreetmap.josm.data.projection.proj.TransverseMercator.Hemisphere; 22 24 import org.openstreetmap.josm.tools.Geometry; 25 import org.openstreetmap.josm.tools.Pair; 23 26 import org.openstreetmap.josm.tools.Utils; 24 27 import org.openstreetmap.josm.tools.date.DateUtils; … … 212 215 Double.toString(n.lat()), ", ", 213 216 Double.toString(n.lon())); 217 EastNorth en = n.getEastNorth(); 214 218 add(tr("Coordinates (projected): "), 215 Double.toString(n.getEastNorth().east()), ", ", 216 Double.toString(n.getEastNorth().north())); 219 Double.toString(en.east()), ", ", 220 Double.toString(en.north())); 221 Pair<Integer, Hemisphere> utmZone = TransverseMercator.locateUtmZone(n.getCoor()); 222 String utmLabel = tr("UTM Zone"); 223 add(utmLabel, utmLabel.endsWith(":") ? " " : ": ", Integer.toString(utmZone.a), utmZone.b.toString().substring(0, 1)); 217 224 } 218 225 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java
r12620 r13167 16 16 import javax.swing.JRadioButton; 17 17 18 import org.openstreetmap.josm.data.projection.proj.TransverseMercator.Hemisphere; 18 19 import org.openstreetmap.josm.tools.GBC; 19 20 import org.openstreetmap.josm.tools.Logging; … … 25 26 */ 26 27 public class UTMProjectionChoice extends ListProjectionChoice { 27 28 /** Earth emispheres **/29 public enum Hemisphere {30 /** North emisphere */31 North,32 /** South emisphere */33 South34 }35 28 36 29 private static final Hemisphere DEFAULT_HEMISPHERE = Hemisphere.North;
Note:
See TracChangeset
for help on using the changeset viewer.