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.referencing.cs;
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     * The direction of positive increments in the coordinate value for a coordinate system
046     * axis. This direction is exact in some cases, and is approximate in other cases.
047     * <p>
048     * Some coordinate systems use non-standard orientations.  For example,
049     * the first axis in South African grids usually points West, instead of
050     * East. This information is obviously relevant for algorithms converting
051     * South African grid coordinates into Lat/Long.
052     *
053     * @author  Martin Desruisseaux (IRD)
054     * @version 3.0
055     * @since   1.0
056     */
057    @UML(identifier="CS_AxisDirection", specification=ISO_19111)
058    public final class AxisDirection extends CodeList<AxisDirection> {
059        /**
060         * Serial number for compatibility with different versions.
061         */
062        private static final long serialVersionUID = -4405275475770755714L;
063    
064        /**
065         * List of all enumerations of this type.
066         * Must be declared before any enum declaration.
067         */
068        private static final List<AxisDirection> VALUES = new ArrayList<AxisDirection>(32);
069    
070        /**
071         * Unknown or unspecified axis orientation.
072         *
073         * @category Other
074         */
075        @UML(identifier="CS_AxisOrientationEnum.CS_AO_Other", specification=OGC_01009)
076        public static final AxisDirection OTHER = new AxisDirection("OTHER");
077    
078        /**
079         * Axis positive direction is north. In a geographic or projected CRS,
080         * north is defined through the geodetic datum. In an engineering CRS,
081         * north may be defined with respect to an engineering object rather
082         * than a geographical direction.
083         *
084         * @category Rose
085         */
086        @UML(identifier="north", obligation=CONDITIONAL, specification=ISO_19111)
087        public static final AxisDirection NORTH = new AxisDirection("NORTH");
088    
089        /**
090         * Axis positive direction is approximately north-north-east.
091         *
092         * @category Rose
093         * @since 2.0
094         */
095        @UML(identifier="northNorthEast", obligation=CONDITIONAL, specification=ISO_19111)
096        public static final AxisDirection NORTH_NORTH_EAST = new AxisDirection("NORTH_NORTH_EAST");
097    
098        /**
099         * Axis positive direction is approximately north-east.
100         *
101         * @category Rose
102         * @since 2.0
103         */
104        @UML(identifier="northEast", obligation=CONDITIONAL, specification=ISO_19111)
105        public static final AxisDirection NORTH_EAST = new AxisDirection("NORTH_EAST");
106    
107        /**
108         * Axis positive direction is approximately east-north-east.
109         *
110         * @category Rose
111         * @since 2.0
112         */
113        @UML(identifier="eastNorthEast", obligation=CONDITIONAL, specification=ISO_19111)
114        public static final AxisDirection EAST_NORTH_EAST = new AxisDirection("EAST_NORTH_EAST");
115    
116        /**
117         * Axis positive direction is &pi;/2 radians clockwise from north.
118         * This is usually used for Grid X coordinates and Longitude.
119         *
120         * @category Rose
121         */
122        @UML(identifier="east", obligation=CONDITIONAL, specification=ISO_19111)
123        public static final AxisDirection EAST = new AxisDirection("EAST");
124    
125        /**
126         * Axis positive direction is approximately east-south-east.
127         *
128         * @category Rose
129         * @since 2.0
130         */
131        @UML(identifier="eastSouthEast", obligation=CONDITIONAL, specification=ISO_19111)
132        public static final AxisDirection EAST_SOUTH_EAST = new AxisDirection("EAST_SOUTH_EAST");
133    
134        /**
135         * Axis positive direction is approximately south-east.
136         *
137         * @category Rose
138         * @since 2.0
139         */
140        @UML(identifier="southEast", obligation=CONDITIONAL, specification=ISO_19111)
141        public static final AxisDirection SOUTH_EAST = new AxisDirection("SOUTH_EAST");
142    
143        /**
144         * Axis positive direction is approximately south-south-east.
145         *
146         * @category Rose
147         * @since 2.0
148         */
149        @UML(identifier="southSouthEast", obligation=CONDITIONAL, specification=ISO_19111)
150        public static final AxisDirection SOUTH_SOUTH_EAST = new AxisDirection("SOUTH_SOUTH_EAST");
151    
152        /**
153         * Axis positive direction is &pi; radians clockwise from north.
154         *
155         * @category Rose
156         */
157        @UML(identifier="south", obligation=CONDITIONAL, specification=ISO_19111)
158        public static final AxisDirection SOUTH = new AxisDirection("SOUTH");
159    
160        /**
161         * Axis positive direction is approximately south-south-west.
162         *
163         * @category Rose
164         * @since 2.0
165         */
166        @UML(identifier="southSouthWest", obligation=CONDITIONAL, specification=ISO_19111)
167        public static final AxisDirection SOUTH_SOUTH_WEST = new AxisDirection("SOUTH_SOUTH_WEST");
168    
169        /**
170         * Axis positive direction is approximately south-west.
171         *
172         * @category Rose
173         * @since 2.0
174         */
175        @UML(identifier="southWest", obligation=CONDITIONAL, specification=ISO_19111)
176        public static final AxisDirection SOUTH_WEST = new AxisDirection("SOUTH_WEST");
177    
178        /**
179         * Axis positive direction is approximately west-south-west.
180         *
181         * @category Rose
182         * @since 2.0
183         */
184        @UML(identifier="westSouthWest", obligation=CONDITIONAL, specification=ISO_19111)
185        public static final AxisDirection WEST_SOUTH_WEST = new AxisDirection("WEST_SOUTH_WEST");
186    
187        /**
188         * Axis positive direction is 3&pi;/2 radians clockwise from north.
189         * This is usually used for Grid X coordinates and Longitude.
190         *
191         * @category Rose
192         */
193        @UML(identifier="west", obligation=CONDITIONAL, specification=ISO_19111)
194        public static final AxisDirection WEST = new AxisDirection("WEST");
195    
196        /**
197         * Axis positive direction is approximately west-north-west.
198         *
199         * @category Rose
200         * @since 2.0
201         */
202        @UML(identifier="westNorthWest", obligation=CONDITIONAL, specification=ISO_19111)
203        public static final AxisDirection WEST_NORTH_WEST = new AxisDirection("WEST_NORTH_WEST");
204    
205        /**
206         * Axis positive direction is approximately north-west.
207         *
208         * @category Rose
209         * @since 2.0
210         */
211        @UML(identifier="northWest", obligation=CONDITIONAL, specification=ISO_19111)
212        public static final AxisDirection NORTH_WEST = new AxisDirection("NORTH_WEST");
213    
214        /**
215         * Axis positive direction is approximately north-north-west.
216         *
217         * @category Rose
218         * @since 2.0
219         */
220        @UML(identifier="northNorthWest", obligation=CONDITIONAL, specification=ISO_19111)
221        public static final AxisDirection NORTH_NORTH_WEST = new AxisDirection("NORTH_NORTH_WEST");
222    
223        /**
224         * Axis positive direction is up relative to gravity.
225         * This is used for {@linkplain org.opengis.referencing.crs.VerticalCRS vertical}
226         * coordinate reference systems.
227         *
228         * @category Vertical
229         */
230        @UML(identifier="up", obligation=CONDITIONAL, specification=ISO_19111)
231        public static final AxisDirection UP = new AxisDirection("UP");
232    
233        /**
234         * Axis positive direction is down relative to gravity.
235         * This is used for {@linkplain org.opengis.referencing.crs.VerticalCRS vertical}
236         * coordinate reference systems.
237         *
238         * @category Vertical
239         */
240        @UML(identifier="down", obligation=CONDITIONAL, specification=ISO_19111)
241        public static final AxisDirection DOWN = new AxisDirection("DOWN");
242    
243        /**
244         * Axis positive direction is in the equatorial plane from the centre of the
245         * modelled earth towards the intersection of the equator with the prime meridian.
246         *
247         * @category Geocentric
248         * @since 2.0
249         */
250        @UML(identifier="geocentricX", obligation=CONDITIONAL, specification=ISO_19111)
251        public static final AxisDirection GEOCENTRIC_X = new AxisDirection("GEOCENTRIC_X");
252    
253        /**
254         * Axis positive direction is in the equatorial plane from the centre of the
255         * modelled earth towards the intersection of the equator and the meridian &pi;/2
256         * radians eastwards from the prime meridian.
257         *
258         * @category Geocentric
259         * @since 2.0
260         */
261        @UML(identifier="geocentricY", obligation=CONDITIONAL, specification=ISO_19111)
262        public static final AxisDirection GEOCENTRIC_Y = new AxisDirection("GEOCENTRIC_Y");
263    
264        /**
265         * Axis positive direction is from the centre of the modelled earth parallel to
266         * its rotation axis and towards its north pole.
267         *
268         * @category Geocentric
269         * @since 2.0
270         */
271        @UML(identifier="geocentricZ", obligation=CONDITIONAL, specification=ISO_19111)
272        public static final AxisDirection GEOCENTRIC_Z = new AxisDirection("GEOCENTRIC_Z");
273    
274        /**
275         * Axis positive direction is towards the future.
276         * This is used for {@linkplain org.opengis.referencing.crs.TemporalCRS temporal}
277         * coordinate reference systems.
278         *
279         * @departure historic
280         *   This code was defined in an older specification (2003) and removed in more recent
281         *   edition (2007), but has been kept in GeoAPI.
282         *
283         * @category Temporal
284         */
285        @UML(identifier="future", obligation=CONDITIONAL, specification=ISO_19111)
286        public static final AxisDirection FUTURE = new AxisDirection("FUTURE");
287    
288        /**
289         * Axis positive direction is towards the past.
290         * This is used for {@linkplain org.opengis.referencing.crs.TemporalCRS temporal}
291         * coordinate reference systems.
292         *
293         * @departure historic
294         *   This code was defined in an older specification (2003) and removed in more recent
295         *   edition (2007), but has been kept in GeoAPI.
296         *
297         * @category Temporal
298         */
299        @UML(identifier="past", obligation=CONDITIONAL, specification=ISO_19111)
300        public static final AxisDirection PAST = new AxisDirection("PAST");
301    
302        /**
303         * Axis positive direction is towards higher pixel column.
304         *
305         * @category Image
306         * @since 2.0
307         */
308        @UML(identifier="columnPositive", obligation=CONDITIONAL, specification=ISO_19111)
309        public static final AxisDirection COLUMN_POSITIVE = new AxisDirection("COLUMN_POSITIVE");
310    
311        /**
312         * Axis positive direction is towards lower pixel column.
313         *
314         * @category Image
315         * @since 2.0
316         */
317        @UML(identifier="columnNegative", obligation=CONDITIONAL, specification=ISO_19111)
318        public static final AxisDirection COLUMN_NEGATIVE = new AxisDirection("COLUMN_NEGATIVE");
319    
320        /**
321         * Axis positive direction is towards higher pixel row.
322         *
323         * @category Image
324         * @since 2.0
325         */
326        @UML(identifier="rowPositive", obligation=CONDITIONAL, specification=ISO_19111)
327        public static final AxisDirection ROW_POSITIVE = new AxisDirection("ROW_POSITIVE");
328    
329        /**
330         * Axis positive direction is towards lower pixel row.
331         *
332         * @category Image
333         * @since 2.0
334         */
335        @UML(identifier="rowNegative", obligation=CONDITIONAL, specification=ISO_19111)
336        public static final AxisDirection ROW_NEGATIVE = new AxisDirection("ROW_NEGATIVE");
337    
338        /**
339         * Axis positive direction is right in display.
340         *
341         * @category Display
342         * @since 2.0
343         */
344        @UML(identifier="displayRight", obligation=CONDITIONAL, specification=ISO_19111)
345        public static final AxisDirection DISPLAY_RIGHT = new AxisDirection("DISPLAY_RIGHT");
346    
347        /**
348         * Axis positive direction is left in display.
349         *
350         * @category Display
351         * @since 2.0
352         */
353        @UML(identifier="displayLeft", obligation=CONDITIONAL, specification=ISO_19111)
354        public static final AxisDirection DISPLAY_LEFT = new AxisDirection("DISPLAY_LEFT");
355    
356        /**
357         * Axis positive direction is towards top of approximately vertical display surface.
358         *
359         * @category Display
360         * @since 2.0
361         */
362        @UML(identifier="displayUp", obligation=CONDITIONAL, specification=ISO_19111)
363        public static final AxisDirection DISPLAY_UP = new AxisDirection("DISPLAY_UP");
364    
365        /**
366         * Axis positive direction is towards bottom of approximately vertical display surface.
367         *
368         * @category Display
369         * @since 2.0
370         */
371        @UML(identifier="displayDown", obligation=CONDITIONAL, specification=ISO_19111)
372        public static final AxisDirection DISPLAY_DOWN = new AxisDirection("DISPLAY_DOWN");
373    
374        /**
375         * Constructs an enum with the given name. The new enum is
376         * automatically added to the list returned by {@link #values}.
377         *
378         * @param name The enum name. This name must not be in use by an other enum of this type.
379         */
380        private AxisDirection(final String name) {
381            super(name, VALUES);
382        }
383    
384        /**
385         * Returns the list of {@code AxisDirection}s.
386         *
387         * @return The list of codes declared in the current JVM.
388         */
389        public static AxisDirection[] values() {
390            synchronized (VALUES) {
391                return VALUES.toArray(new AxisDirection[VALUES.size()]);
392            }
393        }
394    
395        /**
396         * Returns the list of enumerations of the same kind than this enum.
397         */
398        @Override
399        public AxisDirection[] family() {
400            return values();
401        }
402    
403        /**
404         * Returns the axis direction that matches the given string, or returns a
405         * new one if none match it. More specifically, this methods returns the first instance for
406         * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code>
407         * returns {@code true}. If no existing instance is found, then a new one is created for
408         * the given name.
409         *
410         * @param code The name of the code to fetch or to create.
411         * @return A code matching the given name.
412         */
413        public static AxisDirection valueOf(String code) {
414            return valueOf(AxisDirection.class, code);
415        }
416    }