001    /*
002     *    GeoAPI - Java interfaces for OGC/ISO standards
003     *    http://www.geoapi.org
004     *
005     *    Copyright (C) 2004-2012 Open Geospatial Consortium, Inc.
006     *    All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007     *
008     *    Permission to use, copy, and modify this software and its documentation, with
009     *    or without modification, for any purpose and without fee or royalty is hereby
010     *    granted, provided that you include the following on ALL copies of the software
011     *    and documentation or portions thereof, including modifications, that you make:
012     *
013     *    1. The full text of this NOTICE in a location viewable to users of the
014     *       redistributed or derivative work.
015     *    2. Notice of any changes or modifications to the OGC files, including the
016     *       date changes were made.
017     *
018     *    THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019     *    NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020     *    TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021     *    THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022     *    PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023     *
024     *    COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025     *    CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026     *
027     *    The name and trademarks of copyright holders may NOT be used in advertising or
028     *    publicity pertaining to the software without specific, written prior permission.
029     *    Title to copyright in this software and any associated documentation will at all
030     *    times remain with copyright holders.
031     */
032    package org.opengis.metadata.content;
033    
034    import java.util.List;
035    import java.util.ArrayList;
036    
037    import org.opengis.util.CodeList;
038    import org.opengis.annotation.UML;
039    
040    import static org.opengis.annotation.Obligation.*;
041    import static org.opengis.annotation.Specification.*;
042    
043    
044    /**
045     * Code which indicates conditions which may affect the image.
046     *
047     * @author  Martin Desruisseaux (IRD)
048     * @version 3.0
049     * @since   2.0
050     */
051    @UML(identifier="MD_ImagingConditionCode", specification=ISO_19115)
052    public final class ImagingCondition extends CodeList<ImagingCondition> {
053        /**
054         * Serial number for compatibility with different versions.
055         */
056        private static final long serialVersionUID = -1948380148063658761L;
057    
058        /**
059         * List of all enumerations of this type.
060         * Must be declared before any enum declaration.
061         */
062        private static final List<ImagingCondition> VALUES = new ArrayList<ImagingCondition>(11);
063    
064        /**
065         * Portion of the image is blurred.
066         */
067        @UML(identifier="blurredImage", obligation=CONDITIONAL, specification=ISO_19115)
068        public static final ImagingCondition BLURRED_IMAGE = new ImagingCondition("BLURRED_IMAGE");
069    
070        /**
071         * Portion of the image is partially obscured by cloud cover
072         */
073        @UML(identifier="cloud", obligation=CONDITIONAL, specification=ISO_19115)
074        public static final ImagingCondition CLOUD = new ImagingCondition("CLOUD");
075    
076        /**
077         * Acute angle between the plane of the ecliptic (the plane of the Earth's orbit) and
078         * the plane of the celestial equator.
079         */
080        @UML(identifier="degradingObliquity", obligation=CONDITIONAL, specification=ISO_19115)
081        public static final ImagingCondition DEGRADING_OBLIQUITY = new ImagingCondition("DEGRADING_OBLIQUITY");
082    
083        /**
084         * Portion of the image is partially obscured by fog.
085         */
086        @UML(identifier="fog", obligation=CONDITIONAL, specification=ISO_19115)
087        public static final ImagingCondition FOG = new ImagingCondition("FOG");
088    
089        /**
090         * Portion of the image is partially obscured by heavy smoke or dust.
091         */
092        @UML(identifier="heavySmokeOrDust", obligation=CONDITIONAL, specification=ISO_19115)
093        public static final ImagingCondition HEAVY_SMOKE_OR_DUST = new ImagingCondition("HEAVY_SMOKE_OR_DUST");
094    
095        /**
096         * Image was taken at night.
097         */
098        @UML(identifier="night", obligation=CONDITIONAL, specification=ISO_19115)
099        public static final ImagingCondition NIGHT = new ImagingCondition("NIGHT");
100    
101        /**
102         * Image was taken during rainfall.
103         */
104        @UML(identifier="rain", obligation=CONDITIONAL, specification=ISO_19115)
105        public static final ImagingCondition RAIN = new ImagingCondition("RAIN");
106    
107        /**
108         * Image was taken during semi-dark conditions or twilight conditions.
109         */
110        @UML(identifier="semiDarkness", obligation=CONDITIONAL, specification=ISO_19115)
111        public static final ImagingCondition SEMI_DARKNESS = new ImagingCondition("SEMI_DARKNESS");
112    
113        /**
114         * Portion of the image is obscured by shadow.
115         */
116        @UML(identifier="shadow", obligation=CONDITIONAL, specification=ISO_19115)
117        public static final ImagingCondition SHADOW = new ImagingCondition("SHADOW");
118    
119        /**
120         * Portion of the image is obscured by snow.
121         */
122        @UML(identifier="snow", obligation=CONDITIONAL, specification=ISO_19115)
123        public static final ImagingCondition SNOW = new ImagingCondition("SNOW");
124    
125        /**
126         * The absence of collection data of a given point or area caused by the relative
127         * location of topographic features which obstruct the collection path between the
128         * collector(s) and the subject(s) of interest.
129         */
130        @UML(identifier="terrainMasking", obligation=CONDITIONAL, specification=ISO_19115)
131        public static final ImagingCondition TERRAIN_MASKING = new ImagingCondition("TERRAIN_MASKING");
132    
133        /**
134         * Constructs an enum with the given name. The new enum is
135         * automatically added to the list returned by {@link #values}.
136         *
137         * @param name The enum name. This name must not be in use by an other enum of this type.
138         */
139        private ImagingCondition(final String name) {
140            super(name, VALUES);
141        }
142    
143        /**
144         * Returns the list of {@code ImagingCondition}s.
145         *
146         * @return The list of codes declared in the current JVM.
147         */
148        public static ImagingCondition[] values() {
149            synchronized (VALUES) {
150                return VALUES.toArray(new ImagingCondition[VALUES.size()]);
151            }
152        }
153    
154        /**
155         * Returns the list of enumerations of the same kind than this enum.
156         */
157        @Override
158        public ImagingCondition[] family() {
159            return values();
160        }
161    
162        /**
163         * Returns the imaging condition that matches the given string, or returns a
164         * new one if none match it. More specifically, this methods returns the first instance for
165         * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code>
166         * returns {@code true}. If no existing instance is found, then a new one is created for
167         * the given name.
168         *
169         * @param code The name of the code to fetch or to create.
170         * @return A code matching the given name.
171         */
172        public static ImagingCondition valueOf(String code) {
173            return valueOf(ImagingCondition.class, code);
174        }
175    }