Revision 2315

View differences:

branches/gvSIG_WFS04/extensions/extWFS/.cvsignore
1
bin
0 2

  
branches/gvSIG_WFS04/extensions/extWFS/build.xml
1
<project name="Generar extension en Andami" default="generate-without-source" basedir=".">
2
    <description>
3
        Instala el plugin en Andami
4
    </description>
5
  <!-- set global properties for this build -->
6
  <property name="src" location="src"/>
7
  <property name="build" location="bin"/>
8
  <property name="dist"  location="dist"/>
9
  <property name="mainplugin" value="com.iver.cit.gvsig"/>
10
  <property name="plugin" value="com.iver.cit.gvsig.wfs"/>
11
  <property name="gvsiglibjar" value="gvsig-wfs"/>
12
  <property name="fmapjar" value="fmap-wfs"/>
13
  <property name="driverjar" value="wfs"/>
14
  <property name="extensionDir" location="../Andami/gvSIG/extensiones"/>
15
  <property name="drivers-dir" location="${extensionDir}/${mainplugin}/drivers" />
16

  
17
  <target name="init">
18
    <!-- Create the time stamp -->
19
    <tstamp/>
20
    <!-- Create the build directory structure used by compile -->
21
    <mkdir dir="${build}"/>
22
    <mkdir dir="${dist}"/>
23
  	
24
  </target>
25

  
26
  <target name="generate-without-source"
27
  		description="generate the distribution without the source file">
28
    <!-- Create the distribution directory -->
29
    <mkdir dir="${dist}"/>
30
	<mkdir dir="${drivers-dir}/jdbc_spatial" />
31
		
32
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
33
    <jar jarfile="${dist}/${plugin}.jar" basedir="${build}" includes="com/iver/cit/gvsig/**"/>
34
  	<copy file="config/config.xml" todir="${dist}"/>
35
    <copy todir="${dist}">
36
    	<fileset dir="." includes="text*.properties"/>
37
    </copy>
38
    <!-- <copy todir="${dist}">
39
    	<fileset dir="./lib" includes="*.jar,*.zip"/>
40
    	<fileset dir="." includes=".keystore"/>
41
    </copy> -->
42
  	<move todir="${extensionDir}/${mainplugin}/lib">
43
  		<fileset dir="${dist}" includes="${gvsiglibjar}.jar"/>
44
 		<fileset dir="${dist}" includes="${fmapjar}.jar"/>
45
 	</move>
46
    <move todir="${extensionDir}/${plugin}/">
47
    	<fileset dir="${dist}" includes="**/**"/>
48
    </move>
49
  </target>
50

  
51

  
52
  <target name="generate-with-source" description="generate the distribution with the source file" >
53
    <!-- Create the distribution directory -->
54
    <mkdir dir="${dist}"/>
55

  
56
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
57
    <jar jarfile="${dist}/${plugin}.jar" basedir="${build}"/>
58
    <copy file="config/config.xml" todir="${dist}"/>
59
    <copy todir="${dist}">
60
    	<fileset dir="." includes="text*.properties"/>
61
    </copy>
62
    <copy todir="${dist}">
63
    	<fileset dir="." includes="${src}"/>
64
    </copy>
65
    <copy todir="${dist}/images">
66
    	<fileset dir="images/" includes="*"/>
67
    </copy>
68
    <move todir="${extension-dir}/${plugin}/">
69
    	<fileset dir="${dist}" includes="**/**"/>
70
    </move>
71
  </target>
72

  
73
  <target name="clean"
74
        description="clean up" >
75
    <!-- Delete the ${build} and ${dist} directory trees -->
76
    <delete dir="${dist}"/>
77
  </target>
78
</project>
79

  
0 80

  
branches/gvSIG_WFS04/extensions/extWFS/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>gvSIG_JDBC</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
	</buildSpec>
14
	<natures>
15
		<nature>org.eclipse.jdt.core.javanature</nature>
16
	</natures>
17
</projectDescription>
0 18

  
branches/gvSIG_WFS04/extensions/extWFS/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="com.iver.cit.gvsig" />
4
	<libraries library-dir="."/>
5
	<extensions>
6
		<extension class-name="com.iver.cit.gvsig.wfs.ExtWFS"
7
			description="Support to access WFS"
8
			active="true"
9
			priority="1">
10
		</extension>		
11
	</extensions>
12
</plugin-config>
0 13

  
branches/gvSIG_WFS04/extensions/extWFS/src/com/iver/cit/gvsig/fmap/drivers/wfs/WFSDriver.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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.fmap.drivers.wfs;
42

  
43
import java.awt.geom.Rectangle2D;
44
import java.io.IOException;
45
import java.net.MalformedURLException;
46
import java.net.URL;
47
import java.sql.SQLException;
48
import java.util.ArrayList;
49
import java.util.HashMap;
50
import java.util.Hashtable;
51
import java.util.Map;
52

  
53
import org.geotools.data.DataStore;
54
import org.geotools.data.DefaultQuery;
55
import org.geotools.data.FeatureReader;
56
import org.geotools.data.Query;
57
import org.geotools.data.Transaction;
58
import org.geotools.data.wfs.WFSDataStoreFactory;
59
import org.geotools.feature.AttributeType;
60
import org.geotools.filter.FidFilter;
61
import org.geotools.filter.Filter;
62
import org.geotools.filter.FilterFactory;
63

  
64
import com.hardcode.gdbms.engine.data.driver.ObjectDriver;
65
import com.hardcode.gdbms.engine.data.edition.DataWare;
66
import com.hardcode.gdbms.engine.values.Value;
67
import com.iver.cit.gvsig.fmap.DriverException;
68
import com.iver.cit.gvsig.fmap.core.FShape;
69
import com.iver.cit.gvsig.fmap.core.IFeature;
70
import com.iver.cit.gvsig.fmap.core.IGeometry;
71
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
72
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
73
import com.iver.cit.gvsig.fmap.drivers.IWFSdriver;
74

  
75

  
76
/**
77
 * Driver de WFS, utilizando DataStore de geotools.
78
 *
79
 * @author Vicente Caballero Navarro
80
 */
81
public class WFSDriver implements IWFSdriver, ObjectDriver {
82
	private Rectangle2D fullExtent = null;
83
	private Rectangle2D extent = null;
84
	private DataStore ds;
85

  
86
	//private FeatureReader fr;
87
	private String urlS = "http://localhost:8080/geoserver/wfs";
88
	private String versionS = "version=1.0.0";
89
	private String requestS = "request=getcapabilities";
90
	private String serviceS = "service=wfs";
91
	private String userS = "admin";
92
	private String pwdS = "geoserver";
93
	private String[] layersS;
94
	private boolean protocolS = true;
95
	private int numFeaturesS = 100;
96
	private int timeoutS = 10000;
97
	private Hashtable hashRelate;
98

  
99
	///private Hashtable indexFID;
100
	protected int idFID_FieldName;
101
	private int numReg = -1;
102
	private int numField = -1;
103
	private AttributeType[] attributes;
104

  
105
	//private FeatureReader fr;
106
	///private ArrayList typeNames=new ArrayList();
107
	private ArrayList features = new ArrayList();
108

  
109
	/**
110
	 * DOCUMENT ME!
111
	 *
112
	 * @return DOCUMENT ME!
113
	 */
114
	public Rectangle2D getFullExtent() {
115
		return fullExtent;
116
	}
117

  
118
	/**
119
	 * DOCUMENT ME!
120
	 *
121
	 * @return DOCUMENT ME!
122
	 */
123
	public int getShapeType() {
124
		return FShape.MULTI;
125
	}
126

  
127
	/**
128
	 * DOCUMENT ME!
129
	 *
130
	 * @param fids DOCUMENT ME!
131
	 *
132
	 * @return DOCUMENT ME!
133
	 */
134
	private Filter createFidFilter(String[] fids) {
135
		FidFilter filter = FilterFactory.createFilterFactory().createFidFilter();
136

  
137
		for (int i = 0; i < fids.length; i++) {
138
			filter.addFid(fids[i]);
139
		}
140

  
141
		return filter;
142
	}
143

  
144
	/**
145
	 * DOCUMENT ME!
146
	 *
147
	 * @param index DOCUMENT ME!
148
	 *
149
	 * @return DOCUMENT ME!
150
	 */
151
	public IGeometry getShape(int index) {
152
		return ((IFeature) features.get(index)).getGeometry();
153
	}
154

  
155
	/**
156
	 * DOCUMENT ME!
157
	 *
158
	 * @return DOCUMENT ME!
159
	 */
160
	public URL getHost() {
161
		try {
162
			return new URL(urlS + "?" + versionS + "&" + requestS + "&" +
163
				serviceS);
164
		} catch (MalformedURLException e) {
165
			e.printStackTrace();
166
		}
167

  
168
		return null;
169
	}
170

  
171
	/**
172
	 * DOCUMENT ME!
173
	 *
174
	 * @param r DOCUMENT ME!
175
	 * @param strEPSG DOCUMENT ME!
176
	 *
177
	 * @return DOCUMENT ME!
178
	 *
179
	 * @throws DriverException DOCUMENT ME!
180
	 * @throws IOException 
181
	 */
182
	public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG)
183
		throws DriverException, IOException {
184
		WFSFeatureIterator geomIterator = null;
185

  
186
		/*if (r!=null && extent.contains(r)){
187
		   //extent=(Rectangle2D)r.clone();
188
		   return new WFSFeatureIterator(features);
189
		   }
190
		 */
191

  
192
		// ArrayList shapes=new ArrayList();   
193

  
194
		/*        BBoxExpressionImpl RectangleFilter=null;
195
		   try {
196
		           RectangleFilter = (BBoxExpressionImpl)FilterFactoryImpl.createFilterFactory().createBBoxExpression(new Envelope(fullExtent.getX(),fullExtent.getY(),fullExtent.getMaxX(),fullExtent.getMaxY()));
197
		   } catch (IllegalFilterException e2) {
198
		           e2.printStackTrace();
199
		   } catch (FactoryConfigurationError e2) {
200
		           e2.printStackTrace();
201
		   }
202
		 */
203
		Query query = new DefaultQuery(layersS[0]);
204
		FeatureReader fr = null;
205

  
206
		
207
			fr = ds.getFeatureReader(query, Transaction.AUTO_COMMIT);
208

  
209
			if (numField == -1) {
210
				numField = fr.getFeatureType().getAttributeCount();
211
				attributes = fr.getFeatureType().getAttributeTypes();
212
			}
213
		
214
		geomIterator = new WFSFeatureIterator(fr);
215
		return geomIterator;
216
	}
217

  
218
	/**
219
	 * DOCUMENT ME!
220
	 */
221
	public void close() {
222
	}
223

  
224
	/**
225
	 * DOCUMENT ME!
226
	 *
227
	 * @throws DriverException DOCUMENT ME!
228
	 */
229
	public void open() throws DriverException {
230
	}
231

  
232
	/**
233
	 * DOCUMENT ME!
234
	 *
235
	 * @param FID DOCUMENT ME!
236
	 *
237
	 * @return DOCUMENT ME!
238
	 */
239
	public int getRowIndexByFID(IFeature FID) {
240
		int resul;
241
		Integer rowIndex = (Integer) hashRelate.get(FID.getID());
242
		resul = rowIndex.intValue();
243

  
244
		return resul;
245
	}
246

  
247
	/**
248
	 * DOCUMENT ME!
249
	 *
250
	 * @return DOCUMENT ME!
251
	 *
252
	 * @throws IOException DOCUMENT ME!
253
	 */
254
	public int getShapeCount() throws IOException {
255
		return numReg;
256
	}
257

  
258
	/**
259
	 * DOCUMENT ME!
260
	 *
261
	 * @return DOCUMENT ME!
262
	 */
263
	public DriverAttributes getDriverAttributes() {
264
		return null;
265
	}
266

  
267
	/**
268
	 * DOCUMENT ME!
269
	 *
270
	 * @return DOCUMENT ME!
271
	 */
272
	public String getName() {
273
		return "WFS Driver";
274
	}
275

  
276
	/**
277
	 * Recorre el recordset creando una tabla Hash que usaremos para
278
	 * relacionar el n?mero de un registro con su identificador ?nico. Debe
279
	 * ser llamado en el setData justo despu?s de crear el recorset principal
280
	 * @throws IOException 
281
	 */
282
	protected void doRelateID_FID() throws IOException {
283
		if (ds == null) {
284
			URL url = null;
285

  
286
			try {
287
				url = new URL(urlS + "?" + versionS + "&" + requestS + "&" +
288
						serviceS);
289
			} catch (MalformedURLException e) {
290
				e.printStackTrace();
291
			}
292

  
293
			//int timeout=10000;
294
			//boolean protocol=true;
295
			Map m = new HashMap();
296
			m.put(WFSDataStoreFactory.URL.key, url);
297
			m.put(WFSDataStoreFactory.TIMEOUT.key, new Integer(timeoutS));
298
			m.put(WFSDataStoreFactory.PROTOCOL.key, new Boolean(protocolS));
299
			m.put(WFSDataStoreFactory.PASSWORD.key, pwdS);
300
			m.put(WFSDataStoreFactory.USERNAME.key, userS);
301
			m.put(WFSDataStoreFactory.BUFFER_SIZE.key, new Integer(numFeaturesS));
302

  
303
			try {
304
				ds = (new WFSDataStoreFactory()).createNewDataStore(m);
305
			} catch (IOException e) {
306
				e.printStackTrace();
307
			}
308

  
309
			/*
310
			   String[] names=null;
311
			   try {
312
			           names = ds.getTypeNames();
313
			   } catch (IOException e1) {
314
			           e1.printStackTrace();
315
			   }
316
			   System.out.println("Capas :");
317
			
318
			   for (int i=0;i<names.length;i++){
319
			           System.out.println("Capa "+i+" : "+names[i]);
320
			           //Se selecciona la capa que se quiere abrir
321
			           //if (true)//si esta seleccionada en la lista o arbol que se muestre en el wizard
322
			           //typeNames.add(names[i]);
323
			   }
324
			 */
325
		}
326

  
327
		hashRelate = new Hashtable();
328

  
329
		///indexFID = new Hashtable();
330
		//Query query = new DefaultQuery(layersS[0]);
331

  
332
		//FeatureReader fr=null;
333
		//fr = ds.getFeatureReader(query,Transaction.AUTO_COMMIT);
334
		int index = 0;
335
		IFeatureIterator iter = null;
336

  
337
		try {
338
			iter = getFeatureIterator(null, null);
339
		} catch (DriverException e) {
340
			e.printStackTrace();
341
		}
342

  
343
		try {
344
			while (iter.hasNext()) {
345
				IFeature feature = iter.next();
346
				features.add(feature);
347

  
348
				Rectangle2D rect = feature.getGeometry().getBounds2D();
349

  
350
				if (fullExtent == null) {
351
					fullExtent = new Rectangle2D.Double(rect.getMinX(),
352
							rect.getMinY(), rect.getWidth(), rect.getHeight());
353
				} else {
354
					fullExtent.add(new Rectangle2D.Double(rect.getMinX(),
355
							rect.getMinY(), rect.getWidth(), rect.getHeight()));
356
				}
357

  
358
				hashRelate.put(feature.getID(), new Integer(index));
359

  
360
				///indexFID.put(new Integer(index),feature.getID());
361
				index++;
362
			}
363
		} catch (SQLException e) {
364
			e.printStackTrace();
365
		}
366

  
367
		numReg = index;
368
		extent = (Rectangle2D)fullExtent.clone();
369
	}
370

  
371
	/**
372
	 * DOCUMENT ME!
373
	 *
374
	 * @param url DOCUMENT ME!
375
	 * @param user DOCUMENT ME!
376
	 * @param pwd DOCUMENT ME!
377
	 * @param layers DOCUMENT ME!
378
	 * @param protocol DOCUMENT ME!
379
	 * @param numFeatures DOCUMENT ME!
380
	 * @param timeout DOCUMENT ME!
381
	 * @param id_FID_field DOCUMENT ME!
382
	 * @throws IOException 
383
	 */
384
	public void setData(String url, String user, String pwd, String[] layers,
385
		boolean protocol, int numFeatures, int timeout, int id_FID_field) throws IOException {
386
		idFID_FieldName = id_FID_field;
387
		urlS = url;
388
		userS = user;
389
		pwdS = pwd;
390
		layersS = layers;
391
		protocolS = protocol;
392
		numFeaturesS = numFeatures;
393
		timeoutS = timeout;
394
		doRelateID_FID();
395
	}
396

  
397
	/**
398
	 * DOCUMENT ME!
399
	 *
400
	 * @param arg0 DOCUMENT ME!
401
	 * @param arg1 DOCUMENT ME!
402
	 *
403
	 * @return DOCUMENT ME!
404
	 *
405
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException DOCUMENT ME!
406
	 */
407
	public Value getFieldValue(long arg0, int arg1)
408
		throws com.hardcode.gdbms.engine.data.driver.DriverException {
409
		/*try {
410
		   ds.getTypeNames();
411
		   } catch (IOException e1) {
412
		           e1.printStackTrace();
413
		   }*/
414
		/*System.out.println("Filter");
415
		   Filter fidFilter=createFilter(new String[]{(String)indexFID.get(new Integer((int)arg0))});
416
		   System.out.println("Query");
417
		   Query query = new DefaultQuery((String)typeNames.get(0),fidFilter);
418
		   FeatureReader fr=null;
419
		   try {
420
		           System.out.println("getFeatureReader");
421
		           fr = ds.getFeatureReader(query,Transaction.AUTO_COMMIT);
422
		   } catch (IOException e) {
423
		           e.printStackTrace();
424
		   }
425
		           try {
426
		                   return getValue(fr,arg1);
427
		           } catch (NoSuchElementException e) {
428
		                   e.printStackTrace();
429
		           } catch (IOException e) {
430
		                   e.printStackTrace();
431
		           } catch (IllegalAttributeException e) {
432
		                   e.printStackTrace();
433
		           }
434
		 */
435
		return ((IFeature) features.get((int) arg0)).getAttribute(arg1);
436
	}
437

  
438
	/**
439
	 * DOCUMENT ME!
440
	 *
441
	 * @return DOCUMENT ME!
442
	 *
443
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException DOCUMENT ME!
444
	 */
445
	public int getFieldCount()
446
		throws com.hardcode.gdbms.engine.data.driver.DriverException {
447
		return numField;
448
	}
449

  
450
	/**
451
	 * DOCUMENT ME!
452
	 *
453
	 * @param arg0 DOCUMENT ME!
454
	 *
455
	 * @return DOCUMENT ME!
456
	 *
457
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException DOCUMENT ME!
458
	 */
459
	public String getFieldName(int arg0)
460
		throws com.hardcode.gdbms.engine.data.driver.DriverException {
461
		return attributes[arg0].getName();
462
	}
463

  
464
	/**
465
	 * DOCUMENT ME!
466
	 *
467
	 * @return DOCUMENT ME!
468
	 *
469
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException DOCUMENT ME!
470
	 */
471
	public long getRowCount()
472
		throws com.hardcode.gdbms.engine.data.driver.DriverException {
473
		return numReg;
474
	}
475

  
476
	/**
477
	 * DOCUMENT ME!
478
	 *
479
	 * @param arg0 DOCUMENT ME!
480
	 *
481
	 * @return DOCUMENT ME!
482
	 *
483
	 * @throws com.hardcode.gdbms.engine.data.driver.DriverException DOCUMENT ME!
484
	 */
485
	public int getFieldType(int arg0)
486
		throws com.hardcode.gdbms.engine.data.driver.DriverException {
487
		attributes[arg0].getType();
488

  
489
		return FIELD_TYPE_STRING; //fr.getFeatureType().getAttributeType(arg0).getType();
490
	}
491

  
492
    /**
493
     * @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getPrimaryKeys()
494
     */
495
    public int[] getPrimaryKeys() throws com.hardcode.gdbms.engine.data.driver.DriverException {
496
        throw new UnsupportedOperationException();
497
    }
498

  
499
    /**
500
     * @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#write(com.hardcode.gdbms.engine.data.edition.DataWare)
501
     */
502
    public void write(DataWare arg0) throws com.hardcode.gdbms.engine.data.driver.DriverException {
503
        // TODO Auto-generated method stub
504
        
505
    }
506
}
0 507

  
branches/gvSIG_WFS04/extensions/extWFS/src/com/iver/cit/gvsig/fmap/drivers/wfs/WFSFeatureIterator.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 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.fmap.drivers.wfs;
42

  
43
import java.io.IOException;
44
import java.sql.SQLException;
45
import java.util.Date;
46
import java.util.NoSuchElementException;
47

  
48
import org.geotools.data.FeatureReader;
49
import org.geotools.feature.Feature;
50
import org.geotools.feature.IllegalAttributeException;
51

  
52
import com.hardcode.gdbms.engine.values.Value;
53
import com.hardcode.gdbms.engine.values.ValueFactory;
54
import com.iver.cit.gvsig.fmap.core.IFeature;
55
import com.iver.cit.gvsig.fmap.core.IGeometry;
56
import com.iver.cit.gvsig.fmap.core.ShapeFactory;
57
import com.iver.cit.gvsig.fmap.core.v02.FConverter;
58
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
59

  
60
public class WFSFeatureIterator implements IFeatureIterator{
61
	//private IFeature[] features=null;
62
	private FeatureReader featureReader;
63
	//private ArrayList features;
64
	//private int index=-1;
65
	//private int pos=0;
66
	public WFSFeatureIterator(FeatureReader fr){
67
		featureReader=fr;
68
	}
69
	/*public WFSFeatureIterator(ArrayList l){
70
		features=l;
71
	}*/
72
	public boolean hasNext(){
73
		/*if (features !=null){
74
			if (index<features.size()-1)
75
				return true;
76
			else{
77
				index=-1;
78
				features=null;
79
				return false;
80
			}
81
		}*/
82
		try {
83
			if (featureReader.hasNext()){
84
				return true;
85
			}else{
86
				featureReader.close();
87
				
88
				return false;
89
			}
90
		} catch (IOException e) {
91
			e.printStackTrace();
92
		}
93
		return false;
94
	}
95

  
96
	public IFeature next() throws SQLException {
97
	/*	if (features !=null){
98
			return (IFeature)features.get(++index);
99
		}*/
100
		Feature feature=null;
101
		try {
102
			feature = featureReader.next();
103
		} catch (NoSuchElementException e) {
104
			e.printStackTrace();
105
		} catch (IOException e) {
106
			e.printStackTrace();
107
		} catch (IllegalAttributeException e) {
108
			e.printStackTrace();
109
		}
110
		Object[] attr=null;
111
		attr=feature.getAttributes(attr);
112
		Value[] values=getValues(attr);
113
		
114
		IGeometry g=ShapeFactory.createGeometry(FConverter.jts_to_java2d(feature.getDefaultGeometry()));
115
		return new com.iver.cit.gvsig.fmap.core.DefaultFeature(g,values,feature.getID());
116
	}
117
	private Value[] getValues(Object[] attr) {
118
		Value[] values=new Value[attr.length];
119
		for (int i=1;i<attr.length;i++){
120
			if (attr[i]!=null){
121
				if (attr[i] instanceof Double){
122
					values[i]=ValueFactory.createValue(((Double)attr[i]).doubleValue());
123
				}else if (attr[i] instanceof String){
124
					values[i]=ValueFactory.createValue(String.valueOf(attr[i]));
125
				}else if (attr[i] instanceof Long){
126
					values[i]=ValueFactory.createValue(((Long)attr[i]).longValue());
127
				}else if (attr[i] instanceof Integer){
128
					values[i]=ValueFactory.createValue(((Integer)attr[i]).intValue());
129
				}else if (attr[i] instanceof Float){
130
					values[i]=ValueFactory.createValue(((Float)attr[i]).floatValue());
131
				}else if (attr[i] instanceof Short){
132
					values[i]=ValueFactory.createValue(((Short)attr[i]).shortValue());
133
				}else if (attr[i] instanceof Boolean){
134
					values[i]=ValueFactory.createValue(((Boolean)attr[i]).booleanValue());
135
				}else if (attr[i] instanceof Date){
136
					values[i]=ValueFactory.createValue(((Date)attr[i]));
137
				}
138
			//	System.out.println("class = "+attr[i].getClass());
139
					
140
			}else{
141
				values[i]=ValueFactory.createValue("");
142
			}
143
		}
144
		return values;
145
	}
146
	
147
}
0 148

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

  
46
import com.iver.andami.plugins.Extension;
47
import com.iver.cit.gvsig.AddLayer;
48
import com.iver.cit.gvsig.wfs.gui.wfswizard.WizardWFS;
49

  
50
public class ExtWFS implements Extension {
51

  
52
    public void inicializar() {
53
        System.out.println("A?ado Wizard WFS.");
54
        AddLayer.addWizard(WizardWFS.class);
55

  
56
    }
57

  
58
    public void execute(String actionCommand) {
59
        // TODO Auto-generated method stub
60

  
61
    }
62

  
63
    public boolean isEnabled() {
64
        // TODO Auto-generated method stub
65
        return false;
66
    }
67

  
68
    public boolean isVisible() {
69
        // TODO Auto-generated method stub
70
        return false;
71
    }
72

  
73
}
0 74

  
branches/gvSIG_WFS04/extensions/extWFS/src/com/iver/cit/gvsig/wfs/gui/wfswizard/WFSDataSourceAdapter.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 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.wfs.gui.wfswizard;
42

  
43
import java.awt.geom.Rectangle2D;
44
import java.io.IOException;
45
import java.net.URL;
46
import java.util.HashMap;
47
import java.util.Map;
48

  
49
import org.exolab.castor.xml.ValidationException;
50
import org.geotools.data.DataStore;
51
import org.geotools.data.wfs.WFSDataStoreFactory;
52

  
53
import com.iver.cit.gvsig.gui.wizards.LayerInfo;
54
import com.iver.cit.gvsig.gui.wizards.WizardData;
55
import com.iver.cit.gvsig.gui.wizards.WizardDataSource;
56
import com.iver.wmsclient.UnsupportedVersionException;
57
/**
58
 * Adaptador del dataSource.
59
 * 
60
 * @author Vicente Caballero Navarro
61
 */
62
public class WFSDataSourceAdapter implements WizardDataSource {
63
	private String urlS=null;//"http://localhost:8080/geoserver/wfs";
64
	private String versionS=null;//"version=1.0.0";
65
	private String requestS=null;//"request=getcapabilities";
66
	private String serviceS=null;//"service=wfs";
67
	private String userS=null;//"admin";
68
	private String pwdS=null;//"geoserver";
69
	private String[] layersS;
70
	private boolean protocolS=true;
71
	private int numFeaturesS=100;
72
	private int timeoutS=10000;
73
	
74
	public void setData(String user,String pwd,boolean protocol,int numFeatures,int timeout){
75
		userS=user;
76
		pwdS=pwd;
77
		protocolS=protocol;
78
		numFeaturesS=numFeatures;
79
		timeoutS=timeout;
80
	}
81
	public WizardData detalles(URL host)throws IllegalStateException,
82
	ValidationException, UnsupportedVersionException, IOException{
83
		
84
		DataStore ds=null;	
85
		URL url=host;
86
		//int timeout=10000;
87
		//boolean protocol=true;
88
			
89
         Map m = new HashMap();
90
         m.put(WFSDataStoreFactory.URL.key,url);
91
         m.put(WFSDataStoreFactory.TIMEOUT.key,new Integer(timeoutS));
92
         m.put(WFSDataStoreFactory.PROTOCOL.key,new Boolean(protocolS));
93
		 m.put(WFSDataStoreFactory.PASSWORD.key,pwdS);
94
		 m.put(WFSDataStoreFactory.USERNAME.key,userS);
95
		 m.put(WFSDataStoreFactory.BUFFER_SIZE.key,new Integer(numFeaturesS));
96
        //try {
97
			ds = (new WFSDataStoreFactory()).createNewDataStore(m);
98
		//} catch (IOException e) {
99
		//	e.printStackTrace();
100
		//}
101
		String[] names=null;
102
		try {
103
			names = ds.getTypeNames();
104
		} catch (IOException e1) {
105
			e1.printStackTrace();
106
		}
107
		//System.out.println("Capas :");
108
		WizardData data = new WizardData();
109
		LayerInfo root = new LayerInfo();
110
		root.text = "Capas";//l.getTitle().getContent();
111
        root.name = "Nombre";//name.getContent();
112
		for (int i=0;i<names.length;i++){
113
			System.out.println("Capa "+i+" : "+names[i]);
114
			LayerInfo hijo = new LayerInfo();
115
			hijo.text = names[i];//l.getTitle().getContent();
116
	        hijo.name = names[i];//name.getContent();
117
			root.hijos.add(hijo);
118
			
119
			
120
		}
121
		data.setLayer(root);
122
		return data;
123
		
124
	}
125
	
126
	public Rectangle2D getBoundingBox(String[] layerName, String srs) {
127
		return null;
128
	}
129

  
130
}
0 131

  
branches/gvSIG_WFS04/extensions/extWFS/src/com/iver/cit/gvsig/wfs/gui/wfswizard/WizardWFS.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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
/*
42
 * Created on 23-abr-2004
43
 *
44
 * To change the template for this generated file go to
45
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
46
 */
47
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
48
 *
49
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
50
 *
51
 * This program is free software; you can redistribute it and/or
52
 * modify it under the terms of the GNU General Public License
53
 * as published by the Free Software Foundation; either version 2
54
 * of the License, or (at your option) any later version.
55
 *
56
 * This program is distributed in the hope that it will be useful,
57
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
58
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
59
 * GNU General Public License for more details.
60
 *
61
 * You should have received a copy of the GNU General Public License
62
 * along with this program; if not, write to the Free Software
63
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
64
 *
65
 * For more information, contact:
66
 *
67
 *  Generalitat Valenciana
68
 *   Conselleria d'Infraestructures i Transport
69
 *   Av. Blasco Ib??ez, 50
70
 *   46010 VALENCIA
71
 *   SPAIN
72
 *
73
 *      +34 963862235
74
 *   gvsig@gva.es
75
 *      www.gvsig.gva.es
76
 *
77
 *    or
78
 *
79
 *   IVER T.I. S.A
80
 *   Salamanca 50
81
 *   46005 Valencia
82
 *   Spain
83
 *
84
 *   +34 963163400
85
 *   dac@iver.es
86
 */
87
package com.iver.cit.gvsig.wfs.gui.wfswizard;
88

  
89
import java.awt.BorderLayout;
90
import java.awt.Component;
91
import java.io.IOException;
92
import java.net.MalformedURLException;
93
import java.net.URL;
94
import java.util.ArrayList;
95

  
96
import javax.swing.DefaultComboBoxModel;
97
import javax.swing.JButton;
98
import javax.swing.JLabel;
99
import javax.swing.JOptionPane;
100
import javax.swing.JPanel;
101
import javax.swing.JPasswordField;
102
import javax.swing.JRadioButton;
103
import javax.swing.JScrollPane;
104
import javax.swing.JTextField;
105
import javax.swing.ListModel;
106
import javax.swing.tree.DefaultTreeSelectionModel;
107
import javax.swing.tree.TreePath;
108
import javax.swing.tree.TreeSelectionModel;
109

  
110
import org.apache.log4j.Logger;
111
import org.cresques.cts.IProjection;
112
import org.cresques.cts.ProjectionPool;
113
import org.exolab.castor.xml.ValidationException;
114

  
115
import com.iver.andami.PluginServices;
116
import com.iver.cit.gvsig.fmap.drivers.wfs.WFSDriver;
117
import com.iver.cit.gvsig.fmap.layers.FLayer;
118
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
119
import com.iver.cit.gvsig.gui.WizardPanel;
120
import com.iver.cit.gvsig.gui.wizards.LayerInfo;
121
import com.iver.cit.gvsig.gui.wizards.LayerListModel;
122
import com.iver.cit.gvsig.gui.wizards.LayerTreeModel;
123
import com.iver.cit.gvsig.gui.wizards.WizardData;
124
import com.iver.cit.gvsig.gui.wizards.WizardDataSource;
125
import com.iver.cit.gvsig.gui.wizards.WizardListener;
126
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport;
127
import com.iver.utiles.NotExistInXMLEntity;
128
import com.iver.utiles.XMLEntity;
129
import com.iver.utiles.swing.JComboBox;
130
import com.iver.wmsclient.UnsupportedVersionException;
131
/**
132
 * DOCUMENT ME!
133
 *
134
 * @author Vicente Caballero Navarro
135
 */
136
public class WizardWFS extends WizardPanel {
137
	private static Logger logger = Logger.getLogger(WizardWFS.class.getName());
138
	private int page = 0;
139
	private boolean conectado = false;
140
	private javax.swing.JPanel jContentPane = null;
141
	private JComboBox cmbHost = null;
142
	private javax.swing.JPanel panelPage1 = null;
143
	private LayerListModel selectedLayersModel = new LayerListModel();
144
	private javax.swing.JPanel jPanel1 = null;
145
	private WizardListenerSupport listenerSupport = new WizardListenerSupport();
146
	private WizardDataSource dataSource;
147
	private JPanel jPanel = null;
148
	private JLabel jLabel = null;
149
	private JTextField jTxtUser = null;
150
	private JLabel jLabel1 = null;
151
	private JPasswordField jTxtPassword = null;
152
	private JRadioButton jRadioButton = null;
153
	private JRadioButton jRadioButton1 = null;
154
	private JTextField jTxtnumfeatures = null;
155
	private JLabel jLabel2 = null;
156
	private JLabel jLabel3 = null;
157
	private JTextField jTxttimeout = null;
158
	private JButton jButton = null;
159
	private JButton jButton1 = null;
160
	private JScrollPane jScrollPane = null;
161
	private javax.swing.JTree treeLayers1 = null;
162
	private JPanel panePage2 = null;
163
	private String versionS="version=1.0.0";
164
	private String requestS="request=getcapabilities";
165
	private String serviceS="service=wfs";
166
	private LayerListModel modelo;
167
	/**
168
	 * This is the default constructor
169
	 */
170
	public WizardWFS() {
171
		super();
172
		initialize();
173
	}
174

  
175
	/**
176
	 * This method initializes this
177
	 */
178
	private void initialize() {
179
		setTabName("WFS");
180
		this.setSize(510, 311);
181
		this.setLayout(null);
182
		this.setPreferredSize(new java.awt.Dimension(750, 320));
183
		this.setVisible(true);
184
		this.add(getPanePage2(), null);
185
		this.add(getJButton1(), null);
186
		this.add(getJButton(), null);
187
		this.add(getPanelPage1(), null);
188
		//JRadioButtonMenuItem jrmi=new JRadioButtonMenuItem();
189
		//jrmi.add(getJRadioButton());
190
		//jrmi.add(getJRadioButton1());
191
		//this.add(jrmi);
192
		listenerSupport.callStateChanged(true);
193
		// activarVisualizarBotones();
194
	}
195

  
196

  
197

  
198
	/**
199
	 * DOCUMENT ME!
200
	 *
201
	 * @param host DOCUMENT ME!
202
	 */
203
	private void addHost(String host) {
204
		host = host.trim();
205

  
206
		DefaultComboBoxModel model = (DefaultComboBoxModel) getTxtHost()
207
																.getModel();
208

  
209
		if (model.getIndexOf(host) < 0) {
210
			model.addElement(host);
211

  
212
			PluginServices ps = PluginServices.getPluginServices(this);
213
			XMLEntity xml = ps.getPersistentXML();
214

  
215
			try {
216
				String[] servers = xml.getStringArrayProperty("wms-servers");
217
				String[] newServers = new String[servers.length + 1];
218
				System.arraycopy(servers, 0, newServers, 0, servers.length);
219
				newServers[servers.length] = host;
220
				xml.putProperty("wfs-servers", newServers);
221
			} catch (NotExistInXMLEntity e) {
222
				xml.putProperty("wfs-servers", new String[] { host });
223
			}
224

  
225
			ps.setPersistentXML(xml);
226
		}
227
	}
228

  
229
	
230
	
231
	/**
232
	 * This method initializes txtHost
233
	 *
234
	 * @return javax.swing.JTextField
235
	 */
236
	private javax.swing.JComboBox getTxtHost() {
237
		if (cmbHost == null) {
238
			cmbHost = new JComboBox();
239
			cmbHost.setModel(new DefaultComboBoxModel());
240
			cmbHost.setPreferredSize(new java.awt.Dimension(350, 20));
241
			cmbHost.setEditable(true);
242

  
243
			XMLEntity xml = PluginServices.getPluginServices(this)
244
										  .getPersistentXML();
245
			if (xml == null)
246
				xml = new XMLEntity();
247
			String[] servers = null;
248
			if (!xml.contains("wfs-servers")) {
249
				servers = new String[1];
250
				servers[0] = "http://localhost:8080/geoserver/wfs";
251

  
252
				xml.putProperty("wfs-servers", servers);
253
			}
254

  
255
			try {
256
				servers = xml.getStringArrayProperty("wfs-servers");
257

  
258
				for (int i = 0; i < servers.length; i++) {
259
					((DefaultComboBoxModel) cmbHost.getModel()).addElement(servers[i]);
260
				}
261
			} catch (NotExistInXMLEntity e) {
262
			}
263
		}
264

  
265
		return cmbHost;
266
	}
267

  
268
	/**
269
	 * This method initializes panelPage1
270
	 *
271
	 * @return javax.swing.JPanel
272
	 */
273
	private javax.swing.JPanel getPanelPage1() {
274
		if (panelPage1 == null) {
275
			panelPage1 = new javax.swing.JPanel();
276
			panelPage1.setLayout(new BorderLayout());
277
			panelPage1.setPreferredSize(new java.awt.Dimension(480, 220));
278
			panelPage1.setVisible(true);
279
			panelPage1.setBounds(15, 5, 480, 262);
280
			panelPage1.add(getJPanel1(), java.awt.BorderLayout.NORTH);
281
			panelPage1.add(getJPanel(), java.awt.BorderLayout.CENTER);
282
		}
283

  
284
		return panelPage1;
285
	}
286

  
287
	/**
288
	 * This method initializes jPanel1
289
	 *
290
	 * @return javax.swing.JPanel
291
	 */
292
	private javax.swing.JPanel getJPanel1() {
293
		if (jPanel1 == null) {
294
			jPanel1 = new javax.swing.JPanel();
295
			jPanel1.add(getTxtHost(), null);
296
			jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(
297
					null, PluginServices.getText(this, "Cadena de conexi?n"),
298
					javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
299
					javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
300
		}
301

  
302
		return jPanel1;
303
	}
304

  
305
	/**
306
	 * DOCUMENT ME!
307
	 *
308
	 * @param listener
309
	 */
310
	public void addWizardListener(WizardListener listener) {
311
		listenerSupport.addWizardListener(listener);
312
	}
313

  
314
	/**
315
	 * DOCUMENT ME!
316
	 *
317
	 * @param listener
318
	 */
319
	public void removeWizardListener(WizardListener listener) {
320
		listenerSupport.removeWizardListener(listener);
321
	}
322

  
323
	/**
324
	 * DOCUMENT ME!
325
	 *
326
	 * @return
327
	 */
328
	public WizardDataSource getDataSource() {
329
		return dataSource;
330
	}
331

  
332
	/**
333
	 * DOCUMENT ME!
334
	 *
335
	 * @param source
336
	 */
337
	public void setDataSource(WizardDataSource source) {
338
		dataSource = source;
339
	}
340

  
341

  
342

  
343

  
344

  
345
	public String getUrlConnect() {
346
			return cmbHost.getModel().getSelectedItem().toString();
347
	}
348
	public String getUser() {
349
		return jTxtUser.getText();
350
	}
351
	public String getPassword() {
352
		return jTxtPassword.getText();
353
	}
354
	public String getLayerName(){
355
		return getLayers()[0];//getLstSelectedLayers().getModel().toString();
356
	}
357
	public String[] getLayers(){
358
		ListModel listModel= modelo;
359
		String[] layers=new String[listModel.getSize()];
360
		for (int i=0;i<listModel.getSize();i++){
361
			layers[i]=listModel.getElementAt(i).toString();
362
		}
363
		return layers;
364
	}
365
	public WFSDriver getWFSDriver(){
366
		return null;// new FMapWFSDriver();
367
	}
368
	public URL getHost(){
369
		 String urlS="http://localhost:8080/geoserver/wfs";
370
			String versionS="version=1.0.0";
371
			String requestS="request=getcapabilities";
372
			String serviceS="service=wfs";
373
			URL url=null;
374
			try {
375
				url = new URL(urlS+"?"+versionS+"&"+requestS+"&"+serviceS);
376
			} catch (MalformedURLException e) {
377
				e.printStackTrace();
378
			}
379
		return url;
380
	}
381
	public IProjection getProjection(){
382
		return ProjectionPool.get("EPSG:23030");
383
	}
384
	/**
385
	 * This method initializes jPanel	
386
	 * 	
387
	 * @return javax.swing.JPanel	
388
	 */    
389
	private JPanel getJPanel() {
390
		if (jPanel == null) {
391
			jLabel3 = new JLabel();
392
			jLabel3.setBounds(241, 157, 121, 18);
393
			jLabel3.setText("Timeout");
394
			jLabel2 = new JLabel();
395
			jLabel2.setBounds(241, 129, 121, 18);
396
			jLabel2.setText("N. Features buffer");
397
			jPanel = new JPanel();
398
			jLabel = new JLabel();
399
			jLabel1 = new JLabel();
400
			jPanel.setLayout(null);
401
			jLabel.setText("Usuario:");
402
			jLabel.setName("jLabel");
403
			jLabel.setSize(80, 19);
404
			jLabel.setLocation(151, 12);
405
			jLabel1.setBounds(149, 41, 82, 19);
406
			jLabel1.setText("Contrase?a:");
407
			jPanel.add(getJTxttimeout(), null);
408
			jPanel.add(jLabel3, null);
409
			jPanel.add(jLabel2, null);
410
			jPanel.add(getJTxtnumfeatures(), null);
411
			jPanel.add(getJRadioButton1(), null);
412
			jPanel.add(getJRadioButton(), null);
413
			jPanel.add(jLabel, null);
414
			jPanel.add(getJTxtUser(), null);
415
			jPanel.add(jLabel1, null);
416
			jPanel.add(getJTxtPassword(), null);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff