001 //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/ogcwebservices/wms/capabilities/Dimension.java $ 002 /*---------------------------------------------------------------------------- 003 This file is part of deegree, http://deegree.org/ 004 Copyright (C) 2001-2009 by: 005 Department of Geography, University of Bonn 006 and 007 lat/lon GmbH 008 009 This library is free software; you can redistribute it and/or modify it under 010 the terms of the GNU Lesser General Public License as published by the Free 011 Software Foundation; either version 2.1 of the License, or (at your option) 012 any later version. 013 This library is distributed in the hope that it will be useful, but WITHOUT 014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 016 details. 017 You should have received a copy of the GNU Lesser General Public License 018 along with this library; if not, write to the Free Software Foundation, Inc., 019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 020 021 Contact information: 022 023 lat/lon GmbH 024 Aennchenstr. 19, 53177 Bonn 025 Germany 026 http://lat-lon.de/ 027 028 Department of Geography, University of Bonn 029 Prof. Dr. Klaus Greve 030 Postfach 1147, 53001 Bonn 031 Germany 032 http://www.geographie.uni-bonn.de/deegree/ 033 034 e-mail: info@deegree.org 035 ----------------------------------------------------------------------------*/ 036 package org.deegree.ogcwebservices.wms.capabilities; 037 038 import static org.deegree.framework.xml.XMLTools.getNodeAsBoolean; 039 import static org.deegree.ogcbase.CommonNamespaces.getNamespaceContext; 040 041 import org.deegree.framework.xml.NamespaceContext; 042 import org.deegree.framework.xml.XMLParsingException; 043 import org.w3c.dom.Element; 044 045 /** 046 * The Dimension element declares the _existence_ of a dimension. The optional element <Dimension> is used in 047 * Capabilities XML to declare that one or more dimensional parameters are relevant to the information holdings of that 048 * server. The Dimension element does not provide valid values for a Dimension; that is the role of the Extent element 049 * described below. A Dimension element includes a required name, a required measurement units specifier, and an 050 * optional unitSymbol. 051 * <p> 052 * ---------------------------------------------------------------------- 053 * </p> 054 * 055 * @author <a href="mailto:k.lupp@web.de">Katharina Lupp</a> 056 * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider</a> 057 * @version $Revision: 18195 $ 058 */ 059 public class Dimension { 060 061 private static final NamespaceContext nsContext = getNamespaceContext(); 062 063 private String name = null; 064 065 private String unitSymbol = null; 066 067 private String units = null; 068 069 private String defaultValue; 070 071 private boolean multipleValues; 072 073 private boolean nearestValue; 074 075 private boolean current; 076 077 private String values; 078 079 /** 080 * constructor initializing the class with the <Dimension> 081 * 082 * @param name 083 * @param units 084 * @param unitSymbol 085 */ 086 public Dimension( String name, String units, String unitSymbol ) { 087 setName( name ); 088 setUnits( units ); 089 setUnitSymbol( unitSymbol ); 090 } 091 092 /** 093 * @param elem 094 * @throws XMLParsingException 095 */ 096 public Dimension( Element elem ) throws XMLParsingException { 097 name = elem.getAttribute( "name" ); 098 units = elem.getAttribute( "units" ); 099 unitSymbol = elem.hasAttribute( "unitSymbol" ) ? elem.getAttribute( "unitSymbol" ) : null; 100 defaultValue = elem.hasAttribute( "default" ) ? elem.getAttribute( "default" ) : null; 101 multipleValues = getNodeAsBoolean( elem, "@multipleValues", nsContext, false ); 102 nearestValue = getNodeAsBoolean( elem, "@nearestValue", nsContext, false ); 103 current = getNodeAsBoolean( elem, "@current", nsContext, false ); 104 values = elem.getTextContent(); 105 } 106 107 /** 108 * @return the name of the dimension 109 */ 110 public String getName() { 111 return name; 112 } 113 114 /** 115 * sets the name of the dimension 116 * 117 * @param name 118 */ 119 public void setName( String name ) { 120 this.name = name; 121 } 122 123 /** 124 * @return the units the dimension is measured 125 */ 126 public String getUnits() { 127 return units; 128 } 129 130 /** 131 * sets the units the dimension is measured 132 * 133 * @param units 134 */ 135 public void setUnits( String units ) { 136 this.units = units; 137 } 138 139 /** 140 * @return the unit symbols 141 */ 142 public String getUnitSymbol() { 143 return unitSymbol; 144 } 145 146 /** 147 * sets the unit symbols 148 * 149 * @param unitSymbol 150 */ 151 public void setUnitSymbol( String unitSymbol ) { 152 this.unitSymbol = unitSymbol; 153 } 154 155 @Override 156 public String toString() { 157 String ret = null; 158 ret = "name = " + name + "\n"; 159 ret += ( "units = " + units + "\n" ); 160 ret += ( "unitSymbol = " + unitSymbol + "\n" ); 161 return ret; 162 } 163 164 /** 165 * @return the defaultValue 166 */ 167 public String getDefaultValue() { 168 return defaultValue; 169 } 170 171 /** 172 * @param defaultValue 173 * the defaultValue to set 174 */ 175 public void setDefaultValue( String defaultValue ) { 176 this.defaultValue = defaultValue; 177 } 178 179 /** 180 * @return the multipleValues 181 */ 182 public boolean isMultipleValues() { 183 return multipleValues; 184 } 185 186 /** 187 * @param multipleValues 188 * the multipleValues to set 189 */ 190 public void setMultipleValues( boolean multipleValues ) { 191 this.multipleValues = multipleValues; 192 } 193 194 /** 195 * @return the nearestValue 196 */ 197 public boolean isNearestValue() { 198 return nearestValue; 199 } 200 201 /** 202 * @param nearestValue 203 * the nearestValue to set 204 */ 205 public void setNearestValue( boolean nearestValue ) { 206 this.nearestValue = nearestValue; 207 } 208 209 /** 210 * @return the current 211 */ 212 public boolean isCurrent() { 213 return current; 214 } 215 216 /** 217 * @param current 218 * the current to set 219 */ 220 public void setCurrent( boolean current ) { 221 this.current = current; 222 } 223 224 /** 225 * @return the values 226 */ 227 public String getValues() { 228 return values; 229 } 230 231 /** 232 * @param values 233 * the values to set 234 */ 235 public void setValues( String values ) { 236 this.values = values; 237 } 238 239 }