001    // $HeadURL:
002    // /cvsroot/deegree/src/org/deegree/ogcwebservices/getcapabilities/Contents.java,v
003    // 1.1 2004/06/23 11:55:40 mschneider Exp $
004    /*----------------------------------------------------------------------------
005     This file is part of deegree, http://deegree.org/
006     Copyright (C) 2001-2009 by:
007       Department of Geography, University of Bonn
008     and
009       lat/lon GmbH
010    
011     This library is free software; you can redistribute it and/or modify it under
012     the terms of the GNU Lesser General Public License as published by the Free
013     Software Foundation; either version 2.1 of the License, or (at your option)
014     any later version.
015     This library is distributed in the hope that it will be useful, but WITHOUT
016     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
017     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
018     details.
019     You should have received a copy of the GNU Lesser General Public License
020     along with this library; if not, write to the Free Software Foundation, Inc.,
021     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
022    
023     Contact information:
024    
025     lat/lon GmbH
026     Aennchenstr. 19, 53177 Bonn
027     Germany
028     http://lat-lon.de/
029    
030     Department of Geography, University of Bonn
031     Prof. Dr. Klaus Greve
032     Postfach 1147, 53001 Bonn
033     Germany
034     http://www.geographie.uni-bonn.de/deegree/
035    
036     e-mail: info@deegree.org
037    ----------------------------------------------------------------------------*/
038    package org.deegree.model.filterencoding.capabilities;
039    
040    import java.util.HashMap;
041    import java.util.Map;
042    
043    import org.deegree.datatypes.QualifiedName;
044    
045    /**
046     * SpatialCapabilitiesBean
047     *
048     * @author <a href="mailto:tfr@users.sourceforge.net">Torsten Friebe </A>
049     *
050     * @author last edited by: $Author: mschneider $
051     *
052     * @version 2.0, $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
053     *
054     * @since 2.0
055     */
056    public class SpatialCapabilities {
057    
058        // keys are Strings (operator names), values are SpatialOperator-instances
059        private Map<String, SpatialOperator> operators = new HashMap<String, SpatialOperator>();
060    
061        private QualifiedName[] geometryOperands;
062    
063        /**
064         * Creates a new <code>SpatialCapabilities</code> instance that complies to the
065         * <code>Filter Encoding Specification 1.0.0</code> (without <code>GeometryOperands</code>).
066         *
067         * @param spatialOperators
068         */
069        public SpatialCapabilities( SpatialOperator[] spatialOperators ) {
070            setSpatialOperators( spatialOperators );
071        }
072    
073        /**
074         * Creates a new <code>SpatialCapabilities</code> instance that complies to the
075         * <code>Filter Encoding Specification 1.1.0</code> (with <code>GeometryOperands</code>).
076         *
077         * @param spatialOperators
078         * @param geometryOperands
079         */
080        public SpatialCapabilities( SpatialOperator[] spatialOperators, QualifiedName[] geometryOperands ) {
081            setSpatialOperators( spatialOperators );
082            this.geometryOperands = geometryOperands;
083        }
084    
085        /**
086         * @param operator
087         */
088        public void addSpatialOperator( SpatialOperator operator ) {
089            this.operators.put( operator.getName(), operator );
090    
091        }
092    
093        /**
094         * Returns if the given operator is supported.
095         *
096         * @param operatorName
097         * @return if the given operator is supported.
098         */
099        public boolean hasOperator( String operatorName ) {
100            return operators.get( operatorName ) != null ? true : false;
101        }
102    
103        /**
104         * @return the operators
105         */
106        public SpatialOperator[] getSpatialOperators() {
107            return operators.values().toArray( new SpatialOperator[this.operators.size()] );
108        }
109    
110        /**
111         * @param operators
112         */
113        public void setSpatialOperators( SpatialOperator[] operators ) {
114            this.operators.clear();
115            for ( int i = 0; i < operators.length; i++ ) {
116                this.addSpatialOperator( operators[i] );
117            }
118        }
119    
120        /**
121         * @return Returns the geometryOperands.
122         */
123        public QualifiedName[] getGeometryOperands() {
124            return geometryOperands;
125        }
126    
127        /**
128         * @param geometryOperands
129         *            The geometryOperands to set.
130         */
131        public void setGeometryOperands( QualifiedName[] geometryOperands ) {
132            this.geometryOperands = geometryOperands;
133        }
134    }