Changeset 14120 in josm for trunk/test/unit/org
- Timestamp:
- 2018-08-11T17:29:48+02:00 (6 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r14119 r14120 18 18 import org.openstreetmap.josm.data.preferences.JosmBaseDirectories; 19 19 import org.openstreetmap.josm.data.preferences.JosmUrls; 20 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 20 21 import org.openstreetmap.josm.data.projection.Projections; 21 22 import org.openstreetmap.josm.gui.MainApplication; … … 126 127 127 128 // init projection 128 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator129 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 129 130 130 131 // setup projection grid files -
trunk/test/unit/org/openstreetmap/josm/MainTest.java
r14119 r14120 15 15 import org.openstreetmap.josm.Main.InitStatusListener; 16 16 import org.openstreetmap.josm.Main.InitializationTask; 17 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 17 18 import org.openstreetmap.josm.io.OnlineResource; 18 19 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 38 39 public void testPreConstructorInit() { 39 40 Main.preConstructorInit(); 40 assertNotNull( Main.getProjection());41 assertNotNull(CoordinateFormatManager.getDefaultFormat()); 41 42 } 42 43 -
trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java
r13489 r14120 15 15 import org.junit.Rule; 16 16 import org.junit.Test; 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.TestUtils; 19 18 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; … … 24 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 25 24 import org.openstreetmap.josm.data.osm.User; 25 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 26 26 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 27 27 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 57 57 public void testConstructors() { 58 58 EastNorth offset = new EastNorth(1, 2); 59 LatLon destLatLon = Main.getProjection().eastNorth2latlon(offset);59 LatLon destLatLon = ProjectionRegistry.getProjection().eastNorth2latlon(offset); 60 60 EastNorth start = new EastNorth(2, 0); 61 61 -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java
r13210 r14120 20 20 import org.junit.Rule; 21 21 import org.junit.Test; 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.TestUtils; 24 23 import org.openstreetmap.josm.data.Bounds; … … 28 27 import org.openstreetmap.josm.data.gpx.GpxData.GpxDataChangeEvent; 29 28 import org.openstreetmap.josm.data.gpx.GpxData.GpxDataChangeListener; 29 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 30 30 import org.openstreetmap.josm.testutils.JOSMTestRules; 31 31 import org.openstreetmap.josm.tools.ListenerList; … … 327 327 List<WayPoint> points = Stream 328 328 .of(new EastNorth(10, 10), new EastNorth(10, 0), new EastNorth(-1, 0)) 329 .map( Main.getProjection()::eastNorth2latlon)329 .map(ProjectionRegistry.getProjection()::eastNorth2latlon) 330 330 .map(WayPoint::new) 331 331 .collect(Collectors.toList()); … … 336 336 337 337 WayPoint close = data.nearestPointOnTrack(new EastNorth(5, 5), 10); 338 assertEquals(10, close.getEastNorth( Main.getProjection()).east(), .01);339 assertEquals(5, close.getEastNorth( Main.getProjection()).north(), .01);338 assertEquals(10, close.getEastNorth(ProjectionRegistry.getProjection()).east(), .01); 339 assertEquals(5, close.getEastNorth(ProjectionRegistry.getProjection()).north(), .01); 340 340 341 341 close = data.nearestPointOnTrack(new EastNorth(15, 5), 10); 342 assertEquals(10, close.getEastNorth( Main.getProjection()).east(), .01);343 assertEquals(5, close.getEastNorth( Main.getProjection()).north(), .01);342 assertEquals(10, close.getEastNorth(ProjectionRegistry.getProjection()).east(), .01); 343 assertEquals(5, close.getEastNorth(ProjectionRegistry.getProjection()).north(), .01); 344 344 345 345 assertNull(data.nearestPointOnTrack(new EastNorth(5, 5), 1)); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java
r12669 r14120 10 10 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; 11 11 import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource; 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.Bounds; 14 13 import org.openstreetmap.josm.data.coor.EastNorth; … … 16 15 import org.openstreetmap.josm.data.projection.CustomProjection; 17 16 import org.openstreetmap.josm.data.projection.Projection; 17 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 18 18 import org.openstreetmap.josm.data.projection.Projections; 19 19 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 42 42 public void testEPSG3857() { 43 43 Projection projection = Projections.getProjectionByCode("EPSG:3857"); 44 Main.setProjection(projection);44 ProjectionRegistry.setProjection(projection); 45 45 TemplatedWMSTileSource source = new TemplatedWMSTileSource(testImageryWMS, projection); 46 46 verifyMercatorTile(source, 0, 0, 1); … … 67 67 public void testEPSG4326() { 68 68 Projection projection = Projections.getProjectionByCode("EPSG:4326"); 69 Main.setProjection(projection);69 ProjectionRegistry.setProjection(projection); 70 70 TemplatedWMSTileSource source = getSource(projection); 71 71 … … 83 83 public void testEPSG4326widebounds() { 84 84 Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=-180,53,180,54"); 85 Main.setProjection(projection);85 ProjectionRegistry.setProjection(projection); 86 86 TemplatedWMSTileSource source = getSource(projection); 87 87 … … 96 96 public void testEPSG4326narrowbounds() { 97 97 Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=18,-90,20,90"); 98 Main.setProjection(projection);98 ProjectionRegistry.setProjection(projection); 99 99 TemplatedWMSTileSource source = getSource(projection); 100 100 … … 109 109 public void testEPSG2180() { 110 110 Projection projection = Projections.getProjectionByCode("EPSG:2180"); 111 Main.setProjection(projection);111 ProjectionRegistry.setProjection(projection); 112 112 TemplatedWMSTileSource source = getSource(projection); 113 113 … … 128 128 new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 " 129 129 + "+units=m +no_defs +axis=neu +wmssrs=EPSG:3006 +bounds=10.5700,55.2000,24.1800,69.1000 "); 130 Main.setProjection(projection);130 ProjectionRegistry.setProjection(projection); 131 131 TemplatedWMSTileSource source = getSource(projection); 132 132 … … 144 144 new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 " 145 145 + "+units=m +no_defs +axis=neu +wmssrs=EPSG:3006"); 146 Main.setProjection(projection);146 ProjectionRegistry.setProjection(projection); 147 147 TemplatedWMSTileSource source = getSource(projection); 148 148 … … 174 174 175 175 private void verifyLocation(TemplatedWMSTileSource source, LatLon location, int z) { 176 Projection projection = ProjectionRegistry.getProjection(); 176 177 assertTrue( 177 178 "Point outside world bounds", 178 Main.getProjection().getWorldBoundsLatLon().contains(location)179 projection.getWorldBoundsLatLon().contains(location) 179 180 ); 180 181 … … 187 188 tileIndex.getYIndex() <= source.getTileYMax(z)); 188 189 189 EastNorth locationEN = Main.getProjection().latlon2eastNorth(location);190 EastNorth x1 = Main.getProjection().latlon2eastNorth(getTileLatLon(source, tileIndex, z));191 EastNorth x2 = Main.getProjection().latlon2eastNorth(getTileLatLon(source, tileIndex.getXIndex() + 1, tileIndex.getYIndex() + 1, z));190 EastNorth locationEN = projection.latlon2eastNorth(location); 191 EastNorth x1 = projection.latlon2eastNorth(getTileLatLon(source, tileIndex, z)); 192 EastNorth x2 = projection.latlon2eastNorth(getTileLatLon(source, tileIndex.getXIndex() + 1, tileIndex.getYIndex() + 1, z)); 192 193 // test that location is within tile bounds 193 194 assertTrue(locationEN.toString() + " not within " + bboxStr(x1, x2) + -
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMSEndpointTileSourceTest.java
r14092 r14120 11 11 import org.junit.Rule; 12 12 import org.junit.Test; 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.TestUtils; 15 14 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 15 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 16 16 import org.openstreetmap.josm.data.projection.Projections; 17 17 import org.openstreetmap.josm.spi.preferences.Config; … … 78 78 ImageryInfo wmsImageryInfo = ImageryLayerInfo.instance.getDefaultLayers().get(0); 79 79 assertEquals("single_node_in_way", wmsImageryInfo.getDefaultLayers().get(0).getLayerName()); 80 WMSEndpointTileSource tileSource = new WMSEndpointTileSource(wmsImageryInfo, Main.getProjection());80 WMSEndpointTileSource tileSource = new WMSEndpointTileSource(wmsImageryInfo, ProjectionRegistry.getProjection()); 81 81 tileSource.initProjection(Projections.getProjectionByCode("EPSG:3857")); 82 82 assertEquals("https://tools.geofabrik.de/osmi/views/geometry/wxs?FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.1.1&SERVICE=WMS&" … … 122 122 ImageryInfo wmsImageryInfo = ImageryLayerInfo.instance.getDefaultLayers().get(0); 123 123 wmsImageryInfo.setDefaultLayers(Arrays.asList(new DefaultLayer(ImageryType.WMS_ENDPOINT, "historiske-ortofoto", "", ""))); 124 WMSEndpointTileSource tileSource = new WMSEndpointTileSource(wmsImageryInfo, Main.getProjection());124 WMSEndpointTileSource tileSource = new WMSEndpointTileSource(wmsImageryInfo, ProjectionRegistry.getProjection()); 125 125 tileSource.initProjection(Projections.getProjectionByCode("EPSG:3857")); 126 126 assertEquals("b8e36d51-119a-423b-b156-d744d54123d5", wmsImageryInfo.getCustomHttpHeaders().get("X-WAAPI-TOKEN")); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
r14049 r14120 21 21 import org.openstreetmap.gui.jmapviewer.TileXY; 22 22 import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource; 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.TestUtils; 25 24 import org.openstreetmap.josm.data.Bounds; … … 27 26 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 28 27 import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException; 28 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 29 29 import org.openstreetmap.josm.data.projection.Projections; 30 30 import org.openstreetmap.josm.spi.preferences.Config; … … 85 85 @Test 86 86 public void testPseudoMercator() throws IOException, WMTSGetCapabilitiesException { 87 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));87 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 88 88 WMTSTileSource testSource = new WMTSTileSource(testImageryPSEUDO_MERCATOR); 89 testSource.initProjection( Main.getProjection());89 testSource.initProjection(ProjectionRegistry.getProjection()); 90 90 91 91 verifyMercatorTile(testSource, 0, 0, 1); … … 115 115 @Test 116 116 public void testWALLONIE() throws IOException, WMTSGetCapabilitiesException { 117 Main.setProjection(Projections.getProjectionByCode("EPSG:31370"));117 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:31370")); 118 118 WMTSTileSource testSource = new WMTSTileSource(testImageryWALLONIE); 119 testSource.initProjection( Main.getProjection());119 testSource.initProjection(ProjectionRegistry.getProjection()); 120 120 121 121 assertEquals("http://geoservices.wallonie.be/arcgis/rest/services/DONNEES_BASE/FOND_PLAN_ANNOTATIONS_2012_RW_NB/" … … 135 135 @Ignore("disable this test, needs further working") // XXX 136 136 public void testWALLONIENoMatrixDimension() throws IOException, WMTSGetCapabilitiesException { 137 Main.setProjection(Projections.getProjectionByCode("EPSG:31370"));137 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:31370")); 138 138 WMTSTileSource testSource = new WMTSTileSource(getImagery("test/data/wmts/WMTSCapabilities-Wallonie-nomatrixdimension.xml")); 139 testSource.initProjection( Main.getProjection());139 testSource.initProjection(ProjectionRegistry.getProjection()); 140 140 141 141 Bounds wallonieBounds = new Bounds( … … 159 159 @Test 160 160 public void testWIEN() throws IOException, WMTSGetCapabilitiesException { 161 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));161 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 162 162 WMTSTileSource testSource = new WMTSTileSource(testImageryWIEN); 163 testSource.initProjection( Main.getProjection());163 testSource.initProjection(ProjectionRegistry.getProjection()); 164 164 int zoomOffset = 10; 165 165 … … 201 201 @Test 202 202 public void testGeoportalTOPOPL() throws IOException, WMTSGetCapabilitiesException { 203 Main.setProjection(Projections.getProjectionByCode("EPSG:4326"));203 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:4326")); 204 204 WMTSTileSource testSource = new WMTSTileSource(testImageryTOPO_PL); 205 testSource.initProjection( Main.getProjection());205 testSource.initProjection(ProjectionRegistry.getProjection()); 206 206 verifyTile(new LatLon(56, 12), testSource, 0, 0, 1); 207 207 verifyTile(new LatLon(56, 12), testSource, 0, 0, 2); … … 223 223 @Test 224 224 public void testGeoportalORTOPL4326() throws IOException, WMTSGetCapabilitiesException { 225 Main.setProjection(Projections.getProjectionByCode("EPSG:4326"));225 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:4326")); 226 226 WMTSTileSource testSource = new WMTSTileSource(testImageryORTO_PL); 227 testSource.initProjection( Main.getProjection());227 testSource.initProjection(ProjectionRegistry.getProjection()); 228 228 verifyTile(new LatLon(53.60205873528009, 19.552206794646956), testSource, 12412, 3941, 13); 229 229 verifyTile(new LatLon(49.79005619189761, 22.778262259134397), testSource, 17714, 10206, 13); … … 232 232 @Test 233 233 public void testGeoportalORTOPL2180() throws IOException, WMTSGetCapabilitiesException { 234 Main.setProjection(Projections.getProjectionByCode("EPSG:2180"));234 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:2180")); 235 235 WMTSTileSource testSource = new WMTSTileSource(testImageryORTO_PL); 236 testSource.initProjection( Main.getProjection());236 testSource.initProjection(ProjectionRegistry.getProjection()); 237 237 238 238 verifyTile(new LatLon(53.59940948387726, 19.560544913270064), testSource, 6453, 3140, 13); … … 242 242 @Test 243 243 public void testTicket12168() throws IOException, WMTSGetCapabilitiesException { 244 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));244 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 245 245 WMTSTileSource testSource = new WMTSTileSource(testImagery12168); 246 testSource.initProjection( Main.getProjection());246 testSource.initProjection(ProjectionRegistry.getProjection()); 247 247 assertEquals( 248 248 "http://www.ngi.be/cartoweb/1.0.0/topo/default/3857/7/1/1.png", … … 252 252 @Test 253 253 public void testTwoTileSetsForOneProjection() throws Exception { 254 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));254 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 255 255 ImageryInfo ontario = getImagery(TestUtils.getTestDataRoot() + "wmts/WMTSCapabilities-Ontario.xml"); 256 256 ontario.setDefaultLayers(Arrays.asList(new DefaultLayer[] { … … 258 258 })); 259 259 WMTSTileSource testSource = new WMTSTileSource(ontario); 260 testSource.initProjection( Main.getProjection());260 testSource.initProjection(ProjectionRegistry.getProjection()); 261 261 assertEquals( 262 262 "http://maps.ottawa.ca/arcgis/rest/services/Basemap_Imagery_2014/MapServer/WMTS/tile/1.0.0/Basemap_Imagery_2014/default/" … … 269 269 @Test 270 270 public void testTwoTileSetsForOneProjectionSecondLayer() throws Exception { 271 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));271 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 272 272 ImageryInfo ontario = getImagery(TestUtils.getTestDataRoot() + "wmts/WMTSCapabilities-Ontario.xml"); 273 273 ontario.setDefaultLayers(Arrays.asList(new DefaultLayer[] { … … 275 275 })); 276 276 WMTSTileSource testSource = new WMTSTileSource(ontario); 277 testSource.initProjection( Main.getProjection());277 testSource.initProjection(ProjectionRegistry.getProjection()); 278 278 assertEquals( 279 279 "http://maps.ottawa.ca/arcgis/rest/services/Basemap_Imagery_2014/MapServer/WMTS/tile/1.0.0/Basemap_Imagery_2014/default/" … … 286 286 @Test 287 287 public void testManyLayersScrollbars() throws Exception { 288 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));288 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 289 289 WMTSTileSource testSource = new WMTSTileSource(testLotsOfLayers); 290 testSource.initProjection( Main.getProjection());290 testSource.initProjection(ProjectionRegistry.getProjection()); 291 291 } 292 292 293 293 @Test 294 294 public void testParserForDuplicateTags() throws Exception { 295 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));295 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 296 296 WMTSTileSource testSource = new WMTSTileSource(testDuplicateTags); 297 testSource.initProjection( Main.getProjection());297 testSource.initProjection(ProjectionRegistry.getProjection()); 298 298 assertEquals( 299 299 "http://tile.informatievlaanderen.be/ws/raadpleegdiensten/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=grb_bsk&" … … 305 305 @Test 306 306 public void testParserForMissingStyleIdentifier() throws Exception { 307 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));307 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 308 308 WMTSTileSource testSource = new WMTSTileSource(testMissingStyleIdentifer); 309 testSource.initProjection( Main.getProjection());309 testSource.initProjection(ProjectionRegistry.getProjection()); 310 310 } 311 311 312 312 @Test 313 313 public void testForMultipleTileMatricesForOneLayerProjection() throws Exception { 314 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));314 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 315 315 ImageryInfo copy = new ImageryInfo(testMultipleTileMatrixForLayer); 316 316 List<DefaultLayer> defaultLayers = new ArrayList<>(1); … … 318 318 copy.setDefaultLayers(defaultLayers); 319 319 WMTSTileSource testSource = new WMTSTileSource(copy); 320 testSource.initProjection( Main.getProjection());320 testSource.initProjection(ProjectionRegistry.getProjection()); 321 321 assertEquals( 322 322 "http://188.253.0.155:6080/arcgis/rest/services/Mashhad_BaseMap_1/MapServer/WMTS/tile/1.0.0/Mashhad_BaseMap_1" … … 333 333 @Test 334 334 public void testDimension() throws IOException, WMTSGetCapabilitiesException { 335 Main.setProjection(Projections.getProjectionByCode("EPSG:21781"));335 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:21781")); 336 336 ImageryInfo info = new ImageryInfo(testImageryGeoAdminCh); 337 337 List<DefaultLayer> defaultLayers = new ArrayList<>(1); … … 339 339 info.setDefaultLayers(defaultLayers); 340 340 WMTSTileSource testSource = new WMTSTileSource(info); 341 testSource.initProjection( Main.getProjection());341 testSource.initProjection(ProjectionRegistry.getProjection()); 342 342 assertEquals( 343 343 "http://wmts.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte/default/20140101/21781/1/3/2.png", … … 414 414 @Test 415 415 public void testGisKtnGvAt() throws IOException, WMTSGetCapabilitiesException { 416 Main.setProjection(Projections.getProjectionByCode("EPSG:31258"));416 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:31258")); 417 417 final WMTSTileSource source = new WMTSTileSource(testImageryGisKtnGvAt); 418 source.initProjection( Main.getProjection());418 source.initProjection(ProjectionRegistry.getProjection()); 419 419 final TileXY tile = source.latLonToTileXY(46.6103, 13.8558, 11); 420 420 assertEquals("https://gis.ktn.gv.at/arcgis/rest/services/tilecache/Ortho_2013_2015" + -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r12750 r14120 19 19 import org.junit.Rule; 20 20 import org.junit.Test; 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.data.coor.LatLon; 22 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 23 23 import org.openstreetmap.josm.data.projection.Projections; 24 24 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 49 49 their = new DataSet(); 50 50 their.setVersion("0.6"); 51 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator51 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 52 52 } 53 53 -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
r10945 r14120 9 9 import org.junit.Rule; 10 10 import org.junit.Test; 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.coor.LatLon; 12 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 13 13 import org.openstreetmap.josm.data.projection.Projections; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 40 40 @BeforeClass 41 41 public static void setUp() { 42 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator42 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 43 43 } 44 44 -
trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
r14092 r14120 17 17 import org.junit.Rule; 18 18 import org.junit.Test; 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.coor.LatLon; 20 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 21 21 import org.openstreetmap.josm.data.projection.Projections; 22 22 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 83 83 @Test 84 84 public void testRemove() throws Exception { 85 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator85 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 86 86 try (InputStream fis = new FileInputStream("data_nodist/restriction.osm")) { 87 87 DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 96 96 @Test 97 97 public void testMove() throws Exception { 98 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator98 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 99 99 try (InputStream fis = new FileInputStream("data_nodist/restriction.osm")) { 100 100 DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r13702 r14120 8 8 import org.junit.Rule; 9 9 import org.junit.Test; 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.coor.EastNorth; 12 11 import org.openstreetmap.josm.data.coor.LatLon; … … 34 33 @BeforeClass 35 34 public static void setUp() { 36 Main.setProjection(Projections.getProjectionByCode(SWISS_EPSG_CODE)); // Swiss grid35 ProjectionRegistry.setProjection(Projections.getProjectionByCode(SWISS_EPSG_CODE)); // Swiss grid 37 36 } 38 37 … … 97 96 public void testAlatlon2eastNorth() { 98 97 LatLon ll = new LatLon(46.518, 6.567); 99 EastNorth en = Main.getProjection().latlon2eastNorth(ll);98 EastNorth en = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 100 99 if (debug) { 101 100 System.out.println(en); … … 105 104 106 105 ll = new LatLon(47.78, 8.58); 107 en = Main.getProjection().latlon2eastNorth(ll);106 en = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 108 107 if (debug) { 109 108 System.out.println(en); … … 113 112 114 113 ll = new LatLon(46.58, 10.48); 115 en = Main.getProjection().latlon2eastNorth(ll);114 en = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 116 115 if (debug) { 117 116 System.out.println(en); … … 121 120 122 121 ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600); 123 en = Main.getProjection().latlon2eastNorth(ll);122 en = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 124 123 if (debug) { 125 124 System.out.println(en); … … 130 129 // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000 131 130 ll = new LatLon(46.04412093223244, 8.730497366167727); 132 en = Main.getProjection().latlon2eastNorth(ll);131 en = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 133 132 if (debug) { 134 133 System.out.println(en); … … 144 143 public void testBeastNorth2latlon() { 145 144 EastNorth en = new EastNorth(533112.13, 152227.35); 146 LatLon ll = Main.getProjection().eastNorth2latlon(en);145 LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 147 146 if (debug) { 148 147 System.out.println(ll); … … 152 151 153 152 en = new EastNorth(685542.97, 292783.21); 154 ll = Main.getProjection().eastNorth2latlon(en);153 ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 155 154 if (debug) { 156 155 System.out.println(ll); … … 160 159 161 160 en = new EastNorth(833066.95, 163265.32); 162 ll = Main.getProjection().eastNorth2latlon(en);161 ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 163 162 if (debug) { 164 163 System.out.println(ll); … … 168 167 169 168 en = new EastNorth(600000.0, 200000.0); 170 ll = Main.getProjection().eastNorth2latlon(en);169 ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 171 170 if (debug) { 172 171 System.out.println(ll); … … 177 176 // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000 178 177 en = new EastNorth(700000.0, 100000.0); 179 ll = Main.getProjection().eastNorth2latlon(en);178 ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 180 179 if (debug) { 181 180 System.out.println(ll); … … 191 190 public void testCsendandreturn() { 192 191 EastNorth en = new EastNorth(533111.69, 152227.85); 193 LatLon ll = Main.getProjection().eastNorth2latlon(en);194 EastNorth en2 = Main.getProjection().latlon2eastNorth(ll);192 LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 193 EastNorth en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 195 194 if (debug) { 196 195 System.out.println(en.east() - en2.east()); … … 203 202 204 203 en = new EastNorth(685544.16, 292782.91); 205 ll = Main.getProjection().eastNorth2latlon(en);206 en2 = Main.getProjection().latlon2eastNorth(ll);204 ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 205 en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 207 206 if (debug) { 208 207 System.out.println(en.east() - en2.east()); … … 215 214 216 215 en = new EastNorth(833068.04, 163265.39); 217 ll = Main.getProjection().eastNorth2latlon(en);218 en2 = Main.getProjection().latlon2eastNorth(ll);216 ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 217 en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 219 218 if (debug) { 220 219 System.out.println(en.east() - en2.east()); … … 227 226 228 227 en = new EastNorth(600000.0, 200000.0); 229 ll = Main.getProjection().eastNorth2latlon(en);230 en2 = Main.getProjection().latlon2eastNorth(ll);228 ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 229 en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 231 230 if (debug) { 232 231 System.out.println(en.east() - en2.east()); … … 239 238 240 239 en = new EastNorth(700000.0, 100000.0); 241 ll = Main.getProjection().eastNorth2latlon(en);242 en2 = Main.getProjection().latlon2eastNorth(ll);240 ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); 241 en2 = ProjectionRegistry.getProjection().latlon2eastNorth(ll); 243 242 if (debug) { 244 243 System.out.println(en.east() - en2.east()); -
trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java
r12076 r14120 13 13 import org.junit.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.coor.EastNorth; 17 16 import org.openstreetmap.josm.data.coor.LatLon; 17 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 18 18 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint; 19 19 import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle; … … 111 111 112 112 EastNorth eastnorth = p.getEastNorth(); 113 LatLon shouldLatLon = Main.getProjection().getWorldBoundsLatLon().getCenter();114 EastNorth shouldEastNorth = Main.getProjection().latlon2eastNorth(shouldLatLon);113 LatLon shouldLatLon = ProjectionRegistry.getProjection().getWorldBoundsLatLon().getCenter(); 114 EastNorth shouldEastNorth = ProjectionRegistry.getProjection().latlon2eastNorth(shouldLatLon); 115 115 assertEquals("east", shouldEastNorth.east(), eastnorth.east(), 0.01); 116 116 assertEquals("north", shouldEastNorth.north(), eastnorth.north(), 0.01); -
trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java
r11867 r14120 18 18 import org.junit.Rule; 19 19 import org.junit.Test; 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.data.Bounds; 22 21 import org.openstreetmap.josm.data.ProjectionBounds; 23 22 import org.openstreetmap.josm.data.coor.EastNorth; 24 23 import org.openstreetmap.josm.data.coor.LatLon; 24 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 25 25 import org.openstreetmap.josm.gui.util.GuiHelper; 26 26 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 82 82 @Test 83 83 public void testDefaultScale() { 84 assertEquals( Main.getProjection().getDefaultZoomInPPD(), component.getScale(), 0.00001);84 assertEquals(ProjectionRegistry.getProjection().getDefaultZoomInPPD(), component.getScale(), 0.00001); 85 85 } 86 86 -
trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java
r12922 r14120 9 9 import org.junit.Rule; 10 10 import org.junit.Test; 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.actions.CopyAction; 13 12 import org.openstreetmap.josm.data.coor.LatLon; 14 13 import org.openstreetmap.josm.data.osm.DataSet; 15 14 import org.openstreetmap.josm.data.osm.Node; 15 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 16 16 import org.openstreetmap.josm.gui.MainApplication; 17 17 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 55 55 56 56 LatLon pos = new LatLon(55, -5); 57 transferHandler.pasteOn(target, Main.getProjection().latlon2eastNorth(pos));57 transferHandler.pasteOn(target, ProjectionRegistry.getProjection().latlon2eastNorth(pos)); 58 58 assertTrue(pos.equalsEpsilon(ds2.getNodes().iterator().next().getCoor())); 59 59 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java
r14052 r14120 3 3 4 4 import static java.util.concurrent.TimeUnit.MILLISECONDS; 5 import static org.openstreetmap.josm.tools.I18n.tr;6 5 import static org.junit.Assert.assertEquals; 7 6 import static org.junit.Assert.assertFalse; 8 7 import static org.junit.Assert.assertTrue; 9 8 import static org.junit.Assert.fail; 9 import static org.openstreetmap.josm.tools.I18n.tr; 10 10 11 11 import java.awt.Color; … … 19 19 import java.util.regex.Matcher; 20 20 21 import javax.swing.JCheckBoxMenuItem; 21 22 import javax.swing.JMenuItem; 22 import javax.swing.JCheckBoxMenuItem;23 23 import javax.swing.JPopupMenu; 24 24 … … 31 31 import org.openstreetmap.josm.data.DataSource; 32 32 import org.openstreetmap.josm.data.osm.DataSet; 33 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 33 34 import org.openstreetmap.josm.data.projection.Projections; 34 35 import org.openstreetmap.josm.gui.MainApplication; … … 36 37 import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser; 37 38 import org.openstreetmap.josm.gui.bbox.SourceButton; 39 import org.openstreetmap.josm.gui.layer.LayerManagerTest.TestLayer; 38 40 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 39 import org.openstreetmap.josm.gui.layer.LayerManagerTest.TestLayer;40 41 import org.openstreetmap.josm.gui.util.GuiHelper; 41 42 import org.openstreetmap.josm.testutils.ImagePatternMatching; … … 278 279 Main.pref.put("slippy_map_chooser.mapstyle", "White Tiles"); 279 280 // ensure projection matches JMapViewer's 280 Main.setProjection(Projections.getProjectionByCode("EPSG:3857"));281 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); 281 282 282 283 MapView mapView = MainApplication.getMap().mapView; -
trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java
r12990 r14120 14 14 import org.junit.Rule; 15 15 import org.junit.Test; 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.preferences.AbstractProperty; 18 17 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 18 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 19 19 import org.openstreetmap.josm.testutils.JOSMTestRules; 20 20 … … 181 181 public void testIsProjectionSupported() { 182 182 assertFalse(testLayer.isProjectionSupported(null)); 183 assertTrue(testLayer.isProjectionSupported( Main.getProjection()));183 assertTrue(testLayer.isProjectionSupported(ProjectionRegistry.getProjection())); 184 184 } 185 185 -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
r13797 r14120 13 13 import org.junit.Rule; 14 14 import org.junit.Test; 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.coor.LatLon; 17 16 import org.openstreetmap.josm.data.gpx.GpxData; … … 21 20 import org.openstreetmap.josm.data.notes.Note; 22 21 import org.openstreetmap.josm.data.osm.DataSet; 22 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 23 23 import org.openstreetmap.josm.gui.MainApplication; 24 24 import org.openstreetmap.josm.gui.layer.GpxLayer; … … 144 144 TMSLayer layer = new TMSLayer(new ImageryInfo("the name", "http://www.url.com/")); 145 145 layer.getDisplaySettings().setOffsetBookmark( 146 new OffsetBookmark( Main.getProjection().toCode(), layer.getInfo().getId(), layer.getInfo().getName(), "", 12, 34));146 new OffsetBookmark(ProjectionRegistry.getProjection().toCode(), layer.getInfo().getId(), layer.getInfo().getName(), "", 12, 34)); 147 147 return layer; 148 148 } -
trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
r14119 r14120 32 32 import org.openstreetmap.josm.data.preferences.JosmBaseDirectories; 33 33 import org.openstreetmap.josm.data.preferences.JosmUrls; 34 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 34 35 import org.openstreetmap.josm.data.projection.Projections; 35 36 import org.openstreetmap.josm.gui.MainApplication; … … 472 473 473 474 if (useProjection) { 474 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator475 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 475 476 } 476 477 … … 589 590 590 591 // TODO: Remove global listeners and other global state. 591 Main.clearProjectionChangeListeners();592 ProjectionRegistry.clearProjectionChangeListeners(); 592 593 Main.pref.resetToInitialState(); 593 594 Main.platform = null;
Note:
See TracChangeset
for help on using the changeset viewer.