Statistics
| Revision:

root / trunk / extensions / extWCS / src / com / iver / cit / gvsig / gui / wcs / CoverageInfo.java @ 2280

History | View | Annotate | Download (6.54 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.wcs;
42

    
43
import java.util.ArrayList;
44
import java.util.Iterator;
45

    
46
import com.iver.cit.gvsig.gui.wizards.LayerInfo;
47

    
48

    
49
/**
50
 * Class that holds the coverage info.
51
 * 
52
 * Most of the content in this file is here for compatibility with LayerInfo and
53
 * it is not necessary.
54
 * 
55
 * Clase que mantiene la informaci?n de la cobertura
56
 * 
57
 * La mayor?a de su contenido es por compatibilidad con LayerInfo y no se
58
 * necesita.
59
 * 
60
 * @author jaume - jaume.dominguez@iver.es
61
 *  
62
 */
63
public class CoverageInfo extends LayerInfo {
64
    public String text;
65
    public String name;
66
    
67
    // <Jaume>
68
    public String metadataLink;
69
    public String label;
70
    public String[] keywords;
71
    private ArrayList formats;
72
    private ArrayList srs = new ArrayList();
73
    private ArrayList tiempos;
74
    private ArrayList parametros = new ArrayList();
75
    private double maxRes;
76
    // </Jaume>
77
    public boolean queryable;
78
        private boolean hayParametros = false;
79
    /**
80
     * Adds an SRS to the SRSs list
81
     *
82
     * @param srs 
83
     */
84
    public void addSRS(String srs) {
85
            String[] srsArray = srs.split(" ");
86
            for (int i = 0; i < srsArray.length; i++){
87
                        this.srs.add(srsArray[i]);
88
            }
89
    }
90
    
91
    public void setSRSList(ArrayList srs){
92
            this.srs = srs;
93
    }
94

    
95
    /**
96
     * Returns an ArrayList containing the strings with the SRSs
97
     *
98
     * @return ArrayList
99
     */
100
    public ArrayList getSRSs() {
101
                ArrayList ret = new ArrayList();
102
                ret.addAll(srs);
103

    
104
        if (padre != null) {
105
            ret.addAll(padre.getSRSs());
106
        }
107

    
108
        return ret;
109
    }
110

    
111

    
112
    /**
113
     * Compares two CoverageInfo objects
114
     * Compara dos objetos CoverageInfo
115
     */
116
    public boolean equals(Object obj) {
117
            try{
118
                CoverageInfo objeto = (CoverageInfo) obj;
119
                        return this.name.equals(objeto.name);
120
                }catch(ClassCastException e){
121
                        e.printStackTrace();
122
                        return false;
123
                }catch (NullPointerException e) {
124
                        return false;
125
                }
126
    }
127

    
128
        /**
129
         * Returns an ArrayList containing strings with the coverage supported formats
130
         * 
131
         * Devuelve la lista de formatos de la cobertura
132
         * @return ArrayList
133
         */
134
        public ArrayList getFormats() {
135
                return formats;
136
        }
137
        
138
        /**
139
         * Sets the coverage formats list.
140
         * 
141
         * Establece la lista de formatos para la cobertura
142
         * @param formats
143
         */
144
        public void setFormats(ArrayList formats){
145
                this.formats = formats;        
146
        }
147

    
148
        /**
149
         * Returns an ArrayList containing strings with the coverage time positions.
150
         * 
151
         * Devuelve la lista de posiciones para el tiempo de la cobertura
152
         * 
153
         * @return ArrayList
154
         */
155
        public ArrayList getTimes() {
156
                return tiempos;
157
        }
158
        
159
        /**
160
         * Sets the coverage name
161
         * 
162
         * Establece el nombre de la cobertura
163
         * @param name
164
         */
165
        public void setName(String name){
166
                this.name = name;
167
        }
168
        
169
        /**
170
         * Sets the coverage label
171
         * 
172
         * Establece la etiqueta de la cobertura
173
         * @param label
174
         */
175
        public void setLabel(String label){
176
                this.label = label;
177
        }
178
        /**
179
         * Sets the coverage time positions list
180
         * 
181
         * Establece la lista de posiciones para el tiempo de la cobertura
182
         * 
183
         * @return 
184
         */
185
        public void setTiempos(ArrayList tiempos){
186
            // Since the coverage may have not time positions we ensure
187
            // that we won't have nullPointer errors;
188
                if (tiempos == null) this.tiempos = new ArrayList();
189
                else this.tiempos = tiempos;
190
        }
191

    
192
        /**
193
         * Sets the coverage's parameter list (and its possible values)
194
         * Establece la lista de parametros (y sus posibles valores) de la cobertura
195
         * @param parametros
196
         */
197
        public void setParametros(ArrayList parametros){
198
                // Como la cobertura puede no tener par?metros nos aseguramos de que
199
                // no tengamos errores de puntero nulo creando un ArrayList vac?o
200
                if (parametros == null) {
201
                        hayParametros = false;
202
                        this.parametros = new ArrayList();
203
                }
204
                else{
205
                        hayParametros = true;
206
                        this.parametros = parametros;
207
                }
208
        }
209
        /**
210
         * Returns an ArrayList containing a list of Parametro with the parameters list
211
         * and its possible values.
212
         * 
213
         * Devuelve la lista de par?metros (y sus posibles valores) de la cobertura
214
         * @return
215
         */
216
        public ArrayList getParametros() {
217
                return parametros;
218
        }
219
        
220
        /**
221
         * Searches and returns the parameter indicated by its name
222
         * 
223
         * Busca y devuelve el par?metro indicado por nombre.
224
         * @param nombreParametro
225
         * @return Parametro
226
         */
227
        public Parametro getParametro(String nombreParametro){
228
                Parametro p;
229
                Iterator it = parametros.iterator();
230
                while (it.hasNext()){
231
                        p = (Parametro) it.next();
232
                        if (p.getName().equals(nombreParametro)) 
233
                                return p;
234
                }
235
                return null;
236
                
237
        }
238

    
239
        /**
240
         * @return true if the coverage has parameter, false else.
241
         */
242
        public boolean hasParameter() {
243
                return hayParametros;
244
        }
245

    
246
        /**
247
         * Gets the coverage label.
248
         * 
249
         * Obtiene la etiqueta de la cobertura
250
         * @return
251
         */
252
        public String getLabel() {
253
                return this.label;
254
        }
255

    
256
        /**
257
         * Sets the coverage's max resolution.
258
         * 
259
         * Establece la resoluci?n m?xima de la cobertura
260
         * @param maxRes
261
         */
262
        public void setMaxRes(double maxRes) {
263
                this.maxRes = maxRes;
264
        }
265

    
266
        /**
267
         * Gets the coverage's max resolution.
268
         * 
269
         * Obtiene la resoluci?n m?xima de la cobertura
270
         */
271
        public double getMaxRes() {
272
                return maxRes;
273
        }
274

    
275
        /**
276
         * Gets the coverage description (not used in gvSIG)
277
         * 
278
         * Obtiene la descripci?n de la cobertura
279
         * (no se usa en gvSIG)
280
         * @param coverageDescription
281
         */
282
        public void setText(String coverageDescription) {
283
                text = coverageDescription;
284
        }        
285
}