001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2003-2023 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.referencing.operation;
019
020import java.util.Map;
021import java.util.Optional;
022import java.time.temporal.Temporal;
023import org.opengis.parameter.ParameterValueGroup;
024import org.opengis.referencing.crs.CoordinateReferenceSystem;
025import org.opengis.annotation.UML;
026
027import static org.opengis.annotation.Obligation.*;
028import static org.opengis.annotation.Specification.*;
029
030
031/**
032 * Operation in which the parameter values are defined rather than empirically derived.
033 * Coordinate conversions are coordinate operations that make use of exact,
034 * defined (rather than measured or computed), and therefore error-free parameter values.
035 * Corresponding pairs of coordinate tuples in each of the two coordinate reference systems
036 * connected through a coordinate conversion have a fixed arithmetic relationship.
037 * Additionally one of the two tuples cannot exist without specification of the coordinate conversion
038 * and the source coordinate reference system.
039 * Coordinate conversions are therefore intimately related to the concept of
040 * {@linkplain org.opengis.referencing.crs.DerivedCRS Derived <abbr>CRS</abbr>}.
041 *
042 * <h2>Examples</h2>
043 * The best-known examples of coordinate conversions are map projections.
044 * A map projection is a conversion from an ellipsoidal coordinate system
045 * to a Cartesian coordinate system in <abbr>CRS</abbr>s associated to the same datum.
046 * Another example is the change of units such as from radians to degrees or feet to meters.
047 *
048 * @author  OGC Topic 2 (for abstract model and documentation)
049 * @author  Martin Desruisseaux (IRD, Geomatys)
050 * @version 3.1
051 * @since   1.0
052 *
053 * @see Transformation
054 * @see CoordinateOperationFactory#createDefiningConversion(Map, OperationMethod, ParameterValueGroup)
055 */
056@UML(identifier="Conversion", specification=ISO_19111)
057public interface Conversion extends SingleOperation {
058    /**
059     * Returns the <abbr>CRS</abbr> from which coordinates are changed.
060     * If this conversion is part of a derived <abbr>CRS</abbr>, then the source <abbr>CRS</abbr>
061     * should be the same as the {@link org.opengis.referencing.crs.DerivedCRS#getBaseCRS()} value.
062     *
063     * <h4>Obligation</h4>
064     * ISO 19111 declares this property as optional because its value can be inferred from the
065     * {@link org.opengis.referencing.crs.DerivedCRS#getBaseCRS()} property. However, GeoAPI
066     * recommends to provide a non-null value anyway, except for defining conversions.
067     *
068     * @return the <abbr>CRS</abbr> from which coordinates are changed, or {@code null} if not available.
069     */
070    @Override
071    @UML(identifier="sourceCRS", obligation=OPTIONAL, specification=ISO_19111)
072    CoordinateReferenceSystem getSourceCRS();
073
074    /**
075     * Returns the <abbr>CRS</abbr> to which coordinates are changed.
076     * If this conversion is part of a derived <abbr>CRS</abbr>, then the target <abbr>CRS</abbr>
077     * should be the same as the {@link org.opengis.referencing.crs.DerivedCRS} instance.
078     *
079     * <h4>Obligation</h4>
080     * ISO 19111 declares this property as optional because its value can be inferred from the
081     * {@link org.opengis.referencing.crs.DerivedCRS}. However, GeoAPI recommends to provide
082     * a non-null value anyway, except for defining conversions.
083     *
084     * @return the <abbr>CRS</abbr> to which coordinates are changed, or {@code null} if not available.
085     */
086    @Override
087    @UML(identifier="targetCRS", obligation=OPTIONAL, specification=ISO_19111)
088    CoordinateReferenceSystem getTargetCRS();
089
090    /**
091     * This attribute is inherited from {@code CoordinateOperation} but is not applicable in a conversion.
092     *
093     * @return always empty.
094     * @since 3.1
095     */
096    @Override
097    @UML(identifier="sourceCoordinateEpoch", obligation=FORBIDDEN, specification=ISO_19111)
098    default Optional<Temporal> getSourceEpoch() {
099        return Optional.empty();
100    }
101
102    /**
103     * This attribute is inherited from {@code CoordinateOperation} but is not applicable in a conversion.
104     *
105     * @return always empty.
106     * @since 3.1
107     */
108    @Override
109    @UML(identifier="targetCoordinateEpoch", obligation=FORBIDDEN, specification=ISO_19111)
110    default Optional<Temporal> getTargetEpoch() {
111        return Optional.empty();
112    }
113
114    /**
115     * This attribute is inherited from {@code CoordinateOperation} but is not applicable in a conversion.
116     *
117     * @return should be empty.
118     */
119    @Override
120    @UML(identifier="operationVersion", obligation=FORBIDDEN, specification=ISO_19111)
121    default String getOperationVersion() {
122        return null;
123    }
124}