001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2004-2024 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.metadata.content;
019
020import org.opengis.util.CodeList;
021import org.opengis.annotation.UML;
022import org.opengis.geoapi.internal.Vocabulary;
023import org.opengis.metadata.quality.CoverageResult;
024
025import static org.opengis.annotation.Obligation.*;
026import static org.opengis.annotation.Specification.*;
027
028
029/**
030 * Specific type of information represented in the cell.
031 *
032 * @author  Martin Desruisseaux (IRD)
033 * @author  Rémi Maréchal (Geomatys)
034 * @version 3.1
035 * @since   2.0
036 */
037@Vocabulary(capacity=8)
038@UML(identifier="MD_CoverageContentTypeCode", specification=ISO_19115)
039public final class CoverageContentType extends CodeList<CoverageContentType> {
040    /**
041     * Serial number for compatibility with different versions.
042     */
043    private static final long serialVersionUID = -346887088822021485L;
044
045    /**
046     * Meaningful numerical representation of a physical parameter that is not the actual
047     * value of the physical parameter.
048     */
049    @UML(identifier="image", obligation=CONDITIONAL, specification=ISO_19115)
050    public static final CoverageContentType IMAGE = new CoverageContentType("IMAGE");
051
052    /**
053     * Code value with no quantitative meaning, used to represent a physical quantity.
054     */
055    @UML(identifier="thematicClassification", obligation=CONDITIONAL, specification=ISO_19115)
056    public static final CoverageContentType THEMATIC_CLASSIFICATION = new CoverageContentType("THEMATIC_CLASSIFICATION");
057
058    /**
059     * Value in physical units of the quantity being measured.
060     */
061    @UML(identifier="physicalMeasurement", obligation=CONDITIONAL, specification=ISO_19115)
062    public static final CoverageContentType PHYSICAL_MEASUREMENT = new CoverageContentType("PHYSICAL_MEASUREMENT");
063
064    /**
065     * Data, usually a physical measurement, used to support the calculation of the primary
066     * {@linkplain #PHYSICAL_MEASUREMENT physical measurement} coverages in the dataset.
067     *
068     * <div class="note"><b>Example:</b>
069     * grid of aerosol optical thickness used in the calculation of a sea surface temperature product.
070     * </div>
071     *
072     * @since 3.1
073     */
074    @UML(identifier="auxillaryInformation", obligation=CONDITIONAL, specification=ISO_19115)
075    public static final CoverageContentType AUXILLARY_INFORMATION = new CoverageContentType("AUXILLARY_INFORMATION");
076
077    /**
078     * Data used to characterize the quality of the {@linkplain #PHYSICAL_MEASUREMENT physical measurement}
079     * coverage in the dataset. Typically included in a {@link CoverageResult}.
080     *
081     * @since 3.1
082     */
083    @UML(identifier="qualityInformation", obligation=CONDITIONAL, specification=ISO_19115)
084    public static final CoverageContentType QUALITY_INFORMATION = new CoverageContentType("QUALITY_INFORMATION");
085
086    /**
087     * Reference information use to support the calculation or use of
088     * {@linkplain #PHYSICAL_MEASUREMENT physical measurement} coverages in the dataset.
089     *
090     * <div class="note"><b>Example:</b>
091     * grid of latitude longitude used to geolocate the physical measurement.
092     * </div>
093     *
094     * @since 3.1
095     */
096    @UML(identifier="referenceInformation", obligation=CONDITIONAL, specification=ISO_19115)
097    public static final CoverageContentType REFERENCE_INFORMATION = new CoverageContentType("REFERENCE_INFORMATION");
098
099    /**
100     * Results with values that are calculated using a model rather than being observed or calculated from observations.
101     *
102     * @since 3.1
103     */
104    @UML(identifier="modelResult", obligation=CONDITIONAL, specification=ISO_19115)
105    public static final CoverageContentType MODEL_RESULT = new CoverageContentType("MODEL_RESULT");
106
107    /**
108     * Data used to provide coordinate axis values.
109     *
110     * @since 3.1
111     */
112    @UML(identifier="coordinate", obligation=CONDITIONAL, specification=ISO_19115)
113    public static final CoverageContentType COORDINATE = new CoverageContentType("COORDINATE");
114
115    /**
116     * Constructs an element of the given name.
117     *
118     * @param name  the name of the new element. This name shall not be in use by another element of this type.
119     */
120    private CoverageContentType(final String name) {
121        super(name);
122    }
123
124    /**
125     * Returns the list of {@code CoverageContentType}s.
126     *
127     * @return the list of codes declared in the current JVM.
128     */
129    public static CoverageContentType[] values() {
130        return values(CoverageContentType.class);
131    }
132
133    /**
134     * Returns the list of codes of the same kind as this code list element.
135     * Invoking this method is equivalent to invoking {@link #values()}, except that
136     * this method can be invoked on an instance of the parent {@code CodeList} class.
137     *
138     * @return all code {@linkplain #values() values} for this code list.
139     */
140    @Override
141    public CoverageContentType[] family() {
142        return values();
143    }
144
145    /**
146     * Returns the coverage content type that matches the given string, or returns a new one if none match it.
147     * This methods returns the first instance (in declaration order) for which the {@linkplain #name() name}
148     * is {@linkplain String#equalsIgnoreCase(String) equals, ignoring case}, to the given name.
149     * If no existing instance is found, then a new one is created for the given name.
150     *
151     * @param  code  the name of the code to fetch or to create.
152     * @return a code matching the given name.
153     */
154    public static CoverageContentType valueOf(String code) {
155        return valueOf(CoverageContentType.class, code, CoverageContentType::new).get();
156    }
157}