()
| 112 | } |
| 113 | |
| 114 | public static void testTransformPointsWithErrorCodes() |
| 115 | { |
| 116 | if( osr.GetPROJVersionMajor() < 8 ) |
| 117 | { |
| 118 | System.out.println("Skip testTransformPointsWithErrorCodes() due to PROJ < 8"); |
| 119 | return; |
| 120 | } |
| 121 | SpatialReference s = new SpatialReference(""); |
| 122 | s.SetFromUserInput("+proj=longlat +ellps=GRS80"); |
| 123 | SpatialReference t = new SpatialReference(""); |
| 124 | t.SetFromUserInput("+proj=tmerc +ellps=GRS80"); |
| 125 | CoordinateTransformation ct = CoordinateTransformation.CreateCoordinateTransformation(s, t); |
| 126 | double[][] coords = new double[][] { |
| 127 | new double[] {1, 2}, |
| 128 | new double[] {1, 2, 3, 4}, |
| 129 | new double[] {90, 0} |
| 130 | }; |
| 131 | int[] errorCodes = ct.TransformPointsWithErrorCodes(coords); |
| 132 | |
| 133 | check(Math.abs(coords[0][0] - 111257.80439304397) < 1e-5); |
| 134 | check(Math.abs(coords[0][1] - 221183.3401672801) < 1e-5); |
| 135 | check(errorCodes[0] == 0); |
| 136 | |
| 137 | check(Math.abs(coords[1][0] - 111257.80439304397) < 1e-5); |
| 138 | check(Math.abs(coords[1][1] - 221183.3401672801) < 1e-5); |
| 139 | check(Math.abs(coords[1][2] - 3) < 1e-5); |
| 140 | check(Math.abs(coords[1][3] - 4) < 1e-5); |
| 141 | check(errorCodes[1] == 0); |
| 142 | |
| 143 | check(coords[2][0] == Double.POSITIVE_INFINITY); |
| 144 | check(errorCodes[2] == osr.PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); |
| 145 | } |
| 146 | |
| 147 | public static void testSetDesiredAccuracy() |
| 148 | { |
no test coverage detected