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.identification;
033    
034    import java.util.List;
035    import java.util.ArrayList;
036    import org.opengis.util.CodeList;
037    import org.opengis.annotation.UML;
038    
039    import static org.opengis.annotation.Obligation.*;
040    import static org.opengis.annotation.Specification.*;
041    
042    
043    /**
044     * High-level geographic data thematic classification to assist in the grouping and
045     * search of available geographic data sets. Can be used to group keywords as well.
046     * Listed examples are not exhaustive.
047     *
048     * {@note It is understood there are overlaps between general categories and the user
049     *        is encouraged to select the one most appropriate.}
050     *
051     * @author  Martin Desruisseaux (IRD)
052     * @version 3.0
053     * @since   2.0
054     */
055    @UML(identifier="MD_TopicCategoryCode", specification=ISO_19115)
056    public final class TopicCategory extends CodeList<TopicCategory> {
057        /**
058         * Serial number for compatibility with different versions.
059         */
060        private static final long serialVersionUID = -4987523565852255081L;
061    
062        /**
063         * List of all enumerations of this type.
064         * Must be declared before any enum declaration.
065         */
066        private static final List<TopicCategory> VALUES = new ArrayList<TopicCategory>(19);
067    
068        /**
069         * Rearing of animals and/or cultivation of plants.
070         *
071         * Examples: agriculture, irrigation, aquaculture, plantations, herding, pests and
072         *           diseases affecting crops and livestock.
073         */
074        @UML(identifier="farming", obligation=CONDITIONAL, specification=ISO_19115)
075        public static final TopicCategory FARMING = new TopicCategory("FARMING");
076    
077        /**
078         * Flora and/or fauna in natural environment.
079         *
080         * Examples: wildlife, vegetation, biological sciences, ecology, wilderness, sealife,
081         *           wetlands, habitat
082         */
083        @UML(identifier="biota", obligation=CONDITIONAL, specification=ISO_19115)
084        public static final TopicCategory BIOTA = new TopicCategory("BIOTA");
085    
086        /**
087         * Legal land descriptions.
088         *
089         * Examples: political and administrative boundaries.
090         */
091        @UML(identifier="boundaries", obligation=CONDITIONAL, specification=ISO_19115)
092        public static final TopicCategory BOUNDARIES = new TopicCategory("BOUNDARIES");
093    
094        /**
095         * Processes and phenomena of the atmosphere.
096         *
097         * Examples: cloud cover, weather, climate, atmospheric conditions, climate change,
098         *           precipitation.
099         */
100        @UML(identifier="climatologyMeteorologyAtmosphere", obligation=CONDITIONAL, specification=ISO_19115)
101        public static final TopicCategory CLIMATOLOGY_METEOROLOGY_ATMOSPHERE = new TopicCategory("CLIMATOLOGY_METEOROLOGY_ATMOSPHERE");
102    
103        /**
104         * Economic activities, conditions and employment.
105         *
106         * Examples: production, labour, revenue, commerce, industry, tourism and
107         *           ecotourism, forestry, fisheries, commercial or subsistence hunting,
108         *           exploration and exploitation of resources such as minerals, oil and gas.
109         */
110        @UML(identifier="economy", obligation=CONDITIONAL, specification=ISO_19115)
111        public static final TopicCategory ECONOMY = new TopicCategory("ECONOMY");
112    
113        /**
114         * Height above or below sea level.
115         *
116         * Examples: altitude, bathymetry, digital elevation models, slope, derived products.
117         */
118        @UML(identifier="elevation", obligation=CONDITIONAL, specification=ISO_19115)
119        public static final TopicCategory ELEVATION = new TopicCategory("ELEVATION");
120    
121        /**
122         * Environmental resources, protection and conservation.
123         *
124         * Examples: environmental pollution, waste storage and treatment, environmental
125         *           impact assessment, monitoring environmental risk, nature reserves, landscape.
126         */
127        @UML(identifier="environment", obligation=CONDITIONAL, specification=ISO_19115)
128        public static final TopicCategory ENVIRONMENT = new TopicCategory("ENVIRONMENT");
129    
130        /**
131         * Information pertaining to earth sciences.
132         *
133         * Examples: geophysical features and processes, geology, minerals, sciences
134         *           dealing with the composition, structure and origin of the earth's rocks, risks of
135         *           earthquakes, volcanic activity, landslides, gravity information, soils, permafrost,
136         *           hydrogeology, erosion.
137         */
138        @UML(identifier="geoscientificInformation", obligation=CONDITIONAL, specification=ISO_19115)
139        public static final TopicCategory GEOSCIENTIFIC_INFORMATION = new TopicCategory("GEOSCIENTIFIC_INFORMATION");
140    
141        /**
142         * Health, health services, human ecology, and safety.
143         *
144         * Examples: disease and illness, factors affecting health, hygiene, substance abuse,
145         *           mental and physical health, health services.
146         *
147         * @since 2.1
148         */
149        @UML(identifier="health", obligation=CONDITIONAL, specification=ISO_19115)
150        public static final TopicCategory HEALTH = new TopicCategory("HEALTH");
151    
152        /**
153         * Base maps.
154         *
155         * Examples: land cover, topographic maps, imagery, unclassified images,
156         *           annotations.
157         */
158        @UML(identifier="imageryBaseMapsEarthCover", obligation=CONDITIONAL, specification=ISO_19115)
159        public static final TopicCategory IMAGERY_BASE_MAPS_EARTH_COVER = new TopicCategory("IMAGERY_BASE_MAPS_EARTH_COVER");
160    
161        /**
162         * Military bases, structures, activities.
163         *
164         * Examples: barracks, training grounds, military transportation, information collection.
165         */
166        @UML(identifier="intelligenceMilitary", obligation=CONDITIONAL, specification=ISO_19115)
167        public static final TopicCategory INTELLIGENCE_MILITARY = new TopicCategory("INTELLIGENCE_MILITARY");
168    
169        /**
170         * Inland water features, drainage systems and their characteristics.
171         *
172         * Examples: rivers and glaciers, salt lakes, water utilization plans, dams, currents,
173         *           floods, water quality, hydrographic charts.
174         */
175        @UML(identifier="inlandWaters", obligation=CONDITIONAL, specification=ISO_19115)
176        public static final TopicCategory INLAND_WATERS = new TopicCategory("INLAND_WATERS");
177    
178        /**
179         * Positional information and services.
180         *
181         * Examples: addresses, geodetic networks, control points, postal zones and
182         *           services, place names.
183         */
184        @UML(identifier="location", obligation=CONDITIONAL, specification=ISO_19115)
185        public static final TopicCategory LOCATION = new TopicCategory("LOCATION");
186    
187        /**
188         * Features and characteristics of salt water bodies (excluding inland waters).
189         *
190         * Examples: tides, tidal waves, coastal information, reefs.
191         */
192        @UML(identifier="oceans", obligation=CONDITIONAL, specification=ISO_19115)
193        public static final TopicCategory OCEANS = new TopicCategory("OCEANS");
194    
195        /**
196         * Information used for appropriate actions for future use of the land.
197         *
198         * Examples: land use maps, zoning maps, cadastral surveys, land ownership.
199         */
200        @UML(identifier="planningCadastre", obligation=CONDITIONAL, specification=ISO_19115)
201        public static final TopicCategory PLANNING_CADASTRE = new TopicCategory("PLANNING_CADASTRE");
202    
203        /**
204         * Characteristics of society and cultures.
205         *
206         * Examples: settlements, anthropology, archaeology, education, traditional beliefs,
207         *           manners and customs, demographic data, recreational areas and activities, social
208         *           impact assessments, crime and justice, census information
209         */
210        @UML(identifier="society", obligation=CONDITIONAL, specification=ISO_19115)
211        public static final TopicCategory SOCIETY = new TopicCategory("SOCIETY");
212    
213        /**
214         * Man-made construction.
215         *
216         * Examples: buildings, museums, churches, factories, housing, monuments, shops, towers.
217         */
218        @UML(identifier="structure", obligation=CONDITIONAL, specification=ISO_19115)
219        public static final TopicCategory STRUCTURE = new TopicCategory("STRUCTURE");
220    
221        /**
222         * Means and aids for conveying persons and/or goods.
223         *
224         * Examples: roads, airports/airstrips, shipping routes, tunnels, nautical charts,
225         *           vehicle or vessel location, aeronautical charts, railways.
226         */
227        @UML(identifier="transportation", obligation=CONDITIONAL, specification=ISO_19115)
228        public static final TopicCategory TRANSPORTATION = new TopicCategory("TRANSPORTATION");
229    
230        /**
231         * Energy, water and waste systems and communications infrastructure and services.
232         *
233         * Examples: hydroelectricity, geothermal, solar and nuclear sources of energy, water
234         *           purification and distribution, sewage collection and disposal, electricity and gas
235         *           distribution, data communication, telecommunication, radio, communication
236         *           networks.
237         */
238        @UML(identifier="utilitiesCommunication", obligation=CONDITIONAL, specification=ISO_19115)
239        public static final TopicCategory UTILITIES_COMMUNICATION = new TopicCategory("UTILITIES_COMMUNICATION");
240    
241        /**
242         * Constructs an enum with the given name. The new enum is
243         * automatically added to the list returned by {@link #values}.
244         *
245         * @param name The enum name. This name must not be in use by an other enum of this type.
246         */
247        private TopicCategory(final String name) {
248            super(name, VALUES);
249        }
250    
251        /**
252         * Returns the list of {@code TopicCategory}s.
253         *
254         * @return The list of codes declared in the current JVM.
255         */
256        public static TopicCategory[] values() {
257            synchronized (VALUES) {
258                return VALUES.toArray(new TopicCategory[VALUES.size()]);
259            }
260        }
261    
262        /**
263         * Returns the list of enumerations of the same kind than this enum.
264         */
265        @Override
266        public TopicCategory[] family() {
267            return values();
268        }
269    
270        /**
271         * Returns the topic category that matches the given string, or returns a
272         * new one if none match it. More specifically, this methods returns the first instance for
273         * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code>
274         * returns {@code true}. If no existing instance is found, then a new one is created for
275         * the given name.
276         *
277         * @param code The name of the code to fetch or to create.
278         * @return A code matching the given name.
279         */
280        public static TopicCategory valueOf(String code) {
281            return valueOf(TopicCategory.class, code);
282        }
283    }