use of org.opengis.referencing.crs.TemporalCRS in project sis by apache.
the class EllipsoidalHeightCombinerTest method testGeographicCRS.
/**
* Tests {@link EllipsoidalHeightCombiner#createCompoundCRS EllipsoidalHeightCombiner.createCompoundCRS(…)}
* with a geographic CRS.
*
* @throws FactoryException if a CRS can not be created.
*/
@Test
public void testGeographicCRS() throws FactoryException {
final EllipsoidalHeightCombiner services = create();
final Map<String, String> properties = Collections.singletonMap(CoordinateReferenceSystem.NAME_KEY, "WGS 84 (4D)");
final GeographicCRS horizontal = HardCodedCRS.WGS84;
final GeographicCRS volumetric = HardCodedCRS.WGS84_3D;
final VerticalCRS vertical = HardCodedCRS.ELLIPSOIDAL_HEIGHT;
final TemporalCRS temporal = HardCodedCRS.TIME;
final VerticalCRS geoidal = HardCodedCRS.GRAVITY_RELATED_HEIGHT;
/*
* createCompoundCRS(…) should not combine GeographicCRS with non-ellipsoidal height.
*/
CoordinateReferenceSystem compound = services.createCompoundCRS(properties, horizontal, geoidal, temporal);
assertArrayEqualsIgnoreMetadata(new SingleCRS[] { horizontal, geoidal, temporal }, CRS.getSingleComponents(compound).toArray());
/*
* createCompoundCRS(…) should combine GeographicCRS with ellipsoidal height.
*/
compound = services.createCompoundCRS(properties, horizontal, vertical);
assertArrayEqualsIgnoreMetadata(new SingleCRS[] { volumetric }, CRS.getSingleComponents(compound).toArray());
/*
* createCompoundCRS(…) should combine GeographicCRS with ellipsoidal height and keep time.
*/
compound = services.createCompoundCRS(properties, horizontal, vertical, temporal);
assertArrayEqualsIgnoreMetadata(new SingleCRS[] { volumetric, temporal }, CRS.getSingleComponents(compound).toArray());
/*
* Non-standard feature: accept (VerticalCRS + GeodeticCRS) order.
* The test below use the reverse order for all axes compared to the previous test.
*/
compound = services.createCompoundCRS(properties, temporal, vertical, HardCodedCRS.WGS84_φλ);
final Object[] components = CRS.getSingleComponents(compound).toArray();
assertEquals(2, components.length);
assertEqualsIgnoreMetadata(temporal, components[0]);
assertInstanceOf("Shall be a three-dimensional geographic CRS.", GeographicCRS.class, components[1]);
assertAxisDirectionsEqual("Shall be a three-dimensional geographic CRS.", ((CoordinateReferenceSystem) components[1]).getCoordinateSystem(), AxisDirection.UP, AxisDirection.NORTH, AxisDirection.EAST);
}
Aggregations