Search in sources :

Example 1 with DefaultTemporalCRS

use of org.apache.sis.referencing.crs.DefaultTemporalCRS in project sis by apache.

the class ServicesForMetadata method setTemporalExtent.

/**
 * Implementation of the public {@code setBounds} methods for the temporal extent.
 *
 * @param  envelope     the source envelope.
 * @param  target       the target temporal extent.
 * @param  crs          the envelope CRS (mandatory, can not be {@code null}).
 * @param  temporalCRS  the temporal component of the given CRS (mandatory).
 * @throws UnsupportedOperationException if no implementation of {@code TemporalFactory} has been found
 *         on the classpath.
 */
private static void setTemporalExtent(final Envelope envelope, final DefaultTemporalExtent target, final CoordinateReferenceSystem crs, final TemporalCRS temporalCRS) {
    final int dim = AxisDirections.indexOfColinear(crs.getCoordinateSystem(), temporalCRS.getCoordinateSystem());
    // Should not fail since 'temporalCRS' has been extracted from 'crs' by the caller.
    assert dim >= 0 : crs;
    final DefaultTemporalCRS converter = DefaultTemporalCRS.castOrCopy(temporalCRS);
    target.setBounds(converter.toDate(envelope.getMinimum(dim)), converter.toDate(envelope.getMaximum(dim)));
}
Also used : DefaultTemporalCRS(org.apache.sis.referencing.crs.DefaultTemporalCRS)

Aggregations

DefaultTemporalCRS (org.apache.sis.referencing.crs.DefaultTemporalCRS)1