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.spatial;
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 * Name of point and vector spatial objects used to locate zero-, one-, and twodimensional
045 * spatial locations in the dataset.
046 *
047 * @author Martin Desruisseaux (IRD)
048 * @author Cory Horner (Refractions Research)
049 * @version 3.0
050 * @since 2.0
051 */
052 @UML(identifier="MD_GeometricObjectTypeCode", specification=ISO_19115)
053 public final class GeometricObjectType extends CodeList<GeometricObjectType> {
054 /**
055 * Serial number for compatibility with different versions.
056 */
057 private static final long serialVersionUID = -8910485325021913980L;
058
059 /**
060 * List of all enumerations of this type.
061 * Must be declared before any enum declaration.
062 */
063 private static final List<GeometricObjectType> VALUES = new ArrayList<GeometricObjectType>(6);
064
065 /**
066 * Set of geometric primitives such that their boundaries can be represented as a
067 * union of other primitives.
068 *
069 * @since 2.1
070 */
071 @UML(identifier="complex", obligation=CONDITIONAL, specification=ISO_19115)
072 public static final GeometricObjectType COMPLEX = new GeometricObjectType("COMPLEX");
073
074 /**
075 * Connected set of curves, solids or surfaces.
076 *
077 * @since 2.1
078 */
079 @UML(identifier="composite", obligation=CONDITIONAL, specification=ISO_19115)
080 public static final GeometricObjectType COMPOSITE = new GeometricObjectType("COMPOSITE");
081
082 /**
083 * Bounded, 1-dimensional geometric primitive, representing the continuous image of a line.
084 */
085 @UML(identifier="curve", obligation=CONDITIONAL, specification=ISO_19115)
086 public static final GeometricObjectType CURVE = new GeometricObjectType("CURVE");
087
088 /**
089 * Zero-dimensional geometric primitive, representing a position but not having an extent.
090 */
091 @UML(identifier="point", obligation=CONDITIONAL, specification=ISO_19115)
092 public static final GeometricObjectType POINT = new GeometricObjectType("POINT");
093
094 /**
095 * Bounded, connected 3-dimensional geometric primitive, representing the
096 * continuous image of a region of space.
097 */
098 @UML(identifier="solid", obligation=CONDITIONAL, specification=ISO_19115)
099 public static final GeometricObjectType SOLID = new GeometricObjectType("SOLID");
100
101 /**
102 * Bounded, connected 2-dimensional geometric, representing the continuous image
103 * of a region of a plane.
104 */
105 @UML(identifier="surface", obligation=CONDITIONAL, specification=ISO_19115)
106 public static final GeometricObjectType SURFACE = new GeometricObjectType("SURFACE");
107
108 /**
109 * Constructs an enum with the given name. The new enum is
110 * automatically added to the list returned by {@link #values}.
111 *
112 * @param name The enum name. This name must not be in use by an other enum of this type.
113 */
114 private GeometricObjectType(final String name) {
115 super(name, VALUES);
116 }
117
118 /**
119 * Returns the list of {@code GeometricObjectType}s.
120 *
121 * @return The list of codes declared in the current JVM.
122 */
123 public static GeometricObjectType[] values() {
124 synchronized (VALUES) {
125 return VALUES.toArray(new GeometricObjectType[VALUES.size()]);
126 }
127 }
128
129 /**
130 * Returns the list of enumerations of the same kind than this enum.
131 */
132 @Override
133 public GeometricObjectType[] family() {
134 return values();
135 }
136
137 /**
138 * Returns the geometric object type that matches the given string, or returns a
139 * new one if none match it. More specifically, this methods returns the first instance for
140 * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code>
141 * returns {@code true}. If no existing instance is found, then a new one is created for
142 * the given name.
143 *
144 * @param code The name of the code to fetch or to create.
145 * @return A code matching the given name.
146 */
147 public static GeometricObjectType valueOf(String code) {
148 return valueOf(GeometricObjectType.class, code);
149 }
150 }