001    //$HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/base/branches/2.5_testing/src/org/deegree/ogcwebservices/wpvs/capabilities/Dataset.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    
037    package org.deegree.ogcwebservices.wpvs.capabilities;
038    
039    import java.util.ArrayList;
040    import java.util.List;
041    
042    import org.deegree.model.crs.CoordinateSystem;
043    import org.deegree.model.metadata.iso19115.Keywords;
044    import org.deegree.model.spatialschema.Envelope;
045    import org.deegree.ogcwebservices.wpvs.configuration.AbstractDataSource;
046    
047    /**
048     * This class represents a <code>Dataset</code> object.
049     * Exactly one root dataset is mandatory. It may contain zero to any number of child datasets.
050     *
051     * @author <a href="mailto:taddei@lat-lon.de">Ugo Taddei</a>
052     * @author last edited by: $Author: mschneider $
053     *
054     * @version 2.0, $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
055     *
056     * @since 2.0
057     */
058    public class Dataset {
059    
060            // dataset attribs
061            private boolean queryable;
062            private boolean opaque;
063            private boolean noSubset;
064            private int fixedWidth;
065            private int fixedHeight;
066    
067            // dataset elements
068        private String name;
069        private String title;
070        private String abstract_;
071        private Keywords[] keywords;
072        private List<CoordinateSystem> crsList;
073        private String[] mimeTypeFormat;
074        private Dimension[] dimensions;
075        private Identifier identifier;
076        private DataProvider dataProvider;
077        private Envelope wgs84BoundingBox;
078        private Envelope[] boundingBoxes;
079        private MetaData[] metadata;
080        private DatasetReference[] datasetReferences;
081        private double minimumScaleDenominator;
082        private double maximumScaleDenominator;
083        private FeatureListReference[] featureListReferences;
084        private Style[] styles;
085        private List<Dataset> datasets;
086        private ElevationModel elevationModel;
087        private AbstractDataSource[] dataSources;
088            private Dataset parent;
089    
090        /**
091         * Creates a new dataset object from the given parameters.
092         *
093         * @param queryable
094         * @param opaque
095         * @param noSubset
096         * @param fixedWidth
097         * @param fixedHeight
098         * @param name
099         * @param title
100         * @param abstract_
101         * @param keywords
102         * @param crsList a list of available crs'
103         * @param mimeTypeFormat
104         * @param wgs84BoundingBox
105         * @param boundingBoxes
106         * @param dimensions
107         * @param dataProvider
108         * @param identifier
109         * @param metadata
110         * @param datasetReferences
111         * @param featureListReferences
112         * @param styles
113         * @param minScaleDenominator
114         * @param maxScaleDenominator
115         * @param datasets
116         * @param elevationModel
117         * @param dataSources
118         * @param parent
119         */
120        public Dataset( boolean queryable, boolean opaque, boolean noSubset, int fixedWidth,
121                                    int fixedHeight, String name, String title, String abstract_,
122                                    Keywords[] keywords, List<CoordinateSystem> crsList, String[] mimeTypeFormat,
123                                    Envelope wgs84BoundingBox, Envelope[] boundingBoxes, Dimension[] dimensions,
124                                    DataProvider dataProvider, Identifier identifier, MetaData[] metadata,
125                                    DatasetReference[] datasetReferences, FeatureListReference[] featureListReferences,
126                                    Style[] styles, double minScaleDenominator, double maxScaleDenominator,
127                                    Dataset[] datasets, ElevationModel elevationModel,
128                                    AbstractDataSource[] dataSources, Dataset parent ) {
129    
130            this.queryable = queryable;
131                    this.opaque = opaque;
132                    this.noSubset = noSubset;
133                    this.fixedWidth = fixedWidth;
134                    this.fixedHeight = fixedHeight;
135            this.name = name;
136            this.title = title;
137            this.abstract_ = abstract_;
138            this.keywords = keywords;
139            this.crsList = crsList;
140            this.mimeTypeFormat = mimeTypeFormat;
141            this.wgs84BoundingBox = wgs84BoundingBox;
142                    this.boundingBoxes = boundingBoxes;
143            this.dimensions = dimensions;
144            this.dataProvider = dataProvider;
145            this.identifier = identifier;
146            this.metadata = metadata;
147            this.datasetReferences = datasetReferences;
148            this.featureListReferences = featureListReferences;
149            this.styles = styles;
150            this.minimumScaleDenominator = minScaleDenominator;
151            this.maximumScaleDenominator = maxScaleDenominator;
152            setDatasets(datasets);
153                    this.elevationModel = elevationModel;
154            if( elevationModel != null ){
155                this.elevationModel.setParentDataset( this );
156            }
157    
158            this.dataSources = dataSources;
159            this.parent = parent;
160    
161    //        if ( dataSource instanceof LocalWCSDataSource ){
162    //               dataSource = (LocalWCSDataSource)dataSource;
163    //        } else {
164    //              ((LocalWFSDataSource)dataSource).getGeometryProperty();
165    //        }
166    
167        }
168    
169        @Override
170        public String toString ( ){
171            StringBuilder sb = new StringBuilder( 512 );
172            sb.append( "name=").append( name );
173            sb.append( "; title=").append( title );
174            sb.append( "; queryable=" ).append( queryable );
175            sb.append( "; opaque=").append( opaque );
176            sb.append( "; noSubset=").append( noSubset );
177            sb.append( "; fixedWidth=").append( fixedWidth );
178            sb.append( "; fixedHeight=").append( fixedHeight );
179            sb.append( "; crsList=").append( crsList);
180            sb.append( "; wgs84BoundingBox=").append( wgs84BoundingBox );
181            sb.append( "; identifier=").append( identifier );
182            sb.append( "; minimumScaleDenominator=").append( minimumScaleDenominator );
183            sb.append( "; maximumScaleDenominator=").append( maximumScaleDenominator );
184            sb.append( "; elevationModel=").append( elevationModel);
185            return sb.toString();
186        }
187    
188    
189        /**
190         * Each dataset may contain zero to any number of child datasets.
191         *
192         * @param datasets  the datasets within this dataset.
193         */
194        public void setDatasets(Dataset[] datasets) {
195            if( datasets == null ){
196                return;
197            }
198    
199            if ( this.datasets == null ){
200                    this.datasets = new ArrayList<Dataset>();
201            } else {
202                this.datasets.clear();
203            }
204    
205            for (int i = 0; i < datasets.length; i++) {
206                    this.datasets.add( datasets[i] );
207            }
208    
209        }
210    
211            /**
212             * @return Returns the abstract.
213             */
214            public String getAbstract() {
215                    return abstract_;
216            }
217    
218            /**
219             * @return Returns the boundingBoxes.
220             */
221            public Envelope[] getBoundingBoxes() {
222                    return boundingBoxes;
223            }
224    
225            /**
226             * @return Returns the crs.
227             */
228            public CoordinateSystem[] getCrs() {
229                    return crsList.toArray( new CoordinateSystem[crsList.size()]);
230            }
231    
232            /**
233             * @return Returns the dataProvider.
234             */
235            public DataProvider getDataProvider() {
236                    return dataProvider;
237            }
238    
239            /**
240             * @return all child datasets.
241             */
242            public Dataset[] getDatasets() {
243                    return datasets.toArray(new Dataset[datasets.size()]);
244            }
245    
246            /**
247             * @return Returns the datasetReferences.
248             */
249            public DatasetReference[] getDatasetReferences() {
250                    return datasetReferences;
251            }
252    
253            /**
254             * @return Returns the dataSources.
255             */
256            public AbstractDataSource[] getDataSources() {
257                    return dataSources;
258            }
259    
260            /**
261             * @return Returns the dimensions.
262             */
263            public Dimension[] getDimensions() {
264                    return dimensions;
265            }
266    
267            /**
268             * @return Returns the featureListReferences.
269             */
270            public FeatureListReference[] getFeatureListReferences() {
271                    return featureListReferences;
272            }
273    
274            /**
275             * @return Returns the identifier.
276             */
277            public Identifier getIdentifier() {
278                    return identifier;
279            }
280    
281            /**
282             * @return Returns the keywords.
283             */
284            public Keywords[] getKeywords() {
285                    return keywords;
286            }
287    
288            /**
289             * @return Returns the maximumScaleDenominator.
290             */
291            public double getMaximumScaleDenominator() {
292                    return maximumScaleDenominator;
293            }
294    
295            /**
296             * @return Returns the metadata.
297             */
298            public MetaData[] getMetadata() {
299                    return metadata;
300            }
301    
302            /**
303             * @return Returns the mimeTypeFormat.
304             */
305            public String[] getMimeTypeFormat() {
306                    return mimeTypeFormat;
307            }
308    
309            /**
310             * @return Returns the minimumScaleDenominator.
311             */
312            public double getMinimumScaleDenominator() {
313                    return minimumScaleDenominator;
314            }
315    
316            /**
317             * @return Returns the name.
318             */
319            public String getName() {
320                    return name;
321            }
322    
323            /**
324             * @return Returns the styles.
325             */
326            public Style[] getStyles() {
327                    return styles;
328            }
329    
330            /**
331             * @return Returns the title.
332             */
333            public String getTitle() {
334                    return title;
335            }
336    
337            /**
338             * @return Returns the wgs84BoundingBox.
339             */
340            public Envelope getWgs84BoundingBox() {
341                    return wgs84BoundingBox;
342            }
343    
344            /**
345             * @return Returns the fixedHeight.
346             */
347            public int getFixedHeight() {
348                    return fixedHeight;
349            }
350    
351            /**
352             * @return Returns the fixedWidth.
353             */
354            public int getFixedWidth() {
355                    return fixedWidth;
356            }
357    
358            /**
359             * @return Returns the noSubset.
360             */
361            public boolean getNoSubset() {
362                    return noSubset;
363            }
364    
365            /**
366             * @return Returns the opaque.
367             */
368            public boolean getOpaque() {
369                    return opaque;
370            }
371    
372            /**
373             * @return Returns the queryable.
374             */
375            public boolean getQueryable() {
376                    return queryable;
377            }
378    
379            /**
380             * @return Returns the elevationModel.
381             */
382            public ElevationModel getElevationModel() {
383                    return elevationModel;
384            }
385    
386            /**
387             * Returns the parent dataset of this dataset. If the method returns
388         * <code>null</code> the current dataset is the root dataset.
389             *
390             * @return Returns the parent.
391             */
392            public Dataset getParent() {
393                    return parent;
394            }
395    
396    
397        /**
398         * @param elevationModel An other elevationModel.
399         */
400        public void setElevationModel( ElevationModel elevationModel ) {
401            this.elevationModel = elevationModel;
402        }
403    
404    
405    
406    }