Author: desruisseaux
Date: Wed Jan 15 19:42:52 2014
New Revision: 1558550
URL: http://svn.apache.org/r1558550
Log:
Enable the tests that were ignored because of the lack of "CRS:84".
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java?rev=1558550&r1=1558549&r2=1558550&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
[UTF-8] Wed Jan 15 19:42:52 2014
@@ -1020,14 +1020,14 @@ public abstract class AbstractEnvelope i
@Override
public int hashCode() {
final int dimension = getDimension();
- long code = 1;
+ int code = 1;
boolean p = true;
do {
for (int i=0; i<dimension; i++) {
- code = code*31 + doubleToLongBits(p ? getLower(i) :
getUpper(i));
+ code = code*31 + Numerics.hashCode(doubleToLongBits(p ?
getLower(i) : getUpper(i)));
}
} while ((p = !p) == false);
- return Numerics.hashCode(code) +
Objects.hashCode(getCoordinateReferenceSystem());
+ return code + Objects.hashCode(getCoordinateReferenceSystem());
}
/**
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java?rev=1558550&r1=1558549&r2=1558550&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
[UTF-8] Wed Jan 15 19:42:52 2014
@@ -30,11 +30,10 @@ import org.opengis.geometry.MismatchedRe
import org.opengis.metadata.extent.GeographicBoundingBox;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.util.FactoryException;
+import org.apache.sis.referencing.GeodeticObjects;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.referencing.CRS;
import static org.apache.sis.util.ArgumentChecks.*;
import static org.apache.sis.math.MathFunctions.isNegative;
@@ -195,12 +194,7 @@ class ArrayEnvelope extends AbstractEnve
ArraysExt.swap(ordinates, 1, (ordinates.length >>> 1) + 1);
}
}
- try {
- crs = CRS.forCode("CRS:84");
- } catch (FactoryException e) {
- // Should never happen since we asked for a CRS which should
always be present.
- throw new AssertionError(e);
- }
+ crs = GeodeticObjects.WGS84.normalizedGeographic();
}
/**
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java?rev=1558550&r1=1558549&r2=1558550&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
[UTF-8] Wed Jan 15 19:42:52 2014
@@ -25,10 +25,9 @@ import org.opengis.metadata.extent.Geogr
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.cs.AxisDirection;
-import org.opengis.util.FactoryException;
+import org.apache.sis.referencing.GeodeticObjects;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.Emptiable;
-import org.apache.sis.referencing.CRS;
import static java.lang.Double.NaN;
import static java.lang.Double.isNaN;
@@ -209,12 +208,7 @@ public class Envelope2D extends Rectangl
box.getSouthBoundLatitude(),
box.getEastBoundLongitude(),
box.getNorthBoundLatitude());
- try {
- crs = CRS.forCode("CRS:84");
- } catch (FactoryException e) {
- // Should never happen since we asked for a CRS which should
always be present.
- throw new AssertionError(e);
- }
+ crs = GeodeticObjects.WGS84.normalizedGeographic();
if (Boolean.FALSE.equals(box.getInclusion())) {
x += width;
width = -width;
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java?rev=1558550&r1=1558549&r2=1558550&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
[UTF-8] Wed Jan 15 19:42:52 2014
@@ -288,14 +288,14 @@ public enum GeodeticObjects {
* together with an enumeration value that can be used for fetching that
CRS:
*
* <blockquote><table class="sis">
- * <tr><th>Name or alias</th> <th>Enum</th>
<th>EPSG</th></tr>
+ * <tr><th>Name or alias</th> <th>Enum</th>
<th>Code</th></tr>
* <tr><td>ED50</td> <td>{@link #ED50}</td>
<td></td></tr>
* <tr><td>ETRS89</td> <td>{@link #ETRS89}</td>
<td></td></tr>
* <tr><td>NAD27</td> <td>{@link #NAD27}</td>
<td></td></tr>
* <tr><td>NAD83</td> <td>{@link #NAD83}</td>
<td></td></tr>
* <tr><td>GRS 1980 Authalic Sphere</td> <td>{@link #SPHERE}</td>
<td></td></tr>
* <tr><td>WGS 72</td> <td>{@link #WGS72}</td>
<td></td></tr>
- * <tr><td>WGS 84</td> <td>{@link #WGS84}</td>
<td></td></tr>
+ * <tr><td>WGS 84</td> <td>{@link #WGS84}</td>
<td>CRS:84</td></tr>
* </table></blockquote>
*
* @return The geographic CRS with non-standard (<var>longitude</var>,
<var>latitude</var>) axis order.
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java?rev=1558550&r1=1558549&r2=1558550&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
[UTF-8] Wed Jan 15 19:42:52 2014
@@ -20,10 +20,10 @@ import java.awt.geom.Rectangle2D;
import org.opengis.geometry.Envelope;
import org.opengis.geometry.DirectPosition;
import org.opengis.referencing.crs.GeographicCRS;
+import org.apache.sis.referencing.GeodeticObjects;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
-import org.junit.Ignore;
import org.junit.Test;
import static java.lang.Double.NaN;
@@ -55,10 +55,8 @@ public final strictfp class AbstractEnve
/**
* The coordinate reference system used for the tests.
- *
- * @todo Need to be assigned when we will have ported the CRS
implementations.
*/
- static final GeographicCRS WGS84 = null;
+ static final GeographicCRS WGS84 =
GeodeticObjects.WGS84.normalizedGeographic();
/**
* Creates an envelope of the given type. The type shall be one of the
@@ -87,14 +85,15 @@ public final strictfp class AbstractEnve
break;
}
case SUBENVELOPE: {
- final GeneralEnvelope ge = new GeneralEnvelope(5);
- ge.setCoordinateReferenceSystem(WGS84);
+ GeneralEnvelope ge = new GeneralEnvelope(5);
ge.setRange(1, xmin, xmax);
ge.setRange(2, ymin, ymax);
ge.setRange(0, 2, 3); // Following values will be verified in
verifyInvariants(…)
ge.setRange(3, 4, 6);
ge.setRange(4, 8, 9);
- envelope = ge.subEnvelope(1, 3);
+ ge = ge.subEnvelope(1, 3);
+ ge.setCoordinateReferenceSystem(WGS84);
+ envelope = ge;
break;
}
default: throw new IllegalArgumentException(String.valueOf(type));
@@ -190,7 +189,6 @@ public final strictfp class AbstractEnve
* }
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testCrossingAntiMeridian() {
final DirectPosition2D inside = new DirectPosition2D(18, 32);
final DirectPosition2D outside = new DirectPosition2D( 3, 32);
@@ -253,7 +251,6 @@ public final strictfp class AbstractEnve
* }
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testCrossingAntiMeridianTwice() {
final DirectPosition2D inside = new DirectPosition2D(18, 32);
final DirectPosition2D outside = new DirectPosition2D( 3, 32);
@@ -309,7 +306,6 @@ public final strictfp class AbstractEnve
* on the left and right sides.
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testCrossingAntiMeridianThreeTimes() {
final DirectPosition2D wasInside = new DirectPosition2D(18, 32);
final DirectPosition2D outside = new DirectPosition2D( 3, 32);
@@ -415,7 +411,6 @@ public final strictfp class AbstractEnve
* Tests a case crossing the anti-meridian crossing, from 0° to -0°.
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testRange360() {
final DirectPosition2D inside = new DirectPosition2D(18, 32);
final DirectPosition2D wasOutside = new DirectPosition2D( 3, 32);
@@ -501,7 +496,6 @@ public final strictfp class AbstractEnve
*/
@Test
@DependsOnMethod("testToSimpleEnvelopesOnEmptyEnvelope")
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testToSimpleEnvelopesOverAntiMeridian() {
for (int type=0; type<LAST; type++) {
if (type != RECTANGLE) {
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java?rev=1558550&r1=1558549&r2=1558550&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
[UTF-8] Wed Jan 15 19:42:52 2014
@@ -19,7 +19,6 @@ package org.apache.sis.geometry;
import java.util.Arrays;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOn;
-import org.junit.Ignore;
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
@@ -41,7 +40,6 @@ public final strictfp class GeneralDirec
* Tests the {@link GeneralDirectPosition#normalize()} method.
*/
@Test
- @Ignore("The tested position needs to be associated to CRS:84")
public void testNormalize() {
final GeneralDirectPosition position = new
GeneralDirectPosition(WGS84);
position.setCoordinate(300, -100);
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java?rev=1558550&r1=1558549&r2=1558550&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
[UTF-8] Wed Jan 15 19:42:52 2014
@@ -22,7 +22,6 @@ import org.apache.sis.math.MathFunctions
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOnMethod;
-import org.junit.Ignore;
import org.junit.Test;
import static java.lang.Double.NaN;
@@ -215,7 +214,6 @@ public strictfp class GeneralEnvelopeTes
* {@link Envelope2D#createIntersection(Rectangle2D)} methods.
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testIntersection() {
// ┌─────────────┐
// │ ┌───────┐ │
@@ -280,7 +278,6 @@ public strictfp class GeneralEnvelopeTes
* {@link Envelope2D#createUnion(Rectangle2D)} methods.
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testUnion() {
// ┌─────────────┐
// │ ┌───────┐ │
@@ -345,7 +342,6 @@ public strictfp class GeneralEnvelopeTes
* {@link Envelope2D#add(Point2D)} methods.
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testAddPoint() {
final double ymin=-20, ymax=30; // Will not change anymore
final GeneralEnvelope e = create(20, ymin, 80, ymax);
@@ -375,7 +371,6 @@ public strictfp class GeneralEnvelopeTes
* Tests the {@link GeneralEnvelope#normalize()} method.
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testNormalize() {
GeneralEnvelope e = create(-100, -100, +100, +100);
assertTrue(e.normalize());
@@ -401,7 +396,6 @@ public strictfp class GeneralEnvelopeTes
* with an envelope having more then 360° of longitude.
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testNormalizeWorld() {
GeneralEnvelope e = create(-195, -90, +170, +90); // -195° is
equivalent to 165°
assertTrue(e.normalize());
@@ -413,7 +407,6 @@ public strictfp class GeneralEnvelopeTes
* Tests the {@link GeneralEnvelope#simplify()}.
*/
@Test
- @Ignore("The tested envelope needs to be associated to CRS:84")
public void testSimplify() {
// Normal envelope: no change expected.
GeneralEnvelope e = create(-100, -10, +100, +10);