001/* 002 * GeoAPI - Java interfaces for OGC/ISO standards 003 * Copyright © 2004-2024 Open Geospatial Consortium, Inc. 004 * http://www.geoapi.org 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.opengis.metadata.spatial; 019 020import org.opengis.util.CodeList; 021import org.opengis.annotation.UML; 022import org.opengis.geoapi.internal.Vocabulary; 023 024import static org.opengis.annotation.Obligation.*; 025import static org.opengis.annotation.Specification.*; 026 027 028/** 029 * Degree of complexity of the spatial relationships. 030 * 031 * @author Martin Desruisseaux (IRD) 032 * @version 3.1 033 * @since 2.0 034 */ 035@Vocabulary(capacity=9) 036@UML(identifier="MD_TopologyLevelCode", specification=ISO_19115) 037public final class TopologyLevel extends CodeList<TopologyLevel> { 038 /** 039 * Serial number for compatibility with different versions. 040 */ 041 private static final long serialVersionUID = -179324311133793389L; 042 043 /** 044 * Geometry objects without any additional structure which describes topology. 045 */ 046 @UML(identifier="geometryOnly", obligation=CONDITIONAL, specification=ISO_19115) 047 public static final TopologyLevel GEOMETRY_ONLY = new TopologyLevel("GEOMETRY_ONLY"); 048 049 /** 050 * 1-dimensional topological complex. 051 */ 052 @UML(identifier="topology1D", obligation=CONDITIONAL, specification=ISO_19115) 053 public static final TopologyLevel TOPOLOGY_1D = new TopologyLevel("TOPOLOGY_1D"); 054 055 /** 056 * 1-dimensional topological complex which is planar. 057 */ 058 @UML(identifier="planarGraph", obligation=CONDITIONAL, specification=ISO_19115) 059 public static final TopologyLevel PLANAR_GRAPH = new TopologyLevel("PLANAR_GRAPH"); 060 061 /** 062 * 2-dimensional topological complex which is planar. 063 */ 064 @UML(identifier="fullPlanarGraph", obligation=CONDITIONAL, specification=ISO_19115) 065 public static final TopologyLevel FULL_PLANAR_GRAPH = new TopologyLevel("FULL_PLANAR_GRAPH"); 066 067 /** 068 * 1-dimensional topological complex which is isomorphic to a subset of a surface. 069 */ 070 @UML(identifier="surfaceGraph", obligation=CONDITIONAL, specification=ISO_19115) 071 public static final TopologyLevel SURFACE_GRAPH = new TopologyLevel("SURFACE_GRAPH"); 072 073 /** 074 * 2-dimensional topological complex which is isomorphic to a subset of a surface. 075 */ 076 @UML(identifier="fullSurfaceGraph", obligation=CONDITIONAL, specification=ISO_19115) 077 public static final TopologyLevel FULL_SURFACE_GRAPH = new TopologyLevel("FULL_SURFACE_GRAPH"); 078 079 /** 080 * 3-dimensional topological complex. 081 */ 082 @UML(identifier="topology3D", obligation=CONDITIONAL, specification=ISO_19115) 083 public static final TopologyLevel TOPOLOGY_3D = new TopologyLevel("TOPOLOGY_3D"); 084 085 /** 086 * Complete coverage of a 3D coordinate space. 087 */ 088 @UML(identifier="fullTopology3D", obligation=CONDITIONAL, specification=ISO_19115) 089 public static final TopologyLevel FULL_TOPOLOGY_3D = new TopologyLevel("FULL_TOPOLOGY_3D"); 090 091 /** 092 * Topological complex without any specified geometric realization. 093 */ 094 @UML(identifier="abstract", obligation=CONDITIONAL, specification=ISO_19115) 095 public static final TopologyLevel ABSTRACT = new TopologyLevel("ABSTRACT"); 096 097 /** 098 * Constructs an element of the given name. 099 * 100 * @param name the name of the new element. This name shall not be in use by another element of this type. 101 */ 102 private TopologyLevel(final String name) { 103 super(name); 104 } 105 106 /** 107 * Returns the list of {@code TopologyLevel}s. 108 * 109 * @return the list of codes declared in the current JVM. 110 */ 111 public static TopologyLevel[] values() { 112 return values(TopologyLevel.class); 113 } 114 115 /** 116 * Returns the list of codes of the same kind as this code list element. 117 * Invoking this method is equivalent to invoking {@link #values()}, except that 118 * this method can be invoked on an instance of the parent {@code CodeList} class. 119 * 120 * @return all code {@linkplain #values() values} for this code list. 121 */ 122 @Override 123 public TopologyLevel[] family() { 124 return values(); 125 } 126 127 /** 128 * Returns the topology level that matches the given string, or returns a new one if none match it. 129 * This methods returns the first instance (in declaration order) for which the {@linkplain #name() name} 130 * is {@linkplain String#equalsIgnoreCase(String) equals, ignoring case}, to the given name. 131 * If no existing instance is found, then a new one is created for the given name. 132 * 133 * @param code the name of the code to fetch or to create. 134 * @return a code matching the given name. 135 */ 136 public static TopologyLevel valueOf(String code) { 137 return valueOf(TopologyLevel.class, code, TopologyLevel::new).get(); 138 } 139}