Revision 3619

View differences:

tags/extWMS_gvSIG0_5/extensions/extWMS/src/com/iver/cit/gvsig/fmap/services/OGCWMSService.java
1
/*
2
 * Created on 30-may-2005
3
 */
4
package com.iver.cit.gvsig.fmap.services;
5

  
6
import java.awt.Image;
7
import java.awt.geom.Rectangle2D;
8
import java.io.IOException;
9
import java.net.ProtocolException;
10
import java.net.URL;
11
import java.util.ArrayList;
12

  
13
import com.iver.cit.gvsig.fmap.drivers.WMSException;
14
import com.iver.wmsclient.WMSClient;
15

  
16
/**
17
 * @author luisw
18
 */
19
public interface OGCWMSService extends OGCService {
20
	public void setClient(WMSClient client);
21
	public String getLabel();
22
	public String getDescription();
23
	
24
	void getCapabilities(URL servidor) throws
25
		WMSException, IOException, ProtocolException;
26
	
27
	Image getMap(com.iver.wmsclient.MapQuery mapQuery)
28
	throws WMSException, IOException, ProtocolException;
29
	
30
	public String [] getLayerNames();
31

  
32
	/**
33
	 * Obtiene la etiqueta de una capa espec?fica
34
	 * @param nombre de la capa (string)
35
	 * @return string
36
	 */
37
	public String getLabel(String layerName);	
38

  
39
	/**
40
	 * Obtiene la descripci?n de una capa espec?fica
41
	 * @param Nombre de la capa (string)
42
	 * @return string
43
	 */
44
	public String getLayerDescription(String layerName);
45

  
46
	/**
47
	 * Obtiene los SRS de una capa espec?fica
48
	 * @param Nombre de la capa (string)
49
	 * @return ArrayList
50
	 */
51
	public ArrayList getSRSs(String layerName);
52
	public Rectangle2D getFullExtent(String layerName, String srs);
53
	public ArrayList getFormats(String layerName);	
54
}
0 55

  
tags/extWMS_gvSIG0_5/extensions/extWMS/src/com/iver/cit/gvsig/fmap/drivers/WMSDriver.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;
42

  
43
import java.awt.Image;
44
import java.io.IOException;
45
import java.net.ProtocolException;
46
import java.net.URL;
47

  
48

  
49
/**
50
 * Interfaz Driver para WMS.
51
 *
52
 * @author $author$
53
 */
54
public interface WMSDriver {
55
	/**
56
	 * Obtiene las posibilidades del servidor a partir de una URL.
57
	 *
58
	 * @param servidor URL.
59
	 *
60
	 * @throws WMSException 
61
	 * @throws IOException 
62
	 * @throws ProtocolException 
63
	 */
64
	void getCapabilities(URL servidor)
65
		throws WMSException, IOException, ProtocolException;
66

  
67
	/**
68
	 * Devuelve la imagen a partir de MapQuery.
69
	 *
70
	 * @param mapQuery MapQuery.
71
	 *
72
	 * @return Image.
73
	 *
74
	 * @throws WMSException 
75
	 * @throws IOException 
76
	 * @throws ProtocolException 
77
	 */
78
	Image getMap(com.iver.wmsclient.MapQuery mapQuery)
79
		throws WMSException, IOException, ProtocolException;
80

  
81
	//    String getFeatureInfo(InfoQuery infoQuery) throws WMSException, IOException, ProtocolException;
82
}
0 83

  
tags/extWMS_gvSIG0_5/extensions/extWMS/src/com/iver/cit/gvsig/fmap/drivers/WMSException.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;
42

  
43
/**
44
 * Excepci?n provocada por el WMS.
45
 *
46
 * @author Vicente Caballero Navarro
47
 */
48
public class WMSException extends Exception {
49
	/**
50
	 *
51
	 */
52
	public WMSException() {
53
		super();
54
	}
55

  
56
	/**
57
	 * Crea WMSException.
58
	 *
59
	 * @param message
60
	 */
61
	public WMSException(String message) {
62
		super(message);
63
	}
64

  
65
	/**
66
	 * Crea WMSException.
67
	 *
68
	 * @param message
69
	 * @param cause
70
	 */
71
	public WMSException(String message, Throwable cause) {
72
		super(message, cause);
73
	}
74

  
75
	/**
76
	  * Crea WMSException.
77
	 *
78
	 * @param cause
79
	 */
80
	public WMSException(Throwable cause) {
81
		super(cause);
82
	}
83
}
0 84

  
tags/extWMS_gvSIG0_5/extensions/extWMS/src/com/iver/cit/gvsig/fmap/drivers/wms/FMapWMSDriver.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.wms;
42

  
43
import com.iver.cit.gvsig.fmap.drivers.WMSDriver;
44
import com.iver.cit.gvsig.fmap.drivers.WMSException;
45

  
46
import com.iver.wmsclient.Capabilities;
47
import com.iver.wmsclient.FeatureInfoQuery;
48
import com.iver.wmsclient.MapQuery;
49
import com.iver.wmsclient.UnsupportedVersionException;
50
import com.iver.wmsclient.WMSClient;
51
import com.iver.wmsclient.WMSClientFactory;
52

  
53
import org.exolab.castor.xml.ValidationException;
54

  
55
import java.awt.Image;
56
import java.awt.image.BufferedImage;
57

  
58
import java.io.ByteArrayInputStream;
59
import java.io.IOException;
60

  
61
import java.net.ProtocolException;
62
import java.net.URL;
63

  
64
import javax.imageio.ImageIO;
65

  
66

  
67
/**
68
 * Driver WMS.
69
 *
70
 * @author Vicente Caballero Navarro
71
 */
72
public class FMapWMSDriver implements WMSDriver {
73
	private MapQuery lastMapQuery;
74
	private WMSClient client;
75

  
76
	/**
77
	 * @see com.iver.cit.gvsig.fmap.drivers.WMSDriver#getCapabilities(java.net.URL)
78
	 */
79
	public void getCapabilities(URL servidor)
80
		throws WMSException, IOException, ProtocolException {
81
		try {
82
			Capabilities c = getClient(servidor).getCapabilities(servidor);
83
		} catch (UnsupportedVersionException e) {
84
			throw new WMSException(e);
85
		}
86
	}
87

  
88
	/**
89
	 * @see com.iver.cit.gvsig.fmap.drivers.WMSDriver#getMap(com.iver.cit.gvsig.fmap.drivers.wms.MapQuery)
90
	 */
91
	public Image getMap(MapQuery mapQuery)
92
		throws WMSException, IOException, ProtocolException {
93
		BufferedImage image = new BufferedImage(mapQuery.getWidth(),
94
				mapQuery.getHeight(), BufferedImage.TYPE_INT_ARGB);
95

  
96
		try {
97
			byte[] res = client.doMapQuery(mapQuery);
98
			ByteArrayInputStream inbytes = new ByteArrayInputStream(res);
99
			image = ImageIO.read(inbytes);
100

  
101
			return image;
102
		} catch (ValidationException e) {
103
			throw new ProtocolException();
104
		} catch (com.iver.wmsclient.WMSException e) {
105
			throw new WMSException(e);
106
		} catch (NoSuchFieldException e) {
107
			throw new RuntimeException(
108
				"No se incluyeron todos los campos necesarios de la petici?n");
109
		}
110
	}
111

  
112
	/**
113
	 * @see com.iver.cit.gvsig.fmap.drivers.WMSDriver#getFeatureInfo(com.iver.cit.gvsig.fmap.drivers.wms.InfoQuery)
114
	 */
115
	public String getFeatureInfo(FeatureInfoQuery infoQuery)
116
		throws WMSException, IOException, ProtocolException {
117
		return null;
118
	}
119

  
120
	/**
121
	 * Devuelve WMSClient a partir de su URL.
122
	 *
123
	 * @param url URL.
124
	 *
125
	 * @return WMSClient.
126
	 *
127
	 * @throws UnsupportedVersionException
128
	 * @throws IOException
129
	 */
130
	private WMSClient getClient(URL url)
131
		throws UnsupportedVersionException, IOException {
132
		if (client == null) {
133
			client = WMSClientFactory.getClient(url);
134
		}
135

  
136
		return client;
137
	}
138
}
0 139

  
tags/extWMS_gvSIG0_5/extensions/extWMS/src/com/iver/cit/gvsig/fmap/layers/FLyrWMS.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.layers;
42

  
43
import java.awt.Graphics2D;
44
import java.awt.Point;
45
import java.awt.geom.AffineTransform;
46
import java.awt.geom.NoninvertibleTransformException;
47
import java.awt.geom.Point2D;
48
import java.awt.geom.Rectangle2D;
49
import java.awt.image.BufferedImage;
50
import java.io.ByteArrayInputStream;
51
import java.io.IOException;
52
import java.net.MalformedURLException;
53
import java.net.URL;
54

  
55
import javax.imageio.ImageIO;
56

  
57
import org.exolab.castor.xml.ValidationException;
58

  
59
import com.iver.cit.gvsig.fmap.DriverException;
60
import com.iver.cit.gvsig.fmap.ViewPort;
61
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
62
import com.iver.cit.gvsig.fmap.drivers.WMSException;
63
import com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint;
64
import com.iver.cit.gvsig.fmap.operations.Cancellable;
65
import com.iver.utiles.StringUtilities;
66
import com.iver.utiles.XMLEntity;
67
import com.iver.wmsclient.FeatureInfoQuery;
68
import com.iver.wmsclient.MapQuery;
69
import com.iver.wmsclient.UnsupportedVersionException;
70
import com.iver.wmsclient.WMSClient;
71
import com.iver.wmsclient.WMSClientFactory;
72

  
73

  
74
/**
75
 * Capa WMS.
76
 *
77
 * @author Fernando Gonz?lez Cort?s
78
 */
79
public class FLyrWMS extends FLyrDefault implements InfoByPoint {
80
	boolean isPrinting = false;
81
	boolean mustTileDraw = false;
82
	boolean mustTilePrint = true;
83
	int maxTileDrawWidth = -1;
84
	int maxTileDrawHeight = -1;
85
	int maxTilePrintWidth = 1023;
86
	int maxTilePrintHeight = 1023;
87

  
88
	private String m_SRS;
89
	private String m_Format;
90
	private String layerQuery;
91
	private String infoLayerQuery;
92
	private URL host;
93
	private WMSClient wmsClient;
94
	private MapQuery lastMapQuery;
95
	private Rectangle2D fullExtent;
96

  
97
	/**
98
	 * Inicializa una capa WMS con el driver que se le pasa como par?metro y
99
	 * guard?ndose el nombre del fichero para realizar los accesos, la capa
100
	 * tendr? asociada la proyecci?n que se pasa como parametro tambi?n
101
	 *
102
	 * @param layerName Nombre de la capa.
103
	 * @param rect extent
104
	 * @param host URL.
105
	 * @param format Formato
106
	 * @param query Consulta.
107
	 * @param infoQuery inforamci?n de la consulta.
108
	 * @param srs SRS.
109
	 */
110
	public void init(String layerName, Rectangle2D rect,
111
				URL host, String format, String query, String infoQuery, String srs) {
112
		FLyrWMS layer = this;
113
		layer.setHost(host);
114
		layer.setFullExtent(rect);
115
		layer.setFormat(format);
116
		layer.setLayerQuery(query);
117
		layer.setInfoLayerQuery(infoQuery);
118
		layer.setSRS(srs);
119
		layer.setName(layerName);
120
	}
121
	
122
	/**
123
	 * Slecciona el formato del WMS.
124
	 *
125
	 * @return formato seleccionado.
126
	 *
127
	 * @throws WMSException
128
	 * @throws IllegalStateException
129
	 * @throws ValidationException
130
	 * @throws UnsupportedVersionException
131
	 * @throws IOException
132
	 */
133
	private String selectFormat()
134
		throws WMSException, IllegalStateException, ValidationException, 
135
			UnsupportedVersionException, IOException {
136
		String[] formats;
137
		formats = getWmsClient().getInfoFormats();
138

  
139
		for (int i = 0; i < formats.length; i++) {
140
			if (formats[i].equals("GML.1")) {
141
				return formats[i];
142
			}
143

  
144
			if (formats[i].equals("GML.2")) {
145
				return formats[i];
146
			}
147

  
148
			if (formats[i].equals("GML.3")) {
149
				return formats[i];
150
			}
151

  
152
			if (formats[i].equals("application/vnd.ogc.gml")) {
153
				return formats[i];
154
			}
155

  
156
			if (formats[i].indexOf("XML") != -1) {
157
				return formats[i];
158
			}
159
		}
160

  
161
		throw new WMSException("No format supported");
162
	}
163

  
164
	/**
165
	 * Devuelve el XMLEntity con la informaci?n necesaria para reproducir la
166
	 * capa.
167
	 *
168
	 * @return XMLEntity.
169
	 * @throws XMLException
170
	 */
171
	public XMLEntity getXMLEntity() throws XMLException {
172
		XMLEntity xml = super.getXMLEntity();
173

  
174
		xml.putProperty("fullExtent", StringUtilities.rect2String(fullExtent));
175
		xml.putProperty("host", host.toExternalForm());
176
		xml.putProperty("infoLayerQuery", infoLayerQuery);
177
		xml.putProperty("layerQuery", layerQuery);
178
		xml.putProperty("format", m_Format);
179
		xml.putProperty("srs", m_SRS);
180

  
181
		return xml;
182
	}
183

  
184
	/**
185
	 * A partir del XMLEntity reproduce la capa.
186
	 *
187
	 * @param xml XMLEntity
188
	 *
189
	 * @throws XMLException
190
	 * @throws DriverException
191
	 * @throws DriverIOException
192
	 */
193
	public void setXMLEntity03(XMLEntity xml)
194
		throws XMLException {
195
		super.setXMLEntity(xml);
196
		fullExtent = StringUtilities.string2Rect(xml.getStringProperty(
197
					"fullExtent"));
198

  
199
		try {
200
			host = new URL(xml.getStringProperty("host"));
201
		} catch (MalformedURLException e) {
202
			throw new XMLException(e);
203
		}
204

  
205
		infoLayerQuery = xml.getStringProperty("infoLayerQuery");
206
		layerQuery = xml.getStringProperty("layerQuery");
207
		m_Format = xml.getStringProperty("format");
208
		m_SRS = xml.getStringProperty("srs");
209
	}
210

  
211
	/**
212
	 * A partir del XMLEntity reproduce la capa.
213
	 *
214
	 * @param xml XMLEntity
215
	 *
216
	 * @throws XMLException
217
	 * @throws DriverException
218
	 * @throws DriverIOException
219
	 */
220
	public void setXMLEntity(XMLEntity xml)
221
		throws XMLException {
222
		super.setXMLEntity(xml);
223
		fullExtent = StringUtilities.string2Rect(xml.getStringProperty(
224
					"fullExtent"));
225

  
226
		try {
227
			host = new URL(xml.getStringProperty("host"));
228
		} catch (MalformedURLException e) {
229
			throw new XMLException(e);
230
		}
231

  
232
		infoLayerQuery = xml.getStringProperty("infoLayerQuery");
233
		layerQuery = xml.getStringProperty("layerQuery");
234
		m_Format = xml.getStringProperty("format");
235
		m_SRS = xml.getStringProperty("srs");
236
	}
237

  
238
	/**
239
	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint#queryByPoint(com.iver.cit.gvsig.fmap.operations.QueriedPoint)
240
	 */
241
	public String queryByPoint(Point p) throws DriverException {
242
		FeatureInfoQuery query = new FeatureInfoQuery(lastMapQuery);
243
		query.setFeatureCount(Integer.MAX_VALUE);
244
		query.setX((int) p.getX());
245
		query.setY((int) p.getY());
246
		query.setInfoQuery(infoLayerQuery);
247
		
248
		try {
249
			query.setInfoFormat(selectFormat());
250

  
251
			return new String(getWmsClient().doFeatureInfo(query));
252
		} catch (WMSException e) {
253
			return "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><exception>" +
254
			e.getMessage() + "</exception>";
255
		} catch (ValidationException e) {
256
			/*
257
			 * TODO Las traducciones en este m?todo han de ser
258
			 * las mismas que en el m?todo de dibujado
259
			 */
260
			throw new DriverException("No se reconoce el formato de la respuesta",
261
				e);
262
		} catch (UnsupportedVersionException e) {
263
			throw new DriverException("Conflicto de versiones", e);
264
		} catch (IOException e) {
265
			throw new DriverException("Error en la conexi?n", e);
266
		} catch (com.iver.wmsclient.WMSException e) {
267
			throw new DriverException(e.getMessage(), e);
268
		} catch (NoSuchFieldException e) {
269
			throw new RuntimeException(
270
				"No se rellenaron todos los campos de la petici?n");
271
		}
272
	}
273

  
274
	/**
275
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
276
	 */
277
	public Rectangle2D getFullExtent() throws DriverException {
278
		return fullExtent;
279
	}
280

  
281
	/**
282
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#draw(java.awt.image.BufferedImage,
283
	 * 		java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort,
284
	 * 		com.iver.cit.gvsig.fmap.operations.Cancellable)
285
	 */
286
	public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
287
			Cancellable cancel,double scale) throws DriverException {
288
		if (isWithinScale(scale)){	
289
			try {
290
				MapQuery mapQuery = getWmsClient().createQuery();
291
				mapQuery.setBBOX(viewPort.getAdjustedExtent());
292
				mapQuery.setFormat(m_Format);
293
				mapQuery.setHeight(viewPort.getImageHeight());
294
				
295
				// System.err.println("m_Mapa.getHeight() = " + m_Mapa.getHeight());
296
				mapQuery.setLayers(layerQuery);
297
				mapQuery.setSRS(m_SRS);
298
				mapQuery.setStyles("");
299
				mapQuery.setWidth(viewPort.getImageWidth());
300
				mapQuery.setExceptions("application/vnd.ogc.se_xml");
301
				
302
				byte[] bytes;
303
				lastMapQuery = mapQuery;
304
				bytes = getWmsClient().doMapQuery(lastMapQuery);
305
				
306
				ByteArrayInputStream inbytes = new ByteArrayInputStream(bytes);
307
				BufferedImage tempImg = ImageIO.read(inbytes);
308
				// LWS Cambio de estrategia en el posicionado para la impresi?n.
309
				Point2D p2=new Point2D.Double(viewPort.getAdjustedExtent().getX(), viewPort.getAdjustedExtent().getMaxY()); //viewPort.getOffset();
310
				viewPort.getAffineTransform().transform(p2, p2);
311
				g.drawImage(tempImg,(int)p2.getX(),(int)p2.getY(), null);
312
			} catch (ValidationException e) {
313
				throw new DriverException("No se reconoce el formato de la respuesta",
314
						e);
315
			} catch (UnsupportedVersionException e) {
316
				throw new DriverException("Conflicto de versiones", e);
317
			} catch (IOException e) {
318
				
319
				throw new DriverException(e.getMessage(), e);
320
			} catch (com.iver.wmsclient.WMSException e) {
321
				throw new DriverException(e.getMessage(), e);
322
			} catch (NoSuchFieldException e) {
323
				throw new RuntimeException(
324
				"No se rellenaron todos los campos de la petici?n");
325
			} catch (RuntimeException e) {
326
				this.setActive(false);
327
				this.setVisible(false);
328
				throw new DriverException("Error en la conexi?n", e);
329
			}
330
		}
331
	}
332

  
333
	/**
334
	 * @throws NoPathToLayerException 
335
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
336
	 * 		com.iver.cit.gvsig.fmap.ViewPort,
337
	 * 		com.iver.cit.gvsig.fmap.operations.Cancellable)
338
	 */
339
	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,double scale)
340
		throws DriverException {
341
		if (isVisible() && isWithinScale(scale)){	
342
		isPrinting = true;
343
		if (!mustTilePrint) {
344
			draw(null, g, viewPort, cancel,scale);
345
		} else {
346
	        // Para no pedir imagenes demasiado grandes, vamos
347
	        // a hacer lo mismo que hace EcwFile: chunkear.
348
	        // Llamamos a drawView con cuadraditos m?s peque?os
349
	        // del BufferedImage ni caso, cuando se imprime viene con null
350
			Tiling tiles = new Tiling(maxTilePrintWidth, maxTilePrintHeight, g.getClipBounds());
351
			tiles.setAffineTransform((AffineTransform) viewPort.getAffineTransform().clone());
352
			for (int tileNr=0; tileNr < tiles.getNumTiles(); tileNr++) {
353
	    		// Parte que dibuja
354
	    		try {
355
	        		ViewPort vp = tiles.getTileViewPort(viewPort, tileNr);
356
	        		draw(null, g, vp, cancel,scale);
357
				} catch (NoninvertibleTransformException e) {
358
					// TODO Auto-generated catch block
359
					e.printStackTrace();
360
				}
361
	        }
362
		}
363
	    isPrinting = false;
364
		}
365
	}
366
	
367
	public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel,double scale)
368
		throws DriverException {
369
		draw(null, g, viewPort, cancel,scale);
370
	}
371

  
372
	/**
373
	 * Devuelve el WMSClient.
374
	 *
375
	 * @return WMSClient
376
	 *
377
	 * @throws IllegalStateException
378
	 * @throws ValidationException
379
	 * @throws UnsupportedVersionException
380
	 * @throws IOException
381
	 */
382
	private WMSClient getWmsClient()
383
		throws IllegalStateException, ValidationException, 
384
			UnsupportedVersionException, IOException {
385
		if (wmsClient == null) {
386
			wmsClient = WMSClientFactory.getClient(host);
387
		}
388

  
389
		return wmsClient;
390
	}
391

  
392
	/**
393
	 * Devuelve el URL.
394
	 *
395
	 * @return URL.
396
	 */
397
	public URL getHost() {
398
		return host;
399
	}
400

  
401
	/**
402
	 * Inserta el URL.
403
	 *
404
	 * @param host URL.
405
	 */
406
	public void setHost(URL host) {
407
		this.host = host;
408
	}
409

  
410
	/**
411
	 * Devuelve la informaci?n de la consulta.
412
	 *
413
	 * @return String.
414
	 */
415
	public String getInfoLayerQuery() {
416
		return infoLayerQuery;
417
	}
418

  
419
	/**
420
	 * Inserta la informaci?n de la consulta.
421
	 *
422
	 * @param infoLayerQuery String.
423
	 */
424
	public void setInfoLayerQuery(String infoLayerQuery) {
425
		this.infoLayerQuery = infoLayerQuery;
426
	}
427

  
428
	/**
429
	 * Devuelve la consulta.
430
	 *
431
	 * @return String.
432
	 */
433
	public String getLayerQuery() {
434
		return layerQuery;
435
	}
436

  
437
	/**
438
	 * Inserta la consulta.
439
	 *
440
	 * @param layerQuery consulta.
441
	 */
442
	public void setLayerQuery(String layerQuery) {
443
		this.layerQuery = layerQuery;
444
	}
445

  
446
	/**
447
	 * Devuelve el formato.
448
	 *
449
	 * @return Formato.
450
	 */
451
	public String getFormat() {
452
		return m_Format;
453
	}
454

  
455
	/**
456
	 * Inserta el formato.
457
	 *
458
	 * @param format Formato.
459
	 */
460
	public void setFormat(String format) {
461
		m_Format = format;
462
	}
463

  
464
	/**
465
	 * Devuelve el SRS.
466
	 *
467
	 * @return SRS.
468
	 */
469
	public String getSRS() {
470
		return m_SRS;
471
	}
472

  
473
	/**
474
	 * Inserta el SRS.
475
	 *
476
	 * @param m_srs SRS.
477
	 */
478
	public void setSRS(String m_srs) {
479
		m_SRS = m_srs;
480
	}
481

  
482
	/**
483
	 * Inserta la extensi?n total de la capa.
484
	 *
485
	 * @param fullExtent Rect?ngulo.
486
	 */
487
	public void setFullExtent(Rectangle2D fullExtent) {
488
		this.fullExtent = fullExtent;
489
	}
490
}
0 491

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

  
49
import java.awt.geom.Rectangle2D;
50
import java.io.IOException;
51
import java.net.URL;
52
import java.util.ArrayList;
53

  
54
import org.exolab.castor.xml.ValidationException;
55

  
56
import com.iver.cit.gvsig.gui.wizards.LayerInfo;
57
import com.iver.cit.gvsig.gui.wizards.WizardData;
58
import com.iver.cit.gvsig.gui.wizards.WizardDataSource;
59
import com.iver.cit.gvsig.fmap.drivers.UnsupportedVersionException;
60
import com.iver.wmsclient.WMSClient;
61
import com.iver.wmsclient.WMSClientFactory;
62
import com.iver.wmsclient.wms_1_0_0.capabilities.Format;
63
import com.iver.wmsclient.wms_1_0_0.capabilities.Layer;
64
import com.iver.wmsclient.wms_1_0_0.capabilities.Name;
65
import com.iver.wmsclient.wms_1_0_0.capabilities.SRS;
66
import com.iver.wmsclient.wms_1_0_0.capabilities.WMT_MS_Capabilities;
67

  
68

  
69
/**
70
 * Adapta las capa wms de Fmap a los datasource del WMSWizard
71
 *
72
 * @author Fernando Gonz?lez Cort?s
73
 */
74
public class WMSDataSourceAdapter implements WizardDataSource {
75
    private WMSClient cliente;
76

  
77
    /**
78
     * M?todo detalles para la versi?n 1.0.0
79
     *
80
     * @see com.iver.cit.gvsig.gui.wms.WizardDataSource#detalles()
81
     */
82
    private WizardData detalles_1_0_0(WMT_MS_Capabilities cap) {
83
        WizardData data = new WizardData();
84

  
85
        data.setTitle(cap.getService().getTitle().getContent());
86
        data.setAbstract(cap.getService().getAbstract().getContent());
87

  
88
        Format f = cap.getCapability().getRequest().getMap().getFormat();
89
        ArrayList formatos = new ArrayList();
90

  
91
        if (f.getGIF() != null) {
92
            formatos.add("image/gif");
93
        }
94

  
95
        if (f.getPNG() != null) {
96
            formatos.add("image/png");
97
        }
98

  
99
        if (f.getJPEG() != null) {
100
            formatos.add("image/jpeg");
101
        }
102

  
103
        if (f.getTIFF() != null) {
104
            formatos.add("image/tiff");
105
        }
106

  
107
        data.setFormats((String[]) formatos.toArray(new String[0]));
108

  
109
        Layer l = cap.getCapability().getLayer();
110

  
111
        LayerInfo root = new LayerInfo();
112
        root.text = l.getTitle().getContent();
113

  
114
        Name name = l.getName();
115

  
116
        if (name != null) {
117
            root.name = name.getContent();
118
        }
119

  
120
        SRS srs = l.getSRS();
121

  
122
        if (srs != null) {
123
            root.addSRS(l.getSRS().getContent());
124
        }
125

  
126
        rellena_1_0_0((LayerInfo) root, l);
127

  
128
        data.setLayer(root);
129

  
130
        return data;
131
    }
132

  
133
    /**
134
     * M?todo detalles para la versi?n 1.1.0
135
     *
136
     * @see com.iver.cit.gvsig.gui.wms.WizardDataSource#detalles()
137
     */
138
    private WizardData detalles_1_1_0(
139
        com.iver.wmsclient.wms_1_1_0.capabilities.WMT_MS_Capabilities cap) {
140
        WizardData data = new WizardData();
141

  
142
        data.setTitle(cap.getService().getTitle().getContent());
143
        data.setAbstract(cap.getService().getAbstract().getContent());
144

  
145
        com.iver.wmsclient.wms_1_1_0.capabilities.Format[] f = cap.getCapability()
146
                                                                           .getRequest()
147
                                                                           .getGetMap()
148
                                                                           .getFormat();
149
        ArrayList formatos = new ArrayList();
150

  
151
        for (int i = 0; i < f.length; i++) {
152
            if (isValidFormat(f[i].getContent())) {
153
                formatos.add(f[i].getContent());
154
            }
155
        }
156

  
157
        data.setFormats((String[]) formatos.toArray(new String[0]));
158

  
159
        com.iver.wmsclient.wms_1_1_0.capabilities.Layer l = cap.getCapability()
160
                                                                        .getLayer();
161

  
162
        LayerInfo root = new LayerInfo();
163
        root.text = l.getTitle().getContent();
164

  
165
        com.iver.wmsclient.wms_1_1_0.capabilities.Name name = l.getName();
166

  
167
        if (name != null) {
168
            root.name = name.getContent();
169
        }
170

  
171
        com.iver.wmsclient.wms_1_1_0.capabilities.SRS srs = l.getSRS();
172

  
173
        if (srs != null) {
174
            root.addSRS(l.getSRS().getContent());
175
        }
176

  
177
        rellena_1_1_0((LayerInfo) root, l);
178

  
179
        data.setLayer(root);
180

  
181
        return data;
182
    }
183

  
184
    /**
185
     * M?todo detalles para la versi?n 1.3.0
186
     *
187
     * @see com.iver.cit.gvsig.gui.wms.WizardDataSource#detalles()
188
     */
189
    private WizardData detalles_1_3_0(
190
        com.iver.wmsclient.wms_1_3_0.capabilities.WMS_Capabilities cap) {
191
        WizardData data = new WizardData();
192

  
193
        data.setTitle(cap.getService().getTitle().getContent());
194
        data.setAbstract(cap.getService().getAbstract().getContent());
195

  
196
        com.iver.wmsclient.wms_1_3_0.capabilities.Format[] f = cap.getCapability()
197
                                                                           .getRequest()
198
                                                                           .getGetMap()
199
                                                                           .getFormat();
200
        ArrayList formatos = new ArrayList();
201

  
202
        for (int i = 0; i < f.length; i++) {
203
            if (isValidFormat(f[i].getContent())) {
204
                formatos.add(f[i].getContent());
205
            }
206
        }
207

  
208
        data.setFormats((String[]) formatos.toArray(new String[0]));
209

  
210
        com.iver.wmsclient.wms_1_3_0.capabilities.Layer l = cap.getCapability()
211
                                                                        .getLayer();
212

  
213
        LayerInfo root = new LayerInfo();
214
        root.text = l.getTitle().getContent();
215

  
216
        com.iver.wmsclient.wms_1_3_0.capabilities.Name name = l.getName();
217

  
218
        if (name != null) {
219
            root.name = name.getContent();
220
        }
221

  
222
        String[] srs = l.getCRS();
223

  
224
        if (srs != null) {
225
            for (int i = 0; i < srs.length; i++) {
226
                root.addSRS(srs[i]);
227
            }
228
        }
229

  
230
        rellena_1_3_0((LayerInfo) root, l);
231

  
232
        data.setLayer(root);
233

  
234
        return data;
235
    }
236

  
237
    /**
238
     * M?todo detalles para la versi?n 1.1.1
239
     *
240
     * @see com.iver.cit.gvsig.gui.wms.WizardDataSource#detalles()
241
     */
242
    private WizardData detalles_1_1_1(
243
        com.iver.wmsclient.wms_1_1_1.capabilities.WMT_MS_Capabilities cap) {
244
        WizardData data = new WizardData();
245

  
246
        data.setTitle(cap.getService().getTitle().getContent());
247
        if (cap.getService().getAbstract() != null)
248
        data.setAbstract(cap.getService().getAbstract().getContent());
249

  
250
        com.iver.wmsclient.wms_1_1_1.capabilities.Format[] f = cap.getCapability()
251
                                                                           .getRequest()
252
                                                                           .getGetMap()
253
                                                                           .getFormat();
254
        ArrayList formatos = new ArrayList();
255

  
256
        for (int i = 0; i < f.length; i++) {
257
            if (isValidFormat(f[i].getContent())) {
258
                formatos.add(f[i].getContent());
259
            }
260
        }
261

  
262
        data.setFormats((String[]) formatos.toArray(new String[0]));
263

  
264
        com.iver.wmsclient.wms_1_1_1.capabilities.Layer l = cap.getCapability()
265
                                                                        .getLayer();
266

  
267
        LayerInfo root = new LayerInfo();
268
        root.text = l.getTitle().getContent();
269

  
270
        com.iver.wmsclient.wms_1_1_1.capabilities.Name name = l.getName();
271

  
272
        if (name != null) {
273
            root.name = name.getContent();
274
        }
275

  
276
        com.iver.wmsclient.wms_1_1_1.capabilities.SRS[] srs = l.getSRS();
277

  
278
        if (srs != null) {
279
            for (int i = 0; i < srs.length; i++) {
280
                root.addSRS(srs[i].getContent());
281
            }
282
        }
283

  
284
        rellena_1_1_1((LayerInfo) root, l);
285

  
286
        data.setLayer(root);
287

  
288
        return data;
289
    }
290

  
291
    /**
292
     * M?todo para saber los formatos que admite la aplicaci?n
293
     *
294
     * @param format cadena con el formato a validar
295
     *
296
     * @return true si soportamos dicho formato y false en
297
     * caso contrario
298
     */
299
    private boolean isValidFormat(String format) {
300
        if (format.equalsIgnoreCase("image/png") ||
301
                format.equalsIgnoreCase("image/jpg") ||
302
                format.equalsIgnoreCase("image/tiff") ||
303
                format.equalsIgnoreCase("image/jpeg") ||
304
                format.equalsIgnoreCase("image/tif") ||
305
                format.equalsIgnoreCase("image/gif")) {
306
            return true;
307
        }
308

  
309
        return false;
310
    }
311

  
312
    /**
313
     * Genera la jerarquia de capas para la versi?n 1.0.0
314
     *
315
     * @param nodo nodo raiz de la jerarqu?a que hay que generar
316
     * @param layer objeto layer de la respuesta del servidor
317
     */
318
    private void rellena_1_0_0(LayerInfo nodo, Layer layer) {
319
        for (int i = 0; i < layer.getLayerCount(); i++) {
320
            LayerInfo nuevo = new LayerInfo();
321
            nuevo.text = layer.getLayer(i).getTitle().getContent();
322

  
323
            Name name = layer.getLayer(i).getName();
324

  
325
            if (name != null) {
326
                nuevo.name = name.getContent();
327
            }
328

  
329
            SRS srs = layer.getLayer(i).getSRS();
330

  
331
            if (srs != null) {
332
                nuevo.addSRS(srs.getContent());
333
            }
334

  
335
            nuevo.queryable = layer.getLayer(i).getQueryable().toString()
336
                                   .equals("1");
337

  
338
            nodo.hijos.add(nuevo);
339
            nuevo.padre = nodo;
340
            rellena_1_0_0((LayerInfo) nodo.hijos.get(i), layer.getLayer(i));
341
        }
342
    }
343

  
344
    /**
345
     * Genera la jerarquia de capas para la versi?n 1.1.0
346
     *
347
     * @param nodo nodo raiz de la jerarqu?a que hay que generar
348
     * @param layer objeto layer de la respuesta del servidor
349
     */
350
    private void rellena_1_1_0(LayerInfo nodo,
351
        com.iver.wmsclient.wms_1_1_0.capabilities.Layer layer) {
352
        for (int i = 0; i < layer.getLayerCount(); i++) {
353
            LayerInfo nuevo = new LayerInfo();
354
            nuevo.text = layer.getLayer(i).getTitle().getContent();
355

  
356
            com.iver.wmsclient.wms_1_1_0.capabilities.Name name = layer.getLayer(i)
357
                                                                                .getName();
358

  
359
            if (name != null) {
360
                nuevo.name = name.getContent();
361
            }
362

  
363
            com.iver.wmsclient.wms_1_1_0.capabilities.SRS srs = layer.getLayer(i)
364
                                                                              .getSRS();
365

  
366
            if (srs != null) {
367
                nuevo.addSRS(srs.getContent());
368
            }
369

  
370
            nuevo.queryable = layer.getLayer(i).getQueryable().toString()
371
                                   .equals("1");
372

  
373
            nodo.hijos.add(nuevo);
374
            nuevo.padre = nodo;
375
            rellena_1_1_0((LayerInfo) nodo.hijos.get(i), layer.getLayer(i));
376
        }
377
    }
378

  
379
    /**
380
     * Genera la jerarquia de capas para la versi?n 1.1.1
381
     *
382
     * @param nodo nodo raiz de la jerarqu?a que hay que generar
383
     * @param layer objeto layer de la respuesta del servidor
384
     */
385
    private void rellena_1_1_1(LayerInfo nodo,
386
        com.iver.wmsclient.wms_1_1_1.capabilities.Layer layer) {
387
        for (int i = 0; i < layer.getLayerCount(); i++) {
388
            LayerInfo nuevo = new LayerInfo();
389
            nuevo.text = layer.getLayer(i).getTitle().getContent();
390

  
391
            com.iver.wmsclient.wms_1_1_1.capabilities.Name name = layer.getLayer(i)
392
                                                                                .getName();
393
                                                                                
394
            if (name != null){
395
				nuevo.name = name.getContent();
396
            }
397

  
398
            com.iver.wmsclient.wms_1_1_1.capabilities.SRS[] srs = layer.getLayer(i)
399
                                                                                .getSRS();
400

  
401
            if (srs != null) {
402
                for (int j = 0; j < srs.length; j++) {
403
                    nuevo.addSRS(srs[j].getContent());
404
                }
405
            }
406

  
407
            nuevo.queryable = layer.getLayer(i).getQueryable().toString()
408
                                   .equals("1");
409

  
410
            nodo.hijos.add(nuevo);
411
            nuevo.padre = nodo;
412
            rellena_1_1_1((LayerInfo) nodo.hijos.get(i), layer.getLayer(i));
413
        }
414
    }
415

  
416
    /**
417
     * Genera la jerarquia de capas para la versi?n 1.3.0
418
     *
419
     * @param nodo nodo raiz de la jerarqu?a que hay que generar
420
     * @param layer objeto layer de la respuesta del servidor
421
     */
422
    private void rellena_1_3_0(LayerInfo nodo,
423
        com.iver.wmsclient.wms_1_3_0.capabilities.Layer layer) {
424
        for (int i = 0; i < layer.getLayerCount(); i++) {
425
            LayerInfo nuevo = new LayerInfo();
426
            nuevo.text = layer.getLayer(i).getTitle().getContent();
427

  
428
            com.iver.wmsclient.wms_1_3_0.capabilities.Name name = layer.getLayer(i)
429
                                                                                .getName();
430

  
431
            if (name != null) {
432
                nuevo.name = name.getContent();
433
            }
434

  
435
            String[] srs = layer.getLayer(i).getCRS();
436

  
437
            if (srs != null) {
438
                for (int j = 0; j < srs.length; j++) {
439
                    nuevo.addSRS(srs[j]);
440
                }
441
            }
442

  
443
            nuevo.queryable = layer.getLayer(i).getQueryable();
444

  
445
            nodo.hijos.add(nuevo);
446
            nuevo.padre = nodo;
447
            rellena_1_3_0((LayerInfo) nodo.hijos.get(i), layer.getLayer(i));
448
        }
449
    }
450

  
451
    /**
452
     * @see com.iver.cit.gvsig.gui.wms.WizardDataSource#detalles()
453
     */
454
    public WizardData detalles(URL host)
455
        throws IllegalStateException, ValidationException, 
456
            UnsupportedVersionException, IOException {
457
        try {
458
			cliente = WMSClientFactory.getClient(host);
459

  
460
	        com.iver.wmsclient.Capabilities c = cliente.getCapabilities(host);
461
	
462
	        String version = c.getVersion();
463
	
464
	        if (version.equals("1.0.0")) {
465
	            return detalles_1_0_0((WMT_MS_Capabilities) c.getRoot());
466
	        } else if (version.equals("1.1.0")) {
467
	            return detalles_1_1_0((com.iver.wmsclient.wms_1_1_0.capabilities.WMT_MS_Capabilities) c.getRoot());
468
	        } else if (version.equals("1.1.1")) {
469
	            return detalles_1_1_1((com.iver.wmsclient.wms_1_1_1.capabilities.WMT_MS_Capabilities) c.getRoot());
470
	        } else if (version.equals("1.3.0")) {
471
	            return detalles_1_3_0((com.iver.wmsclient.wms_1_3_0.capabilities.WMS_Capabilities) c.getRoot());
472
	        } else {
473
	            throw new UnsupportedVersionException(version);
474
	        }
475
		} catch (com.iver.wmsclient.UnsupportedVersionException e) {
476
            throw new UnsupportedVersionException(e);
477
		}
478
    }
479

  
480
    /**
481
     * @see com.iver.cit.gvsig.gui.wms.WizardDataSource#getBoundingBox(java.lang.String,
482
     *      java.lang.String)
483
     */
484
    public Rectangle2D getBoundingBox(String[] layerName, String srs) {
485
        return cliente.getBoundingBox(layerName, srs);
486
    }
487
}
0 488

  
tags/extWMS_gvSIG0_5/extensions/extWMS/src/com/iver/cit/gvsig/wms/gui/wmswizard/SRSListModel.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.wms.gui.wmswizard;
42

  
43
import java.util.ArrayList;
44
import java.util.HashMap;
45
import java.util.HashSet;
46
import java.util.Iterator;
47

  
48
import javax.swing.AbstractListModel;
49

  
50

  
51
/**
52
 * DOCUMENT ME!
53
 *
54
 * @author Fernando Gonz?lez Cort?s
55
 */
56
public class SRSListModel extends AbstractListModel {
57
	ArrayList comunes = new ArrayList();
58
	
59
    private HashSet srsSet = new HashSet();
60
	private HashMap cuenta = new HashMap();
61
	private ArrayList nombresSRS = new ArrayList();
62

  
63
    /**
64
     * DOCUMENT ME!
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff