/** * Returns the first temporal coordinate reference system found in the given CRS, or {@code * null} if there is none. * * @param crs The coordinate reference system, or {@code null}. * @return The temporal CRS, or {@code null} if none. * @since 2.4 */ public static TemporalCRS getTemporalCRS(final CoordinateReferenceSystem crs) { if (crs instanceof TemporalCRS) { return (TemporalCRS) crs; } if (crs instanceof CompoundCRS) { final CompoundCRS cp = (CompoundCRS) crs; for (final CoordinateReferenceSystem c : cp.getCoordinateReferenceSystems()) { final TemporalCRS candidate = getTemporalCRS(c); if (candidate != null) { return candidate; } } } return null; }
} else { this.coverage = coverage; temporalCRS = DefaultTemporalCRS.wrap(CRS.getTemporalCRS(crs)); if (temporalCRS == null) { throw new IllegalArgumentException(