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