/** * Verifies that an EPSG identifier added by {@link #addIdentifier(CoordinateSystemAxis, short)} has been removed * after the axes have been reordered. * * @param original the axis with EPSG identifier before normalization. * @param normalized the axis after normalization, in which we expect the EPSG identifier to have been removed. */ private static void assertIdentifierRemoved(final CoordinateSystemAxis original, final CoordinateSystemAxis normalized) { assertNotSame (original, normalized); assertNotEquals(original, normalized); assertFalse("identifiers.isEmpty()", original.getIdentifiers().isEmpty()); assertTrue ("identifiers.isEmpty()", normalized.getIdentifiers().isEmpty()); assertEqualsIgnoreMetadata(original, normalized); } }
if (!axis.getIdentifiers().isEmpty()) { // If the axis has no identifier, nothing to remove. for (int j=0; j<n; j++) { if (j != i && axis == oldAxes[j]) {
/** * Tests (un)marshalling of a Cartesian coordinate system. * * @throws JAXBException if an error occurred during unmarshalling. */ @Test public void testXML() throws JAXBException { final DefaultCartesianCS cs = unmarshalFile(DefaultCartesianCS.class, XML_FILE); Validators.validate(cs); GeodeticObjectVerifier.assertIsProjected2D(cs); /* * Values in the following tests are specific to our XML file. * The actual texts in the EPSG database are more descriptive. */ final CoordinateSystemAxis E = cs.getAxis(0); final CoordinateSystemAxis N = cs.getAxis(1); assertEquals("name", "Easting, northing (E,N)", cs.getName().getCode()); assertEquals("remarks", "Used in ProjectedCRS.", cs.getRemarks().toString()); assertEpsgIdentifierEquals(String.valueOf(Constants.EPSG_PROJECTED_CS), getSingleton(cs.getIdentifiers())); assertEpsgIdentifierEquals("1", getSingleton(E.getIdentifiers())); assertEpsgIdentifierEquals("2", getSingleton(N.getIdentifiers())); assertAxisEquals("Easting", "E", AxisDirection.EAST, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Units.METRE, null, E); assertAxisEquals("Northing", "N", AxisDirection.NORTH, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Units.METRE, null, N); /* * Marshal and compare with the original file. */ assertMarshalEqualsFile(XML_FILE, cs, "xmlns:*", "xsi:schemaLocation"); } }
/** * Tests (un)marshalling of an ellipsoidal coordinate system. * * @throws JAXBException if an error occurred during unmarshalling. */ @Test public void testXML() throws JAXBException { final DefaultEllipsoidalCS cs = unmarshalFile(DefaultEllipsoidalCS.class, XML_FILE); Validators.validate(cs); GeodeticObjectVerifier.assertIsGeodetic2D(cs, true); /* * Values in the following tests are specific to our XML file. * The actual texts in the EPSG database are more descriptive. */ final CoordinateSystemAxis φ = cs.getAxis(0); final CoordinateSystemAxis λ = cs.getAxis(1); assertEquals("name", "Latitude (north), Longitude (east)", cs.getName().getCode()); assertEquals("remarks", "Used in two-dimensional GeographicCRS.", cs.getRemarks().toString()); assertAxisEquals("Geodetic latitude", "φ", AxisDirection.NORTH, -90, +90, Units.DEGREE, RangeMeaning.EXACT, φ); assertAxisEquals("Geodetic longitude", "λ", AxisDirection.EAST, -180, +180, Units.DEGREE, RangeMeaning.WRAPAROUND, λ); assertEpsgIdentifierEquals("6422", getSingleton(cs.getIdentifiers())); assertEpsgIdentifierEquals("106", getSingleton(φ.getIdentifiers())); assertEpsgIdentifierEquals("107", getSingleton(λ.getIdentifiers())); /* * Marshal and compare with the original file. */ assertMarshalEqualsFile(XML_FILE, cs, "xmlns:*", "xsi:schemaLocation"); } }