return new EllipsoidalHeightCombiner(crsFactory, csFactory, opFactory).createCompoundCRS( parseMetadataAndClose(element, name, null), components.toArray(new CoordinateReferenceSystem[components.size()]));
final Map<String,?> properties = EllipsoidalHeightCombiner.properties(components); return new EllipsoidalHeightCombiner() { @Override public void initialize(final int factoryTypes) {
CoordinateSystem cs = null; CoordinateReferenceSystem crs = null; if (i == 0 || (cs = getCsIfHorizontal2D(crs = components[i - 1])) == null) { if (i+1 >= components.length || (cs = getCsIfHorizontal2D(crs = components[i + 1])) == null) { continue; final Map<String,?> crsProps = (components.length == 2) ? properties : referencing.getProperties(crs, false); if (crs instanceof GeodeticCRS) { initialize(CS | CRS); cs = csFactory.createEllipsoidalCS(csProps, axes[0], axes[1], axes[2]); crs = crsFactory.createGeographicCRS(crsProps, ((GeodeticCRS) crs).getDatum(), (EllipsoidalCS) cs); } else { initialize(CS | CRS | OPERATION); final ProjectedCRS proj = (ProjectedCRS) crs; GeographicCRS base = proj.getBaseCRS(); if (base.getCoordinateSystem().getDimension() == 2) { base = (GeographicCRS) createCompoundCRS(referencing.getProperties(base, false), base, vertical); case 0: return null; case 1: return components[0]; default: initialize(CRS); return crsFactory.createCompoundCRS(properties, components);
CoordinateReferenceSystem compound = services.createCompoundCRS(properties, horizontal, geoidal, temporal); assertArrayEqualsIgnoreMetadata(new SingleCRS[] {horizontal, geoidal, temporal}, CRS.getSingleComponents(compound).toArray()); compound = services.createCompoundCRS(properties, horizontal, vertical); assertArrayEqualsIgnoreMetadata(new SingleCRS[] {volumetric}, CRS.getSingleComponents(compound).toArray()); compound = services.createCompoundCRS(properties, horizontal, vertical, temporal); assertArrayEqualsIgnoreMetadata(new SingleCRS[] {volumetric, temporal}, CRS.getSingleComponents(compound).toArray()); compound = services.createCompoundCRS(properties, temporal, vertical, HardCodedCRS.WGS84_φλ); final Object[] components = CRS.getSingleComponents(compound).toArray(); assertEquals(2, components.length);
CoordinateSystem cs = null; CoordinateReferenceSystem crs = null; if (i == 0 || (cs = getCsIfHorizontal2D(crs = components[i - 1])) == null) { if (i+1 >= components.length || (cs = getCsIfHorizontal2D(crs = components[i + 1])) == null) { continue; final Map<String,?> crsProps = (components.length == 2) ? properties : referencing.getProperties(crs, false); if (crs instanceof GeodeticCRS) { initialize(CS | CRS); cs = csFactory.createEllipsoidalCS(csProps, axes[0], axes[1], axes[2]); crs = crsFactory.createGeographicCRS(crsProps, ((GeodeticCRS) crs).getDatum(), (EllipsoidalCS) cs); } else { initialize(CS | CRS | OPERATION); final ProjectedCRS proj = (ProjectedCRS) crs; GeographicCRS base = proj.getBaseCRS(); if (base.getCoordinateSystem().getDimension() == 2) { base = (GeographicCRS) createCompoundCRS(referencing.getProperties(base, false), base, vertical); case 0: return null; case 1: return components[0]; default: initialize(CRS); return crsFactory.createCompoundCRS(properties, components);
CoordinateReferenceSystem compound = services.createCompoundCRS(properties, horizontal, geoidal, temporal); assertArrayEqualsIgnoreMetadata(new SingleCRS[] {horizontal, geoidal, temporal}, CRS.getSingleComponents(compound).toArray()); compound = services.createCompoundCRS(properties, horizontal, vertical); assertArrayEqualsIgnoreMetadata(new SingleCRS[] {volumetric}, CRS.getSingleComponents(compound).toArray()); compound = services.createCompoundCRS(properties, horizontal, vertical, temporal); assertArrayEqualsIgnoreMetadata(new SingleCRS[] {volumetric, temporal}, CRS.getSingleComponents(compound).toArray()); compound = services.createCompoundCRS(properties, temporal, vertical, horizontal); final Object[] components = CRS.getSingleComponents(compound).toArray(); assertEquals(2, components.length);
return new EllipsoidalHeightCombiner(crsFactory, csFactory, opFactory).createCompoundCRS( parseMetadataAndClose(element, name, null), components.toArray(new CoordinateReferenceSystem[components.size()]));
final Map<String,?> properties = EllipsoidalHeightCombiner.properties(components); return new EllipsoidalHeightCombiner() { @Override public void initialize(final int factoryTypes) {
/** * Tests {@link EllipsoidalHeightCombiner#properties(CoordinateReferenceSystem...)}. */ @Test public void testProperties() { final Map<String,?> properties = EllipsoidalHeightCombiner.properties(HardCodedCRS.WGS84, HardCodedCRS.GRAVITY_RELATED_HEIGHT, HardCodedCRS.TIME); assertEquals("WGS 84 + MSL height + Time", properties.remove("name")); assertEquals(Extents.WORLD, properties.remove("domainOfValidity")); assertTrue("No other property expected.", properties.isEmpty()); } }