001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/portal/context/Layer.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004    This file is part of deegree.
005    Copyright (C) 2001-2008 by:
006    EXSE, Department of Geography, University of Bonn
007    http://www.giub.uni-bonn.de/deegree/
008    lat/lon GmbH
009    http://www.lat-lon.de
010    
011    This library is free software; you can redistribute it and/or
012    modify it under the terms of the GNU Lesser General Public
013    License as published by the Free Software Foundation; either
014    version 2.1 of the License, or (at your option) any later version.
015    
016    This library is distributed in the hope that it will be useful,
017    but WITHOUT ANY WARRANTY; without even the implied warranty of
018    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019    Lesser General Public License for more details.
020    
021    You should have received a copy of the GNU Lesser General Public
022    License along with this library; if not, write to the Free Software
023    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024    
025    Contact:
026    
027    Andreas Poth
028    lat/lon GmbH
029    Aennchenstr. 19
030    53115 Bonn
031    Germany
032    E-Mail: poth@lat-lon.de
033    
034    Prof. Dr. Klaus Greve
035    Department of Geography
036    University of Bonn
037    Meckenheimer Allee 166
038    53115 Bonn
039    Germany
040    E-Mail: greve@giub.uni-bonn.de
041    
042                     
043     ---------------------------------------------------------------------------*/
044    package org.deegree.portal.context;
045    
046    import org.deegree.ogcbase.BaseURL;
047    
048    
049    
050    /**
051     * encapsulates about a layer described/contained by a Web Map Context
052     *
053     * @version $Revision: 11645 $
054     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
055     */
056    public class Layer {
057        private BaseURL dataURL = null;
058        private BaseURL metadataURL = null;
059        private FormatList formatList = null;
060        private LayerExtension extension = null;
061        private Server server = null;
062        private String abstract_ = null;
063        private String name = null;
064        private String title = null;
065        private StyleList styleList = null;
066        private String[] srs = null;
067        private boolean hidden = false;
068        private boolean queryable = false;
069    
070        /**
071         * Creates a new ContextLayer object.
072         *
073         * @param server service from which the named Layer may be requested
074         * @param name name of the selected layer (
075         * @param title title of the selected layer (
076         * @param abstract_ abstract of the selected layer (
077         * @param srs list of available SRS for the enclosing layer.
078         * @param dataURL contains a link to an online resource where data corresponding 
079         *                 to the layer can be found.
080         * @param metadataURL contains a link to an online resource where descriptive 
081         *                    metadata corresponding to the layer can be found.
082         * @param formatList parent element containing the list of available image 
083         *                   format for this layer.
084         * @param styleList parent element containing the list of available styles 
085         *                  for this layer.
086         * @param extension container tag in which arbitrary vendor specific information 
087         *                  can be included
088         *
089         * @throws ContextException 
090         */
091        public Layer( Server server, String name, String title, String abstract_, String[] srs, 
092                      BaseURL dataURL, BaseURL metadataURL, FormatList formatList, StyleList styleList, 
093                      boolean queryable, boolean hidden, LayerExtension extension )
094              throws ContextException {
095            setName( name );
096            setTitle( title );
097            setAbstract( abstract_ );
098            setSrs( srs );
099            setDataURL( dataURL );
100            setMetadataURL( metadataURL );
101            setFormatList( formatList );
102            setStyleList( styleList );
103            setExtension( extension );
104            setServer( server );
105            setQueryable( queryable );
106            setHidden( hidden );
107        }
108    
109        /**
110         * The element defining the service from which the named Layer may be requested
111         *
112         * @return 
113         */
114        public Server getServer() {
115            return server;
116        }
117    
118        /**
119         * The name of the selected layer (extracted from Capabilities by the Context 
120         * document creator). 
121         *
122         * @return 
123         */
124        public String getName() {
125            return name;
126        }
127    
128        /**
129         * The title of the selected layer (extracted from Capabilities by the Context 
130         * document creator).
131         *
132         * @return 
133         */
134        public String getTitle() {
135            return title;
136        }
137    
138        /**
139         * The abstract of the selected layer (extracted from Capabilities by the Context 
140         * document creator).
141         *
142         * @return 
143         */
144        public String getAbstract() {
145            return abstract_;
146        }
147    
148        /**
149         * A list of available SRS for the enclosing layer. One of the listed SRS�s 
150         * must be the SRS mentioned in the ViewerContext/General/BoundingBox@SRS 
151         * element.
152         *
153         * @return 
154         */
155        public String[] getSrs() {
156            return srs;
157        }
158    
159        /**
160         * This element contains a link to an online resource where data corresponding 
161         * to the layer can be found.
162         *
163         * @return 
164         */
165        public BaseURL getDataURL() {
166            return dataURL;
167        }
168    
169        /**
170         * This element contains a link to an online resource where descriptive metadata 
171         * corresponding to the layer can be found.
172         *
173         * @return 
174         */
175        public BaseURL getMetadataURL() {
176            return metadataURL;
177        }
178    
179        /**
180         * The parent element containing the list of available image format for this 
181         * layer. Image formats should be expressed with MIME types as described in 
182         * WMS 1.1.1 Specification.<p/>
183         * A FormatList shall include at least one Format
184         *
185         * @return 
186         */
187        public FormatList getFormatList() {
188            return formatList;
189        }
190    
191        /**
192         * The parent element containing the list of available styles for this layer.
193         * A StyleList shall include at least one Style
194         *
195         * @return 
196         */
197        public StyleList getStyleList() {
198            return styleList;
199        }
200    
201        /**
202         * The Extension element is a container tag in which arbitrary vendor specific 
203         * information can be included without compromising the ability of other 
204         * clients to enforce schema validation.
205         *
206         * @return 
207         */
208        public LayerExtension getExtension() {
209            return extension;
210        }
211    
212        /**
213         * returns true if the layer can be queried with a GetFeatureInfo request
214         *
215         * @return 
216         */
217        public boolean isQueryable() {
218            return queryable;
219        }
220    
221        /**
222         * returns true if the layer is not visible in the current view
223         *
224         * @return 
225         */
226        public boolean isHidden() {
227            return hidden;
228        }
229    
230        /**
231         *
232         * @param server 
233         *
234         * @throws ContextException 
235         */
236        public void setServer( Server server ) throws ContextException {
237            if ( server == null ) {
238                throw new ContextException( "server isn't allowed to be null" );
239            }
240    
241            this.server = server;
242        }
243    
244        /**
245         *
246         * @param name 
247         *
248         * @throws ContextException 
249         */
250        public void setName( String name ) 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 ) throws ContextException {
265            if ( title == null ) {
266                throw new ContextException( "title isn't allowed to be null" );
267            }
268    
269            this.title = title;
270        }
271    
272        /**
273         *
274         * @param abstract_ 
275         */
276        public void setAbstract( String abstract_ ) {
277            this.abstract_ = abstract_;
278        }
279    
280        /**
281         *
282         * @param srs 
283         */
284        public void setSrs( String[] srs ) {
285            this.srs = srs;
286        }
287    
288        /**
289         *
290         * @param dataURL 
291         */
292        public void setDataURL( BaseURL dataURL ) {
293            this.dataURL = dataURL;
294        }
295    
296        /**
297         *
298         * @param metadataURL 
299         */
300        public void setMetadataURL( BaseURL metadataURL ) {
301            this.metadataURL = metadataURL;
302        }
303    
304        /**
305         *
306         * @param formatList 
307         */
308        public void setFormatList( FormatList formatList ) {
309            this.formatList = formatList;
310        }
311    
312        /**
313         *
314         * @param styleList 
315         */
316        public void setStyleList( StyleList styleList ) {
317            this.styleList = styleList;
318        }
319    
320        /**
321         *
322         *
323         * @param queryable 
324         */
325        public void setQueryable( boolean queryable ) {
326            this.queryable = queryable;
327        }
328    
329        /**
330         *
331         *
332         * @param hidden 
333         */
334        public void setHidden( boolean hidden ) {
335            this.hidden = hidden;
336        }
337    
338        /**
339         * if extension is null, a default LayerExtension object is created
340         *
341         * @param extension 
342         */
343        public void setExtension( LayerExtension extension ) {
344            if ( extension == null ) {
345                extension = new LayerExtension();
346            }
347            this.extension = extension;
348        }
349    
350       
351    }