Changeset 5556 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2012-11-03T18:32:39+01:00 (12 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r4126 r5556 20 20 import org.openstreetmap.josm.data.Preferences; 21 21 import org.openstreetmap.josm.data.coor.LatLon; 22 import org.openstreetmap.josm.data.projection. Mercator;22 import org.openstreetmap.josm.data.projection.Projections; 23 23 24 24 public class DataSetMergerTest { … … 76 76 their = new DataSet(); 77 77 their.setVersion("0.6"); 78 Main.setProjection( new Mercator());78 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 79 79 } 80 80 -
trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
r4126 r5556 19 19 import org.openstreetmap.josm.data.Preferences; 20 20 import org.openstreetmap.josm.data.coor.LatLon; 21 import org.openstreetmap.josm.data.projection. Mercator;21 import org.openstreetmap.josm.data.projection.Projections; 22 22 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 23 23 import org.openstreetmap.josm.io.IllegalDataException; … … 29 29 @BeforeClass 30 30 public static void setUp() { 31 Main.setProjection( new Mercator());31 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 32 32 Main.pref = new Preferences(); 33 33 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
r4126 r5556 11 11 import org.openstreetmap.josm.data.Preferences; 12 12 import org.openstreetmap.josm.data.coor.LatLon; 13 import org.openstreetmap.josm.data.projection. Mercator;13 import org.openstreetmap.josm.data.projection.Projections; 14 14 15 15 public class OsmPrimitiveTest { … … 29 29 @BeforeClass 30 30 public static void setUp() { 31 Main.setProjection( new Mercator());31 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 32 32 } 33 33 -
trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
r4126 r5556 16 16 import org.openstreetmap.josm.data.Preferences; 17 17 import org.openstreetmap.josm.data.coor.LatLon; 18 import org.openstreetmap.josm.data.projection. Mercator;18 import org.openstreetmap.josm.data.projection.Projections; 19 19 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 20 20 import org.openstreetmap.josm.io.OsmReader; … … 66 66 @Test 67 67 public void testRemove() throws Exception { 68 Main.setProjection( new Mercator());68 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 69 69 DataSet ds = OsmReader.parseDataSet(new FileInputStream("data_nodist/restriction.osm"), NullProgressMonitor.INSTANCE); 70 70 removeAllTest(ds); … … 73 73 @Test 74 74 public void testMove() throws Exception { 75 Main.setProjection( new Mercator());75 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 76 76 DataSet ds = OsmReader.parseDataSet(new FileInputStream("data_nodist/restriction.osm"), NullProgressMonitor.INSTANCE); 77 77 -
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r4126 r5556 10 10 import org.openstreetmap.josm.data.Preferences; 11 11 import org.openstreetmap.josm.data.coor.LatLon; 12 import org.openstreetmap.josm.data.projection. Mercator;12 import org.openstreetmap.josm.data.projection.Projections; 13 13 14 14 public class RelationTest { … … 16 16 @BeforeClass 17 17 public static void setUp() { 18 Main.setProjection( new Mercator());18 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 19 19 Main.pref = new Preferences(); 20 20 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r4126 r5556 21 21 import org.openstreetmap.josm.data.osm.RelationMember; 22 22 import org.openstreetmap.josm.data.osm.Way; 23 import org.openstreetmap.josm.data.projection. Mercator;23 import org.openstreetmap.josm.data.projection.Projections; 24 24 25 25 public class MergeSourceBuildingVisitorTest { … … 37 37 @BeforeClass 38 38 public static void setUp() { 39 Main.setProjection( new Mercator());39 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 40 40 Main.pref = new Preferences(); 41 41 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
r5236 r5556 23 23 text = ""; 24 24 25 testProj( new Epsg4326());26 testProj( new Mercator());25 testProj(Projections.getProjectionByCode("EPSG:4326")); // WGS 84 26 testProj(Projections.getProjectionByCode("EPSG:3857")); // Mercator 27 27 if (!"yes".equals(System.getProperty("suppressPermanentFailure"))) { 28 testProj( new LambertEST());28 testProj(Projections.getProjectionByCode("EPSG:3301")); // Lambert EST 29 29 } 30 30 31 31 for (int i=0; i<=3; ++i) { 32 testProj( new Lambert(i));32 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(27561+i))); // Lambert 4 Zones France 33 33 } 34 34 35 35 for (int i=0; i<=4; ++i) { 36 testProj( new Puwg(i));36 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(2176+i))); // PUWG Poland 37 37 } 38 38 39 testProj( new SwissGrid());39 testProj(Projections.getProjectionByCode("EPSG:21781")); // Swiss grid 40 40 41 for (int i=0; i<=6; ++i) { 42 int zone; 43 if (i==0) { 44 zone = 1; 45 } else if (i==6) { 46 zone = 60; 47 } else { 48 zone = rand.nextInt(60) + 1; 49 } 50 UTM.Hemisphere hem = rand.nextBoolean() ? UTM.Hemisphere.North : UTM.Hemisphere.South; 51 testProj(new UTM(zone, hem)); 41 for (int i=0; i<=60; ++i) { 42 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(32601+i))); // UTM North 43 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(32701+i))); // UTM South 52 44 } 53 45 54 46 if (!"yes".equals(System.getProperty("suppressPermanentFailure"))) { 55 47 for (int i=0; i<=4; ++i) { 56 testProj( new UTM_France_DOM(i));48 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(2969+i))); // UTM France DOM 57 49 } 58 50 } 59 51 60 52 for (int i=0; i<=8; ++i) { 61 testProj( new LambertCC9Zones(i));53 testProj(Projections.getProjectionByCode("EPSG:"+Integer.toString(3942+i))); // Lambert CC9 Zones France 62 54 } 63 55 … … 69 61 70 62 private void testProj(Projection p) { 71 double maxErrLat = 0, maxErrLon = 0; 72 73 Bounds b = p.getWorldBoundsLatLon(); 74 75 text += String.format("*** %s %s\n", p.toString(), p.toCode()); 76 for (int num=0; num < 1000; ++num) { 77 78 double lat = rand.nextDouble() * (b.getMax().lat() - b.getMin().lat()) + b.getMin().lat(); 79 double lon = rand.nextDouble() * (b.getMax().lon() - b.getMin().lon()) + b.getMin().lon(); 80 81 LatLon ll = new LatLon(lat, lon); 82 83 for (int i=0; i<10; ++i) { 84 EastNorth en = p.latlon2eastNorth(ll); 85 ll = p.eastNorth2latlon(en); 63 if (p != null) { 64 double maxErrLat = 0, maxErrLon = 0; 65 Bounds b = p.getWorldBoundsLatLon(); 66 67 text += String.format("*** %s %s\n", p.toString(), p.toCode()); 68 for (int num=0; num < 1000; ++num) { 69 70 double lat = rand.nextDouble() * (b.getMax().lat() - b.getMin().lat()) + b.getMin().lat(); 71 double lon = rand.nextDouble() * (b.getMax().lon() - b.getMin().lon()) + b.getMin().lon(); 72 73 LatLon ll = new LatLon(lat, lon); 74 75 for (int i=0; i<10; ++i) { 76 EastNorth en = p.latlon2eastNorth(ll); 77 ll = p.eastNorth2latlon(en); 78 } 79 maxErrLat = Math.max(maxErrLat, Math.abs(lat - ll.lat())); 80 maxErrLon = Math.max(maxErrLon, Math.abs(lon - ll.lon())); 86 81 } 87 maxErrLat = Math.max(maxErrLat, Math.abs(lat - ll.lat())); 88 maxErrLon = Math.max(maxErrLon, Math.abs(lon - ll.lon())); 82 83 String mark = ""; 84 if (maxErrLat + maxErrLon > 1e-5) { 85 mark = "--FAILED-- "; 86 error = true; 87 } 88 text += String.format("%s errorLat: %s errorLon: %s\n", mark, maxErrLat, maxErrLon); 89 89 } 90 91 String mark = "";92 if (maxErrLat + maxErrLon > 1e-5) {93 mark = "--FAILED-- ";94 error = true;95 }96 text += String.format("%s errorLat: %s errorLon: %s\n", mark, maxErrLat, maxErrLon);97 90 } 98 91 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r4126 r5556 15 15 @BeforeClass 16 16 public static void setUp() { 17 Main.setProjection( new SwissGrid());17 Main.setProjection(Projections.getProjectionByCode("EPSG:21781")); // Swiss grid 18 18 } 19 19 … … 47 47 @Test 48 48 public void projReferenceTest() { 49 Projection swiss = new SwissGrid();49 Projection swiss = Projections.getProjectionByCode("EPSG:21781"); // Swiss grid 50 50 String errs = ""; 51 51 for (ProjData pd : data) { -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModelTest.java
r4126 r5556 21 21 import org.openstreetmap.josm.data.osm.Relation; 22 22 import org.openstreetmap.josm.data.osm.Way; 23 import org.openstreetmap.josm.data.projection. Epsg4326;23 import org.openstreetmap.josm.data.projection.Projections; 24 24 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 25 25 import org.openstreetmap.josm.gui.conflict.pair.properties.PropertiesMergeModel; … … 47 47 @BeforeClass 48 48 public static void init() { 49 Main.setProjection( new Epsg4326());49 Main.setProjection(Projections.getProjectionByCode("EPSG:4326")); 50 50 Main.pref = new Preferences(); 51 51 }
Note:
See TracChangeset
for help on using the changeset viewer.