Skip to content

Commit

Permalink
Merge pull request #47 from Neutius/develop
Browse files Browse the repository at this point in the history
Minor fixes for CoordinateTransformTester, as per #41 and #42
  • Loading branch information
echeipesh authored Aug 26, 2019
2 parents 16c9d3d + 54c09e3 commit 73d0095
Showing 1 changed file with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*******************************************************************************/
package org.locationtech.proj4j;

import org.junit.Test;
import org.locationtech.proj4j.CRSFactory;
import org.locationtech.proj4j.CoordinateReferenceSystem;
import org.locationtech.proj4j.CoordinateTransform;
Expand All @@ -35,39 +34,30 @@ public CoordinateTransformTester(boolean verbose) {
this.verbose = verbose;
}

private ProjCoordinate p = new ProjCoordinate();
private ProjCoordinate p2 = new ProjCoordinate();

@Test
public boolean checkTransformFromWGS84(String name, double lon, double lat, double x, double y) {
return checkTransformFromWGS84(name, lon, lat, x, y, 0.0001);
}

@Test
public boolean checkTransformFromWGS84(String name, double lon, double lat, double x, double y, double tolerance) {
return checkTransform(WGS84, lon, lat, createCRS(name), x, y, tolerance);
}

@Test
public boolean checkTransformToWGS84(String name, double x, double y, double lon, double lat, double tolerance) {
return checkTransform(createCRS(name), x, y, WGS84, lon, lat, tolerance);
}

@Test
public boolean checkTransformFromGeo(String name, double lon, double lat, double x, double y, double tolerance) {
CoordinateReferenceSystem crs = createCRS(name);
CoordinateReferenceSystem geoCRS = crs.createGeographic();
return checkTransform(geoCRS, lon, lat, crs, x, y, tolerance);
}

@Test
public boolean checkTransformToGeo(String name, double x, double y, double lon, double lat, double tolerance) {
CoordinateReferenceSystem crs = createCRS(name);
CoordinateReferenceSystem geoCRS = crs.createGeographic();
return checkTransform(crs, x, y, geoCRS, lon, lat, tolerance);
}

@Test
private CoordinateReferenceSystem createCRS(String crsSpec) {
CoordinateReferenceSystem crs = null;
// test if name is a PROJ4 spec
Expand All @@ -79,13 +69,11 @@ private CoordinateReferenceSystem createCRS(String crsSpec) {
return crs;
}

@Test
private static String crsDisplay(CoordinateReferenceSystem crs) {
return crs.getName()
+ "(" + crs.getProjection() + "/" + crs.getDatum().getCode() + ")";
}

@Test
public boolean checkTransform(
String srcCRS, double x1, double y1,
String tgtCRS, double x2, double y2, double tolerance) {
Expand All @@ -94,7 +82,6 @@ public boolean checkTransform(
createCRS(tgtCRS), x2, y2, tolerance);
}

@Test
public boolean checkTransform(
String srcCRS, ProjCoordinate p1,
String tgtCRS, ProjCoordinate p2, double tolerance) {
Expand All @@ -103,7 +90,6 @@ public boolean checkTransform(
createCRS(tgtCRS), p2, tolerance);
}

@Test
public boolean checkTransform(
CoordinateReferenceSystem srcCRS, double x1, double y1,
CoordinateReferenceSystem tgtCRS, double x2, double y2,
Expand All @@ -114,7 +100,6 @@ tgtCRS, new ProjCoordinate(x2, y2),
tolerance);
}

@Test
public boolean checkTransform(
CoordinateReferenceSystem srcCRS, ProjCoordinate p,
CoordinateReferenceSystem tgtCRS, ProjCoordinate p2,
Expand Down Expand Up @@ -168,7 +153,6 @@ public boolean checkTransform(
* @param checkInverse
* @return
*/
@Test
public boolean checkTransform(
String cs1, double x1, double y1,
String cs2, double x2, double y2,
Expand Down

0 comments on commit 73d0095

Please sign in to comment.