001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/ogcwebservices/wms/capabilities/LayerBoundingBox.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 org.deegree.model.spatialschema.EnvelopeImpl;
039    import org.deegree.model.spatialschema.Position;
040    
041    
042    /**
043     * Layers may have zero or more <BoundingBox> elements that are either stated
044     * explicitly or inherited from a parent Layer. Each BoundingBox states the
045     * bounding rectangle of the map data in a particular spatial reference system;
046     * the attribute SRS indicates which SRS applies. If the data area is shaped
047     * irregularly then the BoundingBox gives the minimum enclosing rectangle.The
048     * attributes minx, miny, maxx, maxy indicate the edges of the bounding box in
049     * units of the specified SRS. Optional resx and resy attributes indicate the
050     * spatial resolution of the data in those same units.
051     * <p></p>
052     * A Layer may have multiple BoundingBox element, but each one shall state a
053     * different SRS. A Layer inherits any BoundingBox values defined by its parents.
054     * A BoundingBox inherited from the parent Layer for a particular SRS is replaced
055     * by any declaration for the same SRS in the child Layer. A BoundingBox in the
056     * child for a new SRS not already declared by the parent is added to the list
057     * of bounding boxes for the child Layer. A single Layer element shall not
058     * contain more than one BoundingBox for the same SRS.
059     * <p>----------------------------------------------------------------------</p>
060     *
061     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
062     * @version 2002-03-01
063     */
064    public class LayerBoundingBox extends EnvelopeImpl {
065    
066        private static final long serialVersionUID = 4865010531322434459L;
067    
068        private String sRS = null;
069    
070        private double resx = 0;
071    
072        private double resy = 0;
073    
074    
075        /**
076        * constructor initializing the class with the <LayerBoundingBox>
077         * @param min
078         * @param max
079         * @param srs
080         * @param resx
081         * @param resy
082        */
083        public LayerBoundingBox( Position min, Position max, String srs, double resx, double resy ) {
084            super( min, max );
085            setSRS( srs );
086            setResx( resx );
087            setResy( resy );
088        }
089    
090        /**
091         * @return spatial resolution of the layers data in x-direction. If the resolution
092         * isn't known <tt>-1</tt> will be returned.
093         */
094        public double getResx() {
095            return resx;
096        }
097    
098        /**
099        * sets spatial resolution of the layers data in x-direction
100        * @param resx
101        */
102        public void setResx( double resx ) {
103            this.resx = resx;
104        }
105    
106        /**
107         * @return spatial resolution of the layers data in x-direction. If the resolution
108         * isn't known <tt>-1</tt> will be returned.
109         */
110        public double getResy() {
111            return resy;
112        }
113    
114        /**
115        * sets spatial resolution of the layers data in x-direction
116        * @param resy
117        */
118        public void setResy( double resy ) {
119            this.resy = resy;
120        }
121    
122        /**
123         * @return the name the spatial reference system of the bounding box
124         */
125        public String getSRS() {
126            return sRS;
127        }
128    
129        /**
130         * sets the name of the spatial reference system of the bounding box
131         * @param srs
132         */
133        public void setSRS( String srs ) {
134            sRS = srs;
135        }
136    
137        @Override
138        public String toString() {
139            String ret = null;
140            ret = "resx = " + resx + "\n";
141            ret += ( "resy = " + resy + "\n" );
142            ret += ( "sRS = " + sRS + "\n" );
143            return ret;
144        }
145    
146    }