Revision 2247

View differences:

branches/gvSIG_GisPlanet/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFrameView.java
514 514
		if (!hasIndex) {
515 515
			xml.putProperty("indice", -1);
516 516
		}
517
		if (getFMap()!=null){
517
		if (getFMap()!=null && getFMap().getViewPort().getExtent()!=null){
518 518
			xml.putProperty("extentX", getFMap().getViewPort().getExtent().getX());
519 519
			xml.putProperty("extentY", getFMap().getViewPort().getExtent().getY());
520 520
			xml.putProperty("extentW",
branches/gvSIG_GisPlanet/applications/appgvSIG/src/com/iver/cit/gvsig/gui/legendmanager/panels/FPanelLegendBreaks.java
531 531
			for (int i = 0; i < rs.getFieldCount(); i++) {
532 532
				//TODO deber?a de existir un getFieldType
533 533
				val = rs.getFieldValue(0,i);
534
				if (val.getClass() == NullValue.class) continue;
534
				if (val==null || val.getClass() == NullValue.class ) continue;
535 535
				if ((val.getClass() == IntValue.class) ||
536 536
						(val.getClass() == DoubleValue.class) ||
537 537
						(val.getClass() == FloatValue.class) ||
branches/gvSIG_GisPlanet/applications/appgvSIG/src/com/iver/cit/gvsig/gui/legendmanager/panels/FPanelLegendValues.java
251 251
				if (auxLegend.getSymbolByValue(clave) == null) {
252 252
					//si no esta creado el simbolo se crea
253 253
					theSymbol = new FSymbol(m_lyr.getShapeType());
254
									
254
					if (clave==null){
255
						theSymbol.setDescription("");				
256
					}else{
255 257
					theSymbol.setDescription(clave.toString());
256 258
					auxLegend.addSymbol(clave,theSymbol);
257
									
259
					}		
258 260
					numSymbols++;
259 261
	
260 262
					if (numSymbols > 100) {
branches/gvSIG_GisPlanet/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toolListeners/InfoListener.java
292 292

  
293 293
				for (int k = 0; k < ds.getFieldCount();
294 294
						k++) {
295
					if (ds.getFieldValue(j,k)!=null){
295 296
					ai.addAttribute("",
296 297
						ds.getFieldName(k), "",
297 298
						"xs:string",
298 299
						ds.getFieldValue(j, k).toString());
300
					}else{
301
						ai.addAttribute("",
302
								ds.getFieldName(k), "",
303
								"xs:string",
304
								"");
305
					}
306
					
299 307
				}
300 308

  
301 309
				handler.startElement("", "",
branches/gvSIG_GisPlanet/applications/appgvSIG/src/com/iver/cit/gvsig/gui/wizards/WFSWizard.java
110 110
import com.iver.utiles.NotExistInXMLEntity;
111 111
import com.iver.utiles.XMLEntity;
112 112
import com.iver.utiles.swing.JComboBox;
113
import com.iver.wmsclient.UnsupportedVersionException;
113 114

  
114 115
import org.apache.log4j.Logger;
115 116
import org.cresques.cts.IProjection;
116 117
import org.cresques.cts.ProjectionPool;
118
import org.exolab.castor.xml.ValidationException;
117 119

  
118 120
import java.awt.geom.Rectangle2D;
119 121

  
122
import java.io.IOException;
120 123
import java.net.MalformedURLException;
121 124
import java.net.URL;
122 125

  
......
139 142
import javax.swing.JLabel;
140 143
import java.awt.BorderLayout;
141 144
import java.awt.CardLayout;
145
import java.awt.Component;
142 146
import java.awt.GridLayout;
147

  
148
import javax.swing.JOptionPane;
143 149
import javax.swing.JPasswordField;
144 150
import javax.swing.JCheckBox;
145 151
import javax.swing.JRadioButton;
......
544 550
					//getPanelPage1().setVisible(true);
545 551
					//getPanePage2().setVisible(false);
546 552
					activarVisualizarBotones();
553
					conectado=true;
547 554
				}
548 555
			});
549 556
		}
......
562 569
			jButton1.setText(PluginServices.getText(this, "siguiente"));
563 570
			jButton1.addActionListener(new java.awt.event.ActionListener() {
564 571
				public void actionPerformed(java.awt.event.ActionEvent e) {
572
					try{
565 573
					page++;
566 574
					rellenarControles();
567 575
					//getPanelPage1().setVisible(false);
568 576
					//getPanePage2().setVisible(true);
569 577
					activarVisualizarBotones();
578
					} catch (Exception e1) {
579
						JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),"Servidor WFS no v?lido.");
580
						page--;
581
						listenerSupport.callError(e1);
582
					}
570 583
				}
571 584
			});
572 585
		}
......
582 595
			
583 596
			getJButton().setEnabled(false);
584 597
			getJButton1().setVisible(true);
585

  
598
			
586 599
			if (conectado) {
587 600
				getJButton1().setEnabled(true);
588 601
			} else {
......
710 723
		}
711 724
		/**
712 725
		 * DOCUMENT ME!
726
		 * @throws IOException 
727
		 * @throws UnsupportedVersionException 
728
		 * @throws MalformedURLException 
729
		 * @throws ValidationException 
730
		 * @throws IllegalStateException 
713 731
		 */
714
		private void rellenarControles() {
715
			try {
732
		private void rellenarControles() throws IllegalStateException, ValidationException, MalformedURLException, UnsupportedVersionException, IOException {
716 733
				String host = cmbHost.getModel().getSelectedItem().toString();
717 734
				((WFSDataSourceAdapter)dataSource).setData(getUser(),getPassword(),getProtocol(),getNumFeatures(),getTimeout());
718 735
				WizardData data = dataSource.detalles(new URL(host+"?"+versionS+"&"+requestS+"&"+serviceS));
719 736

  
720 737
				addHost(host);
721
				//modelo.clear();
722
				//getTreeLayers1().repaint();
723
				//((LayerListModel) lstSelectedLayers.getModel()).clear();
724
				//lstSelectedLayers.repaint();
725
				//lblTitle.setText(data.getTitle());
726
				//txtAbstract.setText(data.getAbstract());
727
				//lstFormats1.setModel(new FormatListModel(data.getFormats()));
728 738
				treeLayers1.setModel(new LayerTreeModel(data.getLayer()));
729 739
				conectado = true;
730
				//activarVisualizarBotones();
731
			} catch (Exception e) {
732
				listenerSupport.callError(e);
733
			}
740
			
734 741
		}
735 742

  
736 743
		/**
......
788 795
				//String fields = wfs.getSqlFields();
789 796
				//String whereClause = dbWiz.getSqlWhere();
790 797
				WFSDriver driver = new WFSDriver();
798
				try{
791 799
				driver.setData(url,user,pwd,layers,protocol,numfeatures,timeout,2);
800
				}catch (IOException e) {
801
					JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),"Fallo de la conexi?n con el servidor");
802
					return null;
803
				}
792 804
				return LayerFactory.createWFSLayer(layerName,driver,wfs.getHost(),
793 805
						wfs.getProjection());
794 806
			}
branches/gvSIG_GisPlanet/applications/appgvSIG/src/com/iver/cit/gvsig/gui/wfs/WFSDataSourceAdapter.java
93 93
		 m.put(WFSDataStoreFactory.PASSWORD.key,pwdS);
94 94
		 m.put(WFSDataStoreFactory.USERNAME.key,userS);
95 95
		 m.put(WFSDataStoreFactory.BUFFER_SIZE.key,new Integer(numFeaturesS));
96
        try {
96
        //try {
97 97
			ds = (new WFSDataStoreFactory()).createNewDataStore(m);
98
		} catch (IOException e) {
99
			e.printStackTrace();
100
		}
98
		//} catch (IOException e) {
99
		//	e.printStackTrace();
100
		//}
101 101
		String[] names=null;
102 102
		try {
103 103
			names = ds.getTypeNames();
branches/Fmap_GisPlanet/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/WFSStrategy.java
42 42

  
43 43
import java.awt.Graphics2D;
44 44
import java.awt.image.BufferedImage;
45
import java.io.IOException;
45 46
import java.sql.SQLException;
46 47

  
47 48
import org.cresques.cts.ICoordTrans;
......
91 92
		FBitSet bitSet = selection.getSelection();
92 93
        
93 94
        String strEPSG = viewPort.getProjection().getAbrev().substring(5);
94
        IFeatureIterator geomIt = wfsAdapter.getFeatureIterator(viewPort.getAdjustedExtent(), strEPSG);
95
        IFeatureIterator geomIt=null;
96
        try{
97
        geomIt = wfsAdapter.getFeatureIterator(viewPort.getAdjustedExtent(), strEPSG);
98
        }catch (IOException e) {
99
			throw new DriverException(e);
100
		}
95 101
        VectorialLegend l = (VectorialLegend) ((ClassifiableVectorial) capa).getLegend();
96 102
        int i;
97 103
        FSymbol symbol;
branches/Fmap_GisPlanet/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/WFSAdapter.java
91 91
		    ((IWFSdriver)driver).close();
92 92
		}
93 93

  
94
		public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException
94
		public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException, IOException
95 95
		{
96 96
		    return ((IWFSdriver)driver).getFeatureIterator(r, strEPSG);
97 97
		}
branches/Fmap_GisPlanet/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/wfs/IWFSdriver.java
40 40
*/
41 41
package com.iver.cit.gvsig.fmap.drivers.wfs;
42 42
import java.awt.geom.Rectangle2D;
43
import java.io.IOException;
43 44
import java.net.URL;
44 45
import java.sql.Connection;
45 46

  
......
56 57
     * @param fields (Todos los campos, el primero ha de ser el de las geometr?as
57 58
     * @param whereClause
58 59
     * @param id_FID_field El identificador del campo que contiene una clave ?nica. 1=> primer campo, 2 => segundo campo, etc
60
     * @throws IOException 
59 61
     * 
60 62
     */
61
    public void setData(String url,String user,String pwd,String[] layers,boolean protocol,int numFeatures,int timeout,int id_FID_field);
63
    public void setData(String url,String user,String pwd,String[] layers,boolean protocol,int numFeatures,int timeout,int id_FID_field) throws IOException;
62 64
    public Rectangle2D getFullExtent();
63 65
    // public int getShapeType();
64 66
    public IGeometry getShape(int index);
65 67
    public URL getHost();
66 68
    //public IFeatureIterator getFeatureIterator(String sql) throws DriverException;
67
    public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException;
69
    public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException,IOException;
68 70
	//public String getFields();
69 71
	//public String getWhereClause();
70 72
	public void close();
branches/Fmap_GisPlanet/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/wfs/WFSDriver.java
41 41
package com.iver.cit.gvsig.fmap.drivers.wfs;
42 42

  
43 43
import com.hardcode.gdbms.engine.data.driver.ObjectDriver;
44
import com.hardcode.gdbms.engine.data.edition.DataWare;
44 45
import com.hardcode.gdbms.engine.values.Value;
45 46

  
46 47
import com.iver.cit.gvsig.fmap.DriverException;
......
67 68

  
68 69
import java.io.IOException;
69 70

  
71
import java.net.ConnectException;
70 72
import java.net.MalformedURLException;
71 73
import java.net.URL;
72 74

  
......
77 79
import java.util.Hashtable;
78 80
import java.util.Map;
79 81

  
82
import javax.swing.JOptionPane;
80 83

  
84

  
81 85
/**
82 86
 * Driver de WFS, utilizando DataStore de geotools.
83 87
 *
......
182 186
	 * @return DOCUMENT ME!
183 187
	 *
184 188
	 * @throws DriverException DOCUMENT ME!
189
	 * @throws IOException 
185 190
	 */
186 191
	public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG)
187
		throws DriverException {
192
		throws DriverException, IOException {
188 193
		WFSFeatureIterator geomIterator = null;
189 194

  
190 195
		/*if (r!=null && extent.contains(r)){
......
207 212
		Query query = new DefaultQuery(layersS[0]);
208 213
		FeatureReader fr = null;
209 214

  
210
		try {
215
		
211 216
			fr = ds.getFeatureReader(query, Transaction.AUTO_COMMIT);
212 217

  
213 218
			if (numField == -1) {
214 219
				numField = fr.getFeatureType().getAttributeCount();
215 220
				attributes = fr.getFeatureType().getAttributeTypes();
216 221
			}
217
		} catch (IOException e) {
218
			e.printStackTrace();
219
		}
220

  
222
		
221 223
		geomIterator = new WFSFeatureIterator(fr);
222 224
		return geomIterator;
223 225
	}
......
284 286
	 * Recorre el recordset creando una tabla Hash que usaremos para
285 287
	 * relacionar el n?mero de un registro con su identificador ?nico. Debe
286 288
	 * ser llamado en el setData justo despu?s de crear el recorset principal
289
	 * @throws IOException 
287 290
	 */
288
	protected void doRelateID_FID() {
291
	protected void doRelateID_FID() throws IOException {
289 292
		if (ds == null) {
290 293
			URL url = null;
291 294

  
......
385 388
	 * @param numFeatures DOCUMENT ME!
386 389
	 * @param timeout DOCUMENT ME!
387 390
	 * @param id_FID_field DOCUMENT ME!
391
	 * @throws IOException 
388 392
	 */
389 393
	public void setData(String url, String user, String pwd, String[] layers,
390
		boolean protocol, int numFeatures, int timeout, int id_FID_field) {
394
		boolean protocol, int numFeatures, int timeout, int id_FID_field) throws IOException {
391 395
		idFID_FieldName = id_FID_field;
392 396
		urlS = url;
393 397
		userS = user;
......
437 441
		                   e.printStackTrace();
438 442
		           }
439 443
		 */
440
		return ((IFeature) features.get((int) arg0)).getAttribute(arg1 + 1);
444
		return ((IFeature) features.get((int) arg0)).getAttribute(arg1);
441 445
	}
442 446

  
443 447
	/**
......
449 453
	 */
450 454
	public int getFieldCount()
451 455
		throws com.hardcode.gdbms.engine.data.driver.DriverException {
452
		return numField - 1;
456
		return numField;
453 457
	}
454 458

  
455 459
	/**
......
463 467
	 */
464 468
	public String getFieldName(int arg0)
465 469
		throws com.hardcode.gdbms.engine.data.driver.DriverException {
466
		return attributes[arg0+1].getName();
470
		return attributes[arg0].getName();
467 471
	}
468 472

  
469 473
	/**
......
500 504
    public int[] getPrimaryKeys() throws com.hardcode.gdbms.engine.data.driver.DriverException {
501 505
        throw new UnsupportedOperationException();
502 506
    }
507

  
508
    /**
509
     * @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#write(com.hardcode.gdbms.engine.data.edition.DataWare)
510
     */
511
    public void write(DataWare arg0) throws com.hardcode.gdbms.engine.data.driver.DriverException {
512
        // TODO Auto-generated method stub
513
        
514
    }
503 515
}

Also available in: Unified diff