Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / fmap / layers / WFSLayerNode.java @ 27070

History | View | Annotate | Download (7.9 KB)

1
package com.iver.cit.gvsig.fmap.layers;
2

    
3
import java.util.Vector;
4

    
5
import org.gvsig.remoteClient.gml.schemas.XMLElement;
6
import org.gvsig.remoteClient.gml.types.GMLGeometryType;
7
import org.gvsig.remoteClient.gml.types.IXMLType;
8
import org.gvsig.remoteClient.gml.types.XMLComplexType;
9
import org.gvsig.remoteClient.utils.BoundaryBox;
10

    
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
 *
29
 * For more information, contact:
30
 *
31
 *  Generalitat Valenciana
32
 *   Conselleria d'Infraestructures i Transport
33
 *   Av. Blasco Ib??ez, 50
34
 *   46010 VALENCIA
35
 *   SPAIN
36
 *
37
 *      +34 963862235
38
 *   gvsig@gva.es
39
 *      www.gvsig.gva.es
40
 *
41
 *    or
42
 *
43
 *   IVER T.I. S.A
44
 *   Salamanca 50
45
 *   46005 Valencia
46
 *   Spain
47
 *
48
 *   +34 963163400
49
 *   dac@iver.es
50
 */
51
/* CVS MESSAGES:
52
 *
53
 * $Id: WFSLayerNode.java 21917 2008-06-30 06:50:42Z ppiqueras $
54
 * $Log$
55
 * Revision 1.6.2.4  2007-01-25 16:11:15  jorpiell
56
 * Se han cambiado los imports que hac?an referencia a remoteServices. Esto es as?, porque se han renombrado las clases del driver de GML
57
 *
58
 * Revision 1.6.2.3  2006/11/28 09:24:45  jorpiell
59
 * Si una feature no tiene tipo, se le tiene que informar al usuario de ello
60
 *
61
 * Revision 1.6.2.2  2006/11/17 11:28:45  ppiqueras
62
 * Corregidos bugs y a?adida nueva funcionalidad.
63
 *
64
 * Revision 1.10  2006/11/02 11:13:03  jorpiell
65
 * Se ha capturado una nullPointerException al calcular la geomteria
66
 *
67
 * Revision 1.9  2006/11/01 17:29:07  jorpiell
68
 * Se ha elimiado el nodo virtual de la raiz. Adem?s ya se cargan los valores de un campo complejo en la pesta?a del filtro
69
 *
70
 * Revision 1.8  2006/10/23 07:37:04  jorpiell
71
 * Ya funciona el filterEncoding
72
 *
73
 * Revision 1.7  2006/10/10 12:55:06  jorpiell
74
 * Se ha a?adido el soporte de features complejas
75
 *
76
 * Revision 1.6  2006/06/21 12:35:45  jorpiell
77
 * Se ha a?adido la ventana de propiedades. Esto implica a?adir listeners por todos los paneles. Adem?s no se muestra la geomatr?a en la lista de atributos y se muestran ?nicamnete los que se van a descargar
78
 *
79
 * Revision 1.5  2006/06/15 07:50:58  jorpiell
80
 * A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz
81
 *
82
 * Revision 1.4  2006/05/25 10:31:55  jorpiell
83
 * Se ha renombrado la clase WFSFields por WFSAttributes porque era algo confusa
84
 *
85
 * Revision 1.3  2006/05/23 08:08:17  jorpiell
86
 * Eliminados los atributos innecesarios
87
 *
88
 * Revision 1.2  2006/04/20 16:38:24  jorpiell
89
 * Ahora mismo ya se puede hacer un getCapabilities y un getDescribeType de la capa seleccionada para ver los atributos a dibujar. Queda implementar el panel de opciones y hacer el getFeature().
90
 *
91
 * Revision 1.1  2006/04/19 12:50:16  jorpiell
92
 * Primer commit de la aplicaci?n. Se puede hacer un getCapabilities y ver el mensaje de vienvenida del servidor
93
 *
94
 *
95
 */
96
/**
97
 * This class represents one node of the layer tree of a
98
 * common WFS service.
99
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
100
 */
101
public class WFSLayerNode {
102
        /**
103
         * @return the nameSpace
104
         */
105
        public String getNameSpace() {
106
                return nameSpace;
107
        }
108
        /**
109
         * @param nameSpace the nameSpace to set
110
         */
111
        public void setNameSpace(String nameSpace) {
112
                this.nameSpace = nameSpace;
113
        }
114
        private String        name = null;
115
        private String nameSpace = null;
116
        private String        title = null;
117
        private String        _abstract = null;
118
        private Vector fields = new Vector();
119
        private Vector selectedFields = new Vector();
120
        private String filter = null;
121
        private GMLGeometryType geometry = null;
122
        private Vector srs = new Vector();
123
        private BoundaryBox latLonBbox = null;
124
        private String userName = "";
125

    
126
        
127
        /**
128
         * @return Returns the fields.
129
         */
130
        public Vector getFields() {
131
                return fields;
132
        }
133
        /**
134
         * @param fields The fields to set.
135
         */
136
        public void setFields(Vector fields) {
137
                this.fields = fields;
138
        }
139
        
140
        /**
141
         * @param fields The fields to set.
142
         */
143
        public void setFields(Object[] fields) {
144
                this.fields.clear();
145
                for (int i=0 ; i<fields.length ; i++){
146
                        this.fields.add(fields[i]);
147
                }
148
        }
149
        
150
        
151
        /**
152
         * 
153
         */
154
        public String toString(){
155
                String str;
156
                if (getName()==null)
157
                        str = getTitle();
158
                else
159
                        str = "["+getName()+"] "+getTitle();
160
                return str;
161
        }
162
        /**
163
         * @return Returns the _abstract.
164
         */
165
        public String getAbstract() {
166
                return _abstract;
167
        }
168
        /**
169
         * @param _abstract The _abstract to set.
170
         */
171
        public void setAbstract(String _abstract) {
172
                this._abstract = _abstract;
173
        }
174
        /**
175
         * @return Returns the name.
176
         */
177
        public String getName() {
178
                return name;
179
        }
180
        /**
181
         * @param name The name to set.
182
         */
183
        public void setName(String name) {
184
                this.name = name;
185
        }
186
        /**
187
         * @return Returns the title.
188
         */
189
        public String getTitle() {
190
                return title;
191
        }
192
        /**
193
         * @param title The title to set.
194
         */
195
        public void setTitle(String title) {
196
                this.title = title;
197
        }
198
        /**
199
         * @return Returns the _abstract.
200
         */
201
        public String get_abstract() {
202
                return _abstract;
203
        }
204
        /**
205
         * @param _abstract The _abstract to set.
206
         */
207
        public void set_abstract(String _abstract) {
208
                this._abstract = _abstract;
209
        }        
210
        /**
211
         * @return Returns the userName.
212
         */
213
        public String getUserName() {
214
                return userName;
215
        }
216
        /**
217
         * @param userName The userName to set.
218
         */
219
        public void setUserName(String userName) {
220
                this.userName = userName;
221
        }
222
        /**
223
         * @return Returns the selectedFields.
224
         */
225
        public Vector getSelectedFields() {
226
                return selectedFields;
227
        }
228
        /**
229
         * @param selectedFields The selectedFields to set.
230
         */
231
        public void setSelectedFields(Vector selectedFields) {
232
                this.selectedFields = selectedFields;
233
        }
234
        
235
        /**
236
         * @param fields The fields to set.
237
         */
238
        public void setSelectedFields(Object[] selectedFields) {
239
                this.selectedFields.clear();
240
                for (int i=0 ; i<selectedFields.length ; i++){
241
                        this.selectedFields.add(selectedFields[i]);
242
                }
243
        }
244
        /**
245
         * @return Returns the srs.
246
         */
247
        public Vector getSrs() {
248
                return srs;
249
        }
250
        /**
251
         * @param srs The srs to set.
252
         */
253
        public void setSrs(Vector srs) {
254
                this.srs = srs;
255
        }
256
        /**
257
         * @return Returns the latLonBbox.
258
         */
259
        public BoundaryBox getLatLonBbox() {
260
                return latLonBbox;
261
        }
262
        /**
263
         * @param latLonBbox The latLonBbox to set.
264
         */
265
        public void setLatLonBbox(BoundaryBox latLonBbox) {
266
                this.latLonBbox = latLonBbox;
267
        }
268
        /**
269
         * @return Returns the geometry.
270
         */
271
        public GMLGeometryType getGeometry() {
272
                if (geometry == null){
273
                        if ((getFields() != null) && (getFields().size()>0)){
274
                                XMLElement element = (XMLElement)getFields().get(0);
275
                                //If it doesn't has type
276
                                if (element.getEntityType() != null){
277
                                        if (element.getEntityType().getType() == IXMLType.COMPLEX){
278
                                                Vector attributes = ((XMLComplexType)element.getEntityType()).getAttributes();
279
                                                for (int i=0 ; i<attributes.size() ; i++){
280
                                                        XMLElement child = (XMLElement)attributes.get(i);
281
                                                        if (child.getEntityType() != null){
282
                                                                if (child.getEntityType().getType() == IXMLType.GML_GEOMETRY){
283
                                                                        geometry = (GMLGeometryType)child.getEntityType();
284
                                                                }
285
                                                        }
286
                                                }
287
                                        }
288
                                }
289
                        }                        
290
                }
291
                return geometry;
292
        }
293
        /**
294
         * @param geometry The geometry to set.
295
         */
296
        public void setGeometry(GMLGeometryType geometry) {
297
                this.geometry = geometry;
298
        }
299
        /**
300
         * @return Returns the filter.
301
         */
302
        public String getFilter() {
303
                return filter;
304
        }
305
        /**
306
         * @param filter The filter to set.
307
         */
308
        public void setFilter(String filter) {
309
                this.filter = filter;
310
        }
311
}