/** * Returns the vertical datum type that matches the given string, or returns a new one if none * match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static VerticalDatumType valueOf(String code) { return valueOf(VerticalDatumType.class, code); } }
/** Returns the list of enumerations of the same kind than this enum. */ public VerticalDatumType[] family() { return values(); }
if (vertical == null) { vertical = (VerticalCRS) candidate; if (VerticalDatumType.ELLIPSOIDAL.equals( vertical.getDatum().getVerticalDatumType())) { vi = i;
/** * Returns the VerticalDatumType that matches the given string, or returns a * new one if none match it. */ public static VerticalDatumType valueOf(String code) { if (code == null) { return null; } synchronized (VALUES) { Iterator iter = VALUES.iterator(); while (iter.hasNext()) { VerticalDatumType type = (VerticalDatumType) iter.next(); if (code.equalsIgnoreCase(type.name())) { return type; } } return new VerticalDatumType(code); } } }
/** * Returns the legacy code for the datum type, or 0 if unknown. * This method is used for WKT 1 formatting. * * @param type the vertical datum type, or {@code null} if unknown. * @return the legacy code for the given datum type, or 0 if unknown. */ public static int toLegacy(final VerticalDatumType type) { if (type != null) { final int ordinal = type.ordinal(); if (ordinal >= 0 && ordinal < LEGACY_CODES.length) { return LEGACY_CODES[ordinal]; } } return 0; }
/** * Returns {@code true} if the type of the given datum is ellipsoidal. A vertical datum is not allowed * to be ellipsoidal according ISO 19111, but Apache SIS relaxes this restriction in some limited cases, * for example when parsing a string in the legacy WKT 1 format. Apache SIS should not expose those * vertical heights as much as possible, and instead try to combine them with three-dimensional * geographic or projected CRS as soon as it can. * * @param datum the datum to test, or {@code null} if none. * @return {@code true} if the given datum is non null and of ellipsoidal type. * * @see org.apache.sis.internal.metadata.VerticalDatumTypes#ELLIPSOIDAL * * @since 0.8 */ public static boolean isEllipsoidalHeight(final VerticalDatum datum) { if (datum != null) { final VerticalDatumType type = datum.getVerticalDatumType(); if (type != null) { return "ELLIPSOIDAL".equalsIgnoreCase(type.name()); } } return false; }
/** * Returns the legacy code for the datum type, or 0 if unknown. * This method is used for WKT 1 formatting. * * @param type the vertical datum type, or {@code null} if unknown. * @return the legacy code for the given datum type, or 0 if unknown. */ public static int toLegacy(final VerticalDatumType type) { if (type != null) { final int ordinal = type.ordinal(); if (ordinal >= 0 && ordinal < LEGACY_CODES.length) { return LEGACY_CODES[ordinal]; } } return 0; }
/** * Returns {@code true} if the type of the given datum is ellipsoidal. A vertical datum is not allowed * to be ellipsoidal according ISO 19111, but Apache SIS relaxes this restriction in some limited cases, * for example when parsing a string in the legacy WKT 1 format. Apache SIS should not expose those * vertical heights as much as possible, and instead try to combine them with three-dimensional * geographic or projected CRS as soon as it can. * * @param datum the datum to test, or {@code null} if none. * @return {@code true} if the given datum is non null and of ellipsoidal type. * * @see org.apache.sis.internal.metadata.VerticalDatumTypes#ELLIPSOIDAL * * @since 0.8 */ public static boolean isEllipsoidalHeight(final VerticalDatum datum) { if (datum != null) { final VerticalDatumType type = datum.getVerticalDatumType(); if (type != null) { return "ELLIPSOIDAL".equalsIgnoreCase(type.name()); } } return false; }
.getDatumFactory() .createVerticalDatum( datumMap, VerticalDatumType.valueOf(v_datumType));
/** * Returns the list of enumerations of the same kind than this enum. */ public /*{VerticalDatumType}*/ CodeList[] family() { return values(); }
/** * Creates an operation between a geographic and a vertical coordinate reference systems. The * default implementation accepts the conversion only if the geographic CRS is a tri dimensional * one and the vertical CRS is for {@linkplain VerticalDatumType#ELLIPSOIDAL height above the * ellipsoid}. More elaborated operation, like transformation from ellipsoidal to geoidal * height, should be implemented here. * * @param sourceCRS Input coordinate reference system. * @param targetCRS Output coordinate reference system. * @return A coordinate operation from {@code sourceCRS} to {@code targetCRS}. * @throws FactoryException If the operation can't be constructed. * @todo Implement GEOT-352 here. */ protected CoordinateOperation createOperationStep( final GeographicCRS sourceCRS, final VerticalCRS targetCRS) throws FactoryException { if (VerticalDatumType.ELLIPSOIDAL.equals(targetCRS.getDatum().getVerticalDatumType())) { final Matrix matrix = swapAndScaleAxis( sourceCRS.getCoordinateSystem(), targetCRS.getCoordinateSystem()); return createFromAffineTransform(AXIS_CHANGES, sourceCRS, targetCRS, matrix); } throw new OperationNotFoundException(getErrorMessage(sourceCRS, targetCRS)); }
/** * Returns the vertical datum type that matches the given string, or returns a * new one if none match it. More specifically, this methods returns the first instance for * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code> * returns {@code true}. If no existing instance is found, then a new one is created for * the given name. * * @param code the name of the code to fetch or to create. * @return a code matching the given name. */ public static VerticalDatumType valueOf(String code) { return valueOf(VerticalDatumType.class, code); } }
/** * Returns the list of codes of the same kind than this code list element. * Invoking this method is equivalent to invoking {@link #values()}, except that * this method can be invoked on an instance of the parent {@code CodeList} class. * * @return all code {@linkplain #values() values} for this code list. */ @Override public VerticalDatumType[] family() { return values(); }
return type().equals(((DefaultVerticalDatum) object).type());
/** * Returns the vertical datum type that matches the given string, or returns a * new one if none match it. More specifically, this methods returns the first instance for * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code> * returns {@code true}. If no existing instance is found, then a new one is created for * the given name. * * @param code the name of the code to fetch or to create. * @return a code matching the given name. */ public static VerticalDatumType valueOf(String code) { return valueOf(VerticalDatumType.class, code); } }
/** * Returns the list of codes of the same kind than this code list element. * Invoking this method is equivalent to invoking {@link #values()}, except that * this method can be invoked on an instance of the parent {@code CodeList} class. * * @return all code {@linkplain #values() values} for this code list. */ @Override public VerticalDatumType[] family() { return values(); }
return type().equals(((DefaultVerticalDatum) object).type());
/** * Wraps the given coordinate system. */ Vertical(final CoordinateSystem cs, final CoordinateAxis netcdfAxis) { super(cs, Collections.singletonList(netcdfAxis)); switch (netcdfAxis.getAxisType()) { case Pressure: type = VerticalDatumType.BAROMETRIC; break; case Height: type = VerticalDatumType.GEOIDAL; break; case GeoZ: type = VerticalDatumType.valueOf("ELLIPSOIDAL"); break; default: type = VerticalDatumType.OTHER_SURFACE; break; } }
/** * Tests the list of vertical datum types. Note that {@link #testFromLegacy()} must be executed * first for ensuring {@link VerticalDatumTypes} class initialization prior this test. */ @Test @DependsOnMethod("testFromLegacy") public void testVerticalDatumTypes() { final VerticalDatumType[] types = VerticalDatumType.values(); assertEquals("First code list element.", VerticalDatumType.OTHER_SURFACE, types[0]); assertTrue(ArraysExt.contains(types, VerticalDatumTypes.ELLIPSOIDAL)); } }