001 //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/portal/context/Layer.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.portal.context; 037 038 import org.deegree.ogcbase.BaseURL; 039 040 /** 041 * encapsulates about a layer described/contained by a Web Map Context 042 * 043 * @version $Revision: 18195 $ 044 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a> 045 */ 046 public class Layer { 047 private BaseURL dataURL = null; 048 049 private BaseURL metadataURL = null; 050 051 private FormatList formatList = null; 052 053 private LayerExtension extension = null; 054 055 private Server server = null; 056 057 private String abstract_ = null; 058 059 private String name = null; 060 061 private String title = null; 062 063 private StyleList styleList = null; 064 065 private String[] srs = null; 066 067 private boolean hidden = false; 068 069 private boolean queryable = false; 070 071 /** 072 * Creates a new ContextLayer object. 073 * 074 * @param server 075 * service from which the named Layer may be requested 076 * @param name 077 * name of the selected layer ( 078 * @param title 079 * title of the selected layer ( 080 * @param abstract_ 081 * abstract of the selected layer ( 082 * @param srs 083 * list of available SRS for the enclosing layer. 084 * @param dataURL 085 * contains a link to an online resource where data corresponding to the layer can be found. 086 * @param metadataURL 087 * contains a link to an online resource where descriptive metadata corresponding to the layer can be 088 * found. 089 * @param formatList 090 * parent element containing the list of available image format for this layer. 091 * @param styleList 092 * parent element containing the list of available styles for this layer. 093 * @param queryable 094 * @param hidden 095 * @param extension 096 * container tag in which arbitrary vendor specific information can be included 097 * 098 * @throws ContextException 099 */ 100 public Layer( Server server, String name, String title, String abstract_, String[] srs, BaseURL dataURL, 101 BaseURL metadataURL, FormatList formatList, StyleList styleList, boolean queryable, boolean hidden, 102 LayerExtension extension ) throws ContextException { 103 setName( name ); 104 setTitle( title ); 105 setAbstract( abstract_ ); 106 setSrs( srs ); 107 setDataURL( dataURL ); 108 setMetadataURL( metadataURL ); 109 setFormatList( formatList ); 110 setStyleList( styleList ); 111 setExtension( extension ); 112 setServer( server ); 113 setQueryable( queryable ); 114 setHidden( hidden ); 115 } 116 117 /** 118 * The element defining the service from which the named Layer may be requested 119 * 120 * @return The element defining the service from which the named Layer may be requested 121 */ 122 public Server getServer() { 123 return server; 124 } 125 126 /** 127 * The name of the selected layer (extracted from Capabilities by the Context document creator). 128 * 129 * @return The name of the selected layer (extracted from Capabilities by the Context document creator). 130 */ 131 public String getName() { 132 return name; 133 } 134 135 /** 136 * The title of the selected layer (extracted from Capabilities by the Context document creator). 137 * 138 * @return The title of the selected layer (extracted from Capabilities by the Context document creator). 139 */ 140 public String getTitle() { 141 return title; 142 } 143 144 /** 145 * The abstract of the selected layer (extracted from Capabilities by the Context document creator). 146 * 147 * @return The abstract of the selected layer (extracted from Capabilities by the Context document creator). 148 */ 149 public String getAbstract() { 150 return abstract_; 151 } 152 153 /** 154 * A list of available SRS for the enclosing layer. One of the listed SRS's must be the SRS mentioned in the 155 * ViewerContext/General/BoundingBox@SRS element. 156 * 157 * @return A list of available SRS for the enclosing layer. One of the listed SRS's must be the SRS mentioned in the 158 * ViewerContext/General/BoundingBox@SRS element. 159 */ 160 public String[] getSrs() { 161 return srs; 162 } 163 164 /** 165 * This element contains a link to an online resource where data corresponding to the layer can be found. 166 * 167 * @return a link to an online resource where data corresponding to the layer can be found. 168 */ 169 public BaseURL getDataURL() { 170 return dataURL; 171 } 172 173 /** 174 * This element contains a link to an online resource where descriptive metadata corresponding to the layer can be 175 * found. 176 * 177 * @return a link to an online resource where descriptive metadata corresponding to the layer can be found. 178 */ 179 public BaseURL getMetadataURL() { 180 return metadataURL; 181 } 182 183 /** 184 * The parent element containing the list of available image format for this layer. Image formats should be 185 * expressed with MIME types as described in WMS 1.1.1 Specification.<p/> A FormatList shall include at least one 186 * Format 187 * 188 * @return the list of available image format for this layer. 189 */ 190 public FormatList getFormatList() { 191 return formatList; 192 } 193 194 /** 195 * The parent element containing the list of available styles for this layer. A StyleList shall include at least one 196 * Style 197 * 198 * @return the list of available styles for this layer 199 */ 200 public StyleList getStyleList() { 201 return styleList; 202 } 203 204 /** 205 * The Extension element is a container tag in which arbitrary vendor specific information can be included without 206 * compromising the ability of other clients to enforce schema validation. 207 * 208 * @return a container tag in which arbitrary vendor specific information can be included 209 */ 210 public LayerExtension getExtension() { 211 return extension; 212 } 213 214 /** 215 * @return true if the layer can be queried with a GetFeatureInfo request 216 */ 217 public boolean isQueryable() { 218 return queryable; 219 } 220 221 /** 222 * @return true if the layer is not visible in the current view 223 */ 224 public boolean isHidden() { 225 return hidden; 226 } 227 228 /** 229 * 230 * @param server 231 * 232 * @throws ContextException 233 */ 234 public void setServer( Server server ) 235 throws ContextException { 236 if ( server == null ) { 237 throw new ContextException( "server isn't allowed to be null" ); 238 } 239 240 this.server = server; 241 } 242 243 /** 244 * 245 * @param name 246 * 247 * @throws ContextException 248 */ 249 public void setName( String name ) 250 throws ContextException { 251 if ( name == null ) { 252 throw new ContextException( "name isn't allowed to be null" ); 253 } 254 255 this.name = name; 256 } 257 258 /** 259 * 260 * @param title 261 * 262 * @throws ContextException 263 */ 264 public void setTitle( String title ) 265 throws ContextException { 266 if ( title == null ) { 267 throw new ContextException( "title isn't allowed to be null" ); 268 } 269 270 this.title = title; 271 } 272 273 /** 274 * 275 * @param abstract_ 276 */ 277 public void setAbstract( String abstract_ ) { 278 this.abstract_ = abstract_; 279 } 280 281 /** 282 * 283 * @param srs 284 */ 285 public void setSrs( String[] srs ) { 286 this.srs = srs; 287 } 288 289 /** 290 * 291 * @param dataURL 292 */ 293 public void setDataURL( BaseURL dataURL ) { 294 this.dataURL = dataURL; 295 } 296 297 /** 298 * 299 * @param metadataURL 300 */ 301 public void setMetadataURL( BaseURL metadataURL ) { 302 this.metadataURL = metadataURL; 303 } 304 305 /** 306 * 307 * @param formatList 308 */ 309 public void setFormatList( FormatList formatList ) { 310 this.formatList = formatList; 311 } 312 313 /** 314 * 315 * @param styleList 316 */ 317 public void setStyleList( StyleList styleList ) { 318 this.styleList = styleList; 319 } 320 321 /** 322 * 323 * 324 * @param queryable 325 */ 326 public void setQueryable( boolean queryable ) { 327 this.queryable = queryable; 328 } 329 330 /** 331 * 332 * 333 * @param hidden 334 */ 335 public void setHidden( boolean hidden ) { 336 this.hidden = hidden; 337 } 338 339 /** 340 * if extension is null, a default LayerExtension object is created 341 * 342 * @param extension 343 */ 344 public void setExtension( LayerExtension extension ) { 345 if ( extension == null ) { 346 extension = new LayerExtension(); 347 } 348 this.extension = extension; 349 } 350 351 }