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.coverage;
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     * Specifies the mapping of a band to a color model component.
046     *
047     * @version <A HREF="http://www.opengis.org/docs/01-004.pdf">Grid Coverage specification 1.0</A>
048     * @author  Martin Desruisseaux (IRD)
049     * @since   GeoAPI 1.0
050     *
051     * @see PaletteInterpretation
052     * @see SampleDimension
053     *
054     * @deprecated No replacement.
055     */
056    @Deprecated
057    @UML(identifier="CV_ColorInterpretation", specification=OGC_01004)
058    public final class ColorInterpretation extends CodeList<ColorInterpretation> {
059        /**
060         * Serial number for compatibility with different versions.
061         */
062        private static final long serialVersionUID = 6947933527594223350L;
063    
064        /**
065         * List of all enumerations of this type.
066         * Must be declared before any enum declaration.
067         */
068        private static final List<ColorInterpretation> VALUES = new ArrayList<ColorInterpretation>(14);
069    
070        /**
071         * Band is not associated with a color model component.
072         */
073        @UML(identifier="CV_Undefined", obligation=CONDITIONAL, specification=OGC_01004)
074        public static final ColorInterpretation UNDEFINED = new ColorInterpretation("UNDEFINED");
075    
076        /**
077         * Band is an index into a lookup table.
078         *
079         * @see #PALETTE_INDEX
080         * @see PaletteInterpretation#GRAY
081         */
082        @UML(identifier="CV_GrayIndex", obligation=CONDITIONAL, specification=OGC_01004)
083        public static final ColorInterpretation GRAY_INDEX = new ColorInterpretation("GRAY_INDEX");
084    
085        /**
086         * Band is a color index into a color table.
087         *
088         * @see #GRAY_INDEX
089         */
090        @UML(identifier="CV_PaletteIndex", obligation=CONDITIONAL, specification=OGC_01004)
091        public static final ColorInterpretation PALETTE_INDEX = new ColorInterpretation("PALETTE_INDEX");
092    
093        /**
094         * Red Band for the {@linkplain PaletteInterpretation#RGB RGB} color model components.
095         *
096         * @see #GREEN_BAND
097         * @see #BLUE_BAND
098         * @see #ALPHA_BAND
099         * @see PaletteInterpretation#RGB
100         */
101        @UML(identifier="CV_RedBand", obligation=CONDITIONAL, specification=OGC_01004)
102        public static final ColorInterpretation RED_BAND = new ColorInterpretation("RED_BAND");
103    
104        /**
105         * Greend Band for the {@linkplain PaletteInterpretation#RGB RGB} color model components.
106         *
107         * @see #RED_BAND
108         * @see #BLUE_BAND
109         * @see #ALPHA_BAND
110         * @see PaletteInterpretation#RGB
111         */
112        @UML(identifier="CV_GreenBand", obligation=CONDITIONAL, specification=OGC_01004)
113        public static final ColorInterpretation GREEN_BAND = new ColorInterpretation("GREEN_BAND");
114    
115        /**
116         * Blue Band for the {@linkplain PaletteInterpretation#RGB RGB} color model components.
117         *
118         * @see #RED_BAND
119         * @see #GREEN_BAND
120         * @see #ALPHA_BAND
121         * @see PaletteInterpretation#RGB
122         */
123        @UML(identifier="CV_BlueBand", obligation=CONDITIONAL, specification=OGC_01004)
124        public static final ColorInterpretation BLUE_BAND = new ColorInterpretation("BLUE_BAND");
125    
126        /**
127         * Alpha Band for the {@linkplain PaletteInterpretation#RGB RGB} color model components.
128         * Alpha band may or may not be present.
129         *
130         * @see #RED_BAND
131         * @see #GREEN_BAND
132         * @see #BLUE_BAND
133         * @see PaletteInterpretation#RGB
134         */
135        @UML(identifier="CV_AlphaBand", obligation=CONDITIONAL, specification=OGC_01004)
136        public static final ColorInterpretation ALPHA_BAND = new ColorInterpretation("ALPHA_BAND");
137    
138        /**
139         * Hue Band for the {@linkplain PaletteInterpretation#HLS HLS} color model.
140         *
141         * @see #SATURATION_BAND
142         * @see #LIGHTNESS_BAND
143         * @see PaletteInterpretation#HLS
144         */
145        @UML(identifier="CV_HueBand", obligation=CONDITIONAL, specification=OGC_01004)
146        public static final ColorInterpretation HUE_BAND = new ColorInterpretation("HUE_BAND");
147    
148        /**
149         * Saturation Band for the {@linkplain PaletteInterpretation#HLS HLS} color model.
150         *
151         * @see #HUE_BAND
152         * @see #LIGHTNESS_BAND
153         * @see PaletteInterpretation#HLS
154         */
155        @UML(identifier="CV_SaturationBand", obligation=CONDITIONAL, specification=OGC_01004)
156        public static final ColorInterpretation SATURATION_BAND = new ColorInterpretation("SATURATION_BAND");
157    
158        /**
159         * Lightness Band for the {@linkplain PaletteInterpretation#HLS HLS} color model.
160         *
161         * @see #HUE_BAND
162         * @see #SATURATION_BAND
163         * @see PaletteInterpretation#HLS
164         */
165        @UML(identifier="CV_LightnessBand", obligation=CONDITIONAL, specification=OGC_01004)
166        public static final ColorInterpretation LIGHTNESS_BAND = new ColorInterpretation("LIGHTNESS_BAND");
167    
168        /**
169         * Cyan Band for the {@linkplain PaletteInterpretation#CMYK CMYK} color model.
170         *
171         * @see #MAGENTA_BAND
172         * @see #YELLOW_BAND
173         * @see #BLACK_BAND
174         * @see PaletteInterpretation#CMYK
175         */
176        @UML(identifier="CV_CyanBand", obligation=CONDITIONAL, specification=OGC_01004)
177        public static final ColorInterpretation CYAN_BAND = new ColorInterpretation("CYAN_BAND");
178    
179        /**
180         * Magenta Band for the {@linkplain PaletteInterpretation#CMYK CMYK} color model.
181         *
182         * @see #CYAN_BAND
183         * @see #YELLOW_BAND
184         * @see #BLACK_BAND
185         * @see PaletteInterpretation#CMYK
186         */
187        @UML(identifier="CV_MagentaBand", obligation=CONDITIONAL, specification=OGC_01004)
188        public static final ColorInterpretation MAGENTA_BAND = new ColorInterpretation("MAGENTA_BAND");
189    
190        /**
191         * Yellow Band for the {@linkplain PaletteInterpretation#CMYK CMYK} color model.
192         *
193         * @see #CYAN_BAND
194         * @see #MAGENTA_BAND
195         * @see #BLACK_BAND
196         * @see PaletteInterpretation#CMYK
197         */
198        @UML(identifier="CV_YellowBand", obligation=CONDITIONAL, specification=OGC_01004)
199        public static final ColorInterpretation YELLOW_BAND = new ColorInterpretation("YELLOW_BAND");
200    
201        /**
202         * Black Band for the {@linkplain PaletteInterpretation#CMYK CMYK} color model.
203         *
204         * @see #CYAN_BAND
205         * @see #MAGENTA_BAND
206         * @see #YELLOW_BAND
207         * @see PaletteInterpretation#CMYK
208         */
209        @UML(identifier="CV_BlackBand", obligation=CONDITIONAL, specification=OGC_01004)
210        public static final ColorInterpretation BLACK_BAND = new ColorInterpretation("BLACK_BAND");
211    
212        /**
213         * Constructs an enum with the given name. The new enum is
214         * automatically added to the list returned by {@link #values}.
215         *
216         * @param name The enum name. This name must not be in use by an other enum of this type.
217         */
218        private ColorInterpretation(final String name) {
219            super(name, VALUES);
220        }
221    
222        /**
223         * Returns the list of {@code ColorInterpretation}s.
224         *
225         * @return The list of codes declared in the current JVM.
226         */
227        public static ColorInterpretation[] values() {
228            synchronized (VALUES) {
229                return VALUES.toArray(new ColorInterpretation[VALUES.size()]);
230            }
231        }
232    
233        /**
234         * Returns the list of enumerations of the same kind than this enum.
235         */
236        public ColorInterpretation[] family() {
237            return values();
238        }
239    
240        /**
241         * Returns the color interpretation that matches the given string, or returns a
242         * new one if none match it. More specifically, this methods returns the first instance for
243         * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code>
244         * returns {@code true}. If no existing instance is found, then a new one is created for
245         * the given name.
246         *
247         * @param code The name of the code to fetch or to create.
248         * @return A code matching the given name.
249         */
250        public static ColorInterpretation valueOf(String code) {
251            return valueOf(ColorInterpretation.class, code);
252        }
253    }