- Timestamp:
- 2017-09-09T10:35:27+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/conversion/LatLonParser.java
r12792 r12795 54 54 private double lat = Double.NaN; 55 55 private double lon = Double.NaN; 56 } 57 58 private LatLonParser() { 59 // private constructor 56 60 } 57 61 -
trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
r12792 r12795 33 33 public static final ProjectionCLI INSTANCE = new ProjectionCLI(); 34 34 35 private boolean argInverse = false; 36 private boolean argSwitchInput = false; 37 private boolean argSwitchOutput = false; 35 private boolean argInverse = false; // NOPMD 36 private boolean argSwitchInput = false; // NOPMD 37 private boolean argSwitchOutput = false; // NOPMD 38 38 39 39 @Override … … 62 62 argSwitchOutput = true; 63 63 break; 64 default: 65 // ignore 64 66 } 65 67 } … … 127 129 " EOF\n"+ 128 130 " => 1250371.1334500168 6545331.055189664\n" + 129 " -1.3208998232319113E7 4486401.160664663\n" + 130 ""; 131 " -1.3208998232319113E7 4486401.160664663\n"; 131 132 } 132 133 -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r12792 r12795 978 978 Main.toolbar = toolbar; 979 979 ProjectionPreference.setProjection(); 980 NTV2GridShiftFileWrapper.registerNTV2GridShiftFileSource( 981 NTV2GridShiftFileWrapper.NTV2_SOURCE_PRIORITY_LOCAL, 982 NTV2Proj4DirGridShiftFileSource.getInstance()); 983 NTV2GridShiftFileWrapper.registerNTV2GridShiftFileSource( 984 NTV2GridShiftFileWrapper.NTV2_SOURCE_PRIORITY_DOWNLOAD, 985 JOSM_WEBSITE_NTV2_SOURCE); 980 setupNadGridSources(); 986 981 GuiHelper.translateJavaInternalMessages(); 987 982 preConstructorInit(); … … 1037 1032 RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager()); 1038 1033 } 1034 } 1035 1036 /** 1037 * Setup the sources for NTV2 grid shift files for projection support. 1038 * @since 12795 1039 */ 1040 public static void setupNadGridSources() { 1041 NTV2GridShiftFileWrapper.registerNTV2GridShiftFileSource( 1042 NTV2GridShiftFileWrapper.NTV2_SOURCE_PRIORITY_LOCAL, 1043 NTV2Proj4DirGridShiftFileSource.getInstance()); 1044 NTV2GridShiftFileWrapper.registerNTV2GridShiftFileSource( 1045 NTV2GridShiftFileWrapper.NTV2_SOURCE_PRIORITY_DOWNLOAD, 1046 JOSM_WEBSITE_NTV2_SOURCE); 1039 1047 } 1040 1048 -
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r12760 r12795 121 121 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 122 122 123 // setup projection grid files 124 MainApplication.setupNadGridSources(); 125 123 126 // make sure we don't upload to or test against production 124 127 url = OsmApi.getOsmApi().getBaseUrl().toLowerCase(Locale.ENGLISH).trim(); -
trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
r12746 r12795 269 269 } 270 270 271 /**272 * Unit test of {@link LatLon#parse} method.273 */274 @Test275 public void testParse() {276 assertEquals(new LatLon(49.29918, 19.24788), LatLon.parse("49.29918° 19.24788°"));277 assertEquals(new LatLon(49.29918, 19.24788), LatLon.parse("N 49.29918 E 19.24788°"));278 assertEquals(new LatLon(49.29918, 19.24788), LatLon.parse("49.29918° 19.24788°"));279 assertEquals(new LatLon(49.29918, 19.24788), LatLon.parse("N 49.29918 E 19.24788"));280 assertEquals(new LatLon(49.29918, 19.24788), LatLon.parse("n 49.29918 e 19.24788"));281 assertEquals(new LatLon(-19 - 24.788 / 60, -49 - 29.918 / 60), LatLon.parse("W 49°29.918' S 19°24.788'"));282 assertEquals(new LatLon(-19 - 24.788 / 60, -49 - 29.918 / 60), LatLon.parse("w 49°29.918' s 19°24.788'"));283 assertEquals(new LatLon(49 + 29. / 60 + 04. / 3600, 19 + 24. / 60 + 43. / 3600), LatLon.parse("N 49°29'04\" E 19°24'43\""));284 assertEquals(new LatLon(49.29918, 19.24788), LatLon.parse("49.29918 N, 19.24788 E"));285 assertEquals(new LatLon(49.29918, 19.24788), LatLon.parse("49.29918 n, 19.24788 e"));286 assertEquals(new LatLon(49 + 29. / 60 + 21. / 3600, 19 + 24. / 60 + 38. / 3600), LatLon.parse("49°29'21\" N 19°24'38\" E"));287 assertEquals(new LatLon(49 + 29. / 60 + 51. / 3600, 19 + 24. / 60 + 18. / 3600), LatLon.parse("49 29 51, 19 24 18"));288 assertEquals(new LatLon(49 + 29. / 60, 19 + 24. / 60), LatLon.parse("49 29, 19 24"));289 assertEquals(new LatLon(19 + 24. / 60, 49 + 29. / 60), LatLon.parse("E 49 29, N 19 24"));290 assertEquals(new LatLon(49 + 29. / 60, 19 + 24. / 60), LatLon.parse("49° 29; 19° 24"));291 assertEquals(new LatLon(49 + 29. / 60, 19 + 24. / 60), LatLon.parse("49° 29; 19° 24"));292 assertEquals(new LatLon(49 + 29. / 60, -19 - 24. / 60), LatLon.parse("N 49° 29, W 19° 24"));293 assertEquals(new LatLon(-49 - 29.5 / 60, 19 + 24.6 / 60), LatLon.parse("49° 29.5 S, 19° 24.6 E"));294 assertEquals(new LatLon(49 + 29.918 / 60, 19 + 15.88 / 60), LatLon.parse("N 49 29.918 E 19 15.88"));295 assertEquals(new LatLon(49 + 29.4 / 60, 19 + 24.5 / 60), LatLon.parse("49 29.4 19 24.5"));296 assertEquals(new LatLon(-49 - 29.4 / 60, 19 + 24.5 / 60), LatLon.parse("-49 29.4 N -19 24.5 W"));297 }298 299 /**300 * Unit test of {@link LatLon#parse} method - invalid case 1.301 */302 @Test(expected = IllegalArgumentException.class)303 public void testParseInvalid1() {304 LatLon.parse("48°45'S 23°30'S");305 }306 307 /**308 * Unit test of {@link LatLon#parse} method - invalid case 2.309 */310 @Test(expected = IllegalArgumentException.class)311 public void testParseInvalid2() {312 LatLon.parse("47°45'N 24°00'S");313 }314 271 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r12438 r12795 84 84 @Rule 85 85 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 86 public JOSMTestRules test = new JOSMTestRules().platform().timeout(30_000); 86 public JOSMTestRules test = new JOSMTestRules().platform().projectionNadGrids().timeout(30_000); 87 87 88 88 /** -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r11660 r12795 24 24 @Rule 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 public JOSMTestRules test = new JOSMTestRules().platform(); 26 public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().platform(); 27 27 28 28 /** -
trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
r12760 r12795 55 55 private boolean platform; 56 56 private boolean useProjection; 57 private boolean useProjectionNadGrids; 57 58 private boolean commands; 58 59 private boolean allowMemoryManagerLeaks; … … 154 155 public JOSMTestRules projection() { 155 156 useProjection = true; 157 return this; 158 } 159 160 /** 161 * Set up loading of NTV2 grit shift files to support projections that need them. 162 * @return this instance, for easy chaining 163 */ 164 public JOSMTestRules projectionNadGrids() { 165 useProjectionNadGrids = true; 156 166 return this; 157 167 } … … 313 323 if (useProjection) { 314 324 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 325 } 326 327 if (useProjectionNadGrids) { 328 MainApplication.setupNadGridSources(); 315 329 } 316 330
Note:
See TracChangeset
for help on using the changeset viewer.